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=========================================================================*/
45
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
53class vtkImageData;
55class vtkRenderer;
57class vtkWindow;
58class vtkDataArray;
59class vtkTransform;
60
61#define VTK_TEXTURE_QUALITY_DEFAULT 0
62#define VTK_TEXTURE_QUALITY_16BIT 16
63#define VTK_TEXTURE_QUALITY_32BIT 32
64
65class VTKRENDERINGCORE_EXPORT vtkTexture : public vtkImageAlgorithm
66{
67public:
68 static vtkTexture* New();
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
105 vtkBooleanMacro(Interpolate, vtkTypeBool);
107
109
112 vtkGetMacro(Mipmap, bool);
113 vtkSetMacro(Mipmap, bool);
114 vtkBooleanMacro(Mipmap, bool);
116
118
124 vtkSetMacro(MaximumAnisotropicFiltering, float);
125 vtkGetMacro(MaximumAnisotropicFiltering, float);
127
129
133 vtkSetMacro(Quality, int);
134 vtkGetMacro(Quality, int);
139
141
151 vtkSetMacro(ColorMode, int);
152 vtkGetMacro(ColorMode, int);
157
163
165
169 vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
171
173
178
182 unsigned char* MapScalarsToColors(vtkDataArray* scalars);
183
185
189 void SetTransform(vtkTransform* transform);
190 vtkGetObjectMacro(Transform, vtkTransform);
192
207
209
213 vtkGetMacro(BlendingMode, int);
214 vtkSetMacro(BlendingMode, int);
216
218
222 vtkGetMacro(PremultipliedAlpha, bool);
223 vtkSetMacro(PremultipliedAlpha, bool);
224 vtkBooleanMacro(PremultipliedAlpha, bool);
226
228
239
246 virtual int IsTranslucent();
247
251 virtual int GetTextureUnit() { return 0; }
252
254
260 vtkGetMacro(CubeMap, bool);
261 vtkBooleanMacro(CubeMap, bool);
262 void SetCubeMap(bool val);
264
266
272 vtkGetMacro(UseSRGBColorSpace, bool);
273 vtkSetMacro(UseSRGBColorSpace, bool);
274 vtkBooleanMacro(UseSRGBColorSpace, bool);
276
278
286 vtkSetVector4Macro(BorderColor, float);
287 vtkGetVector4Macro(BorderColor, float);
289
290 enum
291 {
297 };
298
300
313 vtkGetMacro(Wrap, int);
314 vtkSetClampMacro(Wrap, int, ClampToEdge, ClampToBorder);
316
318
322 virtual void SetRepeat(vtkTypeBool r) { this->SetWrap(r ? Repeat : ClampToEdge); }
323 virtual vtkTypeBool GetRepeat() { return (this->GetWrap() == Repeat); }
324 virtual void RepeatOn() { this->SetRepeat(true); }
325 virtual void RepeatOff() { this->SetRepeat(false); }
327 { /* This wasn't doing anything before. */
328 }
329 virtual vtkTypeBool GetEdgeClamp() { return (this->GetWrap() == ClampToEdge); }
330 virtual void EdgeClampOn() { this->SetEdgeClamp(true); }
331 virtual void EdgeClampOff() { this->SetEdgeClamp(false); }
333
334protected:
336 ~vtkTexture() override;
337
338 // A texture is a sink, so there is no need to do anything.
339 // This definition avoids a warning when doing Update() on a vtkTexture object.
340 void ExecuteData(vtkDataObject*) override {}
341
342 bool Mipmap;
344 int Wrap;
345 float BorderColor[4];
352
355 // this is to duplicated the previous behavior of SelfCreatedLookUpTable
360
361 // the result of HasTranslucentPolygonalGeometry is cached
364
365private:
366 vtkTexture(const vtkTexture&) = delete;
367 void operator=(const vtkTexture&) = delete;
368};
369
370#endif
general representation of visualization data
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:34
abstract specification for renderers
Definition vtkRenderer.h:67
Superclass for mapping scalar values to colors.
virtual vtkTypeBool GetRepeat()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:323
virtual void SetWrap(int)
Wrap mode for the texture coordinates Valid values are:
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
@ NumberOfWrapModes
Definition vtkTexture.h:296
void SetQualityToDefault()
Force texture quality to 16-bit or 32-bit.
Definition vtkTexture.h:135
virtual void RepeatOff()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:325
virtual int GetWrap()
Wrap mode for the texture coordinates Valid values are:
virtual void SetQuality(int)
Force texture quality to 16-bit or 32-bit.
void SetColorModeToDirectScalars()
Default: ColorModeToDefault.
Definition vtkTexture.h:155
vtkUnsignedCharArray * MappedScalars
Definition vtkTexture.h:350
void SetQualityTo16Bit()
Force texture quality to 16-bit or 32-bit.
Definition vtkTexture.h:136
vtkTypeBool RestrictPowerOf2ImageSmaller
Definition vtkTexture.h:354
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition vtkTexture.h:97
bool UseSRGBColorSpace
Definition vtkTexture.h:359
virtual void SetRepeat(vtkTypeBool r)
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:322
int SelfAdjustingTableRange
Definition vtkTexture.h:356
vtkTypeBool Interpolate
Definition vtkTexture.h:346
static vtkTexture * New()
int BlendingMode
Definition vtkTexture.h:353
float MaximumAnisotropicFiltering
Definition vtkTexture.h:343
unsigned char * MapScalarsToColors(vtkDataArray *scalars)
Map scalar values into color scalars.
virtual int IsTranslucent()
Is this Texture Translucent?
VTKTextureBlendingMode
Used to specify how the texture will blend its RGB and Alpha values with other textures and the fragm...
Definition vtkTexture.h:198
@ VTK_TEXTURE_BLENDING_MODE_MODULATE
Definition vtkTexture.h:201
@ VTK_TEXTURE_BLENDING_MODE_ADD
Definition vtkTexture.h:202
@ VTK_TEXTURE_BLENDING_MODE_REPLACE
Definition vtkTexture.h:200
@ VTK_TEXTURE_BLENDING_MODE_INTERPOLATE
Definition vtkTexture.h:204
@ VTK_TEXTURE_BLENDING_MODE_SUBTRACT
Definition vtkTexture.h:205
@ VTK_TEXTURE_BLENDING_MODE_NONE
Definition vtkTexture.h:199
@ VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED
Definition vtkTexture.h:203
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:331
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkTexture.h:90
vtkTransform * Transform
Definition vtkTexture.h:351
void SetQualityTo32Bit()
Force texture quality to 16-bit or 32-bit.
Definition vtkTexture.h:137
virtual vtkTypeBool GetEdgeClamp()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:329
virtual void EdgeClampOn()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:330
bool PremultipliedAlpha
Definition vtkTexture.h:357
virtual void RepeatOn()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:324
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:83
int TranslucentCachedResult
Definition vtkTexture.h:363
void SetLookupTable(vtkScalarsToColors *)
Specify the lookup table to convert scalars if necessary.
vtkTimeStamp TranslucentComputationTime
Definition vtkTexture.h:362
void ExecuteData(vtkDataObject *) override
This method is the old style execute method, provided for the sake of backwards compatibility with ol...
Definition vtkTexture.h:340
virtual void SetColorMode(int)
Default: ColorModeToDefault.
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition vtkTexture.h:251
void SetColorModeToDefault()
Default: ColorModeToDefault.
Definition vtkTexture.h:153
void SetColorModeToMapScalars()
Default: ColorModeToDefault.
Definition vtkTexture.h:154
virtual void SetEdgeClamp(vtkTypeBool)
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:326
vtkScalarsToColors * LookupTable
Definition vtkTexture.h:349
float BorderColor[4]
Definition vtkTexture.h:345
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 vtkDataArray
#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:61
#define VTK_TEXTURE_QUALITY_32BIT
Definition vtkTexture.h:63
#define VTK_TEXTURE_QUALITY_16BIT
Definition vtkTexture.h:62