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 // Forward declarations
24 class vtkTextureObject;
25 
26 //----------------------------------------------------------------------------
29 {
30 public:
32 
34  void PrintSelf( ostream& os, vtkIndent indent );
35 
36  // Description:
37  // Low level API to enable access to depth texture in
38  // RenderToTexture mode.
39  vtkTextureObject* GetDepthTexture();
40 
41  // Description:
42  // Low level API to enable access to color texture in
43  // RenderToTexture mode.
44  vtkTextureObject* GetColorTexture();
45 
46  // Description:
47  // Low level API to export the depth texture as vtkImageData in
48  // RenderToImage mode.
49  void GetDepthImage(vtkImageData* im);
50 
51  // Description:
52  // Low level API to export the color texture as vtkImageData in
53  // RenderToImage mode.
54  void GetColorImage(vtkImageData* im);
55 
56 protected:
59 
60  // Description:
61  // Delete OpenGL objects.
62  // \post done: this->OpenGLObjectsCreated==0
63  virtual void ReleaseGraphicsResources(vtkWindow *window);
64 
65  // Description:
66  // Build vertex and fragment shader for the volume rendering
67  void BuildShader(vtkRenderer* ren, vtkVolume* vol, int noOfCmponents);
68 
69  // TODO Take these out as these are no longer needed
70  // Methods called by the AMR Volume Mapper.
71  virtual void PreRender(vtkRenderer * vtkNotUsed(ren),
72  vtkVolume *vtkNotUsed(vol),
73  double vtkNotUsed(datasetBounds)[6],
74  double vtkNotUsed(scalarRange)[2],
75  int vtkNotUsed(noOfComponents),
76  unsigned int vtkNotUsed(numberOfLevels)) {}
77 
78  // \pre input is up-to-date
79  virtual void RenderBlock(vtkRenderer *vtkNotUsed(ren),
80  vtkVolume *vtkNotUsed(vol),
81  unsigned int vtkNotUsed(level)) {}
82 
83  virtual void PostRender(vtkRenderer *vtkNotUsed(ren),
84  int vtkNotUsed(noOfComponents)) {}
85 
86  // Description:
87  // Rendering volume on GPU
88  void GPURender(vtkRenderer *ren, vtkVolume *vol);
89 
90  // Description:
91  // Update the reduction factor of the render viewport (this->ReductionFactor)
92  // according to the time spent in seconds to render the previous frame
93  // (this->TimeToDraw) and a time in seconds allocated to render the next
94  // frame (allocatedTime).
95  // \pre valid_current_reduction_range: this->ReductionFactor>0.0 && this->ReductionFactor<=1.0
96  // \pre positive_TimeToDraw: this->TimeToDraw>=0.0
97  // \pre positive_time: allocatedTime>0
98  // \post valid_new_reduction_range: this->ReductionFactor>0.0 && this->ReductionFactor<=1.0
99  void ComputeReductionFactor(double allocatedTime);
100 
101  // Description:
102  // Empty implementation.
103  void GetReductionRatio(double* ratio)
104  {
105  ratio[0] = ratio[1] = ratio[2] = 1.0;
106  }
107 
108  // Description:
109  // Empty implementation.
110  virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window),
111  vtkVolumeProperty *vtkNotUsed(property))
112  {
113  return 1;
114  }
115 
116  double ReductionFactor;
117 
118 private:
119  class vtkInternal;
120  vtkInternal* Impl;
121 
123  const vtkOpenGLGPUVolumeRayCastMapper&); // Not implemented.
124  void operator=(const vtkOpenGLGPUVolumeRayCastMapper&); // Not implemented.
125 };
126 
127 #endif // vtkOpenGLGPUVolumeRayCastMapper_h
virtual void GPURender(vtkRenderer *, vtkVolume *)
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:49
#define VTKRENDERINGVOLUMEOPENGL2_EXPORT
virtual void GetDepthImage(vtkImageData *)
virtual void GetColorImage(vtkImageData *)
abstract specification for renderers
Definition: vtkRenderer.h:62
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
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
represents the common properties for rendering a volume.
abstracts an OpenGL texture object.
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()