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 00147 00151 virtual bool SupportedByHardware(vtkRenderer *r); 00152 protected: 00154 00155 vtkOpenGLHAVSVolumeMapper(); 00156 ~vtkOpenGLHAVSVolumeMapper(); 00157 virtual int FillInputPortInformation(int port, vtkInformation* info); 00158 00159 //BTX 00160 virtual void Initialize(vtkRenderer *ren, vtkVolume *vol); 00161 virtual void InitializeLookupTables(vtkVolume *vol); 00162 void InitializeGPUDataStructures(); 00163 void InitializeShaders(); 00164 void DeleteShaders(); 00165 void InitializeFramebufferObject(); 00166 00167 void RenderHAVS(vtkRenderer *ren); 00168 void SetupFBOZBuffer(int screenWidth, int screenHeight, float depthNear, float depthFar, 00169 float *zbuffer); 00170 void SetupFBOMRT(); 00171 void DrawFBOInit(int screenWidth, int screenHeight, float depthNear, float depthFar); 00172 void DrawFBOGeometry(); 00173 void DrawFBOFlush(int screenWidth, int screenHeight, float depthNear, float depthFar); 00174 void DrawBlend(int screenWidth, int screenHeight, float depthNear, float depthFar); 00175 00176 void CheckOpenGLError(const char *str); 00177 00178 // GPU 00179 unsigned int VBOVertexName; 00180 unsigned int VBOTexCoordName; 00181 unsigned int VBOVertexIndexName; 00182 unsigned int VertexProgram; 00183 unsigned int FragmentProgramBegin; 00184 unsigned int FragmentProgram; 00185 unsigned int FragmentProgramEnd; 00186 unsigned int FramebufferObject; 00187 int FramebufferObjectSize; 00188 unsigned int FramebufferTextures[4]; 00189 unsigned int DepthTexture; 00190 00191 // Lookup Tables 00192 unsigned int PsiTableTexture; 00193 unsigned int TransferFunctionTexture; 00194 00195 vtkWeakPointer<vtkRenderWindow> RenderWindow; 00196 //ETX 00197 00198 private: 00199 vtkOpenGLHAVSVolumeMapper(const vtkOpenGLHAVSVolumeMapper&); // Not implemented. 00200 void operator=(const vtkOpenGLHAVSVolumeMapper&); // Not implemented. 00201 }; 00202 00203 #endif