HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLTF_Types.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) COPYRIGHTYEAR
3  * Side Effects Software Inc. All rights reserved.
4  *
5  * Redistribution and use of Houdini Development Kit samples in source and
6  * binary forms, with or without modification, are permitted provided that the
7  * following conditions are met:
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. The name of Side Effects Software may not be used to endorse or
11  * promote products derived from this software without specific prior
12  * written permission.
13  *
14  * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS
15  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17  * NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  *----------------------------------------------------------------------------
26  */
27 #ifndef __SOP_GLTFTYPES_H__
28 #define __SOP_GLTFTYPES_H__
29 
30 #include "GLTF_API.h"
31 
32 #include <UT/UT_Matrix4.h>
33 #include <UT/UT_Optional.h>
34 #include <UT/UT_String.h>
35 #include <UT/UT_StringHolder.h>
36 #include <UT/UT_StringMap.h>
37 #include <UT/UT_Array.h>
38 #include <UT/UT_Vector3.h>
39 #include <UT/UT_Vector4.h>
40 
41 namespace GLTF_NAMESPACE
42 {
43 
44 #define GLTF_INVALID_IDX uint32(~0)
45 
46 typedef uint32 GLTF_Int;
49 
51 const uint32 GLTF_GLB_MAGIC = 0x46546C67;
52 const uint32 GLTF_GLB_JSON = 0x4E4F534A;
53 const uint32 GLTF_GLB_BIN = 0x004E4942;
54 
55 constexpr const char *GLTF_PROJECTION_NAME_ORTHOGRAPHIC = "ORTHOGRAPHIC";
56 constexpr const char *GLTF_PROJECTION_NAME_PERSPECTIVE = "PERSPECTIVE";
57 constexpr const char *GLTF_TYPE_NAME_SCALAR = "SCALAR";
58 constexpr const char *GLTF_TYPE_NAME_VEC2 = "VEC2";
59 constexpr const char *GLTF_TYPE_NAME_VEC3 = "VEC3";
60 constexpr const char *GLTF_TYPE_NAME_VEC4 = "VEC4";
61 constexpr const char *GLTF_TYPE_NAME_MAT2 = "MAT2";
62 constexpr const char *GLTF_TYPE_NAME_MAT3 = "MAT3";
63 constexpr const char *GLTF_TYPE_NAME_MAT4 = "MAT4";
64 
66 {
75 };
76 
78 {
86 };
87 
89 {
93 };
94 
96 {
104 };
105 
107 {
112 };
113 
114 //=================================================
115 
116 // Represented as a string in the GLTF file
118 {
127 };
128 
130 {
134 };
135 
137 {
142 };
143 
144 //=========================================================================
145 
146 // GLTF types - unimplemented fields are currently displayed as comments in the
147 // structure declarations
148 
150 {
152  GLTF_Int texCoord = 0;
153  // extensions
154  // extras
155 };
156 
158 {
160  // extensions
161  // extras
162 };
163 
165 {
167  GLTF_Int byteOffset = 0;
168  GLTF_ComponentType componentType = GLTF_COMPONENT_INVALID; // Required
169  bool normalized = false;
172 
173  // A double has a 53 bit mantissa, we can therefore cast to either float
174  // or int32 without loss of precision
177 
178  // sparse
180  // extensions
181  // extras
182 };
183 
185 {
186  // channels
189  // extensions
190  // extras
191 };
192 
194 {
195  UT_String copyright = "";
196  UT_String generator = "";
198  UT_String minversion = "";
199  // extensions
200  // extras
201 };
202 
204 {
205  UT_String myURI = "";
208  // extensions
209  // extras
210 };
211 
213 {
214  GLTF_Handle buffer = 0; // Required
215  GLTF_Int byteOffset = 0;
216  GLTF_Int byteLength = 0; // Required
217  GLTF_Int byteStride = 0;
220  // extensions
221  // extras
222 };
223 
225 {
230  // extensions
231  //
232 };
233 
235 {
240  // extensions
241  // extras
242 };
243 
245 {
250  // extensions
251  // extras
252 };
253 
255 {
258  // extensions
259  // extras
260 };
261 
263 {
267  // extensions
268  // extras
269 };
270 
272 {
276  // extensions
277  // extras
278 };
279 
281 {
282  UT_Vector4 baseColorFactor = {0.0f, 0.0f, 0.0f, 1.0f};
284  fpreal32 metallicFactor = 1.0f;
285  fpreal32 roughnessFactor = 1.0f;
287 };
288 
290 {
292  // extensions
293  // extras
298  UT_Vector3F emissiveFactor = {0.0f, 0.0f, 0.0f};
302 };
303 
305 {
310  // targets
311  // extensions
312  // extras
313 };
314 
316 {
318  // weights
320  // extensions
321  // extras
322 };
323 
325 {
331  // extensions
332  // extras
333 };
334 
336 {
337  UT_String uri = "";
338  UT_String mimeType = "";
341  // extensions
342  // extras
343 };
344 
346 {
352  UT_Vector4 rotation = {0, 0, 0, 1};
353  UT_Vector3 scale = {1, 1, 1};
354  UT_Vector3 translation = {0, 0, 0};
355  // weights
357  // Extensions
358  // Extras
359 
360  // GLTF standard specifies that only a Matrix OR TRS transform
361  // is stored.
362  GLTF_TRANSFORM_TYPE getTransformType() const;
363  void getTransformAsMatrix(UT_Matrix4F &mat) const;
364 };
365 
367 {
370  // extensions
371  // extras
372 };
373 
375 {
376  // inverse bind matrices
377  // skeleton
378  // joins
379  // extensions
380  // extras
381 };
382 
384 {
385  // count
386  // indices
387  // values
388  // extensions
389  // extras
390 };
391 
393 {
396  // extensions
397  // extras
398 };
399 
401 {
405  // extensions
406  // extras
407 };
408 
409 } // end GLTF_NAMESPACE
410 
411 #endif
constexpr const char * GLTF_TYPE_NAME_MAT2
Definition: GLTF_Types.h:61
uint32 GLTF_Int
Definition: GLTF_Types.h:46
UT_Optional< GLTF_Orthographic > orthographic
Definition: GLTF_Types.h:246
#define GLTF_API
Definition: GLTF_API.h:37
GLuint const GLchar * name
Definition: glew.h:1814
GLenum mode
Definition: glew.h:2163
GLenum target
Definition: glew.h:2865
GLuint index
Definition: glew.h:1814
constexpr const char * GLTF_PROJECTION_NAME_ORTHOGRAPHIC
Definition: GLTF_Types.h:55
GLenum GLenum GLenum GLenum GLenum scale
Definition: glew.h:13880
UT_Optional< GLTF_PBRMetallicRoughness > metallicRoughness
Definition: GLTF_Types.h:294
uint32 GLTF_Handle
Definition: GLTF_Types.h:48
GLsizei GLsizei GLchar * source
Definition: glew.h:1832
UT_Optional< fpreal32 > zmag
Definition: GLTF_Types.h:238
UT_Array< GLTF_Accessor * > samplers
Definition: GLTF_Types.h:187
float fpreal32
Definition: SYS_Types.h:200
UT_Array< uint32 > children
Definition: GLTF_Types.h:348
UT_Optional< GLTF_TextureInfo > baseColorTexture
Definition: GLTF_Types.h:283
uint32 GLTF_Offset
Definition: GLTF_Types.h:47
const uint32 GLTF_GLB_JSON
Definition: GLTF_Types.h:52
UT_Optional< GLTF_TextureInfo > metallicRoughnessTexture
Definition: GLTF_Types.h:286
const uint32 GLTF_GLB_MAGIC
Definition: GLTF_Types.h:51
UT_Optional< GLTF_Perspsective > perspective
Definition: GLTF_Types.h:247
#define GLTF_NAMESPACE
Definition: GLTF_API.h:42
hboost::optional< T > UT_Optional
Definition: UT_Optional.h:16
constexpr const char * GLTF_TYPE_NAME_VEC4
Definition: GLTF_Types.h:60
constexpr const char * GLTF_TYPE_NAME_VEC3
Definition: GLTF_Types.h:59
UT_Optional< GLTF_TextureInfo > emissiveTexture
Definition: GLTF_Types.h:297
GLuint buffer
Definition: glew.h:1680
UT_Optional< GLTF_NormalTextureInfo > normalTexture
Definition: GLTF_Types.h:295
static const UT_Matrix4T< float > & getIdentityMatrix()
UT_Optional< GLTF_TextureInfo > occlusionTexture
Definition: GLTF_Types.h:296
GLuint GLuint GLsizei GLenum const void * indices
Definition: glew.h:1253
GLuint sampler
Definition: glew.h:3603
UT_Array< GLTF_Primitive > primitives
Definition: GLTF_Types.h:317
constexpr const char * GLTF_PROJECTION_NAME_PERSPECTIVE
Definition: GLTF_Types.h:56
constexpr const char * GLTF_TYPE_NAME_MAT4
Definition: GLTF_Types.h:63
GLTF_ComponentType componentType
Definition: GLTF_Types.h:275
constexpr const char * GLTF_TYPE_NAME_SCALAR
Definition: GLTF_Types.h:57
constexpr const char * GLTF_TYPE_NAME_MAT3
Definition: GLTF_Types.h:62
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
#define GLTF_INVALID_IDX
Definition: GLTF_Types.h:44
UT_Array< fpreal64 > max
Definition: GLTF_Types.h:175
UT_Optional< fpreal32 > aspectRatio
Definition: GLTF_Types.h:236
GLuint GLuint GLsizei count
Definition: glew.h:1253
unsigned int uint32
Definition: SYS_Types.h:40
constexpr const char * GLTF_TYPE_NAME_VEC2
Definition: GLTF_Types.h:58
const uint32 GLB_BUFFER_IDX
Definition: GLTF_Types.h:50
const uint32 GLTF_GLB_BIN
Definition: GLTF_Types.h:53
UT_Array< uint32 > nodes
Definition: GLTF_Types.h:368
UT_StringMap< uint32 > attributes
Definition: GLTF_Types.h:306
GLint GLenum GLboolean normalized
Definition: glew.h:1905
GLuint GLenum matrix
Definition: glew.h:14742
UT_Array< fpreal64 > min
Definition: GLTF_Types.h:176
MatType rotation(const Quat< typename MatType::value_type > &q, typename MatType::value_type eps=static_cast< typename MatType::value_type >(1.0e-8))
Return the rotation matrix specified by the given quaternion.
Definition: Mat.h:177