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
vtkTexture::VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED
Definition: vtkTexture.h:226
vtkTexture::VTK_TEXTURE_BLENDING_MODE_ADD
Definition: vtkTexture.h:225
vtkTexture::SelfAdjustingTableRange
int SelfAdjustingTableRange
Definition: vtkTexture.h:323
VTK_COLOR_MODE_MAP_SCALARS
#define VTK_COLOR_MODE_MAP_SCALARS
Definition: vtkSystemIncludes.h:103
vtkTexture::ColorMode
int ColorMode
Definition: vtkTexture.h:315
vtkTexture::SetColorModeToDefault
void SetColorModeToDefault()
Definition: vtkTexture.h:173
vtkTexture::Interpolate
vtkTypeBool Interpolate
Definition: vtkTexture.h:313
vtkTexture::RestrictPowerOf2ImageSmaller
vtkTypeBool RestrictPowerOf2ImageSmaller
Definition: vtkTexture.h:321
vtkTexture::ExecuteData
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
vtkTexture::Repeat
vtkTypeBool Repeat
Definition: vtkTexture.h:311
vtkTexture::TranslucentComputationTime
vtkTimeStamp TranslucentComputationTime
Definition: vtkTexture.h:329
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:41
vtkImageAlgorithm.h
vtkTexture::Quality
int Quality
Definition: vtkTexture.h:314
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:40
vtkTexture::MappedScalars
vtkUnsignedCharArray * MappedScalars
Definition: vtkTexture.h:317
vtkTexture::SetQualityTo32Bit
void SetQualityTo32Bit()
Definition: vtkTexture.h:156
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkImageAlgorithm::GetInput
vtkDataObject * GetInput()
Definition: vtkImageAlgorithm.h:81
vtkTexture::SetColorModeToDirectScalars
void SetColorModeToDirectScalars()
Definition: vtkTexture.h:177
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkTexture::BlendingMode
int BlendingMode
Definition: vtkTexture.h:320
VTK_TEXTURE_QUALITY_DEFAULT
#define VTK_TEXTURE_QUALITY_DEFAULT
Definition: vtkTexture.h:67
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:71
vtkTexture::SetColorModeToMapScalars
void SetColorModeToMapScalars()
Definition: vtkTexture.h:175
ADIOS::Transform
Transform
Definition: ADIOSDefs.h:40
vtkTexture::SetQualityTo16Bit
void SetQualityTo16Bit()
Definition: vtkTexture.h:154
vtkTexture::EdgeClamp
vtkTypeBool EdgeClamp
Definition: vtkTexture.h:312
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkTexture::VTKTextureBlendingMode
VTKTextureBlendingMode
Used to specify how the texture will blend its RGB and Alpha values with other textures and the fragm...
Definition: vtkTexture.h:220
vtkTexture::PremultipliedAlpha
bool PremultipliedAlpha
Definition: vtkTexture.h:324
vtkTexture::PostRender
virtual void PostRender(vtkRenderer *)
Cleans up after the texture rendering to restore the state of the graphics context.
Definition: vtkTexture.h:89
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:66
vtkTexture::Load
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:103
vtkTexture::VTK_TEXTURE_BLENDING_MODE_INTERPOLATE
Definition: vtkTexture.h:227
vtkTexture::Transform
vtkTransform * Transform
Definition: vtkTexture.h:318
vtkTexture::UseSRGBColorSpace
bool UseSRGBColorSpace
Definition: vtkTexture.h:326
vtkTexture::TranslucentCachedResult
int TranslucentCachedResult
Definition: vtkTexture.h:330
vtkImageAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAlgorithm::New
static vtkAlgorithm * New()
VTK_COLOR_MODE_DEFAULT
#define VTK_COLOR_MODE_DEFAULT
Definition: vtkSystemIncludes.h:102
VTK_TEXTURE_QUALITY_32BIT
#define VTK_TEXTURE_QUALITY_32BIT
Definition: vtkTexture.h:69
vtkTexture::LookupTable
vtkScalarsToColors * LookupTable
Definition: vtkTexture.h:316
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
VTK_COLOR_MODE_DIRECT_SCALARS
#define VTK_COLOR_MODE_DIRECT_SCALARS
Definition: vtkSystemIncludes.h:104
vtkTexture::Mipmap
bool Mipmap
Definition: vtkTexture.h:310
vtkTexture::GetTextureUnit
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:274
vtkTexture::VTK_TEXTURE_BLENDING_MODE_REPLACE
Definition: vtkTexture.h:223
vtkTexture::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:96
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkTexture::CubeMap
bool CubeMap
Definition: vtkTexture.h:325
vtkTexture::VTK_TEXTURE_BLENDING_MODE_MODULATE
Definition: vtkTexture.h:224
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkTexture::SetQualityToDefault
void SetQualityToDefault()
Definition: vtkTexture.h:152
vtkSystemIncludes.h
VTK_TEXTURE_QUALITY_16BIT
#define VTK_TEXTURE_QUALITY_16BIT
Definition: vtkTexture.h:68