VTK  9.2.6
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=========================================================================*/
49#ifndef vtkTexture_h
50#define vtkTexture_h
51
52#include "vtkImageAlgorithm.h"
53#include "vtkRenderingCoreModule.h" // For export macro
54#include "vtkSystemIncludes.h" // For VTK_COLOR_MODE_*
55
56class vtkImageData;
58class vtkRenderer;
60class vtkWindow;
61class vtkDataArray;
62class vtkTransform;
63
64#define VTK_TEXTURE_QUALITY_DEFAULT 0
65#define VTK_TEXTURE_QUALITY_16BIT 16
66#define VTK_TEXTURE_QUALITY_32BIT 32
67
68class VTKRENDERINGCORE_EXPORT vtkTexture : public vtkImageAlgorithm
69{
70public:
71 static vtkTexture* New();
73 void PrintSelf(ostream& os, vtkIndent indent) override;
74
80 virtual void Render(vtkRenderer* ren);
81
86 virtual void PostRender(vtkRenderer*) {}
87
94
100 virtual void Load(vtkRenderer*) {}
101
103
106 vtkGetMacro(Interpolate, vtkTypeBool);
107 vtkSetMacro(Interpolate, vtkTypeBool);
108 vtkBooleanMacro(Interpolate, vtkTypeBool);
110
112
115 vtkGetMacro(Mipmap, bool);
116 vtkSetMacro(Mipmap, bool);
117 vtkBooleanMacro(Mipmap, bool);
119
121
127 vtkSetMacro(MaximumAnisotropicFiltering, float);
128 vtkGetMacro(MaximumAnisotropicFiltering, float);
130
132
136 vtkSetMacro(Quality, int);
137 vtkGetMacro(Quality, int);
139 void SetQualityTo16Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_16BIT); }
140 void SetQualityTo32Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_32BIT); }
142
144
154 vtkSetMacro(ColorMode, int);
155 vtkGetMacro(ColorMode, int);
156 void SetColorModeToDefault() { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
160
166
168
172 vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
174
176
179 vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray);
181
185 unsigned char* MapScalarsToColors(vtkDataArray* scalars);
186
188
192 void SetTransform(vtkTransform* transform);
193 vtkGetObjectMacro(Transform, vtkTransform);
195
210
212
216 vtkGetMacro(BlendingMode, int);
217 vtkSetMacro(BlendingMode, int);
219
221
225 vtkGetMacro(PremultipliedAlpha, bool);
226 vtkSetMacro(PremultipliedAlpha, bool);
227 vtkBooleanMacro(PremultipliedAlpha, bool);
229
231
238 vtkGetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
239 vtkSetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
240 vtkBooleanMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
242
249 virtual int IsTranslucent();
250
254 virtual int GetTextureUnit() { return 0; }
255
257
263 vtkGetMacro(CubeMap, bool);
264 vtkBooleanMacro(CubeMap, bool);
265 void SetCubeMap(bool val);
267
269
275 vtkGetMacro(UseSRGBColorSpace, bool);
276 vtkSetMacro(UseSRGBColorSpace, bool);
277 vtkBooleanMacro(UseSRGBColorSpace, bool);
279
281
289 vtkSetVector4Macro(BorderColor, float);
290 vtkGetVector4Macro(BorderColor, float);
292
293 enum
294 {
295 ClampToEdge = 0,
299 NumberOfWrapModes
300 };
301
303
316 vtkGetMacro(Wrap, int);
317 vtkSetClampMacro(Wrap, int, ClampToEdge, ClampToBorder);
319
321
325 virtual void SetRepeat(vtkTypeBool r) { this->SetWrap(r ? Repeat : ClampToEdge); }
326 virtual vtkTypeBool GetRepeat() { return (this->GetWrap() == Repeat); }
327 virtual void RepeatOn() { this->SetRepeat(true); }
328 virtual void RepeatOff() { this->SetRepeat(false); }
330 { /* This wasn't doing anything before. */
331 }
332 virtual vtkTypeBool GetEdgeClamp() { return (this->GetWrap() == ClampToEdge); }
333 virtual void EdgeClampOn() { this->SetEdgeClamp(true); }
334 virtual void EdgeClampOff() { this->SetEdgeClamp(false); }
336
337protected:
339 ~vtkTexture() override;
340
341 // A texture is a sink, so there is no need to do anything.
342 // This definition avoids a warning when doing Update() on a vtkTexture object.
343 void ExecuteData(vtkDataObject*) override {}
344
345 bool Mipmap;
347 int Wrap;
348 float BorderColor[4];
355
358 // this is to duplicated the previous behavior of SelfCreatedLookUpTable
363
364 // the result of HasTranslucentPolygonalGeometry is cached
367
368private:
369 vtkTexture(const vtkTexture&) = delete;
370 void operator=(const vtkTexture&) = delete;
371};
372
373#endif
abstract superclass for arrays of numeric data
general representation of visualization data
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:40
abstract specification for renderers
Definition vtkRenderer.h:73
Superclass for mapping scalar values to colors.
handles properties associated with a texture map
Definition vtkTexture.h:69
virtual vtkTypeBool GetRepeat()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:326
virtual void Render(vtkRenderer *ren)
Renders a texture map.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageData * GetInput()
Get the input as a vtkImageData object.
~vtkTexture() override
void SetQualityToDefault()
Force texture quality to 16-bit or 32-bit.
Definition vtkTexture.h:138
virtual void RepeatOff()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:328
void SetColorModeToDirectScalars()
Default: ColorModeToDefault.
Definition vtkTexture.h:158
vtkUnsignedCharArray * MappedScalars
Definition vtkTexture.h:353
void SetQualityTo16Bit()
Force texture quality to 16-bit or 32-bit.
Definition vtkTexture.h:139
vtkTypeBool RestrictPowerOf2ImageSmaller
Definition vtkTexture.h:357
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition vtkTexture.h:100
bool UseSRGBColorSpace
Definition vtkTexture.h:362
virtual void SetRepeat(vtkTypeBool r)
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:325
int SelfAdjustingTableRange
Definition vtkTexture.h:359
vtkTypeBool Interpolate
Definition vtkTexture.h:349
static vtkTexture * New()
int BlendingMode
Definition vtkTexture.h:356
float MaximumAnisotropicFiltering
Definition vtkTexture.h:346
unsigned char * MapScalarsToColors(vtkDataArray *scalars)
Map scalar values into color scalars.
virtual int IsTranslucent()
Is this Texture Translucent? returns false (0) if the texture is either fully opaque or has only full...
VTKTextureBlendingMode
Used to specify how the texture will blend its RGB and Alpha values with other textures and the fragm...
Definition vtkTexture.h:201
@ VTK_TEXTURE_BLENDING_MODE_MODULATE
Definition vtkTexture.h:204
@ VTK_TEXTURE_BLENDING_MODE_ADD
Definition vtkTexture.h:205
@ VTK_TEXTURE_BLENDING_MODE_REPLACE
Definition vtkTexture.h:203
@ VTK_TEXTURE_BLENDING_MODE_INTERPOLATE
Definition vtkTexture.h:207
@ VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED
Definition vtkTexture.h:206
void SetTransform(vtkTransform *transform)
Set a transform on the texture which allows one to scale, rotate and translate the texture.
virtual void EdgeClampOff()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:334
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkTexture.h:93
vtkTransform * Transform
Definition vtkTexture.h:354
void SetQualityTo32Bit()
Force texture quality to 16-bit or 32-bit.
Definition vtkTexture.h:140
virtual vtkTypeBool GetEdgeClamp()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:332
virtual void EdgeClampOn()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:333
bool PremultipliedAlpha
Definition vtkTexture.h:360
virtual void RepeatOn()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:327
void SetCubeMap(bool val)
Is this texture a cube map, if so it needs 6 inputs one for each side of the cube.
virtual void PostRender(vtkRenderer *)
Cleans up after the texture rendering to restore the state of the graphics context.
Definition vtkTexture.h:86
int TranslucentCachedResult
Definition vtkTexture.h:366
void SetLookupTable(vtkScalarsToColors *)
Specify the lookup table to convert scalars if necessary.
vtkTimeStamp TranslucentComputationTime
Definition vtkTexture.h:365
void ExecuteData(vtkDataObject *) override
This method is the old style execute method, provided for the sake of backwards compatibility with ol...
Definition vtkTexture.h:343
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition vtkTexture.h:254
void SetColorModeToDefault()
Default: ColorModeToDefault.
Definition vtkTexture.h:156
void SetColorModeToMapScalars()
Default: ColorModeToDefault.
Definition vtkTexture.h:157
virtual void SetEdgeClamp(vtkTypeBool)
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:329
vtkScalarsToColors * LookupTable
Definition vtkTexture.h:352
record modification and/or execution time
describes linear transformations via a 4x4 matrix
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_COLOR_MODE_MAP_SCALARS
#define VTK_COLOR_MODE_DEFAULT
#define VTK_COLOR_MODE_DIRECT_SCALARS
#define VTK_TEXTURE_QUALITY_DEFAULT
Definition vtkTexture.h:64
#define VTK_TEXTURE_QUALITY_32BIT
Definition vtkTexture.h:66
#define VTK_TEXTURE_QUALITY_16BIT
Definition vtkTexture.h:65