Constructor Function.
46 {
48
50
51 for (int i = 0; i < data.size(); i++)
52 {
54 Json::object_t node = data[i];
55
57
58 if (node.find("children") != node.end())
59 {
60 for (int c = 0; c < node["children"].size(); c++)
61 {
62 uint32_t nodeId = node["children"][c];
63 item.children.push_back(nodeId);
64 }
65 }
66
69
70 if (node.find("matrix") != node.end())
71 {
73 }
74 else
75 {
79 item.rotation = glm::toMat4(glm::quat({ rotate.w, rotate.x, rotate.y, rotate.z }));
80
81 item.matrix = glm::translate(glm::mat4(1.0f), glm::vec3(item.translation)) * item.rotation * glm::scale(glm::mat4(1.0f), glm::vec3(item.scale));
82 }
83 }
84 }
#define SPICES_PROFILE_ZONE
static glm::mat4 GetMatrix(const Json::array_t &accessor)
Turn a Json::array_t to glm::mat4.
static int GetElementInt(const Json::object_t &root, const char *path, int pDefault)
Get int value in Json::object_t.
static glm::vec4 GetElementVector(Json::object_t &root, const char *path, glm::vec4 pDefault)
Get vec4 value in Json::object_t.
static std::string GetElementString(const Json::object_t &root, const char *path, const std::string &pDefault)
Get string value in Json::object_t.
std::vector< Item > m_NodesData
Data of Gltf Json Nodes.
GltfObject(const Json &data)
Constructor Function.