OrthoSlice.hpp

00001 #ifndef _FISHEYE_SCALAR_ORTHOSLICE_HPP
00002 #define _FISHEYE_SCALAR_ORTHOSLICE_HPP
00003 
00004 #include "fisheyescalarDllApi.h"
00005 
00006 #include <bone/BundleInput.hpp>
00007 #include <bone/FishField.hpp>
00008 
00009 #include <ocean/plankton/VCreator.hpp>
00010 
00011 #include <ocean/shrimp/VObjectStatus.hpp>
00012 
00013 #include <ocean/GLvish/VGLRenderObject.hpp>
00014 #include <ocean/GLvish/BoundingBox.hpp>
00015 #include <ocean/GLvish/Colormap.hpp>
00016 #include <ocean/GLvish/Shader.hpp>
00017 
00018 #include <ocean/eagle/PhysicalSpace.hpp>
00019 
00020 #include <field/DirectProductArray.hpp>
00021 
00022 #include <eye/retina/TexturedQuad.hpp>
00023 #include <eye/retina/FieldSlice.hpp>
00024 #include <eye/retina/VFieldRenderObject.hpp>
00025 
00026 #include <ocean/plankton/VTimer.hpp>
00027 #include <bone/FieldObject.hpp>
00028 
00029 #include <fish/lakeview/GL/Texture.hpp>
00030 
00031 namespace Wizt
00032 {
00033 
00034 
00035 using namespace Fiber;
00036 using namespace Eagle;
00037 
00042 class   fisheyescalar_API OrthoSlice : public VFieldRenderObject,
00043                                        public Fish<Skeleton>,
00044                                        public Orientation
00045 {
00046 public:
00047         typedef LIST<double, LIST<float> > InputTypes;
00048 
00049         typedef DirectProductMemArray<Eagle::point3>   ProcArray_t;
00050 
00051         struct  FieldState : State, FieldSlice
00052         {
00053                 WeakPtr<Colormap>       LastColormap;
00054                 int                     RefinementLevel;
00055                 Ageable                 TriggerAge;
00056                 Range                   DataRange;
00057 
00058                 int                     bits;
00059                 double                  shift;
00060 
00061                 typedef std::map<RefPtr<CreativeArrayBase>, RefPtr<TexturedQuad> > Blocks_t;
00062                 Blocks_t                Blocks;
00063 
00064                 override RefPtr<Quad> extract(const RefPtr<FragmentID>&f,
00065                                               const MultiIndex<3>&Dims,
00066                                               const RefPtr<CreativeArrayBase>&FieldBase, index_t Slice);
00067 
00068                 void render(VGLRenderContext&Context, const RefPtr<ValueSet>&Values, 
00069                             bool interpolate) const;
00070 
00071                 FieldState()
00072                 : bits(8)
00073                 , shift(0.5) 
00074                 {}
00075 
00076                 ~FieldState()
00077                 {
00078                         puts("~FieldState()"); fflush(stdout);
00079                 }
00080 
00081                 using FieldSlice::reset;
00082 
00083                 void reset()
00084                 {
00085                         Blocks.clear();
00086                 }
00087 
00088                 bool empty() const
00089                 {
00090                         return Blocks.size() < 1;
00091                 }
00092 
00093                 override bool IrregularFragment(const RefPtr<FragmentID>&f, const RefPtr<CreativeArrayBase>&DC);
00094 
00095         };
00096 
00097         override RefPtr<State> newState() const
00098         {
00099                 return new FieldState();
00100         }
00101 
00102         TypedSlot<double>       SliceLocation; 
00103         TypedSlot<Enum>         Mode;
00104         TypedSlot<VColormap>    myColormap;
00105         TypedSlot<Range>        myRange;
00106         TypedSlot<double>       Transparency; 
00107 
00108         TypedSlot<Enum>         DataOperator;
00109 
00110         TypedSlot<Enum>         Precision;
00111 
00112         TypedSlot<double>       Shift; 
00113 
00114         OrthoSlice(const string&name, int p, const RefPtr<VCreationPreferences>&VP);
00115 
00116         override bool update(VRequest&R, double precision);
00117         override void render(VGLRenderContext&Context) const;
00118 
00119 static string createChildname(const string&parent_name)
00120         {
00121                 return "Orthoslice<" + parent_name + ">";
00122         }
00123 
00124 //static        RefPtr<VAcceptInfo> accept(const RefPtr<VObject>&vobj);
00125 
00126 };
00127 
00128 } // namespace Wizt
00129 
00130 #endif
00131 
00132