VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkOpenGLGPUVolumeRayCastMapper.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 #ifndef vtkOpenGLGPUVolumeRayCastMapper_h
00017 #define vtkOpenGLGPUVolumeRayCastMapper_h
00018 
00019 #include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
00020 
00021 #include <vtkGPUVolumeRayCastMapper.h>
00022 
00023 //----------------------------------------------------------------------------
00024 class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkOpenGLGPUVolumeRayCastMapper :
00025   public vtkGPUVolumeRayCastMapper
00026 {
00027 public:
00028   static vtkOpenGLGPUVolumeRayCastMapper* New();
00029 
00030   vtkTypeMacro(vtkOpenGLGPUVolumeRayCastMapper, vtkGPUVolumeRayCastMapper);
00031   void PrintSelf( ostream& os, vtkIndent indent );
00032 
00033 protected:
00034   vtkOpenGLGPUVolumeRayCastMapper();
00035   ~vtkOpenGLGPUVolumeRayCastMapper();
00036 
00037   // Description:
00038   // Delete OpenGL objects.
00039   // \post done: this->OpenGLObjectsCreated==0
00040   virtual void ReleaseGraphicsResources(vtkWindow *window);
00041 
00042   // Description:
00043   // Build vertex and fragment shader for the volume rendering
00044   void BuildShader(vtkRenderer* ren, vtkVolume* vol, int noOfCmponents);
00045 
00046   // TODO Take these out as these are no longer needed
00047   // Methods called by the AMR Volume Mapper.
00048   virtual void PreRender(vtkRenderer * vtkNotUsed(ren),
00049                          vtkVolume *vtkNotUsed(vol),
00050                          double vtkNotUsed(datasetBounds)[6],
00051                          double vtkNotUsed(scalarRange)[2],
00052                          int vtkNotUsed(noOfComponents),
00053                          unsigned int vtkNotUsed(numberOfLevels)) {}
00054 
00055   // \pre input is up-to-date
00056   virtual void RenderBlock(vtkRenderer *vtkNotUsed(ren),
00057                            vtkVolume *vtkNotUsed(vol),
00058                            unsigned int vtkNotUsed(level)) {}
00059 
00060   virtual void PostRender(vtkRenderer *vtkNotUsed(ren),
00061                           int vtkNotUsed(noOfComponents)) {}
00062 
00063   // Description:
00064   // Rendering volume on GPU
00065   void GPURender(vtkRenderer *ren, vtkVolume *vol);
00066 
00067   // Description:
00068   // Update the reduction factor of the render viewport (this->ReductionFactor)
00069   // according to the time spent in seconds to render the previous frame
00070   // (this->TimeToDraw) and a time in seconds allocated to render the next
00071   // frame (allocatedTime).
00072   // \pre valid_current_reduction_range: this->ReductionFactor>0.0 && this->ReductionFactor<=1.0
00073   // \pre positive_TimeToDraw: this->TimeToDraw>=0.0
00074   // \pre positive_time: allocatedTime>0
00075   // \post valid_new_reduction_range: this->ReductionFactor>0.0 && this->ReductionFactor<=1.0
00076   void ComputeReductionFactor(double allocatedTime);
00077 
00078   // Description:
00079   // Empty implementation.
00080   void GetReductionRatio(double* ratio)
00081     {
00082     ratio[0] = ratio[1] = ratio[2] = 1.0;
00083     }
00084 
00085   // Description:
00086   // Empty implementation.
00087   virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window),
00088                                 vtkVolumeProperty *vtkNotUsed(property))
00089     {
00090     return 1;
00091     }
00092 
00093   double ReductionFactor;
00094 
00095 private:
00096   class vtkInternal;
00097   vtkInternal* Impl;
00098 
00099   vtkOpenGLGPUVolumeRayCastMapper(
00100     const vtkOpenGLGPUVolumeRayCastMapper&); // Not implemented.
00101   void operator=(const vtkOpenGLGPUVolumeRayCastMapper&); // Not implemented.
00102 };
00103 
00104 #endif // vtkOpenGLGPUVolumeRayCastMapper_h