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 =========================================================================*/
83 #ifndef vtkVolumeTextureMapper3D_h
84 #define vtkVolumeTextureMapper3D_h
85 
86 #include "vtkRenderingVolumeModule.h" // For export macro
87 #include "vtkVolumeMapper.h"
88 
89 class vtkImageData;
92 class vtkVolumeProperty;
93 #if !defined(VTK_LEGACY_REMOVE)
94 class VTKRENDERINGVOLUME_EXPORT vtkVolumeTextureMapper3D : public vtkVolumeMapper
95 {
96 public:
98  void PrintSelf(ostream& os, vtkIndent indent);
99 
100  static vtkVolumeTextureMapper3D *New();
101 
103 
109  vtkSetMacro( SampleDistance, float );
110  vtkGetMacro( SampleDistance, float );
112 
114 
117  vtkGetVectorMacro( VolumeDimensions, int, 3 );
119 
121 
124  vtkGetVectorMacro( VolumeSpacing, float, 3 );
126 
134  vtkRenderer *vtkNotUsed(r))
135  {return 0;}
136 
138 
142  vtkGetMacro( NumberOfPolygons, int );
144 
146 
150  vtkGetMacro( ActualSampleDistance, float );
152 
158  virtual void Render(vtkRenderer *, vtkVolume *) {}
159 
163  enum
164  {
165  FRAGMENT_PROGRAM_METHOD=0,
166  NVIDIA_METHOD=1,
167  ATI_METHOD=2,
168  NO_METHOD=3
169  };
170 
174  int GetNumberOfScalarComponents(vtkImageData *input);
175 
177 
182  vtkSetClampMacro( PreferredRenderMethod, int,
186  { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD ); }
188  { this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::NVIDIA_METHOD ); }
189  vtkGetMacro(PreferredRenderMethod, int);
191 
192 
194 
202  vtkSetMacro(UseCompressedTexture,bool);
203  vtkGetMacro(UseCompressedTexture,bool);
205 
206 protected:
209 
214 
215  unsigned char *Volume1;
216  unsigned char *Volume2;
217  unsigned char *Volume3;
220  int VolumeDimensions[3];
221  float VolumeSpacing[3];
222 
225 
228 
236 
237  unsigned char ColorLookup[65536*4];
238  unsigned char AlphaLookup[65536];
239  float TempArray1[3*4096];
240  float TempArray2[4096];
244 
245  unsigned char DiffuseLookup[65536*4];
246  unsigned char SpecularLookup[65536*4];
247 
250 
254 
256 
260  void ComputePolygons( vtkRenderer *ren, vtkVolume *vol, double bounds[6] );
261 
263 
267  int UpdateVolumes( vtkVolume * );
268  int UpdateColorLookup( vtkVolume * );
270 
275  virtual int IsTextureSizeSupported(int vtkNotUsed(size)[3],
276  int vtkNotUsed(components))
277  {
278  return 0;
279  }
280 
281 private:
282  vtkVolumeTextureMapper3D(const vtkVolumeTextureMapper3D&) VTK_DELETE_FUNCTION;
283  void operator=(const vtkVolumeTextureMapper3D&) VTK_DELETE_FUNCTION;
284 };
285 
286 #endif // VTK_LEGACY_REMOVE
287 #endif
288 
289 
290 
291 
292 
293 
vtkVolumeTextureMapper3D::BufferSize
int BufferSize
Definition: vtkVolumeTextureMapper3D.h:213
vtkVolumeTextureMapper3D::SavedScalarOpacityFunction
vtkPiecewiseFunction * SavedScalarOpacityFunction
Definition: vtkVolumeTextureMapper3D.h:231
vtkVolumeTextureMapper3D::VolumeSize
int VolumeSize
Definition: vtkVolumeTextureMapper3D.h:218
vtkVolumeTextureMapper3D
volume render with 3D texture mapping
Definition: vtkVolumeTextureMapper3D.h:94
vtkVolumeMapper
Abstract class for a volume mapper.
Definition: vtkVolumeMapper.h:49
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD
@ FRAGMENT_PROGRAM_METHOD
Definition: vtkVolumeTextureMapper3D.h:165
vtkVolumeTextureMapper3D::SavedTextureMTime
vtkTimeStamp SavedTextureMTime
Definition: vtkVolumeTextureMapper3D.h:248
vtkVolumeMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkVolumeTextureMapper3D::Volume2
unsigned char * Volume2
Definition: vtkVolumeTextureMapper3D.h:216
vtkVolumeTextureMapper3D::SavedRGBFunction
vtkColorTransferFunction * SavedRGBFunction
Definition: vtkVolumeTextureMapper3D.h:229
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkVolumeTextureMapper3D::SetPreferredMethodToNVidia
void SetPreferredMethodToNVidia()
Definition: vtkVolumeTextureMapper3D.h:187
vtkVolumeTextureMapper3D::SavedParametersInput
vtkImageData * SavedParametersInput
Definition: vtkVolumeTextureMapper3D.h:227
vtkVolumeTextureMapper3D::RenderMethod
int RenderMethod
Definition: vtkVolumeTextureMapper3D.h:251
vtkColorTransferFunction
Defines a transfer function for mapping a property to an RGB color value.
Definition: vtkColorTransferFunction.h:58
vtkVolumeTextureMapper3D::IntersectionBuffer
float * IntersectionBuffer
Definition: vtkVolumeTextureMapper3D.h:211
vtkVolumeTextureMapper3D::SetPreferredMethodToFragmentProgram
void SetPreferredMethodToFragmentProgram()
Definition: vtkVolumeTextureMapper3D.h:185
vtkVolumeTextureMapper3D::ColorTableSize
int ColorTableSize
Definition: vtkVolumeTextureMapper3D.h:241
vtkVolumeTextureMapper3D::Volume3
unsigned char * Volume3
Definition: vtkVolumeTextureMapper3D.h:217
vtkVolumeTextureMapper3D::SavedScalarOpacityDistance
float SavedScalarOpacityDistance
Definition: vtkVolumeTextureMapper3D.h:235
vtkVolumeTextureMapper3D::SavedSampleDistance
float SavedSampleDistance
Definition: vtkVolumeTextureMapper3D.h:234
vtkVolumeTextureMapper3D::SavedColorChannels
int SavedColorChannels
Definition: vtkVolumeTextureMapper3D.h:233
vtkVolumeTextureMapper3D::PreferredRenderMethod
int PreferredRenderMethod
Definition: vtkVolumeTextureMapper3D.h:252
vtkVolumeMapper.h
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkVolumeTextureMapper3D::ColorTableScale
float ColorTableScale
Definition: vtkVolumeTextureMapper3D.h:242
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkVolumeTextureMapper3D::ActualSampleDistance
float ActualSampleDistance
Definition: vtkVolumeTextureMapper3D.h:224
vtkVolumeTextureMapper3D::SavedGrayFunction
vtkPiecewiseFunction * SavedGrayFunction
Definition: vtkVolumeTextureMapper3D.h:230
vtkVolumeTextureMapper3D::VolumeComponents
int VolumeComponents
Definition: vtkVolumeTextureMapper3D.h:219
vtkVolumeTextureMapper3D::SupportsNonPowerOfTwoTextures
bool SupportsNonPowerOfTwoTextures
Definition: vtkVolumeTextureMapper3D.h:255
vtkVolumeTextureMapper3D::Render
virtual void Render(vtkRenderer *, vtkVolume *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkVolumeTextureMapper3D.h:158
vtkVolumeTextureMapper3D::IsRenderSupported
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.
Definition: vtkVolumeTextureMapper3D.h:133
vtkPiecewiseFunction
Defines a 1D piecewise function.
Definition: vtkPiecewiseFunction.h:51
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkVolumeTextureMapper3D::IsTextureSizeSupported
virtual int IsTextureSizeSupported(int vtkNotUsed(size)[3], int vtkNotUsed(components))
Impemented in subclass - check is texture size is OK.
Definition: vtkVolumeTextureMapper3D.h:275
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkVolumeTextureMapper3D::UseCompressedTexture
bool UseCompressedTexture
Definition: vtkVolumeTextureMapper3D.h:253
vtkVolumeTextureMapper3D::Volume1
unsigned char * Volume1
Definition: vtkVolumeTextureMapper3D.h:215
vtkVolumeTextureMapper3D::SampleDistance
float SampleDistance
Definition: vtkVolumeTextureMapper3D.h:223
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkVolumeTextureMapper3D::SavedTextureInput
vtkImageData * SavedTextureInput
Definition: vtkVolumeTextureMapper3D.h:226
vtkVolumeTextureMapper3D::SavedParametersMTime
vtkTimeStamp SavedParametersMTime
Definition: vtkVolumeTextureMapper3D.h:249
vtkVolumeTextureMapper3D::NVIDIA_METHOD
@ NVIDIA_METHOD
Definition: vtkVolumeTextureMapper3D.h:166
vtkVolumeTextureMapper3D::NumberOfPolygons
int NumberOfPolygons
Definition: vtkVolumeTextureMapper3D.h:212
vtkVolumeTextureMapper3D::SavedGradientOpacityFunction
vtkPiecewiseFunction * SavedGradientOpacityFunction
Definition: vtkVolumeTextureMapper3D.h:232
vtkVolumeTextureMapper3D::PolygonBuffer
float * PolygonBuffer
Definition: vtkVolumeTextureMapper3D.h:210
vtkVolumeTextureMapper3D::ColorTableOffset
float ColorTableOffset
Definition: vtkVolumeTextureMapper3D.h:243
vtkVolumeProperty
represents the common properties for rendering a volume.
Definition: vtkVolumeProperty.h:60