VTK  9.5.2
vtkTexture.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
37#ifndef vtkTexture_h
38#define vtkTexture_h
39
40#include "vtkImageAlgorithm.h"
41#include "vtkRenderingCoreModule.h" // For export macro
42#include "vtkSystemIncludes.h" // For VTK_COLOR_MODE_*
43#include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
44
45VTK_ABI_NAMESPACE_BEGIN
46class vtkImageData;
48class vtkRenderer;
50class vtkWindow;
51class vtkDataArray;
52class vtkTransform;
53
54#define VTK_TEXTURE_QUALITY_DEFAULT 0
55#define VTK_TEXTURE_QUALITY_16BIT 16
56#define VTK_TEXTURE_QUALITY_32BIT 32
57
58class VTKRENDERINGCORE_EXPORT VTK_MARSHALMANUAL vtkTexture : public vtkImageAlgorithm
59{
60public:
61 static vtkTexture* New();
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
70 virtual void Render(vtkRenderer* ren);
71
76 virtual void PostRender(vtkRenderer*) {}
77
84
90 virtual void Load(vtkRenderer*) {}
91
93
96 vtkGetMacro(Interpolate, vtkTypeBool);
97 vtkSetMacro(Interpolate, vtkTypeBool);
98 vtkBooleanMacro(Interpolate, vtkTypeBool);
100
102
105 vtkGetMacro(Mipmap, bool);
106 vtkSetMacro(Mipmap, bool);
107 vtkBooleanMacro(Mipmap, bool);
109
111
117 vtkSetMacro(MaximumAnisotropicFiltering, float);
118 vtkGetMacro(MaximumAnisotropicFiltering, float);
120
122
126 vtkSetMacro(Quality, int);
127 vtkGetMacro(Quality, int);
129 void SetQualityTo16Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_16BIT); }
130 void SetQualityTo32Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_32BIT); }
132
134
144 vtkSetMacro(ColorMode, int);
145 vtkGetMacro(ColorMode, int);
146 void SetColorModeToDefault() { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
150
156
158
162 vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
164
166
169 vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray);
171
175 unsigned char* MapScalarsToColors(vtkDataArray* scalars);
176
178
182 void SetTransform(vtkTransform* transform);
183 vtkGetObjectMacro(Transform, vtkTransform);
185
191 {
192 VTK_TEXTURE_BLENDING_MODE_NONE = 0,
198 VTK_TEXTURE_BLENDING_MODE_SUBTRACT
199 };
200
202
206 vtkGetMacro(BlendingMode, int);
207 vtkSetMacro(BlendingMode, int);
209
211
215 vtkGetMacro(PremultipliedAlpha, bool);
216 vtkSetMacro(PremultipliedAlpha, bool);
217 vtkBooleanMacro(PremultipliedAlpha, bool);
219
221
228 vtkGetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
229 vtkSetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
230 vtkBooleanMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
232
239 virtual int IsTranslucent();
240
244 virtual int GetTextureUnit() { return 0; }
245
247
253 vtkGetMacro(CubeMap, bool);
254 vtkBooleanMacro(CubeMap, bool);
255 void SetCubeMap(bool val);
257
259
265 vtkGetMacro(UseSRGBColorSpace, bool);
266 vtkSetMacro(UseSRGBColorSpace, bool);
267 vtkBooleanMacro(UseSRGBColorSpace, bool);
269
271
279 vtkSetVector4Macro(BorderColor, float);
280 vtkGetVector4Macro(BorderColor, float);
282
283 enum
284 {
285 ClampToEdge = 0,
289 NumberOfWrapModes
290 };
291
293
306 vtkGetMacro(Wrap, int);
307 vtkSetClampMacro(Wrap, int, ClampToEdge, ClampToBorder);
309
311
315 virtual void SetRepeat(vtkTypeBool r) { this->SetWrap(r ? Repeat : ClampToEdge); }
316 virtual vtkTypeBool GetRepeat() { return (this->GetWrap() == Repeat); }
317 virtual void RepeatOn() { this->SetRepeat(true); }
318 virtual void RepeatOff() { this->SetRepeat(false); }
320 { /* This wasn't doing anything before. */
321 }
322 virtual vtkTypeBool GetEdgeClamp() { return (this->GetWrap() == ClampToEdge); }
323 virtual void EdgeClampOn() { this->SetEdgeClamp(true); }
324 virtual void EdgeClampOff() { this->SetEdgeClamp(false); }
326
327protected:
329 ~vtkTexture() override;
330
331 // A texture is a sink, so there is no need to do anything.
332 // This definition avoids a warning when doing Update() on a vtkTexture object.
333 void ExecuteData(vtkDataObject*) override {}
334
335 bool Mipmap;
337 int Wrap;
338 float BorderColor[4];
345
348 // this is to duplicated the previous behavior of SelfCreatedLookUpTable
353
354 // the result of HasTranslucentPolygonalGeometry is cached
357
358private:
359 vtkTexture(const vtkTexture&) = delete;
360 void operator=(const vtkTexture&) = delete;
361};
362
363VTK_ABI_NAMESPACE_END
364#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:46
general representation of visualization data
Definition: vtkDataObject.h:56
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:47
a simple class to control print indentation
Definition: vtkIndent.h:29
abstract specification for renderers
Definition: vtkRenderer.h:63
Superclass for mapping scalar values to colors.
handles properties associated with a texture map
Definition: vtkTexture.h:59
virtual vtkTypeBool GetRepeat()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:316
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
@ MirroredRepeat
Definition: vtkTexture.h:287
void SetQualityToDefault()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:128
int ColorMode
Definition: vtkTexture.h:341
virtual void RepeatOff()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:318
void SetColorModeToDirectScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:148
vtkUnsignedCharArray * MappedScalars
Definition: vtkTexture.h:343
void SetQualityTo16Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:129
vtkTypeBool RestrictPowerOf2ImageSmaller
Definition: vtkTexture.h:347
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:90
bool UseSRGBColorSpace
Definition: vtkTexture.h:352
virtual void SetRepeat(vtkTypeBool r)
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:315
int SelfAdjustingTableRange
Definition: vtkTexture.h:349
vtkTypeBool Interpolate
Definition: vtkTexture.h:339
static vtkTexture * New()
int BlendingMode
Definition: vtkTexture.h:346
float MaximumAnisotropicFiltering
Definition: vtkTexture.h:336
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:191
@ VTK_TEXTURE_BLENDING_MODE_MODULATE
Definition: vtkTexture.h:194
@ VTK_TEXTURE_BLENDING_MODE_ADD
Definition: vtkTexture.h:195
@ VTK_TEXTURE_BLENDING_MODE_REPLACE
Definition: vtkTexture.h:193
@ VTK_TEXTURE_BLENDING_MODE_INTERPOLATE
Definition: vtkTexture.h:197
@ VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED
Definition: vtkTexture.h:196
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:324
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:83
vtkTransform * Transform
Definition: vtkTexture.h:344
void SetQualityTo32Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:130
bool CubeMap
Definition: vtkTexture.h:351
virtual vtkTypeBool GetEdgeClamp()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:322
virtual void EdgeClampOn()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:323
bool PremultipliedAlpha
Definition: vtkTexture.h:350
virtual void RepeatOn()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:317
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:76
int TranslucentCachedResult
Definition: vtkTexture.h:356
void SetLookupTable(vtkScalarsToColors *)
Specify the lookup table to convert scalars if necessary.
vtkTimeStamp TranslucentComputationTime
Definition: vtkTexture.h:355
void ExecuteData(vtkDataObject *) override
This method is the old style execute method, provided for the sake of backwards compatibility with ol...
Definition: vtkTexture.h:333
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:244
void SetColorModeToDefault()
Default: ColorModeToDefault.
Definition: vtkTexture.h:146
bool Mipmap
Definition: vtkTexture.h:335
void SetColorModeToMapScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:147
virtual void SetEdgeClamp(vtkTypeBool)
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:319
vtkScalarsToColors * LookupTable
Definition: vtkTexture.h:342
record modification and/or execution time
Definition: vtkTimeStamp.h:25
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:51
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition: vtkWindow.h:29
@ Transform
Definition: vtkX3D.h:41
int vtkTypeBool
Definition: vtkABI.h:64
#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:54
#define VTK_TEXTURE_QUALITY_32BIT
Definition: vtkTexture.h:56
#define VTK_TEXTURE_QUALITY_16BIT
Definition: vtkTexture.h:55
#define VTK_MARSHALMANUAL