Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
vtkMitkOpenGLVolumeTextureMapper3D.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 // .NAME vtkMitkOpenGLVolumeTextureMapper3D - concrete implementation of 3D volume texture mapping
18 
19 // .SECTION Description
20 // vtkMitkOpenGLVolumeTextureMapper3D renders a volume using 3D texture mapping.
21 // See vtkMitkVolumeTextureMapper3D for full description.
22 
23 // .SECTION see also
24 // vtkMitkVolumeTextureMapper3D vtkVolumeMapper
25 
26 #ifndef __vtkMitkOpenGLVolumeTextureMapper3D_h
27 #define __vtkMitkOpenGLVolumeTextureMapper3D_h
28 
29 #include "MitkMapperExtExports.h"
30 #include "mitkBaseRenderer.h"
32 
33 #ifndef VTK_IMPLEMENT_MESA_CXX
34 #include "vtkOpenGL.h" // GLfloat type is used in some method signatures.
35 #endif
36 
37 class vtkRenderWindow;
38 class vtkVolumeProperty;
39 
40 #include "mitkCommon.h"
41 
43 {
44 public:
46  void PrintSelf(ostream &os, vtkIndent indent) override;
47 
49 
50  // Description:
51  // Is hardware rendering supported? No if the input data is
52  // more than one independent component, or if the hardware does
53  // not support the required extensions
54  // int IsRenderSupported(vtkVolumeProperty *);
55  int IsRenderSupported(vtkRenderer *ren, vtkVolumeProperty *) override;
56 
57  // BTX
58 
59  // Description:
60  // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
61  // DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS
62  // Render the volume
63  virtual void Render(vtkRenderer *ren, vtkVolume *vol) override;
64 
65  // ETX
66 
67  // Desciption:
68  // Initialize when we go to render, or go to answer the
69  // IsRenderSupported question. Don't call unless we have
70  // a valid OpenGL context!
71  vtkGetMacro(Initialized, int);
72 
73  // Description:
74  // Release any graphics resources that are being consumed by this texture.
75  // The parameter window could be used to determine which graphic
76  // resources to release.
77  // deprecatedSince{2013_12} Use ReleaseGraphicsResources(mitk::BaseRenderer* renderer) instead
78  DEPRECATED(void ReleaseGraphicsResources(vtkWindow *) override);
79 
80  // Description:
81  // Release any graphics resources that are being consumed by this texture.
82  // The parameter renderer could be used to determine which graphic
83  // resources to release.
84  void ReleaseGraphicsResources(mitk::BaseRenderer *renderer);
85 
86 protected:
89 
91 
92  // BTX
93 
94  void GetLightInformation(vtkRenderer *ren,
95  vtkVolume *vol,
96  GLfloat lightDirection[2][4],
97  GLfloat lightDiffuseColor[2][4],
98  GLfloat lightSpecularColor[2][4],
99  GLfloat halfwayVector[2][4],
100  GLfloat *ambient);
101  // ETX
102 
104  GLuint Volume1Index;
105  GLuint Volume2Index;
106  GLuint Volume3Index;
109 
111  GLuint prgRGBAShade;
112 
113  vtkRenderWindow *RenderWindow;
114 
116 
117  // void Initialize();
118  void Initialize(vtkRenderer *r);
119 
120  virtual void RenderFP(vtkRenderer *ren, vtkVolume *vol);
121 
122  void SetupOneIndependentTextures(vtkRenderer *ren, vtkVolume *vol);
123  void RenderOneIndependentShadeFP(vtkRenderer *ren, vtkVolume *vol);
124 
125  void SetupRGBATextures(vtkRenderer *ren, vtkVolume *vol);
126  void RenderRGBAShadeFP(vtkRenderer *ren, vtkVolume *vol);
127 
128  void DeleteTextureIndex(GLuint *index);
129  void CreateTextureIndex(GLuint *index);
130 
131  void RenderPolygons(vtkRenderer *ren, vtkVolume *vol, int stages[4]);
132 
133  void SetupProgramLocalsForShadingFP(vtkRenderer *ren, vtkVolume *vol);
134 
135  void Setup3DTextureParameters(bool linear);
136 
137  void ComputeVolumeDimensions();
138 
139  bool UpdateVolumes(vtkVolume *);
140 
141  bool UpdateVolumesRGBA(vtkVolume *);
142 
143 private:
145  void operator=(const vtkMitkOpenGLVolumeTextureMapper3D &); // Not implemented.
146 };
147 
148 #endif
#define MITKMAPPEREXT_EXPORT
Organizes the rendering process.
virtual void Render(vtkRenderer *, vtkVolume *) override
#define DEPRECATED(func)
Definition: mitkCommon.h:183
vtkTypeMacro(vtkMitkVolumeTextureMapper3D, vtkVolumeMapper)
void PrintSelf(ostream &os, vtkIndent indent) override
virtual int IsRenderSupported(vtkRenderer *, vtkVolumeProperty *)=0
vtkGetMacro(SampleDistance, float)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.