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 "vtkRenderingVolumeOpenGLNewModule.h" // For export macro
20 
21 #include <vtkGPUVolumeRayCastMapper.h>
22 
23 //----------------------------------------------------------------------------
24 class VTKRENDERINGVOLUMEOPENGLNEW_EXPORT vtkOpenGLGPUVolumeRayCastMapper :
25   public vtkGPUVolumeRayCastMapper
26 {
27 public:
28   static vtkOpenGLGPUVolumeRayCastMapper* New();
29 
30   vtkTypeMacro(vtkOpenGLGPUVolumeRayCastMapper, vtkGPUVolumeRayCastMapper);
31   void PrintSelf( ostream& os, vtkIndent indent );
32 
33 protected:
34   vtkOpenGLGPUVolumeRayCastMapper();
35   ~vtkOpenGLGPUVolumeRayCastMapper();
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 noOfComponents);
45 
46   // Description:
47   // Rendering volume on GPU
48   void GPURender(vtkRenderer *ren, vtkVolume *vol);
49 
50   // Description:
51   // Not implemented
PreRender(vtkRenderer * vtkNotUsed (ren),vtkVolume * vtkNotUsed (vol),double vtkNotUsed (datasetBounds)[6],double vtkNotUsed (scalarRange)[2],int vtkNotUsed (numberOfScalarComponents),unsigned int vtkNotUsed (numberOfLevels))52   virtual void PreRender(vtkRenderer* vtkNotUsed(ren),
53                          vtkVolume* vtkNotUsed(vol),
54                          double vtkNotUsed(datasetBounds)[6],
55                          double vtkNotUsed(scalarRange)[2],
56                          int vtkNotUsed(numberOfScalarComponents),
57                          unsigned int vtkNotUsed(numberOfLevels)) {};
58 
59   // Description:
60   // Empty implementation.
RenderBlock(vtkRenderer * vtkNotUsed (ren),vtkVolume * vtkNotUsed (vol),unsigned int vtkNotUsed (level))61   virtual void RenderBlock(vtkRenderer* vtkNotUsed(ren),
62                            vtkVolume* vtkNotUsed(vol),
63                            unsigned int vtkNotUsed(level)) {};
64 
65   // Description:
66   // Empty implementation.
PostRender(vtkRenderer * vtkNotUsed (ren),int vtkNotUsed (umberOfScalarComponents))67   virtual void PostRender(vtkRenderer* vtkNotUsed(ren),
68                           int vtkNotUsed(umberOfScalarComponents)) {};
69 
70   // Description:
71   // Empty implementation.
GetReductionRatio(double * ratio)72   void GetReductionRatio(double* ratio)
73     {
74     ratio[0] = ratio[1] = ratio[2] = 1.0;
75     }
76 
77   // Description:
78   // Empty implementation.
IsRenderSupported(vtkRenderWindow * vtkNotUsed (window),vtkVolumeProperty * vtkNotUsed (property))79   virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window),
80                                 vtkVolumeProperty *vtkNotUsed(property))
81     {
82     return 1;
83     }
84 
85 private:
86   class vtkInternal;
87   vtkInternal* Impl;
88 
89   vtkOpenGLGPUVolumeRayCastMapper(
90     const vtkOpenGLGPUVolumeRayCastMapper&); // Not implemented.
91   void operator=(const vtkOpenGLGPUVolumeRayCastMapper&); // Not implemented.
92 };
93 
94 #endif // vtkOpenGLGPUVolumeRayCastMapper_h
95