SpiecsEngine
 
Loading...
Searching...
No Matches

◆ GltfAccessors()

Spices::GltfAccessors::GltfAccessors ( const Json & data)
inlineexplicit

Constructor Function.

Parameters
[in]dataSpecific Json element.

Definition at line 40 of file GltfAccessors.h.

41 : GltfObject(data)
42 {
44
45 m_AccessorsData.resize(data.size());
46
47 for (int i = 0; i < data.size(); i++)
48 {
49 Item& item = m_AccessorsData[i];
50 const Json& json = data[i];
51
52 item.bufferView = GltfHelper::GetElementInt(json, "bufferView", -1);
53 item.byteOffset = GltfHelper::GetElementInt(json, "byteOffset", 0);
54 item.componentType = GltfHelper::GetElementInt(json, "componentType", -1);
55 item.count = GltfHelper::GetElementInt(json, "count", -1);
56 item.max = GltfHelper::GetVector(GltfHelper::GetElementJsonArray(json, "max", { 0.0, 0.0, 0.0, 0.0 }));
57 item.min = GltfHelper::GetVector(GltfHelper::GetElementJsonArray(json, "min", { 0.0, 0.0, 0.0, 0.0 }));
58 item.type = GltfHelper::GetElementString(json, "type", "");
59 }
60 }
#define SPICES_PROFILE_ZONE
std::vector< Item > m_AccessorsData
Data of Gltf Json Accessors.
static Json::array_t GetElementJsonArray(const Json::object_t &root, const char *path, Json::array_t pDefault)
Get array value in Json::object_t.
static int GetElementInt(const Json::object_t &root, const char *path, int pDefault)
Get int 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.
static glm::vec4 GetVector(const Json::array_t &accessor)
Turn a Json::array_t to glm::vec4.
GltfObject(const Json &data)
Constructor Function.
Definition GltfObject.h:33
nlohmann::json Json
using Json insteadd of nlohmann::json
Definition GltfObject.h:25

References GltfAccessors().

Referenced by GltfAccessors().