00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __mitkVolumeRendererTexture3D_h
00012 #define __mitkVolumeRendererTexture3D_h
00013
00014 #include "mitkVolumeRenderer.h"
00015 #include "mitkGeometryTypes.h"
00016 #include "mitkEncodedGradientEstimator.h"
00017 #include "mitkEncodedGradientShader.h"
00018
00019 typedef struct _polygon_type
00020 {
00021 Point3f verts[6];
00022 Point3f texCoords[6];
00023 unsigned char vertNum;
00024 } TexPolygon;
00025
00032 class MITK_VISUALIZATION_API mitkVolumeRendererTexture3D : public mitkVolumeRenderer
00033 {
00034 public:
00035 MITK_TYPE(mitkVolumeRendererTexture3D, mitkVolumeRenderer)
00036
00037 virtual void PrintSelf(ostream &os);
00038
00039 mitkVolumeRendererTexture3D();
00040
00044 virtual int Render(mitkScene *scene, mitkVolumeModel *vol);
00045
00052 void SetSampleDistance(float sd)
00053 { m_SampleDistance = sd; m_AutoAdjustSampleDistance = false; }
00054
00058 void EnableAutoSampleDistance() { m_AutoAdjustSampleDistance = true; }
00059
00064 void SetGradientEstimator(mitkEncodedGradientEstimator *gradest);
00065
00070 mitkEncodedGradientEstimator* GetGradientEstimator(){return m_GradientEstimator;};
00071
00072
00073
00074 protected:
00075 virtual ~mitkVolumeRendererTexture3D();
00076
00077 bool _buildDummyTexture(int dims[3]);
00078 bool _buildTexture(mitkVolumeModel *vol);
00079 bool _buildShadedTexture(mitkScene *scene, mitkVolumeModel *vol);
00080 void _deleteTexture();
00081 void _clearTexPolygons();
00082
00083 mitkRCPtr<mitkEncodedGradientEstimator> m_GradientEstimator;
00084 mitkRCPtr<mitkEncodedGradientShader> m_GradientShader;
00085
00086 unsigned int m_TexID;
00087
00088 int m_DummyTexWidth;
00089 int m_DummyTexHeight;
00090 int m_DummyTexDepth;
00091
00092 float m_SampleDistance;
00093
00094 int m_Shading;
00095
00096 unsigned int m_PolyNum;
00097 unsigned int m_PolyArraySize;
00098 TexPolygon *m_Polygons;
00099
00100 unsigned char *m_GradientMagnitudes;
00101 unsigned short *m_EncodedNormals;
00102
00103 unsigned int m_TexBufSize;
00104 unsigned char *m_TexBuf;
00105
00106 bool m_IsTex3DSupported;
00107 bool m_AutoAdjustSampleDistance;
00108 bool m_FirstRendering;
00109
00110 private:
00111 mitkVolumeRendererTexture3D(const mitkVolumeRendererTexture3D&);
00112 void operator = (const mitkVolumeRendererTexture3D&);
00113
00114 };
00115
00116
00117
00118
00119
00120
00121 #endif
00122