2023-12-17 03:29:08 -08:00
|
|
|
#pragma once
|
|
|
|
|
2024-01-14 09:38:57 -08:00
|
|
|
#include "ehs/EHS.h"
|
|
|
|
#include "ehs/Array.h"
|
|
|
|
#include "ehs/io/File.h"
|
2023-12-17 03:29:08 -08:00
|
|
|
#include "Mesh.h"
|
|
|
|
#include "Bone.h"
|
|
|
|
#include "Animation.h"
|
|
|
|
|
2023-12-17 15:56:13 -08:00
|
|
|
namespace ehs
|
2023-12-17 03:29:08 -08:00
|
|
|
{
|
|
|
|
enum class ModelEncoding : UInt_8
|
|
|
|
{
|
|
|
|
EHM
|
|
|
|
};
|
|
|
|
|
2023-12-18 02:13:20 -08:00
|
|
|
class Model : public BaseObj
|
2023-12-17 03:29:08 -08:00
|
|
|
{
|
|
|
|
protected:
|
2023-12-18 02:13:20 -08:00
|
|
|
UInt_64 hashId;
|
|
|
|
Str_8 id;
|
2023-12-17 03:29:08 -08:00
|
|
|
Array<Mesh> meshes;
|
|
|
|
Bone skeleton;
|
|
|
|
Array<Animation> animations;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Model();
|
|
|
|
|
|
|
|
Model(const Str_8& filePath);
|
|
|
|
|
|
|
|
Model(Str_8 id, Array<Mesh> meshes, Bone skeleton, Array<Animation> animations);
|
|
|
|
|
|
|
|
Model(Str_8 id, Array<Mesh> meshes, Bone skeleton);
|
|
|
|
|
|
|
|
Model(Str_8 id, Array<Mesh> meshes);
|
|
|
|
|
|
|
|
Model(Model&& model) noexcept;
|
|
|
|
|
|
|
|
Model(const Model& model) = default;
|
|
|
|
|
|
|
|
Model& operator=(Model&& model) noexcept;
|
|
|
|
|
|
|
|
Model& operator=(const Model& model) = default;
|
|
|
|
|
2023-12-18 02:13:20 -08:00
|
|
|
void Release();
|
2023-12-17 03:29:08 -08:00
|
|
|
|
2023-12-18 02:13:20 -08:00
|
|
|
UInt_64 GetHashId() const;
|
2023-12-17 03:29:08 -08:00
|
|
|
|
2023-12-18 02:13:20 -08:00
|
|
|
void SetId(Str_8 newId);
|
2023-12-17 03:29:08 -08:00
|
|
|
|
2023-12-18 02:13:20 -08:00
|
|
|
Str_8 GetId() const;
|
2023-12-17 03:29:08 -08:00
|
|
|
|
2024-01-23 17:26:27 -08:00
|
|
|
const Array<Mesh>& GetMeshes() const;
|
2023-12-17 03:29:08 -08:00
|
|
|
|
|
|
|
Array<Mesh>& GetMeshes();
|
|
|
|
|
2023-12-18 02:13:20 -08:00
|
|
|
Mesh* GetMesh(UInt_64 inHashId);
|
2023-12-17 03:29:08 -08:00
|
|
|
|
2023-12-18 02:13:20 -08:00
|
|
|
Mesh* GetMesh(const Str_8& inId);
|
2023-12-17 03:29:08 -08:00
|
|
|
|
2024-01-23 17:26:27 -08:00
|
|
|
const Bone& GetSkeleton() const;
|
2023-12-17 03:29:08 -08:00
|
|
|
|
|
|
|
Bone& GetSkeleton();
|
|
|
|
|
2023-12-18 02:13:20 -08:00
|
|
|
Animation* GetAnimation(UInt_64 inHashId);
|
2023-12-17 03:29:08 -08:00
|
|
|
|
2024-01-23 17:26:27 -08:00
|
|
|
const Array<Animation>& GetAnimations() const;
|
2023-12-17 03:29:08 -08:00
|
|
|
|
|
|
|
Array<Animation>& GetAnimations();
|
|
|
|
|
|
|
|
void Calculate();
|
|
|
|
|
2023-12-18 02:13:20 -08:00
|
|
|
void Export(const Str_8& filePath, ModelEncoding encoding);
|
2023-12-17 03:29:08 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
void ToEHM(File& file);
|
|
|
|
|
|
|
|
void FromEHM(File& file);
|
|
|
|
};
|
|
|
|
}
|