VTK
vtkTexture.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTexture.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 =========================================================================*/
52 #ifndef vtkTexture_h
53 #define vtkTexture_h
54 
55 #include "vtkRenderingCoreModule.h" // For export macro
56 #include "vtkImageAlgorithm.h"
57 
58 class vtkImageData;
59 class vtkScalarsToColors;
60 class vtkRenderer;
62 class vtkWindow;
63 class vtkDataArray;
64 class vtkTransform;
65 
66 #define VTK_TEXTURE_QUALITY_DEFAULT 0
67 #define VTK_TEXTURE_QUALITY_16BIT 16
68 #define VTK_TEXTURE_QUALITY_32BIT 32
69 
70 class VTKRENDERINGCORE_EXPORT vtkTexture : public vtkImageAlgorithm
71 {
72 public:
73  static vtkTexture* New();
74  vtkTypeMacro(vtkTexture, vtkImageAlgorithm);
75  void PrintSelf(ostream& os, vtkIndent indent);
76 
82  virtual void Render(vtkRenderer* ren);
83 
88  virtual void PostRender(vtkRenderer*) {}
89 
96 
102  virtual void Load(vtkRenderer*) {}
103 
105 
109  vtkGetMacro(Repeat, int);
110  vtkSetMacro(Repeat, int);
111  vtkBooleanMacro(Repeat, int);
113 
115 
121  vtkGetMacro(EdgeClamp, int);
122  vtkSetMacro(EdgeClamp, int);
123  vtkBooleanMacro(EdgeClamp, int);
125 
127 
130  vtkGetMacro(Interpolate, int);
131  vtkSetMacro(Interpolate, int);
132  vtkBooleanMacro(Interpolate, int);
134 
136 
140  vtkSetMacro(Quality, int);
141  vtkGetMacro(Quality, int);
143  { this->SetQuality(VTK_TEXTURE_QUALITY_DEFAULT); }
145  { this->SetQuality(VTK_TEXTURE_QUALITY_16BIT); }
147  { this->SetQuality(VTK_TEXTURE_QUALITY_32BIT); }
149 
151 
159  vtkGetMacro(MapColorScalarsThroughLookupTable, int);
160  vtkSetMacro(MapColorScalarsThroughLookupTable, int);
161  vtkBooleanMacro(MapColorScalarsThroughLookupTable, int);
163 
169 
171 
175  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
177 
179 
182  vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray);
184 
188  unsigned char* MapScalarsToColors(vtkDataArray* scalars);
189 
191 
195  void SetTransform(vtkTransform *transform);
196  vtkGetObjectMacro(Transform, vtkTransform);
198 
204  {
205  VTK_TEXTURE_BLENDING_MODE_NONE = 0,
211  VTK_TEXTURE_BLENDING_MODE_SUBTRACT
212  };
213 
215 
219  vtkGetMacro(BlendingMode, int);
220  vtkSetMacro(BlendingMode, int);
222 
224 
228  vtkGetMacro(PremultipliedAlpha, bool);
229  vtkSetMacro(PremultipliedAlpha, bool);
230  vtkBooleanMacro(PremultipliedAlpha, bool);
232 
234 
241  vtkGetMacro(RestrictPowerOf2ImageSmaller, int);
242  vtkSetMacro(RestrictPowerOf2ImageSmaller, int);
243  vtkBooleanMacro(RestrictPowerOf2ImageSmaller, int);
245 
252  virtual int IsTranslucent();
253 
257  virtual int GetTextureUnit() { return 0; }
258 
259 protected:
262 
263  // A texture is a sink, so there is no need to do anything.
264  // This definition avoids a warning when doing Update() on a vtkTexture object.
265  virtual void ExecuteData(vtkDataObject *)
266  {
267  }
268 
269  int Repeat;
272  int Quality;
277 
280  // this is to duplicated the previous behavior of SelfCreatedLookUpTable
283 
284  // the result of HasTranslucentPolygonalGeometry is cached
287 
288 private:
289  vtkTexture(const vtkTexture&) VTK_DELETE_FUNCTION;
290  void operator=(const vtkTexture&) VTK_DELETE_FUNCTION;
291 };
292 
293 #endif
vtkTexture::VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED
@ VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED
Definition: vtkTexture.h:209
vtkTexture::VTK_TEXTURE_BLENDING_MODE_ADD
@ VTK_TEXTURE_BLENDING_MODE_ADD
Definition: vtkTexture.h:208
vtkTexture::SelfAdjustingTableRange
int SelfAdjustingTableRange
Definition: vtkTexture.h:281
vtkTexture::vtkTexture
vtkTexture()
vtkTexture::Render
virtual void Render(vtkRenderer *ren)
Renders a texture map.
vtkTexture::TranslucentComputationTime
vtkTimeStamp TranslucentComputationTime
Definition: vtkTexture.h:285
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:42
vtkImageAlgorithm.h
vtkTexture::Quality
int Quality
Definition: vtkTexture.h:272
vtkTexture::MapScalarsToColors
unsigned char * MapScalarsToColors(vtkDataArray *scalars)
Map scalar values into color scalars.
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:41
vtkTexture::MappedScalars
vtkUnsignedCharArray * MappedScalars
Definition: vtkTexture.h:275
vtkTexture::SetQualityTo32Bit
void SetQualityTo32Bit()
Definition: vtkTexture.h:146
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkTexture::BlendingMode
int BlendingMode
Definition: vtkTexture.h:278
VTK_TEXTURE_QUALITY_DEFAULT
#define VTK_TEXTURE_QUALITY_DEFAULT
Definition: vtkTexture.h:66
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:71
vtkTexture::EdgeClamp
int EdgeClamp
Definition: vtkTexture.h:270
ADIOS::Transform
Transform
Definition: ADIOSDefs.h:40
vtkTexture::ExecuteData
virtual void ExecuteData(vtkDataObject *)
This method is the old style execute method, provided for the sake of backwards compatibility with ol...
Definition: vtkTexture.h:265
vtkTexture::SetQualityTo16Bit
void SetQualityTo16Bit()
Definition: vtkTexture.h:144
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkTexture::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkTexture::VTKTextureBlendingMode
VTKTextureBlendingMode
Used to specify how the texture will blend its RGB and Alpha values with other textures and the fragm...
Definition: vtkTexture.h:204
vtkTexture::Repeat
int Repeat
Definition: vtkTexture.h:269
vtkTexture::SetLookupTable
void SetLookupTable(vtkScalarsToColors *)
Specify the lookup table to convert scalars if necessary.
vtkTexture::PremultipliedAlpha
bool PremultipliedAlpha
Definition: vtkTexture.h:282
vtkTexture::SetTransform
void SetTransform(vtkTransform *transform)
Set a transform on the texture which allows one to scale, rotate and translate the texture.
vtkTexture::PostRender
virtual void PostRender(vtkRenderer *)
Cleans up after the texture rendering to restore the state of the graphics context.
Definition: vtkTexture.h:88
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:67
vtkTexture::Load
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:102
vtkTexture::VTK_TEXTURE_BLENDING_MODE_INTERPOLATE
@ VTK_TEXTURE_BLENDING_MODE_INTERPOLATE
Definition: vtkTexture.h:210
vtkTexture::~vtkTexture
~vtkTexture()
vtkTexture::Transform
vtkTransform * Transform
Definition: vtkTexture.h:276
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkTexture::TranslucentCachedResult
int TranslucentCachedResult
Definition: vtkTexture.h:286
vtkTexture::MapColorScalarsThroughLookupTable
int MapColorScalarsThroughLookupTable
Definition: vtkTexture.h:273
vtkTexture::GetInput
vtkImageData * GetInput()
Get the input as a vtkImageData object.
VTK_TEXTURE_QUALITY_32BIT
#define VTK_TEXTURE_QUALITY_32BIT
Definition: vtkTexture.h:68
vtkTexture::Interpolate
int Interpolate
Definition: vtkTexture.h:271
vtkTexture::LookupTable
vtkScalarsToColors * LookupTable
Definition: vtkTexture.h:274
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkTexture::New
static vtkTexture * New()
vtkTexture::IsTranslucent
virtual int IsTranslucent()
Is this Texture Translucent? returns false (0) if the texture is either fully opaque or has only full...
vtkTexture::GetTextureUnit
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:257
vtkTexture::VTK_TEXTURE_BLENDING_MODE_REPLACE
@ VTK_TEXTURE_BLENDING_MODE_REPLACE
Definition: vtkTexture.h:206
vtkTexture::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:95
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkTexture::VTK_TEXTURE_BLENDING_MODE_MODULATE
@ VTK_TEXTURE_BLENDING_MODE_MODULATE
Definition: vtkTexture.h:207
vtkTexture::RestrictPowerOf2ImageSmaller
int RestrictPowerOf2ImageSmaller
Definition: vtkTexture.h:279
vtkTexture::SetQualityToDefault
void SetQualityToDefault()
Definition: vtkTexture.h:142
VTK_TEXTURE_QUALITY_16BIT
#define VTK_TEXTURE_QUALITY_16BIT
Definition: vtkTexture.h:67