irrlicht/source/Irrlicht/CB3DJSONMeshFileLoader.h

52 lines
1.2 KiB
C
Raw Normal View History

#pragma once
2023-11-26 08:03:32 +01:00
#include "IAnimatedMesh.h"
#include "IMeshLoader.h"
#include "CSkinnedMesh.h"
2023-11-26 08:03:32 +01:00
#include "IReadFile.h"
2023-11-28 12:08:17 +01:00
#include "SB3DStructs.h"
2023-11-26 08:03:32 +01:00
#include "path.h"
2023-11-28 11:25:09 +01:00
#include "json/json.hpp"
2023-11-28 11:38:24 +01:00
#include <tuple>
2023-11-28 11:25:09 +01:00
using json = nlohmann::json;
2023-11-26 08:03:32 +01:00
namespace irr
{
namespace scene
{
class CB3DJSONMeshFileLoader : public IMeshLoader
{
private:
// Fields.
CSkinnedMesh* AnimatedMesh;
2023-11-28 12:08:17 +01:00
core::array<SB3dTexture> Textures;
/*
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 JSONDataContainer;
// Methods.
2023-11-28 11:09:46 +01:00
CSkinnedMesh* cleanUp(std::string);
2023-11-28 11:38:24 +01:00
std::tuple<bool, std::string> parseJSONFile(io::IReadFile* file);
2023-11-28 11:21:34 +01:00
std::tuple<bool, std::string> load();
2023-11-28 12:08:17 +01:00
std::tuple<bool, std::string> readChunkTEXS();
2023-11-28 14:03:34 +01:00
std::tuple<bool, std::string> readChunkBRUS();
2023-11-26 08:03:32 +01:00
public:
CB3DJSONMeshFileLoader();
bool isALoadableFileExtension(const io::path& fileName) const override;
IAnimatedMesh* createMesh(io::IReadFile* file) override;
};// class CB3DJSONMeshFileLoader
} // namespace scene
} // namespace irr