VTK  9.1.0
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=========================================================================*/
155#ifndef vtkTexture_h
156#define vtkTexture_h
157
158#include "vtkImageAlgorithm.h"
159#include "vtkRenderingCoreModule.h" // For export macro
160#include "vtkSystemIncludes.h" // For VTK_COLOR_MODE_*
161
162class vtkImageData;
164class vtkRenderer;
166class vtkWindow;
167class vtkDataArray;
168class vtkTransform;
169
170#define VTK_TEXTURE_QUALITY_DEFAULT 0
171#define VTK_TEXTURE_QUALITY_16BIT 16
172#define VTK_TEXTURE_QUALITY_32BIT 32
173
174class VTKRENDERINGCORE_EXPORT vtkTexture : public vtkImageAlgorithm
175{
176public:
177 static vtkTexture* New();
179 void PrintSelf(ostream& os, vtkIndent indent) override;
180
186 virtual void Render(vtkRenderer* ren);
187
192 virtual void PostRender(vtkRenderer*) {}
193
200
206 virtual void Load(vtkRenderer*) {}
207
209
212 vtkGetMacro(Interpolate, vtkTypeBool);
213 vtkSetMacro(Interpolate, vtkTypeBool);
214 vtkBooleanMacro(Interpolate, vtkTypeBool);
216
218
221 vtkGetMacro(Mipmap, bool);
222 vtkSetMacro(Mipmap, bool);
223 vtkBooleanMacro(Mipmap, bool);
225
227
233 vtkSetMacro(MaximumAnisotropicFiltering, float);
234 vtkGetMacro(MaximumAnisotropicFiltering, float);
236
238
242 vtkSetMacro(Quality, int);
243 vtkGetMacro(Quality, int);
245 void SetQualityTo16Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_16BIT); }
246 void SetQualityTo32Bit() { this->SetQuality(VTK_TEXTURE_QUALITY_32BIT); }
248
250
260 vtkSetMacro(ColorMode, int);
261 vtkGetMacro(ColorMode, int);
262 void SetColorModeToDefault() { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
266
272
274
278 vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
280
282
285 vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray);
287
291 unsigned char* MapScalarsToColors(vtkDataArray* scalars);
292
294
298 void SetTransform(vtkTransform* transform);
299 vtkGetObjectMacro(Transform, vtkTransform);
301
307 {
308 VTK_TEXTURE_BLENDING_MODE_NONE = 0,
314 VTK_TEXTURE_BLENDING_MODE_SUBTRACT
315 };
316
318
322 vtkGetMacro(BlendingMode, int);
323 vtkSetMacro(BlendingMode, int);
325
327
331 vtkGetMacro(PremultipliedAlpha, bool);
332 vtkSetMacro(PremultipliedAlpha, bool);
333 vtkBooleanMacro(PremultipliedAlpha, bool);
335
337
344 vtkGetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
345 vtkSetMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
346 vtkBooleanMacro(RestrictPowerOf2ImageSmaller, vtkTypeBool);
348
355 virtual int IsTranslucent();
356
360 virtual int GetTextureUnit() { return 0; }
361
363
369 vtkGetMacro(CubeMap, bool);
370 vtkBooleanMacro(CubeMap, bool);
371 void SetCubeMap(bool val);
373
375
381 vtkGetMacro(UseSRGBColorSpace, bool);
382 vtkSetMacro(UseSRGBColorSpace, bool);
383 vtkBooleanMacro(UseSRGBColorSpace, bool);
385
387
395 vtkSetVector4Macro(BorderColor, float);
396 vtkGetVector4Macro(BorderColor, float);
398
399 enum
400 {
401 ClampToEdge = 0,
405 NumberOfWrapModes
406 };
407
409
422 vtkGetMacro(Wrap, int);
423 vtkSetClampMacro(Wrap, int, ClampToEdge, ClampToBorder);
425
427
431 virtual void SetRepeat(vtkTypeBool r) { this->SetWrap(r ? Repeat : ClampToEdge); }
432 virtual vtkTypeBool GetRepeat() { return (this->GetWrap() == Repeat); }
433 virtual void RepeatOn() { this->SetRepeat(true); }
434 virtual void RepeatOff() { this->SetRepeat(false); }
436 { /* This wasn't doing anything before. */
437 }
438 virtual vtkTypeBool GetEdgeClamp() { return (this->GetWrap() == ClampToEdge); }
439 virtual void EdgeClampOn() { this->SetEdgeClamp(true); }
440 virtual void EdgeClampOff() { this->SetEdgeClamp(false); }
442
443protected:
445 ~vtkTexture() override;
446
447 // A texture is a sink, so there is no need to do anything.
448 // This definition avoids a warning when doing Update() on a vtkTexture object.
449 void ExecuteData(vtkDataObject*) override {}
450
451 bool Mipmap;
453 int Wrap;
454 float BorderColor[4];
461
464 // this is to duplicated the previous behavior of SelfCreatedLookUpTable
469
470 // the result of HasTranslucentPolygonalGeometry is cached
473
474private:
475 vtkTexture(const vtkTexture&) = delete;
476 void operator=(const vtkTexture&) = delete;
477};
478
479#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
general representation of visualization data
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract specification for renderers
Definition: vtkRenderer.h:182
Superclass for mapping scalar values to colors.
handles properties associated with a texture map
Definition: vtkTexture.h:175
virtual vtkTypeBool GetRepeat()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:432
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:244
int ColorMode
Definition: vtkTexture.h:457
@ MirroredRepeat
Definition: vtkTexture.h:403
virtual void RepeatOff()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:434
void SetColorModeToDirectScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:264
vtkUnsignedCharArray * MappedScalars
Definition: vtkTexture.h:459
void SetQualityTo16Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:245
vtkTypeBool RestrictPowerOf2ImageSmaller
Definition: vtkTexture.h:463
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:206
bool UseSRGBColorSpace
Definition: vtkTexture.h:468
virtual void SetRepeat(vtkTypeBool r)
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:431
int SelfAdjustingTableRange
Definition: vtkTexture.h:465
vtkTypeBool Interpolate
Definition: vtkTexture.h:455
static vtkTexture * New()
int BlendingMode
Definition: vtkTexture.h:462
float MaximumAnisotropicFiltering
Definition: vtkTexture.h:452
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:307
@ VTK_TEXTURE_BLENDING_MODE_MODULATE
Definition: vtkTexture.h:310
@ VTK_TEXTURE_BLENDING_MODE_ADD
Definition: vtkTexture.h:311
@ VTK_TEXTURE_BLENDING_MODE_REPLACE
Definition: vtkTexture.h:309
@ VTK_TEXTURE_BLENDING_MODE_INTERPOLATE
Definition: vtkTexture.h:313
@ VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED
Definition: vtkTexture.h:312
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:440
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:199
vtkTransform * Transform
Definition: vtkTexture.h:460
void SetQualityTo32Bit()
Force texture quality to 16-bit or 32-bit.
Definition: vtkTexture.h:246
bool CubeMap
Definition: vtkTexture.h:467
virtual vtkTypeBool GetEdgeClamp()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:438
virtual void EdgeClampOn()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:439
bool PremultipliedAlpha
Definition: vtkTexture.h:466
virtual void RepeatOn()
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:433
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:192
int TranslucentCachedResult
Definition: vtkTexture.h:472
void SetLookupTable(vtkScalarsToColors *)
Specify the lookup table to convert scalars if necessary.
vtkTimeStamp TranslucentComputationTime
Definition: vtkTexture.h:471
void ExecuteData(vtkDataObject *) override
This method is the old style execute method, provided for the sake of backwards compatibility with ol...
Definition: vtkTexture.h:449
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:360
void SetColorModeToDefault()
Default: ColorModeToDefault.
Definition: vtkTexture.h:262
bool Mipmap
Definition: vtkTexture.h:451
void SetColorModeToMapScalars()
Default: ColorModeToDefault.
Definition: vtkTexture.h:263
virtual void SetEdgeClamp(vtkTypeBool)
Convenience functions to maintain backwards compatibility.
Definition: vtkTexture.h:435
vtkScalarsToColors * LookupTable
Definition: vtkTexture.h:458
record modification and/or execution time
Definition: vtkTimeStamp.h:52
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
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:170
#define VTK_TEXTURE_QUALITY_32BIT
Definition: vtkTexture.h:172
#define VTK_TEXTURE_QUALITY_16BIT
Definition: vtkTexture.h:171