Skip to main content

Post-processing tools 2025 R1

GLTFAttribute

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_GLTFATTRIBUTE__
14#define __INCLUDED_GLTF_GLTFATTRIBUTE__
15
16#include "GLTFCommon.h"
17#include "GLTFObject.h"
18
19namespace ANSYS { namespace AVZ { namespace GLTFWriter {
20 class GLTF;
21 class Buffer;
22
31 class Attribute : public Object
32 {
33 public:
36 {
37// AT_BYTE = 5120,
38// AT_SHORT = 5122,
39// AT_UNSIGNED_SHORT = 5123,
40 AT_INT = 5124,
41// AT_UNSIGNED_INT = 5125,
42 AT_FLOAT = 5126,
43 AT_FLOAT_VEC2 = 35664,
44 AT_FLOAT_VEC3 = 35665,
45 AT_FLOAT_VEC4 = 35666,
46
47 AT_FLOAT_MAT4 = 35676
48 };
49
50 protected:
51 virtual ~Attribute() {}
52
53 public:
59 static GLTFWRITERSPEC Attribute *Create(GLTF *gltf,
60 const char *name,
61 AttributeType type,
62 unsigned int count,
63 const int *data,
64 Buffer *buffer = 0
65 );
71 static GLTFWRITERSPEC Attribute *Create(GLTF *gltf,
72 const char *name,
73 AttributeType type,
74 unsigned int count,
75 const float *data,
76 Buffer *buffer = 0
77 );
82 static GLTFWRITERSPEC Attribute *CreatePosition(GLTF *gltf,
83 unsigned int count,
84 const float *data,
85 Buffer *buffer = 0
86 );
89 static GLTFWRITERSPEC Attribute *CreateColor(GLTF *gltf,
90 AttributeType type,
91 unsigned int count,
92 const float *data,
93 Buffer *buffer = 0
94 );
97 static GLTFWRITERSPEC Attribute *CreatePointSize(GLTF *gltf,
98 unsigned int count,
99 const float *data,
100 Buffer *buffer = 0
101 );
106 unsigned int count,
107 const float* data,
108 Buffer* buffer = 0
109 );
114 static GLTFWRITERSPEC Attribute *CreateNormal(GLTF *gltf,
115 unsigned int count,
116 const float *data,
117 Buffer *buffer = 0
118 );
127 static GLTFWRITERSPEC Attribute *CreateTextureCoord(GLTF *gltf,
128 unsigned int num,
129 unsigned int count,
130 const float *data,
131 Buffer *buffer = 0
132 );
133
140 GLTFWRITERSPEC virtual bool SetMinMax(AttributeType type,
141 const int *mn,
142 const int *mx
143 ) = 0;
150 GLTFWRITERSPEC virtual bool SetMinMax(AttributeType type,
151 const float *mn,
152 const float *mx
153 ) = 0;
155 GLTFWRITERSPEC virtual void SetLogarithmic(bool log
156 ) = 0;
157 };
158
159} } }
160
161#endif
Attributes define the per element index values for elements defined by Index.
static Attribute * Create(GLTF *gltf, const char *name, AttributeType type, unsigned int count, const int *data, Buffer *buffer=0)
@ AT_FLOAT_MAT4
4x4 (16) AT_FLOATs
static Attribute * CreateNormal(GLTF *gltf, unsigned int count, const float *data, Buffer *buffer=0)
static Attribute * Create(GLTF *gltf, const char *name, AttributeType type, unsigned int count, const float *data, Buffer *buffer=0)
virtual void SetLogarithmic(bool log)=0
static Attribute * CreatePointSize(GLTF *gltf, unsigned int count, const float *data, Buffer *buffer=0)
static Attribute * CreateDisplacementScale(GLTF *gltf, unsigned int count, const float *data, Buffer *buffer=0)
static Attribute * CreateTextureCoord(GLTF *gltf, unsigned int num, unsigned int count, const float *data, Buffer *buffer=0)
virtual bool SetMinMax(AttributeType type, const int *mn, const int *mx)=0
static Attribute * CreatePosition(GLTF *gltf, unsigned int count, const float *data, Buffer *buffer=0)
virtual bool SetMinMax(AttributeType type, const float *mn, const float *mx)=0
static Attribute * CreateColor(GLTF *gltf, AttributeType type, unsigned int count, const float *data, Buffer *buffer=0)
Buffers define files that are used to contain attribute and index data.
Definition GLTFBuffer.h:36
This is the main class of the GLTFWriter.
Definition GLTFGLTF.h:32
GLTFWriter API Documentation.

Connect with Ansys