VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOpenGLHAVSVolumeMapper.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 =========================================================================*/ 00015 00016 /* Copyright 2005, 2006 by University of Utah. */ 00017 00117 #ifndef __vtkOpenGLHAVSVolumeMapper_h 00118 #define __vtkOpenGLHAVSVolumeMapper_h 00119 00120 #include "vtkRenderingVolumeOpenGLModule.h" // For export macro 00121 #include "vtkHAVSVolumeMapper.h" 00122 00123 #include <vtkWeakPointer.h> // to cache the vtkRenderWindow 00124 class vtkRenderer; 00125 class vtkRenderWindow; 00126 00127 00128 class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkOpenGLHAVSVolumeMapper 00129 : public vtkHAVSVolumeMapper 00130 { 00131 public: 00132 static vtkOpenGLHAVSVolumeMapper *New(); 00133 vtkTypeMacro(vtkOpenGLHAVSVolumeMapper, 00134 vtkHAVSVolumeMapper); 00135 virtual void PrintSelf(ostream& os, vtkIndent indent); 00136 00138 virtual void Render(vtkRenderer *ren, vtkVolume *vol); 00139 00142 virtual void ReleaseGraphicsResources(vtkWindow *); 00143 00146 virtual void SetGPUDataStructures(bool); 00147 00149 00153 virtual bool SupportedByHardware(vtkRenderer *r); 00154 protected: 00156 00157 vtkOpenGLHAVSVolumeMapper(); 00158 ~vtkOpenGLHAVSVolumeMapper(); 00159 virtual int FillInputPortInformation(int port, vtkInformation* info); 00160 00161 //BTX 00162 virtual void Initialize(vtkRenderer *ren, vtkVolume *vol); 00163 virtual void InitializeLookupTables(vtkVolume *vol); 00164 void InitializeGPUDataStructures(); 00165 void InitializeShaders(); 00166 void DeleteShaders(); 00167 void InitializeFramebufferObject(); 00168 00169 void RenderHAVS(vtkRenderer *ren); 00170 void SetupFBOZBuffer(int screenWidth, int screenHeight, float depthNear, float depthFar, 00171 float *zbuffer); 00172 void SetupFBOMRT(); 00173 void DrawFBOInit(int screenWidth, int screenHeight, float depthNear, float depthFar); 00174 void DrawFBOGeometry(); 00175 void DrawFBOFlush(int screenWidth, int screenHeight, float depthNear, float depthFar); 00176 void DrawBlend(int screenWidth, int screenHeight, float depthNear, float depthFar); 00177 00178 void CheckOpenGLError(const char *str); 00179 00180 // GPU 00181 unsigned int VBOVertexName; 00182 unsigned int VBOTexCoordName; 00183 unsigned int VBOVertexIndexName; 00184 unsigned int VertexProgram; 00185 unsigned int FragmentProgramBegin; 00186 unsigned int FragmentProgram; 00187 unsigned int FragmentProgramEnd; 00188 unsigned int FramebufferObject; 00189 int FramebufferObjectSize; 00190 unsigned int FramebufferTextures[4]; 00191 unsigned int DepthTexture; 00192 00193 // Lookup Tables 00194 unsigned int PsiTableTexture; 00195 unsigned int TransferFunctionTexture; 00196 00197 vtkWeakPointer<vtkRenderWindow> RenderWindow; 00198 //ETX 00199 00200 private: 00201 vtkOpenGLHAVSVolumeMapper(const vtkOpenGLHAVSVolumeMapper&); // Not implemented. 00202 void operator=(const vtkOpenGLHAVSVolumeMapper&); // Not implemented. 00203 }; 00204 00205 #endif