Constructor Function.
Read buffer file.
40 {
42
44
45 for (int i = 0; i < data.size(); i++)
46 {
48 const Json& json = data[i];
49
52
56 std::stringstream file;
57 file << path.string() << "/" << item.uri;
58
59 std::ifstream
f(file.str(), std::ios::in | std::ios::binary);
60 if (!f)
61 {
62 std::stringstream ss;
63 ss << "Buffer Files: " << file.str() << " is not finded.";
64
65 SPICES_CORE_ERROR(ss.str())
66 continue;
67 }
68
69 f.seekg(0, f.end);
70 std::streamoff length = f.tellg();
71 f.seekg(0, f.beg);
72
73 item.buffer =
std::make_unique<
std::vector<
char>>(length, 0);
74 f.read(item.buffer->data(), length);
75 }
76 }
#define SPICES_PROFILE_ZONE
std::filesystem::path m_Path
gltf file directory path.
std::vector< Item > m_BuffersData
Data of Gltf Json Buffers.
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.
GltfObject(const Json &data)
Constructor Function.
nlohmann::json Json
using Json insteadd of nlohmann::json