2023-11-28 10:46:25 +01:00
|
|
|
#pragma once
|
|
|
|
|
2023-11-26 08:03:32 +01:00
|
|
|
#include "IAnimatedMesh.h"
|
|
|
|
#include "IMeshLoader.h"
|
2023-11-28 10:46:25 +01:00
|
|
|
#include "CSkinnedMesh.h"
|
2023-11-26 08:03:32 +01:00
|
|
|
#include "IReadFile.h"
|
|
|
|
#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
|
|
|
|
{
|
2023-11-28 10:46:25 +01:00
|
|
|
private:
|
2023-11-28 11:02:31 +01:00
|
|
|
// Fields.
|
2023-11-28 10:46:25 +01:00
|
|
|
CSkinnedMesh* AnimatedMesh;
|
2023-11-28 11:06:58 +01:00
|
|
|
/*
|
|
|
|
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;
|
2023-11-28 11:02:31 +01:00
|
|
|
|
|
|
|
// 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 10:46:25 +01:00
|
|
|
|
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
|