Skip to main content

Post-processing tools 2023 R2

ANSYS::Nexus::GLTFWriter::Primitive Class Reference

Last update: 17.04.2023

Primitives are the renderable parts of meshes. More...

#include <GLTFWriter.h>

Inheritance diagram for ANSYS::Nexus::GLTFWriter::Primitive:

Public Types

enum  PrimitiveType {
  PT_POINTS = 0 , PT_LINES = 1 , PT_LINE_LOOP = 2 , PT_LINE_STRIP = 3 ,
  PT_TRIANGLES = 4 , PT_TRIANGLE_STRIP = 5 , PT_TRIANGLE_FAN = 6
}
 
enum  PrimitiveXAttachment { PXA_NONE , PXA_LEFT , PXA_CENTER , PXA_RIGHT }
 
enum  PrimitiveYAttachment { PYA_NONE , PYA_BOTTOM , PYA_CENTER , PYA_TOP }
 

Public Member Functions

virtual PrimitiveMirror ()=0
 
virtual bool AppendAttribute (Attribute *attribute)=0
 

Static Public Member Functions

static PrimitiveCreate (GLTF *gltf, PrimitiveType type, Material *material, Index *indices=0, bool isPickable=true)
 
static PrimitiveCreate2DTexture (GLTF *gltf, Texture *texture, float width, float height, PrimitiveXAttachment xAttach=PXA_LEFT, PrimitiveYAttachment yAttach=PYA_CENTER)
 
static PrimitiveCreate2DTexture (GLTF *gltf, Texture *texture, float width, float height, float x=0, float y=0)
 

Detailed Description

Primitives are the renderable parts of meshes.

Definition at line 29 of file GLTFMesh.h.

Member Enumeration Documentation

◆ PrimitiveType

Type of primitive

Enumerator
PT_POINTS 

Treats each vertex as a single point.

PT_LINES 

Treats each pair of vertices as an independent line segment.

PT_LINE_LOOP 

Draws a connected group of line segments from the first vertex to the last, then back to the first.

PT_LINE_STRIP 

Draws a connected group of line segments from the first vertex to the last.

PT_TRIANGLES 

Treats each triplet of vertices as an independent triangle.

PT_TRIANGLE_STRIP 

Draws a connected group of triangles. One triangle is defined for each vertex presented after the first two vertices.

PT_TRIANGLE_FAN 

Draws a connected group of triangles. One triangle is defined for each vertex presented after the first two vertices.

Definition at line 33 of file GLTFMesh.h.

◆ PrimitiveXAttachment

Type of X Attachment

Enumerator
PXA_NONE 

Use X location.

PXA_LEFT 

Anchor at left edge.

PXA_CENTER 

Center in horizontal direction.

PXA_RIGHT 

Anchor at right edge.

Definition at line 44 of file GLTFMesh.h.

◆ PrimitiveYAttachment

Type of Y Attachment

Enumerator
PYA_NONE 

Use Y location.

PYA_BOTTOM 

Anchor at bottom edge.

PYA_CENTER 

Center in vertical direction.

PYA_TOP 

Anchor at top edge.

Definition at line 52 of file GLTFMesh.h.

Member Function Documentation

◆ AppendAttribute()

virtual bool ANSYS::Nexus::GLTFWriter::Primitive::AppendAttribute ( Attribute attribute)
pure virtual

Adds an attribute to a primitive. Multiple attributes can be appended to a primitive.

Returns
Status of AppendAttribute.
Parameters
[in]attributeAttribute object.

◆ Create()

static Primitive* ANSYS::Nexus::GLTFWriter::Primitive::Create ( GLTF gltf,
PrimitiveType  type,
Material material,
Index indices = 0,
bool  isPickable = true 
)
static

Creates a primitive.

Returns
Primitive object. Do not delete this pointer.
Parameters
[in]gltfGLTF object.
[in]typePrimitive::PrimitiveType defining type of primitive to create.
[in]materialMaterial used to render primitive.
[in]indicesOptional, indices used to render type. indices are index into appended attributes. If no indices are specified, vertices are grouped as appropriate for primitive type.
[in]isPickableOptional, primitive can participate in probing, hit-detection, and pivot point selection. A 2D overlay is an example of something this is not pickable.
Examples
Test002.cpp, Test005.cpp, Test008.cpp, Test009.cpp, Test010.cpp, Test013.cpp, and Test014.cpp.

◆ Create2DTexture() [1/2]

static Primitive* ANSYS::Nexus::GLTFWriter::Primitive::Create2DTexture ( GLTF gltf,
Texture texture,
float  width,
float  height,
float  x = 0,
float  y = 0 
)
static

Creates a 2D billboard from a texture.

Returns
Primitive object. Do not delete this pointer.
Parameters
[in]gltfGLTF object.
[in]textureTexture object used to texture billboard.
[in]widthWidth of billboard. Ranges from 0 to 1 as fraction of minimum screen dimension.
[in]heightHeight of billboard. Ranges from 0 to 1 as fraction of minimum screen dimension.
[in]xX screen location. Ranges from 0 to 1.
[in]yY screen location. Ranges from 0 to 1.

◆ Create2DTexture() [2/2]

static Primitive* ANSYS::Nexus::GLTFWriter::Primitive::Create2DTexture ( GLTF gltf,
Texture texture,
float  width,
float  height,
PrimitiveXAttachment  xAttach = PXA_LEFT,
PrimitiveYAttachment  yAttach = PYA_CENTER 
)
static

Creates a 2D billboard from a texture.

Returns
Primitive object. Do not delete this pointer.
Parameters
[in]gltfGLTF object.
[in]textureTexture object used to texture billboard.
[in]widthWidth of billboard. Ranges from 0 to 1 as fraction of minimum screen dimension.
[in]heightHeight of billboard. Ranges from 0 to 1 as fraction of minimum screen dimension.
[in]xAttachX location attachment.
[in]yAttachY location attachment.
Examples
Test005.cpp.

◆ Mirror()

virtual Primitive* ANSYS::Nexus::GLTFWriter::Primitive::Mirror ( )
pure virtual

Creates a mirrored Primitive.

Returns
Primitive object. Do not delete this pointer.

The documentation for this class was generated from the following file:
  • D:/ANSYSDev/NoBackup/branches/EnSight-Second-Coming/webgl_viewer/gltfwriterlib/include/GLTFMesh.h