VTK  9.4.20241218
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
146#ifndef vtkTexture_h
147#define vtkTexture_h
148
149#include "vtkImageAlgorithm.h"
150#include "vtkRenderingCoreModule.h" // For export macro
151#include "vtkSystemIncludes.h" // For VTK_COLOR_MODE_*
152#include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
153
154VTK_ABI_NAMESPACE_BEGIN
155class vtkImageData;
157class vtkRenderer;
159class vtkWindow;
160class vtkDataArray;
161class vtkTransform;
162
163#define VTK_TEXTURE_QUALITY_DEFAULT 0
164#define VTK_TEXTURE_QUALITY_16BIT 16
165#define VTK_TEXTURE_QUALITY_32BIT 32
166
167class VTKRENDERINGCORE_EXPORT VTK_MARSHALMANUAL vtkTexture : public vtkImageAlgorithm
168{
169public:
170 static vtkTexture* New();
172 void PrintSelf(ostream& os, vtkIndent indent) override;
173
179 virtual void Render(vtkRenderer* ren);
180
185 virtual void PostRender(vtkRenderer*) {}
186
193
199 virtual void Load(vtkRenderer*) {}
200
202
205 vtkGetMacro(Interpolate, vtkTypeBool);
206 vtkSetMacro(Interpolate, vtkTypeBool);
207 vtkBooleanMacro(Interpolate, vtkTypeBool);
209
211
214 vtkGetMacro(Mipmap, bool);
215 vtkSetMacro(Mipmap, bool);
216 vtkBooleanMacro(Mipmap, bool);
218
220
226 vtkSetMacro(MaximumAnisotropicFiltering, float);
227 vtkGetMacro(MaximumAnisotropicFiltering, float);
229
231
235 vtkSetMacro(Quality, int);
236 vtkGetMacro(Quality, int);
238 void SetQualityTo16Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_16BIT); }
239 void SetQualityTo32Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_32BIT); }
241
243
253 vtkSetMacro(ColorMode, int);
254 vtkGetMacro(ColorMode, int);
255 void SetColorModeToDefault() { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
259
265
267
271 vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
273
275
278 vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray);
280
284 unsigned char* MapScalarsToColors(vtkDataArray* scalars);
285
287
291 void SetTransform(vtkTransform* transform);
292 vtkGetObjectMacro(Transform, vtkTransform);
294
300 {
301 VTK_TEXTURE_BLENDING_MODE_NONE = 0,
307 VTK_TEXTURE_BLENDING_MODE_SUBTRACT
308 };
309
311
315 vtkGetMacro(BlendingMode, int);
316 vtkSetMacro(BlendingMode, int);
318
320
324 vtkGetMacro(PremultipliedAlpha, bool);
325 vtkSetMacro(PremultipliedAlpha, bool);
326 vtkBooleanMacro(PremultipliedAlpha, bool);
328
330
337 vtkGetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
338 vtkSetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
339 vtkBooleanMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
341
348 virtual int IsTranslucent();
349
353 virtual int GetTextureUnit() { return 0; }
354
356
362 vtkGetMacro(CubeMap, bool);
363 vtkBooleanMacro(CubeMap, bool);
364 void SetCubeMap(bool val);
366
368
374 vtkGetMacro(UseSRGBColorSpace, bool);
375 vtkSetMacro(UseSRGBColorSpace, bool);
376 vtkBooleanMacro(UseSRGBColorSpace, bool);
378
380
388 vtkSetVector4Macro(BorderColor, float);
389 vtkGetVector4Macro(BorderColor, float);
391
392 enum
393 {
394 ClampToEdge = 0,
398 NumberOfWrapModes
399 };
400
402
415 vtkGetMacro(Wrap, int);
416 vtkSetClampMacro(Wrap, int, ClampToEdge, ClampToBorder);
418
420
424 virtual void SetRepeat(vtkTypeBool r) { this->SetWrap(r ? Repeat : ClampToEdge); }
425 virtual vtkTypeBool GetRepeat() { return (this->GetWrap() == Repeat); }
426 virtual void RepeatOn() { this->SetRepeat(true); }
427 virtual void RepeatOff() { this->SetRepeat(false); }
429 { /* This wasn't doing anything before. */
430 }
431 virtual vtkTypeBool GetEdgeClamp() { return (this->GetWrap() == ClampToEdge); }
432 virtual void EdgeClampOn() { this->SetEdgeClamp(true); }
433 virtual void EdgeClampOff() { this->SetEdgeClamp(false); }
435
436protected:
438 ~vtkTexture() override;
439
440 // A texture is a sink, so there is no need to do anything.
441 // This definition avoids a warning when doing Update() on a vtkTexture object.
442 void ExecuteData(vtkDataObject*) override {}
443
444 bool Mipmap;
446 int Wrap;
447 float BorderColor[4];
454
457 // this is to duplicated the previous behavior of SelfCreatedLookUpTable
462
463 // the result of HasTranslucentPolygonalGeometry is cached
466
467private:
468 vtkTexture(const vtkTexture&) = delete;
469 void operator=(const vtkTexture&) = delete;
470};
471
472VTK_ABI_NAMESPACE_END
473#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:108
abstract specification for renderers
Superclass for mapping scalar values to colors.
handles properties associated with a texture map
Definition vtkTexture.h:168
virtual vtkTypeBool GetRepeat()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:425
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:237
virtual void RepeatOff()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:427
void SetColorModeToDirectScalars()
Default: ColorModeToDefault.
Definition vtkTexture.h:257
vtkUnsignedCharArray * MappedScalars
Definition vtkTexture.h:452
void SetQualityTo16Bit()
Force texture quality to 16-bit or 32-bit.
Definition vtkTexture.h:238
vtkTypeBool RestrictPowerOf2ImageSmaller
Definition vtkTexture.h:456
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition vtkTexture.h:199
bool UseSRGBColorSpace
Definition vtkTexture.h:461
virtual void SetRepeat(vtkTypeBool r)
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:424
int SelfAdjustingTableRange
Definition vtkTexture.h:458
vtkTypeBool Interpolate
Definition vtkTexture.h:448
static vtkTexture * New()
int BlendingMode
Definition vtkTexture.h:455
float MaximumAnisotropicFiltering
Definition vtkTexture.h:445
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:300
@ VTK_TEXTURE_BLENDING_MODE_MODULATE
Definition vtkTexture.h:303
@ VTK_TEXTURE_BLENDING_MODE_ADD
Definition vtkTexture.h:304
@ VTK_TEXTURE_BLENDING_MODE_REPLACE
Definition vtkTexture.h:302
@ VTK_TEXTURE_BLENDING_MODE_INTERPOLATE
Definition vtkTexture.h:306
@ VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED
Definition vtkTexture.h:305
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:433
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkTexture.h:192
vtkTransform * Transform
Definition vtkTexture.h:453
void SetQualityTo32Bit()
Force texture quality to 16-bit or 32-bit.
Definition vtkTexture.h:239
virtual vtkTypeBool GetEdgeClamp()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:431
virtual void EdgeClampOn()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:432
bool PremultipliedAlpha
Definition vtkTexture.h:459
virtual void RepeatOn()
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:426
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:185
int TranslucentCachedResult
Definition vtkTexture.h:465
void SetLookupTable(vtkScalarsToColors *)
Specify the lookup table to convert scalars if necessary.
vtkTimeStamp TranslucentComputationTime
Definition vtkTexture.h:464
void ExecuteData(vtkDataObject *) override
This method is the old style execute method, provided for the sake of backwards compatibility with ol...
Definition vtkTexture.h:442
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition vtkTexture.h:353
void SetColorModeToDefault()
Default: ColorModeToDefault.
Definition vtkTexture.h:255
void SetColorModeToMapScalars()
Default: ColorModeToDefault.
Definition vtkTexture.h:256
virtual void SetEdgeClamp(vtkTypeBool)
Convenience functions to maintain backwards compatibility.
Definition vtkTexture.h:428
vtkScalarsToColors * LookupTable
Definition vtkTexture.h:451
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:48
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:163
#define VTK_TEXTURE_QUALITY_32BIT
Definition vtkTexture.h:165
#define VTK_TEXTURE_QUALITY_16BIT
Definition vtkTexture.h:164
#define VTK_MARSHALMANUAL