VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOpenGLVolumeTextureMapper3D.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00026 #ifndef __vtkOpenGLVolumeTextureMapper3D_h 00027 #define __vtkOpenGLVolumeTextureMapper3D_h 00028 00029 #include "vtkRenderingVolumeOpenGLModule.h" // For export macro 00030 #include "vtkVolumeTextureMapper3D.h" 00031 #include "vtkOpenGL.h" // GLfloat type is used in some method signatures. 00032 00033 class vtkRenderWindow; 00034 class vtkVolumeProperty; 00035 00036 class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkOpenGLVolumeTextureMapper3D 00037 : public vtkVolumeTextureMapper3D 00038 { 00039 public: 00040 vtkTypeMacro(vtkOpenGLVolumeTextureMapper3D,vtkVolumeTextureMapper3D); 00041 void PrintSelf(ostream& os, vtkIndent indent); 00042 00043 static vtkOpenGLVolumeTextureMapper3D *New(); 00044 00046 00049 int IsRenderSupported(vtkVolumeProperty *, 00050 vtkRenderer *ren); 00052 00053 //BTX 00054 00057 virtual void Render(vtkRenderer *ren, vtkVolume *vol); 00058 00059 //ETX 00060 00061 // Desciption: 00062 // Initialize when we go to render, or go to answer the 00063 // IsRenderSupported question. Don't call unless we have 00064 // a valid OpenGL context! 00065 vtkGetMacro( Initialized, int ); 00066 00070 void ReleaseGraphicsResources(vtkWindow *); 00071 00072 protected: 00073 vtkOpenGLVolumeTextureMapper3D(); 00074 ~vtkOpenGLVolumeTextureMapper3D(); 00075 00076 //BTX 00077 00078 void GetLightInformation(vtkRenderer *ren, 00079 vtkVolume *vol, 00080 GLfloat lightDirection[2][4], 00081 GLfloat lightDiffuseColor[2][4], 00082 GLfloat lightSpecularColor[2][4], 00083 GLfloat halfwayVector[2][4], 00084 GLfloat *ambient ); 00085 //ETX 00086 00087 int Initialized; 00088 GLuint Volume1Index; 00089 GLuint Volume2Index; 00090 GLuint Volume3Index; 00091 GLuint ColorLookupIndex; 00092 GLuint AlphaLookupIndex; 00093 vtkRenderWindow *RenderWindow; 00094 00095 bool SupportsCompressedTexture; 00096 bool SupportsNonPowerOfTwoTextures; 00097 00098 // Actual internal texture format (uncompressed vs compressed) 00099 // Computed in Render() 00100 int InternalAlpha; // GLint 00101 int InternalLA; // GLint 00102 int InternalRGB; // GLint 00103 int InternalRGBA; // GLint 00104 00105 void Initialize(vtkRenderer *r); 00106 00107 virtual void RenderNV(vtkRenderer *ren, vtkVolume *vol); 00108 virtual void RenderFP(vtkRenderer *ren, vtkVolume *vol); 00109 00110 void RenderOneIndependentNoShadeFP( vtkRenderer *ren, 00111 vtkVolume *vol ); 00112 void RenderOneIndependentShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00113 void RenderTwoDependentNoShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00114 void RenderTwoDependentShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00115 void RenderFourDependentNoShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00116 void RenderFourDependentShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00117 00118 void RenderOneIndependentNoShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00119 void RenderOneIndependentShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00120 void RenderTwoDependentNoShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00121 void RenderTwoDependentShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00122 void RenderFourDependentNoShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00123 void RenderFourDependentShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00124 00125 void SetupOneIndependentTextures( vtkRenderer *ren, vtkVolume *vol ); 00126 void SetupTwoDependentTextures( vtkRenderer *ren, vtkVolume *vol ); 00127 void SetupFourDependentTextures( vtkRenderer *ren, vtkVolume *vol ); 00128 00129 void SetupRegisterCombinersNoShadeNV( vtkRenderer *ren, 00130 vtkVolume *vol, 00131 int components ); 00132 00133 void SetupRegisterCombinersShadeNV( vtkRenderer *ren, 00134 vtkVolume *vol, 00135 int components ); 00136 00137 void DeleteTextureIndex( GLuint *index ); 00138 void CreateTextureIndex( GLuint *index ); 00139 00140 void RenderPolygons( vtkRenderer *ren, 00141 vtkVolume *vol, 00142 int stages[4] ); 00143 00144 void SetupProgramLocalsForShadingFP( vtkRenderer *ren, vtkVolume *vol ); 00145 00147 00149 int IsTextureSizeSupported(int size[3], 00150 int components); 00152 00154 void Setup3DTextureParameters( vtkVolumeProperty *property ); 00155 00156 private: 00157 vtkOpenGLVolumeTextureMapper3D(const vtkOpenGLVolumeTextureMapper3D&); // Not implemented. 00158 void operator=(const vtkOpenGLVolumeTextureMapper3D&); // Not implemented. 00159 }; 00160 00161 #endif