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, vtkTypeBool);
111  vtkSetMacro(Repeat, vtkTypeBool);
112  vtkBooleanMacro(Repeat, vtkTypeBool);
114 
116 
122  vtkGetMacro(EdgeClamp, vtkTypeBool);
123  vtkSetMacro(EdgeClamp, vtkTypeBool);
124  vtkBooleanMacro(EdgeClamp, vtkTypeBool);
126 
128 
131  vtkGetMacro(Interpolate, vtkTypeBool);
132  vtkSetMacro(Interpolate, vtkTypeBool);
133  vtkBooleanMacro(Interpolate, vtkTypeBool);
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 
171  vtkSetMacro(ColorMode, int);
172  vtkGetMacro(ColorMode, int);
174  { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
176  { this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS); }
178  { this->SetColorMode(VTK_COLOR_MODE_DIRECT_SCALARS); }
180 
186 
188 
191  void SetLookupTable(vtkScalarsToColors *);
192  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
194 
196 
199  vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray);
201 
205  unsigned char* MapScalarsToColors(vtkDataArray* scalars);
206 
208 
212  void SetTransform(vtkTransform *transform);
213  vtkGetObjectMacro(Transform, vtkTransform);
215 
221  {
222  VTK_TEXTURE_BLENDING_MODE_NONE = 0,
228  VTK_TEXTURE_BLENDING_MODE_SUBTRACT
229  };
230 
232 
236  vtkGetMacro(BlendingMode, int);
237  vtkSetMacro(BlendingMode, int);
239 
241 
245  vtkGetMacro(PremultipliedAlpha, bool);
246  vtkSetMacro(PremultipliedAlpha, bool);
247  vtkBooleanMacro(PremultipliedAlpha, bool);
249 
251 
258  vtkGetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
259  vtkSetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
260  vtkBooleanMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
262 
269  virtual int IsTranslucent();
270 
274  virtual int GetTextureUnit() { return 0; }
275 
277 
283  vtkGetMacro(CubeMap, bool);
284  vtkBooleanMacro(CubeMap, bool);
285  void SetCubeMap(bool val);
287 
289 
295  vtkGetMacro(UseSRGBColorSpace, bool);
296  vtkSetMacro(UseSRGBColorSpace, bool);
297  vtkBooleanMacro(UseSRGBColorSpace, bool);
299 
300 protected:
301  vtkTexture();
302  ~vtkTexture() override;
303 
304  // A texture is a sink, so there is no need to do anything.
305  // This definition avoids a warning when doing Update() on a vtkTexture object.
306  void ExecuteData(vtkDataObject *) override
307  {
308  }
309 
310  bool Mipmap;
314  int Quality;
319 
322  // this is to duplicated the previous behavior of SelfCreatedLookUpTable
325  bool CubeMap;
327 
328  // the result of HasTranslucentPolygonalGeometry is cached
331 
332 private:
333  vtkTexture(const vtkTexture&) = delete;
334  void operator=(const vtkTexture&) = delete;
335 };
336 
337 #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:220
#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:177
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkScalarsToColors * LookupTable
Definition: vtkTexture.h:316
int TranslucentCachedResult
Definition: vtkTexture.h:330
bool PremultipliedAlpha
Definition: vtkTexture.h:324
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
vtkTypeBool EdgeClamp
Definition: vtkTexture.h:312
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
int ColorMode
Definition: vtkTexture.h:315
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:103
#define VTK_TEXTURE_QUALITY_DEFAULT
Definition: vtkTexture.h:67
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:325
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkTransform * Transform
Definition: vtkTexture.h:318
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkTimeStamp TranslucentComputationTime
Definition: vtkTexture.h:329
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
bool Mipmap
Definition: vtkTexture.h:310
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:175
vtkUnsignedCharArray * MappedScalars
Definition: vtkTexture.h:317
dynamic, self-adjusting array of unsigned char
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:274
int SelfAdjustingTableRange
Definition: vtkTexture.h:323
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:306
vtkTypeBool RestrictPowerOf2ImageSmaller
Definition: vtkTexture.h:321
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
vtkTypeBool Interpolate
Definition: vtkTexture.h:313
general representation of visualization data
Definition: vtkDataObject.h:64
vtkTypeBool Repeat
Definition: vtkTexture.h:311
int BlendingMode
Definition: vtkTexture.h:320
void SetColorModeToDefault()
Default: ColorModeToDefault.
Definition: vtkTexture.h:173
bool UseSRGBColorSpace
Definition: vtkTexture.h:326
Transform
Definition: ADIOSDefs.h:40