Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkOoCVolumeRendererTexture3D.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 
00011 #ifndef __mitkOoCVolumeRendererTexture3D_h
00012 #define __mitkOoCVolumeRendererTexture3D_h
00013 
00014 #include "mitkVolumeRenderer.h"
00015 #include "mitkVolumeRendererTexture3D.h"
00016 
00017 class mitkVector;
00018 class mitkMatrix;
00019 class mitkVolume;
00020 class mitkVolumeProperty;
00021 class BSPTree;
00022 class BSPTreeNodeList;
00023 
00029 class MITK_VISUALIZATION_API mitkOoCVolumeRendererTexture3D : public mitkVolumeRenderer
00030 {
00031 public:
00032     MITK_TYPE(mitkOoCVolumeRendererTexture3D, mitkVolumeRenderer)
00033 
00034     virtual void PrintSelf(ostream &os);
00035 
00039     mitkOoCVolumeRendererTexture3D();
00040 
00044     virtual int Render(mitkScene *scene, mitkVolumeModel *vol);
00045 
00050     void SetSampleDistance(float sd) { m_SampleDistance = sd; }
00051 
00061     void SetSubVolumeSize(int w, int h, int d);
00062 
00067     void SetGradientEstimator(mitkEncodedGradientEstimator *gradest);
00068 
00073     mitkEncodedGradientEstimator* GetGradientEstimator(){return m_GradientEstimator;};
00074 
00075 
00076 protected:
00077     virtual ~mitkOoCVolumeRendererTexture3D();
00078 
00079     bool _buildDummyTexture();
00080     //bool _applyTFs(mitkVolumeModel *vol);
00081     bool _splitVolume(mitkVolume *data, mitkVolume *encnorms=NULL, mitkVolume *gradmags=NULL);
00082     void _cutEmptyBlocks(mitkVolumeProperty *prop);
00083     void _generateTFs(mitkVolumeProperty *prop);
00084     //by xiang dehui
00085     void _generate2DTFRGBAs(mitkVolumeProperty *prop);
00086     void _buildTexture(int width, int height, int depth, mitkVolumeModel *vol);
00087     void _generatePolygons();
00088     void _renderTexture();
00089     void _deleteTexture();
00090     void _clearTexPolygons();
00091     void _clearTexCache();
00092 
00093     void _fillBufs(int cfidx);
00094 
00095     void _renderFromVert0(mitkVolumeModel *vol);
00096     void _renderFromVert1(mitkVolumeModel *vol);
00097     void _renderFromVert2(mitkVolumeModel *vol);
00098     void _renderFromVert3(mitkVolumeModel *vol);
00099     void _renderFromVert4(mitkVolumeModel *vol);
00100     void _renderFromVert5(mitkVolumeModel *vol);
00101     void _renderFromVert6(mitkVolumeModel *vol);
00102     void _renderFromVert7(mitkVolumeModel *vol);
00103 
00104     bool _buildBSPTree(BSPTree *tree, BSPTreeNodeList *list, int si, float subspace[6]);
00105     void _drawBSPTree(BSPTree *tree, mitkVector *dir, mitkVolumeModel *vol);
00106     void _deleteBSPTree();
00107 
00108     bool _updateShadingTables(mitkScene *scene, mitkVolumeModel *vol);
00109 
00110     mitkRCPtr<mitkEncodedGradientEstimator> m_GradientEstimator;
00111     mitkRCPtr<mitkEncodedGradientShader> m_GradientShader;
00112 
00113     unsigned int m_TexID;
00114 
00115     int m_DummyTexWidth;
00116     int m_DummyTexHeight;
00117     int m_DummyTexDepth;
00118 
00119     int m_SubVolWidth;
00120     int m_SubVolHeight;
00121     int m_SubVolDepth;
00122 
00123     float m_SampleDistance;
00124 
00125     float m_SubVolBnd[6];
00126     float m_TexBnd[3];
00127 
00128     //for test
00129     float m_Spacings[3];
00130 
00131     unsigned int m_PolyNum;
00132     unsigned int m_PolyArraySize;
00133     TexPolygon *m_Polygons;
00134 
00135     void *m_SrcBuf;
00136     unsigned int m_SrcBufSize;
00137     unsigned short *m_NormBuf;
00138     unsigned int m_NormBufSize;
00139     unsigned char *m_GradBuf;
00140     unsigned int m_GradBufSize;
00141     void *m_TexBuf;
00142     unsigned int m_TexBufSize;
00143 
00144     unsigned char *m_BlockFlags;
00145 
00146     mitkVector *m_SubCubeVerts;
00147     mitkMatrix *m_ViewToModelMat;
00148     mitkMatrix *m_ModelToViewMat;
00149 
00150     mitkStringList *m_CacheFileNames;
00151     int *m_BlockMinVals;
00152     int *m_BlockMaxVals;
00153 
00154     unsigned char *m_SOTF;
00155     unsigned char *m_SCTFR;
00156     unsigned char *m_SCTFG;
00157     unsigned char *m_SCTFB;
00158     //by xiang dehui
00159     unsigned char *m_TF_2DOpacity; 
00160     unsigned char *m_TF_2DRed;
00161     unsigned char *m_TF_2DGreen;
00162     unsigned char *m_TF_2DBlue;
00163 
00164     float *m_fSOTF;
00165     float *m_fGOTF;
00166     float *m_fSCTFR;
00167     float *m_fSCTFG;
00168     float *m_fSCTFB;
00169     //by xiang dehui
00170     float *m_TF_f2DOpacity; 
00171     float *m_TF_f2DRed;
00172     float *m_TF_f2DGreen;
00173     float *m_TF_f2DBlue;
00174 
00175     float *m_fShadDiffR;
00176     float *m_fShadDiffG;
00177     float *m_fShadDiffB;
00178     float *m_fShadSpecR;
00179     float *m_fShadSpecG;
00180     float *m_fShadSpecB;
00181 
00182     int m_Shading;
00183     int m_GradOn;
00184 
00185     mitkVolume *m_EncodedNormalsVol;
00186     mitkVolume *m_GradientMagnitudesVol;
00187 
00188     BSPTree *m_SubVolTree;
00189 
00190     bool m_IsTex3DSupported;
00191     bool m_FirstRendering;
00192 
00193 private:
00194     mitkOoCVolumeRendererTexture3D(const mitkOoCVolumeRendererTexture3D&);
00195     void operator = (const mitkOoCVolumeRendererTexture3D&);
00196 
00197 };
00198 
00199 
00200 //#define DEFINED_mitkOoCVolumeRendererTexture3D
00201 
00202 
00203 
00204 #endif
00205 

Generated on Tue Feb 25 15:00:37 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3