VTK
vtkOpenGLGPUVolumeRayCastMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLGPUVolumeRayCastMapper.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
16 #ifndef vtkOpenGLGPUVolumeRayCastMapper_h
17 #define vtkOpenGLGPUVolumeRayCastMapper_h
18 
19 #include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
20 
22 
23 //----------------------------------------------------------------------------
24 class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkOpenGLGPUVolumeRayCastMapper :
26 {
27 public:
29 
31  void PrintSelf( ostream& os, vtkIndent indent );
32 
33 protected:
36 
37  // Description:
38  // Delete OpenGL objects.
39  // \post done: this->OpenGLObjectsCreated==0
40  virtual void ReleaseGraphicsResources(vtkWindow *window);
41 
42  // Description:
43  // Build vertex and fragment shader for the volume rendering
44  void BuildShader(vtkRenderer* ren, vtkVolume* vol, int noOfCmponents);
45 
46  // TODO Take these out as these are no longer needed
47  // Methods called by the AMR Volume Mapper.
48  virtual void PreRender(vtkRenderer * vtkNotUsed(ren),
49  vtkVolume *vtkNotUsed(vol),
50  double vtkNotUsed(datasetBounds)[6],
51  double vtkNotUsed(scalarRange)[2],
52  int vtkNotUsed(noOfComponents),
53  unsigned int vtkNotUsed(numberOfLevels)) {}
54 
55  // \pre input is up-to-date
56  virtual void RenderBlock(vtkRenderer *vtkNotUsed(ren),
57  vtkVolume *vtkNotUsed(vol),
58  unsigned int vtkNotUsed(level)) {}
59 
60  virtual void PostRender(vtkRenderer *vtkNotUsed(ren),
61  int vtkNotUsed(noOfComponents)) {}
62 
63  // Description:
64  // Rendering volume on GPU
65  void GPURender(vtkRenderer *ren, vtkVolume *vol);
66 
67  // Description:
68  // Update the reduction factor of the render viewport (this->ReductionFactor)
69  // according to the time spent in seconds to render the previous frame
70  // (this->TimeToDraw) and a time in seconds allocated to render the next
71  // frame (allocatedTime).
72  // \pre valid_current_reduction_range: this->ReductionFactor>0.0 && this->ReductionFactor<=1.0
73  // \pre positive_TimeToDraw: this->TimeToDraw>=0.0
74  // \pre positive_time: allocatedTime>0
75  // \post valid_new_reduction_range: this->ReductionFactor>0.0 && this->ReductionFactor<=1.0
76  void ComputeReductionFactor(double allocatedTime);
77 
78  // Description:
79  // Empty implementation.
80  void GetReductionRatio(double* ratio)
81  {
82  ratio[0] = ratio[1] = ratio[2] = 1.0;
83  }
84 
85  // Description:
86  // Empty implementation.
87  virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window),
88  vtkVolumeProperty *vtkNotUsed(property))
89  {
90  return 1;
91  }
92 
93  double ReductionFactor;
94 
95 private:
96  class vtkInternal;
97  vtkInternal* Impl;
98 
100  const vtkOpenGLGPUVolumeRayCastMapper&); // Not implemented.
101  void operator=(const vtkOpenGLGPUVolumeRayCastMapper&); // Not implemented.
102 };
103 
104 #endif // vtkOpenGLGPUVolumeRayCastMapper_h
virtual void GPURender(vtkRenderer *, vtkVolume *)
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:49
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void PostRender(vtkRenderer *vtkNotUsed(ren), int vtkNotUsed(noOfComponents))
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
OpenGL subclass that draws the image to the screen.
a simple class to control print indentation
Definition: vtkIndent.h:38
represents the common properties for rendering a volume.
create a window for renderers to draw into
virtual void PreRender(vtkRenderer *vtkNotUsed(ren), vtkVolume *vtkNotUsed(vol), double vtkNotUsed(datasetBounds)[6], double vtkNotUsed(scalarRange)[2], int vtkNotUsed(noOfComponents), unsigned int vtkNotUsed(numberOfLevels))
virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window), vtkVolumeProperty *vtkNotUsed(property))
void PrintSelf(ostream &os, vtkIndent indent)
virtual void RenderBlock(vtkRenderer *vtkNotUsed(ren), vtkVolume *vtkNotUsed(vol), unsigned int vtkNotUsed(level))
Ray casting performed on the GPU.
static vtkGPUVolumeRayCastMapper * New()