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 "vtkHAVSVolumeMapper.h" 00121 00122 #include <vtkWeakPointer.h> // to cache the vtkRenderWindow 00123 class vtkRenderer; 00124 class vtkRenderWindow; 00125 00126 00127 class VTK_VOLUMERENDERING_EXPORT vtkOpenGLHAVSVolumeMapper : public vtkHAVSVolumeMapper 00128 { 00129 public: 00130 static vtkOpenGLHAVSVolumeMapper *New(); 00131 vtkTypeMacro(vtkOpenGLHAVSVolumeMapper, 00132 vtkHAVSVolumeMapper); 00133 virtual void PrintSelf(ostream& os, vtkIndent indent); 00134 00136 virtual void Render(vtkRenderer *ren, vtkVolume *vol); 00137 00140 virtual void ReleaseGraphicsResources(vtkWindow *); 00141 00144 virtual void SetGPUDataStructures(bool); 00145 00150 virtual bool SupportedByHardware(vtkRenderer *r); 00151 protected: 00152 00153 vtkOpenGLHAVSVolumeMapper(); 00154 ~vtkOpenGLHAVSVolumeMapper(); 00155 virtual int FillInputPortInformation(int port, vtkInformation* info); 00156 00157 //BTX 00158 virtual void Initialize(vtkRenderer *ren, vtkVolume *vol); 00159 virtual void InitializeLookupTables(vtkVolume *vol); 00160 void InitializeGPUDataStructures(); 00161 void InitializeShaders(); 00162 void DeleteShaders(); 00163 void InitializeFramebufferObject(); 00164 00165 void RenderHAVS(vtkRenderer *ren); 00166 void SetupFBOZBuffer(int screenWidth, int screenHeight, float depthNear, float depthFar, 00167 float *zbuffer); 00168 void SetupFBOMRT(); 00169 void DrawFBOInit(int screenWidth, int screenHeight, float depthNear, float depthFar); 00170 void DrawFBOGeometry(); 00171 void DrawFBOFlush(int screenWidth, int screenHeight, float depthNear, float depthFar); 00172 void DrawBlend(int screenWidth, int screenHeight, float depthNear, float depthFar); 00173 00174 void CheckOpenGLError(const char *str); 00175 00176 // GPU 00177 unsigned int VBOVertexName; 00178 unsigned int VBOTexCoordName; 00179 unsigned int VBOVertexIndexName; 00180 unsigned int VertexProgram; 00181 unsigned int FragmentProgramBegin; 00182 unsigned int FragmentProgram; 00183 unsigned int FragmentProgramEnd; 00184 unsigned int FramebufferObject; 00185 int FramebufferObjectSize; 00186 unsigned int FramebufferTextures[4]; 00187 unsigned int DepthTexture; 00188 00189 // Lookup Tables 00190 unsigned int PsiTableTexture; 00191 unsigned int TransferFunctionTexture; 00192 00193 vtkWeakPointer<vtkRenderWindow> RenderWindow; 00194 //ETX 00195 00196 private: 00197 vtkOpenGLHAVSVolumeMapper(const vtkOpenGLHAVSVolumeMapper&); // Not implemented. 00198 void operator=(const vtkOpenGLHAVSVolumeMapper&); // Not implemented. 00199 }; 00200 00201 #endif