From 66c9f3c3c5bc8bf1f947b36587157406050ba399 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Tue, 28 Nov 2023 08:15:23 -0500 Subject: [PATCH] Framework for BRUS --- source/Irrlicht/CB3DJSONMeshFileLoader.cpp | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/source/Irrlicht/CB3DJSONMeshFileLoader.cpp b/source/Irrlicht/CB3DJSONMeshFileLoader.cpp index 6a43c477..5c3d0267 100644 --- a/source/Irrlicht/CB3DJSONMeshFileLoader.cpp +++ b/source/Irrlicht/CB3DJSONMeshFileLoader.cpp @@ -211,9 +211,37 @@ std::tuple parseNode(json data, SMeshBuffer* meshBuffer) { /** * Returns (success, failure reason). + * [optional] */ std::tuple CB3DJSONMeshFileLoader::readChunkBRUS() { + //? Can skip number of BRUS because JSON. :D + //? note: BRUS is an array of objects. + + json brus; + + // We're checking the root of the JSON structure here. So we can just peak directly into the root. + if (JSONDataContainer.contains("BRUS") && JSONDataContainer["BRUS"].is_array()) { + + brus = JSONDataContainer["BRUS"]; + + } else { + + // We also want to warn developers if they're using {} instead of []. + if (JSONDataContainer.contains("BRUS") && !JSONDataContainer["BRUS"].is_array()) { + return {false, "BRUS is not an array."}; + } + + // Since it's optional, it succeeds if it's not there. + return {true, ""}; + } + + int index = 0; + for (auto reference = brus.begin(); reference != brus.end(); ++reference) { + + + index++; + } return {true, ""}; }