5 #include <ext/tinygltf/tiny_gltf.h>
44 static Model*
read(
const string& pathName,
const string& fileName,
bool useBC7TextureCompression =
true);
53 case TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE:
54 case TINYGLTF_COMPONENT_TYPE_BYTE:
56 case TINYGLTF_COMPONENT_TYPE_UNSIGNED_SHORT:
57 case TINYGLTF_COMPONENT_TYPE_SHORT:
59 case TINYGLTF_COMPONENT_TYPE_UNSIGNED_INT:
60 case TINYGLTF_COMPONENT_TYPE_INT:
62 case TINYGLTF_COMPONENT_TYPE_FLOAT:
64 case TINYGLTF_COMPONENT_TYPE_DOUBLE:
65 return sizeof(double);
76 case TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE:
78 case TINYGLTF_COMPONENT_TYPE_BYTE:
80 case TINYGLTF_COMPONENT_TYPE_UNSIGNED_SHORT:
82 case TINYGLTF_COMPONENT_TYPE_SHORT:
84 case TINYGLTF_COMPONENT_TYPE_UNSIGNED_INT:
86 case TINYGLTF_COMPONENT_TYPE_INT:
88 case TINYGLTF_COMPONENT_TYPE_FLOAT:
90 case TINYGLTF_COMPONENT_TYPE_DOUBLE:
102 case TINYGLTF_TYPE_VEC2:
104 case TINYGLTF_TYPE_VEC3:
106 case TINYGLTF_TYPE_VEC4:
108 case TINYGLTF_TYPE_MAT2:
110 case TINYGLTF_TYPE_MAT3:
112 case TINYGLTF_TYPE_MAT4:
114 case TINYGLTF_TYPE_SCALAR:
116 case TINYGLTF_TYPE_VECTOR:
118 case TINYGLTF_TYPE_MATRIX:
134 static void interpolateKeyFrames(
int frameTimeCount,
const float* frameTimes,
const vector<Matrix4x4>& keyFrameMatrices,
int interpolatedMatrixCount, vector<Matrix4x4>& interpolatedMatrices,
int frameStartIdx);
148 static Node*
parseNode(
const string& pathName,
const string& fileName, tinygltf::Model& gltfModel,
int gltfNodeIdx,
Model* model,
Node* parentNode,
int& anonymousNodeIdx,
bool useBC7TextureCompression);
160 static void parseNodeChildren(
const string& pathName,
const string& fileName, tinygltf::Model& gltfModel,
const vector<int>& gltfNodeChildrenIdx,
Node* parentNode,
int& anonymousNodeIdx,
bool useBC7TextureCompression);
170 return pathName +
"/" + fileName +
"-" + imageName +
".png";
static void computeTangentsAndBitangents(Node *node)
Compute tangents and bitangents.
static string getComponentTypeString(int type)
static string getTypeString(int type)
static const Matrix4x4 getNodeScaleMatrix(const tinygltf::Model &gltfModel, const string &nodeId)
Get node scale matrix.
static size_t getComponentTypeByteSize(int type)
static Node * parseNode(const string &pathName, const string &fileName, tinygltf::Model &gltfModel, int gltfNodeIdx, Model *model, Node *parentNode, int &anonymousNodeIdx, bool useBC7TextureCompression)
Parse GLTF node.
static void parseNodeChildren(const string &pathName, const string &fileName, tinygltf::Model &gltfModel, const vector< int > &gltfNodeChildrenIdx, Node *parentNode, int &anonymousNodeIdx, bool useBC7TextureCompression)
Parse GLTF node children into TDME node.
static const string determineTextureFileName(const string &pathName, const string &fileName, const string &imageName)
Determine texture file name.
static const Matrix4x4 getNodeTranslationMatrix(const tinygltf::Model &gltfModel, const string &nodeId)
Get node translation matrix.
static const Matrix4x4 getNodeRotationMatrix(const tinygltf::Model &gltfModel, const string &nodeId)
Get node rotation matrix.
static void interpolateKeyFrames(int frameTimeCount, const float *frameTimes, const vector< Matrix4x4 > &keyFrameMatrices, int interpolatedMatrixCount, vector< Matrix4x4 > &interpolatedMatrices, int frameStartIdx)
Interpolate key frames to our internal 30fps format.
static Model * read(const string &pathName, const string &fileName, bool useBC7TextureCompression=true)
Reads GLTF file.
Representation of a 3D model.
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.