VTK  9.4.20241209
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
vtkDrawTexturedElements Class Reference

A base class for mappers or render responders that need to draw primitives via vertex-pulling. More...

#include <vtkDrawTexturedElements.h>

Inheritance diagram for vtkDrawTexturedElements:
[legend]
Collaboration diagram for vtkDrawTexturedElements:
[legend]

Public Types

enum  ElementShape {
  Point , Line , LineStrip , Triangle ,
  TriangleStrip , TriangleFan , AbstractPatches
}
 The type of primitive to output. More...
 
enum  PatchShape { PatchLine , PatchTriangle , PatchQuadrilateral }
 The type of primitive that abstract patches are tessellated into. More...
 

Public Member Functions

 vtkDrawTexturedElements ()
 
virtual ~vtkDrawTexturedElements ()
 
vtkShaderGetShader (vtkShader::Type shaderType)
 Return a shader of the given type (creating as needed).
 
void BindArrayToTexture (vtkStringToken textureName, vtkDataArray *array, bool asScalars=false)
 Bind a data array to the given textureName (used in shader program texelFetch calls).
 
void AppendArrayToTexture (vtkStringToken textureName, vtkDataArray *array, bool asScalars=false)
 
bool UnbindArray (vtkStringToken)
 
vtkIdType GetNumberOfInstances ()
 Set/get the number of element instances to draw.
 
virtual bool SetNumberOfInstances (vtkIdType numberOfInstances)
 
vtkIdType GetNumberOfElements ()
 Set/get the number of elements (primitives) to draw per instance.
 
virtual bool SetNumberOfElements (vtkIdType numberOfElements)
 
void DrawInstancedElements (vtkRenderer *ren, vtkActor *a, vtkMapper *mapper)
 Render geometry.
 
void ReleaseResources (vtkWindow *window)
 Release any graphics resources associated with the window.
 
vtkShaderProgramGetShaderProgram ()
 Return the internal shader program so subclasses can create/replace shaders.
 
vtkCollectionGetGLSLModCollection () const
 Return the GLSL mods.
 
int GetElementType ()
 
virtual bool SetElementType (int elementType)
 
int GetPatchType ()
 
virtual bool SetPatchType (int patchType)
 
bool GetIncludeColormap ()
 
virtual bool SetIncludeColormap (bool includeColormap)
 

Static Public Member Functions

static vtkIdType PatchVertexCountFromPrimitive (int element)
 Return the number of vertices in the patch primitive.
 

Protected Types

using ShaderMap = std::map< vtkShader::Type, vtkShader * >
 

Protected Member Functions

void SetCustomUniforms (vtkRenderer *ren, vtkActor *a)
 Set any custom uniforms provided by the actor.
 
void ReadyShaderProgram (vtkRenderer *ren)
 
void ReportUnsupportedLineWidth (float width, float maxWidth, vtkMapper *mapper)
 
void PreDraw (vtkRenderer *ren, vtkActor *a, vtkMapper *mapper)
 
void DrawInstancedElementsImpl (vtkRenderer *ren, vtkActor *a, vtkMapper *mapper)
 
void PostDraw (vtkRenderer *ren, vtkActor *a, vtkMapper *mapper)
 

Protected Attributes

Internal * P { nullptr }
 Private data for this class.
 
vtkIdType FirstVertexId { 0 }
 
vtkIdType NumberOfInstances { 1 }
 
vtkIdType NumberOfElements { 1 }
 
int ElementType { ElementShape::TriangleStrip }
 
int PatchType { PatchShape::PatchTriangle }
 
bool IncludeColormap { true }
 
std::unordered_map< vtkStringToken, vtkOpenGLArrayTextureBufferAdapterArrays
 
ShaderMap Shaders
 
vtkSmartPointer< vtkShaderProgramShaderProgram
 
vtkNew< vtkOpenGLVertexArrayObjectVAO
 
vtkNew< vtkOpenGLTextureColorTextureGL
 
vtkNew< vtkCollectionGLSLMods
 

Detailed Description

A base class for mappers or render responders that need to draw primitives via vertex-pulling.

Since this class is intended to be inherited by other classes that must also inherit a VTK mapper or responder class, it is not a subclass of vtkObject; instead, it provides methods your subclass can invoke during rendering.

This currently handles hexahedra and tetrahedra.

Definition at line 47 of file vtkDrawTexturedElements.h.

Member Typedef Documentation

◆ ShaderMap

Definition at line 150 of file vtkDrawTexturedElements.h.

Member Enumeration Documentation

◆ ElementShape

The type of primitive to output.

Enumerator
Point 

Send points to the shader.

Line 

Send line segments to the shader.

LineStrip 

Send line segments to the shader.

Triangle 

Send triangles to the shader.

TriangleStrip 

Send triangles to the shader (moving window of 3 vertices).

TriangleFan 

Send triangle fans to the shader (first vertex is constant).

AbstractPatches 

Send abstract patches to the shader.

Definition at line 54 of file vtkDrawTexturedElements.h.

◆ PatchShape

The type of primitive that abstract patches are tessellated into.

Enumerator
PatchLine 

Input to the essellation control shader is a line segment.

PatchTriangle 

Input to the essellation control shader is a triangle.

PatchQuadrilateral 

Input to the essellation control shader is a quadrilateral.

Definition at line 66 of file vtkDrawTexturedElements.h.

Constructor & Destructor Documentation

◆ vtkDrawTexturedElements()

vtkDrawTexturedElements::vtkDrawTexturedElements ( )

◆ ~vtkDrawTexturedElements()

virtual vtkDrawTexturedElements::~vtkDrawTexturedElements ( )
virtual

Member Function Documentation

◆ GetShader()

vtkShader * vtkDrawTexturedElements::GetShader ( vtkShader::Type  shaderType)

Return a shader of the given type (creating as needed).

◆ BindArrayToTexture()

void vtkDrawTexturedElements::BindArrayToTexture ( vtkStringToken  textureName,
vtkDataArray array,
bool  asScalars = false 
)

Bind a data array to the given textureName (used in shader program texelFetch calls).

If asScalars is false (the default), then the array's components are treated as components of single texture values. If asScalars is true, then a 2-d texture image is uploaded where each value is a scalar (row indices are tuple IDs, column indices are component IDs).

◆ AppendArrayToTexture()

void vtkDrawTexturedElements::AppendArrayToTexture ( vtkStringToken  textureName,
vtkDataArray array,
bool  asScalars = false 
)

◆ UnbindArray()

bool vtkDrawTexturedElements::UnbindArray ( vtkStringToken  )

◆ GetNumberOfInstances()

vtkIdType vtkDrawTexturedElements::GetNumberOfInstances ( )
inline

Set/get the number of element instances to draw.

Definition at line 88 of file vtkDrawTexturedElements.h.

◆ SetNumberOfInstances()

virtual bool vtkDrawTexturedElements::SetNumberOfInstances ( vtkIdType  numberOfInstances)
virtual

Reimplemented in vtkArrayRenderer.

◆ GetNumberOfElements()

vtkIdType vtkDrawTexturedElements::GetNumberOfElements ( )
inline

Set/get the number of elements (primitives) to draw per instance.

Definition at line 92 of file vtkDrawTexturedElements.h.

◆ SetNumberOfElements()

virtual bool vtkDrawTexturedElements::SetNumberOfElements ( vtkIdType  numberOfElements)
virtual

Reimplemented in vtkArrayRenderer.

◆ GetElementType()

int vtkDrawTexturedElements::GetElementType ( )
inline

Set/get the type of elements to draw.

This determines the number of vertices rendered per element. Values must come from the ElementShape enum; the default is ElementShape::TriangleStrip.

Definition at line 101 of file vtkDrawTexturedElements.h.

◆ SetElementType()

virtual bool vtkDrawTexturedElements::SetElementType ( int  elementType)
virtual

Set/get the type of elements to draw.

This determines the number of vertices rendered per element. Values must come from the ElementShape enum; the default is ElementShape::TriangleStrip.

Reimplemented in vtkArrayRenderer.

◆ GetPatchType()

int vtkDrawTexturedElements::GetPatchType ( )
inline

Set/get the type of primitive an abstract patch gets tessellated into.

This determines the number of input patch vertices to the tessellation shaders. Values must come from the PatchShape enum; the default is PatchShape::Triangle.

Definition at line 111 of file vtkDrawTexturedElements.h.

◆ SetPatchType()

virtual bool vtkDrawTexturedElements::SetPatchType ( int  patchType)
virtual

Set/get the type of primitive an abstract patch gets tessellated into.

This determines the number of input patch vertices to the tessellation shaders. Values must come from the PatchShape enum; the default is PatchShape::Triangle.

◆ GetIncludeColormap()

bool vtkDrawTexturedElements::GetIncludeColormap ( )
inline

Set/get whether to upload a colormap texture.

If enabled (the default), then create (if needed) and upload a colormap texture image bound to a "color_map" uniform sampler.

Definition at line 120 of file vtkDrawTexturedElements.h.

◆ SetIncludeColormap()

virtual bool vtkDrawTexturedElements::SetIncludeColormap ( bool  includeColormap)
virtual

Set/get whether to upload a colormap texture.

If enabled (the default), then create (if needed) and upload a colormap texture image bound to a "color_map" uniform sampler.

◆ DrawInstancedElements()

void vtkDrawTexturedElements::DrawInstancedElements ( vtkRenderer ren,
vtkActor a,
vtkMapper mapper 
)

Render geometry.

This just calls glDrawElementInstanced().

◆ ReleaseResources()

void vtkDrawTexturedElements::ReleaseResources ( vtkWindow window)

Release any graphics resources associated with the window.

◆ GetShaderProgram()

vtkShaderProgram * vtkDrawTexturedElements::GetShaderProgram ( )

Return the internal shader program so subclasses can create/replace shaders.

◆ GetGLSLModCollection()

vtkCollection * vtkDrawTexturedElements::GetGLSLModCollection ( ) const

Return the GLSL mods.

◆ PatchVertexCountFromPrimitive()

static vtkIdType vtkDrawTexturedElements::PatchVertexCountFromPrimitive ( int  element)
static

Return the number of vertices in the patch primitive.

◆ SetCustomUniforms()

void vtkDrawTexturedElements::SetCustomUniforms ( vtkRenderer ren,
vtkActor a 
)
protected

Set any custom uniforms provided by the actor.

◆ ReadyShaderProgram()

void vtkDrawTexturedElements::ReadyShaderProgram ( vtkRenderer ren)
protected

◆ ReportUnsupportedLineWidth()

void vtkDrawTexturedElements::ReportUnsupportedLineWidth ( float  width,
float  maxWidth,
vtkMapper mapper 
)
protected

◆ PreDraw()

void vtkDrawTexturedElements::PreDraw ( vtkRenderer ren,
vtkActor a,
vtkMapper mapper 
)
protected

◆ DrawInstancedElementsImpl()

void vtkDrawTexturedElements::DrawInstancedElementsImpl ( vtkRenderer ren,
vtkActor a,
vtkMapper mapper 
)
protected

◆ PostDraw()

void vtkDrawTexturedElements::PostDraw ( vtkRenderer ren,
vtkActor a,
vtkMapper mapper 
)
protected

Member Data Documentation

◆ P

Internal* vtkDrawTexturedElements::P { nullptr }
protected

Private data for this class.

Definition at line 154 of file vtkDrawTexturedElements.h.

◆ FirstVertexId

vtkIdType vtkDrawTexturedElements::FirstVertexId { 0 }
protected

Definition at line 155 of file vtkDrawTexturedElements.h.

◆ NumberOfInstances

vtkIdType vtkDrawTexturedElements::NumberOfInstances { 1 }
protected

Definition at line 156 of file vtkDrawTexturedElements.h.

◆ NumberOfElements

vtkIdType vtkDrawTexturedElements::NumberOfElements { 1 }
protected

Definition at line 157 of file vtkDrawTexturedElements.h.

◆ ElementType

int vtkDrawTexturedElements::ElementType { ElementShape::TriangleStrip }
protected

Definition at line 158 of file vtkDrawTexturedElements.h.

◆ PatchType

int vtkDrawTexturedElements::PatchType { PatchShape::PatchTriangle }
protected

Definition at line 159 of file vtkDrawTexturedElements.h.

◆ IncludeColormap

bool vtkDrawTexturedElements::IncludeColormap { true }
protected

Definition at line 160 of file vtkDrawTexturedElements.h.

◆ Arrays

std::unordered_map<vtkStringToken, vtkOpenGLArrayTextureBufferAdapter> vtkDrawTexturedElements::Arrays
protected

Definition at line 161 of file vtkDrawTexturedElements.h.

◆ Shaders

ShaderMap vtkDrawTexturedElements::Shaders
protected

Definition at line 162 of file vtkDrawTexturedElements.h.

◆ ShaderProgram

vtkSmartPointer<vtkShaderProgram> vtkDrawTexturedElements::ShaderProgram
protected

Definition at line 163 of file vtkDrawTexturedElements.h.

◆ VAO

vtkNew<vtkOpenGLVertexArrayObject> vtkDrawTexturedElements::VAO
protected

Definition at line 164 of file vtkDrawTexturedElements.h.

◆ ColorTextureGL

vtkNew<vtkOpenGLTexture> vtkDrawTexturedElements::ColorTextureGL
protected

Definition at line 165 of file vtkDrawTexturedElements.h.

◆ GLSLMods

vtkNew<vtkCollection> vtkDrawTexturedElements::GLSLMods
protected

Definition at line 166 of file vtkDrawTexturedElements.h.


The documentation for this class was generated from the following file: