Skip to main content

EnSight 2025 R2

ANSYS::AVZ::GLTFWriter::Primitive Class Reference

Last update: 16.07.2025

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

#include <GLTFWriter.h>

Inheritance diagram for ANSYS::AVZ::GLTFWriter::Primitive:
ANSYS::AVZ::GLTFWriter::Object

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 Primitive * Mirror ()=0
 
virtual bool AppendAttribute (Attribute *attribute)=0
 
- Public Member Functions inherited from ANSYS::AVZ::GLTFWriter::Object
virtual void SetName (const char *name)=0
 
virtual const char * GetName () const =0
 
virtual const char * GetID () const =0
 

Static Public Member Functions

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

Detailed Description

Primitives are the renderable parts of meshes.

Examples
Test002.cpp, Test005.cpp, Test008.cpp, Test009.cpp, Test010.cpp, Test013.cpp, and Test014.cpp.

Definition at line 30 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 34 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 45 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 53 of file GLTFMesh.h.

Constructor & Destructor Documentation

◆ ~Primitive()

virtual ANSYS::AVZ::GLTFWriter::Primitive::~Primitive ( )
inlineprotectedvirtual

Definition at line 62 of file GLTFMesh.h.

Member Function Documentation

◆ AppendAttribute()

virtual bool ANSYS::AVZ::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.
Examples
Test002.cpp, Test005.cpp, Test008.cpp, Test009.cpp, Test010.cpp, Test013.cpp, and Test014.cpp.

◆ Create()

static Primitive * ANSYS::AVZ::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.

◆ Create2DTexture() [1/2]

static Primitive * ANSYS::AVZ::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::AVZ::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.

◆ Mirror()

virtual Primitive * ANSYS::AVZ::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/Product-src/webgl_viewer/gltfwriterlib/include/GLTFMesh.h

Connect with Ansys