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 =========================================================================*/
46 #ifndef vtkTexture_h
47 #define vtkTexture_h
48 
49 #include "vtkRenderingCoreModule.h" // For export macro
50 #include "vtkImageAlgorithm.h"
51 #include "vtkSystemIncludes.h" // For VTK_COLOR_MODE_*
52 
53 class vtkImageData;
54 class vtkScalarsToColors;
55 class vtkRenderer;
57 class vtkWindow;
58 class vtkDataArray;
59 class vtkTransform;
60 
61 #define VTK_TEXTURE_QUALITY_DEFAULT 0
62 #define VTK_TEXTURE_QUALITY_16BIT 16
63 #define VTK_TEXTURE_QUALITY_32BIT 32
64 
65 class VTKRENDERINGCORE_EXPORT vtkTexture : public vtkImageAlgorithm
66 {
67 public:
68  static vtkTexture* New();
69  vtkTypeMacro(vtkTexture, vtkImageAlgorithm);
70  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
77  virtual void Render(vtkRenderer* ren);
78 
83  virtual void PostRender(vtkRenderer*) {}
84 
91 
97  virtual void Load(vtkRenderer*) {}
98 
100 
104  vtkGetMacro(Repeat, vtkTypeBool);
105  vtkSetMacro(Repeat, vtkTypeBool);
106  vtkBooleanMacro(Repeat, vtkTypeBool);
108 
110 
116  vtkGetMacro(EdgeClamp, vtkTypeBool);
117  vtkSetMacro(EdgeClamp, vtkTypeBool);
118  vtkBooleanMacro(EdgeClamp, vtkTypeBool);
120 
122 
125  vtkGetMacro(Interpolate, vtkTypeBool);
126  vtkSetMacro(Interpolate, vtkTypeBool);
127  vtkBooleanMacro(Interpolate, vtkTypeBool);
129 
131 
134  vtkGetMacro(Mipmap, bool);
135  vtkSetMacro(Mipmap, bool);
136  vtkBooleanMacro(Mipmap, bool);
138 
140 
144  vtkSetMacro(Quality, int);
145  vtkGetMacro(Quality, int);
147  { this->SetQuality(VTK_TEXTURE_QUALITY_DEFAULT); }
149  { this->SetQuality(VTK_TEXTURE_QUALITY_16BIT); }
151  { this->SetQuality(VTK_TEXTURE_QUALITY_32BIT); }
153 
155 
165  vtkSetMacro(ColorMode, int);
166  vtkGetMacro(ColorMode, int);
168  { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
170  { this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS); }
172  { this->SetColorMode(VTK_COLOR_MODE_DIRECT_SCALARS); }
174 
180 
182 
185  void SetLookupTable(vtkScalarsToColors *);
186  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
188 
190 
193  vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray);
195 
199  unsigned char* MapScalarsToColors(vtkDataArray* scalars);
200 
202 
206  void SetTransform(vtkTransform *transform);
207  vtkGetObjectMacro(Transform, vtkTransform);
209 
215  {
216  VTK_TEXTURE_BLENDING_MODE_NONE = 0,
222  VTK_TEXTURE_BLENDING_MODE_SUBTRACT
223  };
224 
226 
230  vtkGetMacro(BlendingMode, int);
231  vtkSetMacro(BlendingMode, int);
233 
235 
239  vtkGetMacro(PremultipliedAlpha, bool);
240  vtkSetMacro(PremultipliedAlpha, bool);
241  vtkBooleanMacro(PremultipliedAlpha, bool);
243 
245 
252  vtkGetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
253  vtkSetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
254  vtkBooleanMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
256 
263  virtual int IsTranslucent();
264 
268  virtual int GetTextureUnit() { return 0; }
269 
271 
277  vtkGetMacro(CubeMap, bool);
278  vtkBooleanMacro(CubeMap, bool);
279  void SetCubeMap(bool val);
281 
283 
289  vtkGetMacro(UseSRGBColorSpace, bool);
290  vtkSetMacro(UseSRGBColorSpace, bool);
291  vtkBooleanMacro(UseSRGBColorSpace, bool);
293 
294 protected:
295  vtkTexture();
296  ~vtkTexture() override;
297 
298  // A texture is a sink, so there is no need to do anything.
299  // This definition avoids a warning when doing Update() on a vtkTexture object.
300  void ExecuteData(vtkDataObject *) override
301  {
302  }
303 
304  bool Mipmap;
308  int Quality;
313 
316  // this is to duplicated the previous behavior of SelfCreatedLookUpTable
319  bool CubeMap;
321 
322  // the result of HasTranslucentPolygonalGeometry is cached
325 
326 private:
327  vtkTexture(const vtkTexture&) = delete;
328  void operator=(const vtkTexture&) = delete;
329 };
330 
331 #endif
#define VTK_COLOR_MODE_DIRECT_SCALARS
virtual void PostRender(vtkRenderer *)
Cleans up after the texture rendering to restore the state of the graphics context.
Definition: vtkTexture.h:83
VTKTextureBlendingMode
Used to specify how the texture will blend its RGB and Alpha values with other textures and the fragm...
Definition: vtkTexture.h:214
#define VTK_TEXTURE_QUALITY_16BIT
Definition: vtkTexture.h:62
void SetQualityTo16Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:148
void SetColorModeToDirectScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:171
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkScalarsToColors * LookupTable
Definition: vtkTexture.h:310
int TranslucentCachedResult
Definition: vtkTexture.h:324
bool PremultipliedAlpha
Definition: vtkTexture.h:318
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:90
vtkDataObject * GetInput()
Get a data object for one of the input port connections.
abstract specification for renderers
Definition: vtkRenderer.h:57
vtkTypeBool EdgeClamp
Definition: vtkTexture.h:306
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
int ColorMode
Definition: vtkTexture.h:309
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:97
#define VTK_TEXTURE_QUALITY_DEFAULT
Definition: vtkTexture.h:61
int vtkTypeBool
Definition: vtkABI.h:69
Superclass for mapping scalar values to colors.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
#define VTK_COLOR_MODE_MAP_SCALARS
bool CubeMap
Definition: vtkTexture.h:319
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkTransform * Transform
Definition: vtkTexture.h:312
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkTimeStamp TranslucentComputationTime
Definition: vtkTexture.h:323
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
bool Mipmap
Definition: vtkTexture.h:304
handles properties associated with a texture map
Definition: vtkTexture.h:65
void SetQualityToDefault()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:146
#define VTK_COLOR_MODE_DEFAULT
void SetColorModeToMapScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:169
vtkUnsignedCharArray * MappedScalars
Definition: vtkTexture.h:311
dynamic, self-adjusting array of unsigned char
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:268
int SelfAdjustingTableRange
Definition: vtkTexture.h:317
void SetQualityTo32Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:150
void ExecuteData(vtkDataObject *) override
This method is the old style execute method, provided for the sake of backwards compatibility with ol...
Definition: vtkTexture.h:300
vtkTypeBool RestrictPowerOf2ImageSmaller
Definition: vtkTexture.h:315
Generic algorithm superclass for image algs.
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_TEXTURE_QUALITY_32BIT
Definition: vtkTexture.h:63
vtkTypeBool Interpolate
Definition: vtkTexture.h:307
general representation of visualization data
Definition: vtkDataObject.h:58
vtkTypeBool Repeat
Definition: vtkTexture.h:305
int BlendingMode
Definition: vtkTexture.h:314
void SetColorModeToDefault()
Default: ColorModeToDefault.
Definition: vtkTexture.h:167
bool UseSRGBColorSpace
Definition: vtkTexture.h:320
Transform
Definition: ADIOSDefs.h:40