VTK  9.0.1
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 "vtkImageAlgorithm.h"
50 #include "vtkRenderingCoreModule.h" // For export macro
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 
146  vtkSetMacro(MaximumAnisotropicFiltering, float);
147  vtkGetMacro(MaximumAnisotropicFiltering, float);
149 
151 
155  vtkSetMacro(Quality, int);
156  vtkGetMacro(Quality, int);
157  void SetQualityToDefault() { this->SetQuality(VTK_TEXTURE_QUALITY_DEFAULT); }
158  void SetQualityTo16Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_16BIT); }
159  void SetQualityTo32Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_32BIT); }
161 
163 
173  vtkSetMacro(ColorMode, int);
174  vtkGetMacro(ColorMode, int);
175  void SetColorModeToDefault() { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
176  void SetColorModeToMapScalars() { this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS); }
179 
185 
187 
190  void SetLookupTable(vtkScalarsToColors*);
191  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
193 
195 
198  vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray);
200 
204  unsigned char* MapScalarsToColors(vtkDataArray* scalars);
205 
207 
211  void SetTransform(vtkTransform* transform);
212  vtkGetObjectMacro(Transform, vtkTransform);
214 
220  {
221  VTK_TEXTURE_BLENDING_MODE_NONE = 0,
227  VTK_TEXTURE_BLENDING_MODE_SUBTRACT
228  };
229 
231 
235  vtkGetMacro(BlendingMode, int);
236  vtkSetMacro(BlendingMode, int);
238 
240 
244  vtkGetMacro(PremultipliedAlpha, bool);
245  vtkSetMacro(PremultipliedAlpha, bool);
246  vtkBooleanMacro(PremultipliedAlpha, bool);
248 
250 
257  vtkGetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
258  vtkSetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
259  vtkBooleanMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
261 
268  virtual int IsTranslucent();
269 
273  virtual int GetTextureUnit() { return 0; }
274 
276 
282  vtkGetMacro(CubeMap, bool);
283  vtkBooleanMacro(CubeMap, bool);
284  void SetCubeMap(bool val);
286 
288 
294  vtkGetMacro(UseSRGBColorSpace, bool);
295  vtkSetMacro(UseSRGBColorSpace, bool);
296  vtkBooleanMacro(UseSRGBColorSpace, bool);
298 
299 protected:
300  vtkTexture();
301  ~vtkTexture() override;
302 
303  // A texture is a sink, so there is no need to do anything.
304  // This definition avoids a warning when doing Update() on a vtkTexture object.
305  void ExecuteData(vtkDataObject*) override {}
306 
307  bool Mipmap;
312  int Quality;
317 
320  // this is to duplicated the previous behavior of SelfCreatedLookUpTable
323  bool CubeMap;
325 
326  // the result of HasTranslucentPolygonalGeometry is cached
329 
330 private:
331  vtkTexture(const vtkTexture&) = delete;
332  void operator=(const vtkTexture&) = delete;
333 };
334 
335 #endif
float MaximumAnisotropicFiltering
Definition: vtkTexture.h:308
#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:219
#define VTK_TEXTURE_QUALITY_16BIT
Definition: vtkTexture.h:62
void SetQualityTo16Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:158
void SetColorModeToDirectScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:177
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkScalarsToColors * LookupTable
Definition: vtkTexture.h:314
int TranslucentCachedResult
Definition: vtkTexture.h:328
bool PremultipliedAlpha
Definition: vtkTexture.h:322
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:67
vtkTypeBool EdgeClamp
Definition: vtkTexture.h:310
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
int ColorMode
Definition: vtkTexture.h:313
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:37
#define VTK_COLOR_MODE_MAP_SCALARS
bool CubeMap
Definition: vtkTexture.h:323
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkTransform * Transform
Definition: vtkTexture.h:316
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
vtkTimeStamp TranslucentComputationTime
Definition: vtkTexture.h:327
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
bool Mipmap
Definition: vtkTexture.h:307
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:157
#define VTK_COLOR_MODE_DEFAULT
void SetColorModeToMapScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:176
vtkUnsignedCharArray * MappedScalars
Definition: vtkTexture.h:315
dynamic, self-adjusting array of unsigned char
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:273
int SelfAdjustingTableRange
Definition: vtkTexture.h:321
void SetQualityTo32Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:159
void ExecuteData(vtkDataObject *) override
This method is the old style execute method, provided for the sake of backwards compatibility with ol...
Definition: vtkTexture.h:305
vtkTypeBool RestrictPowerOf2ImageSmaller
Definition: vtkTexture.h:319
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:311
general representation of visualization data
Definition: vtkDataObject.h:59
vtkTypeBool Repeat
Definition: vtkTexture.h:309
int BlendingMode
Definition: vtkTexture.h:318
void SetColorModeToDefault()
Default: ColorModeToDefault.
Definition: vtkTexture.h:175
bool UseSRGBColorSpace
Definition: vtkTexture.h:324