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 "vtkVolumeTextureMapper3D.h" 00030 00031 #ifndef VTK_IMPLEMENT_MESA_CXX 00032 # include "vtkOpenGL.h" // GLfloat type is used in some method signatures. 00033 #endif 00034 00035 00036 class vtkRenderWindow; 00037 class vtkVolumeProperty; 00038 00039 class VTK_VOLUMERENDERING_EXPORT vtkOpenGLVolumeTextureMapper3D : public vtkVolumeTextureMapper3D 00040 { 00041 public: 00042 vtkTypeMacro(vtkOpenGLVolumeTextureMapper3D,vtkVolumeTextureMapper3D); 00043 void PrintSelf(ostream& os, vtkIndent indent); 00044 00045 static vtkOpenGLVolumeTextureMapper3D *New(); 00046 00048 00051 int IsRenderSupported(vtkVolumeProperty *, 00052 vtkRenderer *ren); 00054 00055 //BTX 00056 00059 virtual void Render(vtkRenderer *ren, vtkVolume *vol); 00060 00061 //ETX 00062 00063 // Desciption: 00064 // Initialize when we go to render, or go to answer the 00065 // IsRenderSupported question. Don't call unless we have 00066 // a valid OpenGL context! 00067 vtkGetMacro( Initialized, int ); 00068 00072 void ReleaseGraphicsResources(vtkWindow *); 00073 00074 protected: 00075 vtkOpenGLVolumeTextureMapper3D(); 00076 ~vtkOpenGLVolumeTextureMapper3D(); 00077 00078 //BTX 00079 00080 void GetLightInformation(vtkRenderer *ren, 00081 vtkVolume *vol, 00082 GLfloat lightDirection[2][4], 00083 GLfloat lightDiffuseColor[2][4], 00084 GLfloat lightSpecularColor[2][4], 00085 GLfloat halfwayVector[2][4], 00086 GLfloat *ambient ); 00087 //ETX 00088 00089 int Initialized; 00090 GLuint Volume1Index; 00091 GLuint Volume2Index; 00092 GLuint Volume3Index; 00093 GLuint ColorLookupIndex; 00094 GLuint AlphaLookupIndex; 00095 vtkRenderWindow *RenderWindow; 00096 00097 bool SupportsCompressedTexture; 00098 bool SupportsNonPowerOfTwoTextures; 00099 00100 // Actual internal texture format (uncompressed vs compressed) 00101 // Computed in Render() 00102 int InternalAlpha; // GLint 00103 int InternalLA; // GLint 00104 int InternalRGB; // GLint 00105 int InternalRGBA; // GLint 00106 00107 void Initialize(vtkRenderer *r); 00108 00109 virtual void RenderNV(vtkRenderer *ren, vtkVolume *vol); 00110 virtual void RenderFP(vtkRenderer *ren, vtkVolume *vol); 00111 00112 void RenderOneIndependentNoShadeFP( vtkRenderer *ren, 00113 vtkVolume *vol ); 00114 void RenderOneIndependentShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00115 void RenderTwoDependentNoShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00116 void RenderTwoDependentShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00117 void RenderFourDependentNoShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00118 void RenderFourDependentShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00119 00120 void RenderOneIndependentNoShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00121 void RenderOneIndependentShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00122 void RenderTwoDependentNoShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00123 void RenderTwoDependentShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00124 void RenderFourDependentNoShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00125 void RenderFourDependentShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00126 00127 void SetupOneIndependentTextures( vtkRenderer *ren, vtkVolume *vol ); 00128 void SetupTwoDependentTextures( vtkRenderer *ren, vtkVolume *vol ); 00129 void SetupFourDependentTextures( vtkRenderer *ren, vtkVolume *vol ); 00130 00131 void SetupRegisterCombinersNoShadeNV( vtkRenderer *ren, 00132 vtkVolume *vol, 00133 int components ); 00134 00135 void SetupRegisterCombinersShadeNV( vtkRenderer *ren, 00136 vtkVolume *vol, 00137 int components ); 00138 00139 void DeleteTextureIndex( GLuint *index ); 00140 void CreateTextureIndex( GLuint *index ); 00141 00142 void RenderPolygons( vtkRenderer *ren, 00143 vtkVolume *vol, 00144 int stages[4] ); 00145 00146 void SetupProgramLocalsForShadingFP( vtkRenderer *ren, vtkVolume *vol ); 00147 00149 00151 int IsTextureSizeSupported(int size[3], 00152 int components); 00154 00156 void Setup3DTextureParameters( vtkVolumeProperty *property ); 00157 00158 private: 00159 vtkOpenGLVolumeTextureMapper3D(const vtkOpenGLVolumeTextureMapper3D&); // Not implemented. 00160 void operator=(const vtkOpenGLVolumeTextureMapper3D&); // Not implemented. 00161 }; 00162 00163 00164 #endif 00165 00166 00167