EHS/include/io/model/Model.h

81 lines
1.3 KiB
C
Raw Normal View History

2023-12-17 03:29:08 -08:00
#pragma once
2023-12-17 15:00:08 -08:00
#include "EHS.h"
#include "Array.h"
2023-12-17 15:56:13 -08:00
#include "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
Array<Mesh> GetMeshes() const;
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
Bone GetSkeleton() const;
Bone& GetSkeleton();
2023-12-18 02:13:20 -08:00
Animation* GetAnimation(UInt_64 inHashId);
2023-12-17 03:29:08 -08:00
Array<Animation> GetAnimations() const;
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);
};
}