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 #include "vtkSystemIncludes.h" // For VTK_COLOR_MODE_*
58 
59 class vtkImageData;
60 class vtkScalarsToColors;
61 class vtkRenderer;
63 class vtkWindow;
64 class vtkDataArray;
65 class vtkTransform;
66 
67 #define VTK_TEXTURE_QUALITY_DEFAULT 0
68 #define VTK_TEXTURE_QUALITY_16BIT 16
69 #define VTK_TEXTURE_QUALITY_32BIT 32
70 
71 class VTKRENDERINGCORE_EXPORT vtkTexture : public vtkImageAlgorithm
72 {
73 public:
74  static vtkTexture* New();
75  vtkTypeMacro(vtkTexture, vtkImageAlgorithm);
76  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
83  virtual void Render(vtkRenderer* ren);
84 
89  virtual void PostRender(vtkRenderer*) {}
90 
97 
103  virtual void Load(vtkRenderer*) {}
104 
106 
110  vtkGetMacro(Repeat, int);
111  vtkSetMacro(Repeat, int);
112  vtkBooleanMacro(Repeat, int);
114 
116 
122  vtkGetMacro(EdgeClamp, int);
123  vtkSetMacro(EdgeClamp, int);
124  vtkBooleanMacro(EdgeClamp, int);
126 
128 
131  vtkGetMacro(Interpolate, int);
132  vtkSetMacro(Interpolate, int);
133  vtkBooleanMacro(Interpolate, int);
135 
137 
140  vtkGetMacro(Mipmap, bool);
141  vtkSetMacro(Mipmap, bool);
142  vtkBooleanMacro(Mipmap, bool);
144 
146 
150  vtkSetMacro(Quality, int);
151  vtkGetMacro(Quality, int);
153  { this->SetQuality(VTK_TEXTURE_QUALITY_DEFAULT); }
155  { this->SetQuality(VTK_TEXTURE_QUALITY_16BIT); }
157  { this->SetQuality(VTK_TEXTURE_QUALITY_32BIT); }
159 
161 
172  VTK_LEGACY(void SetMapColorScalarsThroughLookupTable(int val));
173  VTK_LEGACY(int GetMapColorScalarsThroughLookupTable());
174  VTK_LEGACY(void MapColorScalarsThroughLookupTableOn());
175  VTK_LEGACY(void MapColorScalarsThroughLookupTableOff());
177 
179 
189  vtkSetMacro(ColorMode, int);
190  vtkGetMacro(ColorMode, int);
192  { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
194  { this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS); }
196  { this->SetColorMode(VTK_COLOR_MODE_DIRECT_SCALARS); }
198 
204 
206 
209  void SetLookupTable(vtkScalarsToColors *);
210  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
212 
214 
217  vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray);
219 
223  unsigned char* MapScalarsToColors(vtkDataArray* scalars);
224 
226 
230  void SetTransform(vtkTransform *transform);
231  vtkGetObjectMacro(Transform, vtkTransform);
233 
239  {
240  VTK_TEXTURE_BLENDING_MODE_NONE = 0,
246  VTK_TEXTURE_BLENDING_MODE_SUBTRACT
247  };
248 
250 
254  vtkGetMacro(BlendingMode, int);
255  vtkSetMacro(BlendingMode, int);
257 
259 
263  vtkGetMacro(PremultipliedAlpha, bool);
264  vtkSetMacro(PremultipliedAlpha, bool);
265  vtkBooleanMacro(PremultipliedAlpha, bool);
267 
269 
276  vtkGetMacro(RestrictPowerOf2ImageSmaller, int);
277  vtkSetMacro(RestrictPowerOf2ImageSmaller, int);
278  vtkBooleanMacro(RestrictPowerOf2ImageSmaller, int);
280 
287  virtual int IsTranslucent();
288 
292  virtual int GetTextureUnit() { return 0; }
293 
295 
301  vtkGetMacro(CubeMap, bool);
302  vtkBooleanMacro(CubeMap, bool);
303  void SetCubeMap(bool val);
305 
307 
313  vtkGetMacro(UseSRGBColorSpace, bool);
314  vtkSetMacro(UseSRGBColorSpace, bool);
315  vtkBooleanMacro(UseSRGBColorSpace, bool);
317 
318 protected:
319  vtkTexture();
320  ~vtkTexture() override;
321 
322  // A texture is a sink, so there is no need to do anything.
323  // This definition avoids a warning when doing Update() on a vtkTexture object.
324  void ExecuteData(vtkDataObject *) override
325  {
326  }
327 
328  bool Mipmap;
329  int Repeat;
332  int Quality;
337 
340  // this is to duplicated the previous behavior of SelfCreatedLookUpTable
343  bool CubeMap;
345 
346  // the result of HasTranslucentPolygonalGeometry is cached
349 
350 private:
351  vtkTexture(const vtkTexture&) = delete;
352  void operator=(const vtkTexture&) = delete;
353 };
354 
355 #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:89
VTKTextureBlendingMode
Used to specify how the texture will blend its RGB and Alpha values with other textures and the fragm...
Definition: vtkTexture.h:238
#define VTK_TEXTURE_QUALITY_16BIT
Definition: vtkTexture.h:68
void SetQualityTo16Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:154
void SetColorModeToDirectScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:195
int Interpolate
Definition: vtkTexture.h:331
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkScalarsToColors * LookupTable
Definition: vtkTexture.h:334
int TranslucentCachedResult
Definition: vtkTexture.h:348
bool PremultipliedAlpha
Definition: vtkTexture.h:342
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:96
vtkDataObject * GetInput()
Get a data object for one of the input port connections.
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
int ColorMode
Definition: vtkTexture.h:333
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:103
#define VTK_TEXTURE_QUALITY_DEFAULT
Definition: vtkTexture.h:67
Superclass for mapping scalar values to colors.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
#define VTK_COLOR_MODE_MAP_SCALARS
bool CubeMap
Definition: vtkTexture.h:343
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkTransform * Transform
Definition: vtkTexture.h:336
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkTimeStamp TranslucentComputationTime
Definition: vtkTexture.h:347
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
bool Mipmap
Definition: vtkTexture.h:328
handles properties associated with a texture map
Definition: vtkTexture.h:71
void SetQualityToDefault()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:152
#define VTK_COLOR_MODE_DEFAULT
void SetColorModeToMapScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:193
vtkUnsignedCharArray * MappedScalars
Definition: vtkTexture.h:335
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
dynamic, self-adjusting array of unsigned char
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:292
int SelfAdjustingTableRange
Definition: vtkTexture.h:341
int EdgeClamp
Definition: vtkTexture.h:330
void SetQualityTo32Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:156
void ExecuteData(vtkDataObject *) override
This method is the old style execute method, provided for the sake of backwards compatibility with ol...
Definition: vtkTexture.h:324
int RestrictPowerOf2ImageSmaller
Definition: vtkTexture.h:339
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:69
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
general representation of visualization data
Definition: vtkDataObject.h:64
int BlendingMode
Definition: vtkTexture.h:338
void SetColorModeToDefault()
Default: ColorModeToDefault.
Definition: vtkTexture.h:191
bool UseSRGBColorSpace
Definition: vtkTexture.h:344
Transform
Definition: ADIOSDefs.h:39