From 132f1ae5d619d0c31ac5650d0034d357a4c7b145 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Tue, 28 Nov 2023 05:02:31 -0500 Subject: [PATCH] Now we can use C++ tricks to make this easier --- source/Irrlicht/CB3DJSONMeshFileLoader.cpp | 14 ++++++++------ source/Irrlicht/CB3DJSONMeshFileLoader.h | 12 ++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/source/Irrlicht/CB3DJSONMeshFileLoader.cpp b/source/Irrlicht/CB3DJSONMeshFileLoader.cpp index a23c0642..6bb7f30f 100644 --- a/source/Irrlicht/CB3DJSONMeshFileLoader.cpp +++ b/source/Irrlicht/CB3DJSONMeshFileLoader.cpp @@ -191,13 +191,16 @@ void CB3DJSONMeshFileLoader::cleanUp(std::string failure) { AnimatedMesh = 0; } -IAnimatedMesh* CB3DJSONMeshFileLoader::createMesh(io::IReadFile* file) { +bool CB3DJSONMeshFileLoader::parseJSONFile() { +} + +IAnimatedMesh* CB3DJSONMeshFileLoader::createMesh(io::IReadFile* file) { // Less than zero? What is this file a black hole? if (file->getSize() <= 0) { this->cleanUp("B3D JSON severe error! File size is 0!"); - return nullptr; + return AnimatedMesh; } // So here we turn this mangled disaster into a C string. @@ -214,7 +217,6 @@ IAnimatedMesh* CB3DJSONMeshFileLoader::createMesh(io::IReadFile* file) { output[file->getSize()] = '\0'; // We have to catch a JSON parse error or else the game will segfault. - json data; try { data = json::parse(output); } catch (const json::parse_error& e) { @@ -236,10 +238,10 @@ IAnimatedMesh* CB3DJSONMeshFileLoader::createMesh(io::IReadFile* file) { } // Now we can start doing a full parse of the data in the model JSON. - IAnimatedMesh* finalizedModel = parseModel(data); + const bool placeholder = parseModel(data); - - return finalizedModel; + println("We got to the end."); + return nullptr; } } // namespace scene diff --git a/source/Irrlicht/CB3DJSONMeshFileLoader.h b/source/Irrlicht/CB3DJSONMeshFileLoader.h index 9af346b6..c4bd0dba 100644 --- a/source/Irrlicht/CB3DJSONMeshFileLoader.h +++ b/source/Irrlicht/CB3DJSONMeshFileLoader.h @@ -15,8 +15,20 @@ namespace scene class CB3DJSONMeshFileLoader : public IMeshLoader { private: + // Fields. CSkinnedMesh* AnimatedMesh; + /* + Quick note about JSON. + This is static memory, it's a static memory address so I do not think + that this needs to be freed. + So once this model goes out of scope, I'm pretty sure that this will + be pointing to the next model. Or maybe the last model loaded. + */ + json data; + + // Methods. void cleanUp(std::string); + bool parseJSONFile(); public: