Skip to main content

EnSight 2025 R2

GLTFMesh

Last update: 16.07.2025
1/*
2 * Copyright 2018-2021 ANSYS, Inc. Unauthorized use, distribution, or duplication is prohibited.
3 *
4 * Restricted Rights Legend
5 *
6 * Use, duplication, or disclosure of this
7 * software and its documentation by the
8 * Government is subject to restrictions as
9 * set forth in subdivision [(b)(3)(ii)] of
10 * the Rights in Technical Data and Computer
11 * Software clause at 52.227-7013.
12 */
13#ifndef __INCLUDED_GLTF_GLTFMESH__
14#define __INCLUDED_GLTF_GLTFMESH__
15
16#include "GLTFCommon.h"
17#include "GLTFObject.h"
18
19namespace ANSYS { namespace AVZ { namespace GLTFWriter {
20 class GLTF;
21 class Attribute;
22 class Index;
23 class Material;
24 class Texture;
25 class Value;
26
30 class Primitive : public Object
31 {
32 public:
60
61 protected:
62 virtual ~Primitive() {}
63
64 public:
67 static GLTFWRITERSPEC Primitive *Create(GLTF *gltf,
68 PrimitiveType type,
69 Material *material,
70 Index *indices = 0,
71 bool isPickable = true
72 );
73
76 GLTFWRITERSPEC virtual Primitive *Mirror() = 0;
79 GLTFWRITERSPEC virtual bool AppendAttribute(Attribute *attribute
80 ) = 0;
83 static GLTFWRITERSPEC Primitive *Create2DTexture(GLTF *gltf,
84 Texture *texture,
85 float width,
86 float height,
89 );
92 static GLTFWRITERSPEC Primitive *Create2DTexture(GLTF *gltf,
93 Texture *texture,
94 float width,
95 float height,
96 float x = 0,
97 float y = 0
98 );
99 };
100
104 class Mesh : public Object
105 {
106 protected:
107 virtual ~Mesh() {}
108
109 public:
112 static GLTFWRITERSPEC Mesh *Create(GLTF *gltf
113 );
114
117 GLTFWRITERSPEC virtual Mesh *Mirror() = 0;
119 GLTFWRITERSPEC virtual bool AppendPrimitive(Primitive *primitive
120 ) = 0;
123 GLTFWRITERSPEC virtual unsigned int NumPrimitives() const = 0;
127 GLTFWRITERSPEC virtual bool AppendValue(Value* value
128 ) = 0;
129 };
130
131} } }
132
133#endif
Attributes define the per element index values for elements defined by Index.
This is the main class of the GLTFWriter.
Definition GLTFGLTF.h:32
Indexes define elements within primitives.
Definition GLTFIndex.h:29
Materials describe how primitives are rendered.
Meshes define the renderable objects that can be added to a node.
Definition GLTFMesh.h:105
virtual bool AppendValue(Value *value)=0
virtual unsigned int NumPrimitives() const =0
static Mesh * Create(GLTF *gltf)
virtual Mesh * Mirror()=0
virtual bool AppendPrimitive(Primitive *primitive)=0
Object is base class for GLTF objects.
Definition GLTFObject.h:23
Primitives are the renderable parts of meshes.
Definition GLTFMesh.h:31
@ PYA_TOP
Anchor at top edge.
Definition GLTFMesh.h:58
@ PYA_BOTTOM
Anchor at bottom edge.
Definition GLTFMesh.h:56
@ PYA_CENTER
Center in vertical direction.
Definition GLTFMesh.h:57
virtual Primitive * Mirror()=0
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, float x=0, float y=0)
static Primitive * Create2DTexture(GLTF *gltf, Texture *texture, float width, float height, PrimitiveXAttachment xAttach=PXA_LEFT, PrimitiveYAttachment yAttach=PYA_CENTER)
@ PT_TRIANGLE_STRIP
Draws a connected group of triangles. One triangle is defined for each vertex presented after the fir...
Definition GLTFMesh.h:41
@ PT_TRIANGLE_FAN
Draws a connected group of triangles. One triangle is defined for each vertex presented after the fir...
Definition GLTFMesh.h:42
@ PT_LINES
Treats each pair of vertices as an independent line segment.
Definition GLTFMesh.h:37
@ PT_POINTS
Treats each vertex as a single point.
Definition GLTFMesh.h:36
@ PT_LINE_LOOP
Draws a connected group of line segments from the first vertex to the last, then back to the first.
Definition GLTFMesh.h:38
@ PT_LINE_STRIP
Draws a connected group of line segments from the first vertex to the last.
Definition GLTFMesh.h:39
@ PT_TRIANGLES
Treats each triplet of vertices as an independent triangle.
Definition GLTFMesh.h:40
virtual bool AppendAttribute(Attribute *attribute)=0
@ PXA_CENTER
Center in horizontal direction.
Definition GLTFMesh.h:49
@ PXA_LEFT
Anchor at left edge.
Definition GLTFMesh.h:48
@ PXA_RIGHT
Anchor at right edge.
Definition GLTFMesh.h:50
Textures are images that can be used to color a primitive.
Definition GLTFTexture.h:28
Values are objects for storing single and multiple numbers and strings.
Definition GLTFValue.h:26
GLTFWriter API Documentation.

Connect with Ansys