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
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
general representation of visualization data
Definition: vtkDataObject.h:65
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract specification for renderers
Definition: vtkRenderer.h:64
Superclass for mapping scalar values to colors.
handles properties associated with a texture map
Definition: vtkTexture.h:71
int Interpolate
Definition: vtkTexture.h:271
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
static vtkTexture * New()
virtual void Render(vtkRenderer *ren)
Renders a texture map.
int RestrictPowerOf2ImageSmaller
Definition: vtkTexture.h:279
void SetQualityToDefault()
Definition: vtkTexture.h:142
vtkUnsignedCharArray * MappedScalars
Definition: vtkTexture.h:275
void SetQualityTo16Bit()
Definition: vtkTexture.h:144
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:102
int SelfAdjustingTableRange
Definition: vtkTexture.h:281
int BlendingMode
Definition: vtkTexture.h:278
virtual int IsTranslucent()
Is this Texture Translucent? returns false (0) if the texture is either fully opaque or has only full...
VTKTextureBlendingMode
Used to specify how the texture will blend its RGB and Alpha values with other textures and the fragm...
Definition: vtkTexture.h:204
@ VTK_TEXTURE_BLENDING_MODE_MODULATE
Definition: vtkTexture.h:207
@ VTK_TEXTURE_BLENDING_MODE_ADD
Definition: vtkTexture.h:208
@ VTK_TEXTURE_BLENDING_MODE_REPLACE
Definition: vtkTexture.h:206
@ VTK_TEXTURE_BLENDING_MODE_INTERPOLATE
Definition: vtkTexture.h:210
@ VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED
Definition: vtkTexture.h:209
void SetTransform(vtkTransform *transform)
Set a transform on the texture which allows one to scale, rotate and translate the texture.
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:95
vtkTransform * Transform
Definition: vtkTexture.h:276
void SetQualityTo32Bit()
Definition: vtkTexture.h:146
bool PremultipliedAlpha
Definition: vtkTexture.h:282
vtkImageData * GetInput()
Get the input as a vtkImageData object.
unsigned char * MapScalarsToColors(vtkDataArray *scalars)
Map scalar values into color scalars.
virtual void PostRender(vtkRenderer *)
Cleans up after the texture rendering to restore the state of the graphics context.
Definition: vtkTexture.h:88
int TranslucentCachedResult
Definition: vtkTexture.h:286
void SetLookupTable(vtkScalarsToColors *)
Specify the lookup table to convert scalars if necessary.
vtkTimeStamp TranslucentComputationTime
Definition: vtkTexture.h:285
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:257
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkScalarsToColors * LookupTable
Definition: vtkTexture.h:274
int MapColorScalarsThroughLookupTable
Definition: vtkTexture.h:273
int EdgeClamp
Definition: vtkTexture.h:270
record modification and/or execution time
Definition: vtkTimeStamp.h:36
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
Transform
Definition: ADIOSDefs.h:40
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_TEXTURE_QUALITY_DEFAULT
Definition: vtkTexture.h:66
#define VTK_TEXTURE_QUALITY_32BIT
Definition: vtkTexture.h:68
#define VTK_TEXTURE_QUALITY_16BIT
Definition: vtkTexture.h:67