HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLTF_Util.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 
28 #ifndef __SOP_GLTFUTIL_H__
29 #define __SOP_GLTFUTIL_H__
30 
31 #include "GLTF_API.h"
32 #include "GLTF_Types.h"
33 
34 namespace GLTF_NAMESPACE
35 {
36 
38 {
39 public:
40  template <typename T>
41  static T
43  {
44  return *reinterpret_cast<T *>(data + stride * index);
45  }
46 
47  static const char *typeGetName(GLTF_Type type);
48  static GLTF_Int componentTypeGetBytes(GLTF_ComponentType type);
49  static GLTF_Int typeGetElements(GLTF_Type type);
50  static GLTF_Int
51  getDefaultStride(GLTF_Type type, GLTF_ComponentType component_type);
52 
53  ///
54  /// Returns 0 if previous_stride == 0 and GetDefaultStride otherwise.
55  ///
56  static GLTF_Int getStride(uint32 previous_stride, GLTF_Type type,
57  GLTF_ComponentType component_type);
58 
59  static GLTF_Type getTypeForTupleSize(uint32 tuplesize);
60 
61  ///
62  /// Returns a list of the scene names in the given filename,
63  /// where the index in the returned array corrosponds to the
64  /// scene index, and the value corrosponds to the name if one
65  /// exists, and "" othewise.
66  ///
67  static UT_Array<UT_String> getSceneList(const UT_String &filename);
68 
69  static bool
70  DecomposeMatrixToTRS(const UT_Matrix4F &mat, UT_Vector3F &translation,
72 
73  static const char *getLightTypeName(GLTF_LightType type);
74 };
75 
76 } // end GLTF_NAMESPACE
77 
78 #endif
uint32 GLTF_Int
Definition: GLTF_Types.h:46
#define GLTF_API
Definition: GLTF_API.h:37
GT_API const UT_StringHolder filename
GA_API const UT_StringHolder scale
#define GLTF_NAMESPACE
Definition: GLTF_API.h:42
GLint GLenum GLboolean GLsizei stride
Definition: glcorearb.h:872
SIM_API const UT_StringHolder rotation
GLuint index
Definition: glcorearb.h:786
unsigned int uint32
Definition: SYS_Types.h:40
static T readInterleavedElement(unsigned char *data, uint32 stride, uint32 index)
Definition: GLTF_Util.h:42
type
Definition: core.h:1059
Definition: format.h:895