VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkOpenGLVolumeTextureMapper3D.h,v $ 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 vtkTypeRevisionMacro(vtkOpenGLVolumeTextureMapper3D,vtkVolumeTextureMapper3D); 00043 void PrintSelf(ostream& os, vtkIndent indent); 00044 00045 static vtkOpenGLVolumeTextureMapper3D *New(); 00046 00050 int IsRenderSupported(vtkVolumeProperty *); 00051 00052 //BTX 00053 00056 virtual void Render(vtkRenderer *ren, vtkVolume *vol); 00057 00058 //ETX 00059 00060 // Desciption: 00061 // Initialize when we go to render, or go to answer the 00062 // IsRenderSupported question. Don't call unless we have 00063 // a valid OpenGL context! 00064 vtkGetMacro( Initialized, int ); 00065 00069 void ReleaseGraphicsResources(vtkWindow *); 00070 00071 protected: 00072 vtkOpenGLVolumeTextureMapper3D(); 00073 ~vtkOpenGLVolumeTextureMapper3D(); 00074 00075 //BTX 00076 00077 void GetLightInformation(vtkRenderer *ren, 00078 vtkVolume *vol, 00079 GLfloat lightDirection[2][4], 00080 GLfloat lightDiffuseColor[2][4], 00081 GLfloat lightSpecularColor[2][4], 00082 GLfloat halfwayVector[2][4], 00083 GLfloat *ambient ); 00084 //ETX 00085 00086 int Initialized; 00087 GLuint Volume1Index; 00088 GLuint Volume2Index; 00089 GLuint Volume3Index; 00090 GLuint ColorLookupIndex; 00091 GLuint AlphaLookupIndex; 00092 vtkRenderWindow *RenderWindow; 00093 00094 void Initialize(); 00095 00096 virtual void RenderNV(vtkRenderer *ren, vtkVolume *vol); 00097 virtual void RenderFP(vtkRenderer *ren, vtkVolume *vol); 00098 00099 void RenderOneIndependentNoShadeFP( vtkRenderer *ren, 00100 vtkVolume *vol ); 00101 void RenderOneIndependentShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00102 void RenderTwoDependentNoShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00103 void RenderTwoDependentShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00104 void RenderFourDependentNoShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00105 void RenderFourDependentShadeFP( vtkRenderer *ren, vtkVolume *vol ); 00106 00107 void RenderOneIndependentNoShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00108 void RenderOneIndependentShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00109 void RenderTwoDependentNoShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00110 void RenderTwoDependentShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00111 void RenderFourDependentNoShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00112 void RenderFourDependentShadeNV( vtkRenderer *ren, vtkVolume *vol ); 00113 00114 void SetupOneIndependentTextures( vtkRenderer *ren, vtkVolume *vol ); 00115 void SetupTwoDependentTextures( vtkRenderer *ren, vtkVolume *vol ); 00116 void SetupFourDependentTextures( vtkRenderer *ren, vtkVolume *vol ); 00117 00118 void SetupRegisterCombinersNoShadeNV( vtkRenderer *ren, 00119 vtkVolume *vol, 00120 int components ); 00121 00122 void SetupRegisterCombinersShadeNV( vtkRenderer *ren, 00123 vtkVolume *vol, 00124 int components ); 00125 00126 void DeleteTextureIndex( GLuint *index ); 00127 void CreateTextureIndex( GLuint *index ); 00128 00129 void RenderPolygons( vtkRenderer *ren, 00130 vtkVolume *vol, 00131 int stages[4] ); 00132 00133 void SetupProgramLocalsForShadingFP( vtkRenderer *ren, vtkVolume *vol ); 00134 00136 int IsTextureSizeSupported( int size[3] ); 00137 00139 void Setup3DTextureParameters( vtkVolumeProperty *property ); 00140 00141 private: 00142 vtkOpenGLVolumeTextureMapper3D(const vtkOpenGLVolumeTextureMapper3D&); // Not implemented. 00143 void operator=(const vtkOpenGLVolumeTextureMapper3D&); // Not implemented. 00144 }; 00145 00146 00147 #endif 00148 00149 00150