VTK
vtkVolumeTextureMapper3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVolumeTextureMapper3D.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 =========================================================================*/
77 #ifndef vtkVolumeTextureMapper3D_h
78 #define vtkVolumeTextureMapper3D_h
79 
80 #include "vtkRenderingVolumeModule.h" // For export macro
81 #include "vtkVolumeMapper.h"
82 
83 class vtkImageData;
86 class vtkVolumeProperty;
87 #if !defined(VTK_LEGACY_REMOVE)
88 class VTKRENDERINGVOLUME_EXPORT vtkVolumeTextureMapper3D : public vtkVolumeMapper
89 {
90 public:
92  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
93 
94  static vtkVolumeTextureMapper3D *New();
95 
97 
103  vtkSetMacro( SampleDistance, float );
104  vtkGetMacro( SampleDistance, float );
106 
108 
111  vtkGetVectorMacro( VolumeDimensions, int, 3 );
113 
115 
118  vtkGetVectorMacro( VolumeSpacing, float, 3 );
120 
128  vtkRenderer *vtkNotUsed(r))
129  {return 0;}
130 
132 
136  vtkGetMacro( NumberOfPolygons, int );
138 
140 
144  vtkGetMacro( ActualSampleDistance, float );
146 
152  void Render(vtkRenderer *, vtkVolume *) VTK_OVERRIDE {}
153 
157  enum
158  {
159  FRAGMENT_PROGRAM_METHOD=0,
160  NVIDIA_METHOD=1,
161  ATI_METHOD=2,
162  NO_METHOD=3
163  };
164 
168  int GetNumberOfScalarComponents(vtkImageData *input);
169 
171 
176  vtkSetClampMacro( PreferredRenderMethod, int,
180  { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD ); }
182  { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::NVIDIA_METHOD ); }
183  vtkGetMacro(PreferredRenderMethod, int);
185 
186 
188 
196  vtkSetMacro(UseCompressedTexture,bool);
197  vtkGetMacro(UseCompressedTexture,bool);
199 
200 protected:
202  ~vtkVolumeTextureMapper3D() VTK_OVERRIDE;
203 
204  float *PolygonBuffer;
205  float *IntersectionBuffer;
206  int NumberOfPolygons;
207  int BufferSize;
208 
209  unsigned char *Volume1;
210  unsigned char *Volume2;
211  unsigned char *Volume3;
212  int VolumeSize;
213  int VolumeComponents;
214  int VolumeDimensions[3];
215  float VolumeSpacing[3];
216 
217  float SampleDistance;
218  float ActualSampleDistance;
219 
220  vtkImageData *SavedTextureInput;
221  vtkImageData *SavedParametersInput;
222 
223  vtkColorTransferFunction *SavedRGBFunction;
224  vtkPiecewiseFunction *SavedGrayFunction;
225  vtkPiecewiseFunction *SavedScalarOpacityFunction;
226  vtkPiecewiseFunction *SavedGradientOpacityFunction;
227  int SavedColorChannels;
228  float SavedSampleDistance;
229  float SavedScalarOpacityDistance;
230 
231  unsigned char ColorLookup[65536*4];
232  unsigned char AlphaLookup[65536];
233  float TempArray1[3*4096];
234  float TempArray2[4096];
235  int ColorTableSize;
236  float ColorTableScale;
237  float ColorTableOffset;
238 
239  unsigned char DiffuseLookup[65536*4];
240  unsigned char SpecularLookup[65536*4];
241 
242  vtkTimeStamp SavedTextureMTime;
243  vtkTimeStamp SavedParametersMTime;
244 
245  int RenderMethod;
246  int PreferredRenderMethod;
247  bool UseCompressedTexture;
248 
249  bool SupportsNonPowerOfTwoTextures;
250 
254  void ComputePolygons( vtkRenderer *ren, vtkVolume *vol, double bounds[6] );
255 
257 
261  int UpdateVolumes( vtkVolume * );
262  int UpdateColorLookup( vtkVolume * );
264 
269  virtual int IsTextureSizeSupported(int vtkNotUsed(size)[3],
270  int vtkNotUsed(components))
271  {
272  return 0;
273  }
274 
275 private:
276  vtkVolumeTextureMapper3D(const vtkVolumeTextureMapper3D&) VTK_DELETE_FUNCTION;
277  void operator=(const vtkVolumeTextureMapper3D&) VTK_DELETE_FUNCTION;
278 };
279 
280 #endif // VTK_LEGACY_REMOVE
281 #endif
282 
283 
284 
285 
286 
287 
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:44
Abstract class for a volume mapper.
volume render with 3D texture mapping
Defines a 1D piecewise function.
record modification and/or execution time
Definition: vtkTimeStamp.h:32
virtual int IsRenderSupported(vtkVolumeProperty *, vtkRenderer *vtkNotUsed(r))
Based on hardware and properties, we may or may not be able to render using 3D texture mapping...
abstract specification for renderers
Definition: vtkRenderer.h:57
void Render(vtkRenderer *, vtkVolume *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
void SetPreferredMethodToFragmentProgram()
Set the preferred render method.
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
represents the common properties for rendering a volume.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Defines a transfer function for mapping a property to an RGB color value.
static vtkAlgorithm * New()
void SetPreferredMethodToNVidia()
Set the preferred render method.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.