diff --git a/source/Irrlicht/CB3DJSONMeshFileLoader.cpp b/source/Irrlicht/CB3DJSONMeshFileLoader.cpp index e3347b03..45293ebc 100644 --- a/source/Irrlicht/CB3DJSONMeshFileLoader.cpp +++ b/source/Irrlicht/CB3DJSONMeshFileLoader.cpp @@ -211,7 +211,15 @@ std::tuple parseNode(json data, SMeshBuffer* meshBuffer) { /** * Returns (success, failure reason). - * This is an optional component of B3D. +*/ +std::tuple CB3DJSONMeshFileLoader::readChunkBRUS() { + + + return {true, ""}; +} + +/** + * Returns (success, failure reason). */ std::tuple CB3DJSONMeshFileLoader::readChunkTEXS() { @@ -364,6 +372,7 @@ std::tuple CB3DJSONMeshFileLoader::readChunkTEXS() { B3DTexture.Angle = t["angle"]; } else { + if (t.contains("angle")) { return {false, "\"angle\" in TEXS block index (" + std::to_string(index) + ") is not a number."}; } @@ -398,13 +407,22 @@ std::tuple CB3DJSONMeshFileLoader::load() { return {false, "Wrong version in B3D JSON! Expected: 1"}; } - // Success, failure reason + // Grab TEXS (textures). std::tuple texturesSuccess = this->readChunkTEXS(); if (!std::get<0>(texturesSuccess)) { return {false, std::get<1>(texturesSuccess)}; } + // Grab BRUS (brushes). Defines where materials go. + std::tuple brushesSuccess = this->readChunkBRUS(); + + if (!std::get<0>(brushesSuccess)) { + return {false, std::get<1>(brushesSuccess)}; + } + + + // return animatedMesh; diff --git a/source/Irrlicht/CB3DJSONMeshFileLoader.h b/source/Irrlicht/CB3DJSONMeshFileLoader.h index 54b0c835..4d6ed212 100644 --- a/source/Irrlicht/CB3DJSONMeshFileLoader.h +++ b/source/Irrlicht/CB3DJSONMeshFileLoader.h @@ -37,6 +37,7 @@ private: std::tuple parseJSONFile(io::IReadFile* file); std::tuple load(); std::tuple readChunkTEXS(); + std::tuple readChunkBRUS(); public: