00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __mitkOoCVolumeRendererTexture3DEx_h
00012 #define __mitkOoCVolumeRendererTexture3DEx_h
00013
00014 #include "mitkVolumeRenderer.h"
00015 #include "mitkVolumeDivider.h"
00016 #include "mitkVolumeRendererTexture3D.h"
00017 #include "mitkRCPtr.h"
00018
00019 class mitkVector;
00020 class mitkMatrix;
00021 class mitkVolume;
00022 class mitkVolumeProperty;
00023
00029 class MITK_VISUALIZATION_API mitkOoCVolumeRendererTexture3DEx : public mitkVolumeRenderer
00030 {
00031 public:
00032 MITK_TYPE(mitkOoCVolumeRendererTexture3DEx, mitkVolumeRenderer)
00033
00034 virtual void PrintSelf(ostream &os);
00035
00039 mitkOoCVolumeRendererTexture3DEx();
00040
00044 virtual int Render(mitkScene *scene, mitkVolumeModel *vol);
00045
00050 void SetSampleDistance(float sd) { m_SampleDistance = sd; }
00051
00061 void SetSubVolumeSize(int wmin, int wmax, int hmin, int hmax, int dmin, int dmax);
00062
00072 void SetSubVolumeSize(int sizemin[3], int sizemax[3]);
00073
00074 void SplitYFirst(bool yf=true) { m_SplitYFirst = yf; m_SubVolSizeChanged = true; }
00075
00076 protected:
00077 virtual ~mitkOoCVolumeRendererTexture3DEx();
00078
00079 bool _buildDummyTexture(int w, int h, int d);
00080 void _generateTFs(mitkVolumeProperty *prop);
00081
00082 void _generate2DTFRGBAs(mitkVolumeProperty *prop);
00083 void _buildTexture(int width, int height, int depth, mitkVolumeModel *vol);
00084 void _generatePolygons();
00085 void _renderTexture(int width, int height, int depth);
00086 void _deleteTexture();
00087 void _clearTexPolygons();
00088
00089 void _drawBSPTree(CuboidBSPTree *tree, float eye[3], mitkVolumeModel *vol);
00090
00091 bool _updateShadingTables(mitkScene *scene, mitkVolumeModel *vol);
00092
00093 bool _initBuffers(int pixbytes);
00094 void _deleteBuffers();
00095
00096 bool _initBlocks();
00097 void _classifyBlocks(CuboidBSPTree *tree);
00098
00099
00100
00101
00102
00103 void _printBSPTree(CuboidBSPTree *tree, FILE *fp, int level);
00104
00105 mitkRCPtr<mitkEncodedGradientEstimator> m_GradientEstimator;
00106 mitkRCPtr<mitkEncodedGradientShader> m_GradientShader;
00107
00108
00109
00110
00111 unsigned int m_TexID;
00112 unsigned int m_TexBufID;
00113
00114 int m_DummyTexWidth;
00115 int m_DummyTexHeight;
00116 int m_DummyTexDepth;
00117
00118 float m_SampleDistance;
00119
00120 float m_SubVolBnd[6];
00121 float m_TexBnd[6];
00122
00123 unsigned int m_PolyNum;
00124 unsigned int m_PolyArraySize;
00125 TexPolygon *m_Polygons;
00126
00127 void *m_SrcBuf;
00128 unsigned short *m_NormBuf;
00129 unsigned char *m_GradBuf;
00130 void *m_TexBuf;
00131
00132 unsigned int m_BlockNum;
00133 unsigned char *m_BlockFlags;
00134
00135 mitkVector *m_SubCubeVerts;
00136 mitkMatrix *m_ViewToModelMat;
00137 mitkMatrix *m_ModelToViewMat;
00138
00139
00140
00141
00142
00143 unsigned char *m_SOTF;
00144 unsigned char *m_SCTFR;
00145 unsigned char *m_SCTFG;
00146 unsigned char *m_SCTFB;
00147
00148 unsigned char *m_TF_2DOpacity;
00149 unsigned char *m_TF_2DRed;
00150 unsigned char *m_TF_2DGreen;
00151 unsigned char *m_TF_2DBlue;
00152
00153 float *m_TF_f2DOpacity;
00154 float *m_TF_f2DRed;
00155 float *m_TF_f2DGreen;
00156 float *m_TF_f2DBlue;
00157
00158 float *m_fSOTF;
00159 float *m_fGOTF;
00160 float *m_fSCTFR;
00161 float *m_fSCTFG;
00162 float *m_fSCTFB;
00163 float *m_fShadDiffR;
00164 float *m_fShadDiffG;
00165 float *m_fShadDiffB;
00166 float *m_fShadSpecR;
00167 float *m_fShadSpecG;
00168 float *m_fShadSpecB;
00169 int mMaxX;
00170
00171 int m_Shading;
00172 int m_GradOn;
00173
00174 mitkVolume *m_EncodedNormalsVol;
00175 mitkVolume *m_GradientMagnitudesVol;
00176
00177 int m_XLeftMargin;
00178 int m_XRightMargin;
00179 int m_YBottomMargin;
00180 int m_YTopMargin;
00181 int m_ZFrontMargin;
00182 int m_ZBackMargin;
00183 int m_XOverlap;
00184 int m_YOverlap;
00185 int m_ZOverlap;
00186 int m_SubVolSizeMin[3];
00187 int m_SubVolSizeMax[3];
00188
00189 mitkVolumeDivider *m_VolDivider;
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200 bool m_IsTex3DSupported;
00201 bool m_SplitYFirst;
00202 bool m_FirstRendering;
00203 bool m_SubVolSizeChanged;
00204
00205 private:
00206 mitkOoCVolumeRendererTexture3DEx(const mitkOoCVolumeRendererTexture3DEx&);
00207 void operator = (const mitkOoCVolumeRendererTexture3DEx&);
00208
00209 };
00210
00211
00212
00213
00214
00215
00216 #endif
00217