mirror of
https://github.com/minetest/irrlicht.git
synced 2025-02-22 05:40:26 +01:00
Now we can use C++ tricks to make this easier
This commit is contained in:
parent
80e5da381d
commit
132f1ae5d6
@ -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
|
||||
|
@ -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:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user