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=========================================================================*/
158#ifndef vtkTexture_h
159#define vtkTexture_h
160
161#include "vtkImageAlgorithm.h"
162#include "vtkRenderingCoreModule.h" // For export macro
163#include "vtkSystemIncludes.h" // For VTK_COLOR_MODE_*
164
165class vtkImageData;
167class vtkRenderer;
169class vtkWindow;
170class vtkDataArray;
171class vtkTransform;
172
173#define VTK_TEXTURE_QUALITY_DEFAULT 0
174#define VTK_TEXTURE_QUALITY_16BIT 16
175#define VTK_TEXTURE_QUALITY_32BIT 32
176
177class VTKRENDERINGCORE_EXPORT vtkTexture : public vtkImageAlgorithm
178{
179public:
180 static vtkTexture* New();
182 void PrintSelf(ostream& os, vtkIndent indent) override;
183
189 virtual void Render(vtkRenderer* ren);
190
195 virtual void PostRender(vtkRenderer*) {}
196
203
209 virtual void Load(vtkRenderer*) {}
210
212
215 vtkGetMacro(Interpolate, vtkTypeBool);
216 vtkSetMacro(Interpolate, vtkTypeBool);
217 vtkBooleanMacro(Interpolate, vtkTypeBool);
219
221
224 vtkGetMacro(Mipmap, bool);
225 vtkSetMacro(Mipmap, bool);
226 vtkBooleanMacro(Mipmap, bool);
228
230
236 vtkSetMacro(MaximumAnisotropicFiltering, float);
237 vtkGetMacro(MaximumAnisotropicFiltering, float);
239
241
245 vtkSetMacro(Quality, int);
246 vtkGetMacro(Quality, int);
248 void SetQualityTo16Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_16BIT); }
249 void SetQualityTo32Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_32BIT); }
251
253
263 vtkSetMacro(ColorMode, int);
264 vtkGetMacro(ColorMode, int);
265 void SetColorModeToDefault() { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
269
275
277
281 vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
283
285
288 vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray);
290
294 unsigned char* MapScalarsToColors(vtkDataArray* scalars);
295
297
301 void SetTransform(vtkTransform* transform);
302 vtkGetObjectMacro(Transform, vtkTransform);
304
310 {
311 VTK_TEXTURE_BLENDING_MODE_NONE = 0,
317 VTK_TEXTURE_BLENDING_MODE_SUBTRACT
318 };
319
321
325 vtkGetMacro(BlendingMode, int);
326 vtkSetMacro(BlendingMode, int);
328
330
334 vtkGetMacro(PremultipliedAlpha, bool);
335 vtkSetMacro(PremultipliedAlpha, bool);
336 vtkBooleanMacro(PremultipliedAlpha, bool);
338
340
347 vtkGetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
348 vtkSetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
349 vtkBooleanMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
351
358 virtual int IsTranslucent();
359
363 virtual int GetTextureUnit() { return 0; }
364
366
372 vtkGetMacro(CubeMap, bool);
373 vtkBooleanMacro(CubeMap, bool);
374 void SetCubeMap(bool val);
376
378
384 vtkGetMacro(UseSRGBColorSpace, bool);
385 vtkSetMacro(UseSRGBColorSpace, bool);
386 vtkBooleanMacro(UseSRGBColorSpace, bool);
388
390
398 vtkSetVector4Macro(BorderColor, float);
399 vtkGetVector4Macro(BorderColor, float);
401
402 enum
403 {
404 ClampToEdge = 0,
408 NumberOfWrapModes
409 };
410
412
425 vtkGetMacro(Wrap, int);
426 vtkSetClampMacro(Wrap, int, ClampToEdge, ClampToBorder);
428
430
434 virtual void SetRepeat(vtkTypeBool r) { this->SetWrap(r ? Repeat : ClampToEdge); }
435 virtual vtkTypeBool GetRepeat() { return (this->GetWrap() == Repeat); }
436 virtual void RepeatOn() { this->SetRepeat(true); }
437 virtual void RepeatOff() { this->SetRepeat(false); }
439 { /* This wasn't doing anything before. */
440 }
441 virtual vtkTypeBool GetEdgeClamp() { return (this->GetWrap() == ClampToEdge); }
442 virtual void EdgeClampOn() { this->SetEdgeClamp(true); }
443 virtual void EdgeClampOff() { this->SetEdgeClamp(false); }
445
446protected:
448 ~vtkTexture() override;
449
450 // A texture is a sink, so there is no need to do anything.
451 // This definition avoids a warning when doing Update() on a vtkTexture object.
452 void ExecuteData(vtkDataObject*) override {}
453
454 bool Mipmap;
456 int Wrap;
457 float BorderColor[4];
464
467 // this is to duplicated the previous behavior of SelfCreatedLookUpTable
472
473 // the result of HasTranslucentPolygonalGeometry is cached
476
477private:
478 vtkTexture(const vtkTexture&) = delete;
479 void operator=(const vtkTexture&) = delete;
480};
481
482#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
general representation of visualization data
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract specification for renderers
Definition: vtkRenderer.h:179
Superclass for mapping scalar values to colors.
handles properties associated with a texture map
Definition: vtkTexture.h:178
virtual vtkTypeBool GetRepeat()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:435
@ MirroredRepeat
Definition: vtkTexture.h:406
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:247
int ColorMode
Definition: vtkTexture.h:460
virtual void RepeatOff()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:437
void SetColorModeToDirectScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:267
vtkUnsignedCharArray * MappedScalars
Definition: vtkTexture.h:462
void SetQualityTo16Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:248
vtkTypeBool RestrictPowerOf2ImageSmaller
Definition: vtkTexture.h:466
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:209
bool UseSRGBColorSpace
Definition: vtkTexture.h:471
virtual void SetRepeat(vtkTypeBool r)
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:434
int SelfAdjustingTableRange
Definition: vtkTexture.h:468
vtkTypeBool Interpolate
Definition: vtkTexture.h:458
static vtkTexture * New()
int BlendingMode
Definition: vtkTexture.h:465
float MaximumAnisotropicFiltering
Definition: vtkTexture.h:455
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:310
@ VTK_TEXTURE_BLENDING_MODE_MODULATE
Definition: vtkTexture.h:313
@ VTK_TEXTURE_BLENDING_MODE_ADD
Definition: vtkTexture.h:314
@ VTK_TEXTURE_BLENDING_MODE_REPLACE
Definition: vtkTexture.h:312
@ VTK_TEXTURE_BLENDING_MODE_INTERPOLATE
Definition: vtkTexture.h:316
@ VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED
Definition: vtkTexture.h:315
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:443
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:202
vtkTransform * Transform
Definition: vtkTexture.h:463
void SetQualityTo32Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:249
bool CubeMap
Definition: vtkTexture.h:470
virtual vtkTypeBool GetEdgeClamp()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:441
virtual void EdgeClampOn()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:442
bool PremultipliedAlpha
Definition: vtkTexture.h:469
virtual void RepeatOn()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:436
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:195
int TranslucentCachedResult
Definition: vtkTexture.h:475
void SetLookupTable(vtkScalarsToColors *)
Specify the lookup table to convert scalars if necessary.
vtkTimeStamp TranslucentComputationTime
Definition: vtkTexture.h:474
void ExecuteData(vtkDataObject *) override
This method is the old style execute method, provided for the sake of backwards compatibility with ol...
Definition: vtkTexture.h:452
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:363
void SetColorModeToDefault()
Default: ColorModeToDefault.
Definition: vtkTexture.h:265
bool Mipmap
Definition: vtkTexture.h:454
void SetColorModeToMapScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:266
virtual void SetEdgeClamp(vtkTypeBool)
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:438
vtkScalarsToColors * LookupTable
Definition: vtkTexture.h:461
record modification and/or execution time
Definition: vtkTimeStamp.h:55
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:170
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ Transform
Definition: vtkX3D.h:47
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:173
#define VTK_TEXTURE_QUALITY_32BIT
Definition: vtkTexture.h:175
#define VTK_TEXTURE_QUALITY_16BIT
Definition: vtkTexture.h:174