Skip to main content

Post-processing tools 2024 R1

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 Nexus { namespace GLTFWriter {
20 class GLTF;
21 class Attribute;
22 class Index;
23 class Material;
24 class Texture;
25
29 class Primitive : public Object
30 {
31 public:
34 {
42 };
45 {
50 };
53 {
57 PYA_TOP
58 };
59
60 protected:
61 virtual ~Primitive() {}
62
63 public:
66 static GLTFWRITERSPEC Primitive *Create(GLTF *gltf,
67 PrimitiveType type,
68 Material *material,
69 Index *indices = 0,
70 bool isPickable = true
71 );
72
75 GLTFWRITERSPEC virtual Primitive *Mirror() = 0;
78 GLTFWRITERSPEC virtual bool AppendAttribute(Attribute *attribute
79 ) = 0;
82 static GLTFWRITERSPEC Primitive *Create2DTexture(GLTF *gltf,
83 Texture *texture,
84 float width,
85 float height,
88 );
91 static GLTFWRITERSPEC Primitive *Create2DTexture(GLTF *gltf,
92 Texture *texture,
93 float width,
94 float height,
95 float x = 0,
96 float y = 0
97 );
98 };
99
103 class Mesh : public Object
104 {
105 protected:
106 virtual ~Mesh() {}
107
108 public:
111 static GLTFWRITERSPEC Mesh *Create(GLTF *gltf
112 );
113
116 GLTFWRITERSPEC virtual Mesh *Mirror() = 0;
118 GLTFWRITERSPEC virtual bool AppendPrimitive(Primitive *primitive
119 ) = 0;
122 GLTFWRITERSPEC virtual unsigned int NumPrimitives() const = 0;
123 };
124
125} } }
126
127#endif
Attributes define the per element index values for elements defined by Index.
Definition: GLTFAttribute.h:32
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.
Definition: GLTFMaterial.h:30
Meshes define the renderable objects that can be added to a node.
Definition: GLTFMesh.h:104
virtual bool AppendPrimitive(Primitive *primitive)=0
virtual unsigned int NumPrimitives() const =0
static Mesh * Create(GLTF *gltf)
Primitives are the renderable parts of meshes.
Definition: GLTFMesh.h:30
@ PT_POINTS
Treats each vertex as a single point.
Definition: GLTFMesh.h:35
@ PT_LINES
Treats each pair of vertices as an independent line segment.
Definition: GLTFMesh.h:36
@ PT_LINE_STRIP
Draws a connected group of line segments from the first vertex to the last.
Definition: GLTFMesh.h:38
@ PT_TRIANGLES
Treats each triplet of vertices as an independent triangle.
Definition: GLTFMesh.h:39
@ PT_TRIANGLE_FAN
Draws a connected group of triangles. One triangle is defined for each vertex presented after the fir...
Definition: GLTFMesh.h:41
@ 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:37
@ PT_TRIANGLE_STRIP
Draws a connected group of triangles. One triangle is defined for each vertex presented after the fir...
Definition: GLTFMesh.h:40
static Primitive * Create(GLTF *gltf, PrimitiveType type, Material *material, Index *indices=0, bool isPickable=true)
@ PYA_BOTTOM
Anchor at bottom edge.
Definition: GLTFMesh.h:55
@ PYA_CENTER
Center in vertical direction.
Definition: GLTFMesh.h:56
@ PYA_TOP
Anchor at top edge.
Definition: GLTFMesh.h:57
@ PXA_RIGHT
Anchor at right edge.
Definition: GLTFMesh.h:49
@ PXA_CENTER
Center in horizontal direction.
Definition: GLTFMesh.h:48
@ PXA_LEFT
Anchor at left edge.
Definition: GLTFMesh.h:47
virtual bool AppendAttribute(Attribute *attribute)=0
virtual Primitive * Mirror()=0
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)
Textures are images that can be used to color a primitive.
Definition: GLTFTexture.h:28
GLTFWriter API Documentation.
Definition: GLTFAnimation.h:19

Connect with Ansys