EHS
Mdl.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/EHS.h"
4#include "ehs/Array.h"
5#include "ehs/io/File.h"
6#include "MdlCodec.h"
7#include "Mesh.h"
8#include "Bone.h"
9#include "Animation.h"
10
11namespace ehs
12{
13 enum class ModelEncoding : UInt_8
14 {
15 EHM
16 };
17
18 class EHS_LIB_IO Mdl : public BaseObj
19 {
20 private:
21 static Array<MdlCodec> codecs;
22
23 protected:
24 UInt_64 hashId;
29
30 public:
31 static bool HasCodec(UInt_64 hashExt);
32
33 static bool HasCodec(const Str_8& ext);
34
35 static bool AddCodec(MdlCodec codec);
36
37 static const MdlCodec* GetCodec(UInt_64 hashExt);
38
39 static const MdlCodec* GetCodec(const Str_8& ext);
40
41 Mdl();
42
43 Mdl(const Str_8& filePath);
44
45 Mdl(Str_8 id, Array<Mesh> meshes, Bone skeleton, Array<Animation> animations);
46
47 Mdl(Str_8 id, Array<Mesh> meshes, Bone skeleton);
48
49 Mdl(Str_8 id, Array<Mesh> meshes);
50
51 Mdl(Mdl&& model) noexcept;
52
53 Mdl(const Mdl& model) = default;
54
55 Mdl& operator=(Mdl&& model) noexcept;
56
57 Mdl& operator=(const Mdl& model) = default;
58
59 void Release();
60
61 UInt_64 GetHashId() const;
62
63 void SetId(Str_8 newId);
64
65 Str_8 GetId() const;
66
67 const Array<Mesh>& GetMeshes() const;
68
69 Array<Mesh>& GetMeshes();
70
71 Mesh* GetMesh(UInt_64 inHashId);
72
73 Mesh* GetMesh(const Str_8& inId);
74
75 const Bone& GetSkeleton() const;
76
77 Bone& GetSkeleton();
78
79 Animation* GetAnimation(UInt_64 inHashId);
80
81 const Array<Animation>& GetAnimations() const;
82
83 Array<Animation>& GetAnimations();
84
85 void Calculate();
86
87 bool Export(const Str_8& filePath) const;
88 };
89
90 bool EncodeEHM(const MdlCodec* codec, Serializer<UInt_64>& data, const Mdl* mdl);
91
92 bool DecodeEHM(const MdlCodec* codec, Serializer<UInt_64>& data, Mdl* mdl);
93}
Definition: Animation.h:11
Definition: Array.h:16
Definition: BaseObj.h:9
Definition: Bone.h:10
Definition: MdlCodec.h:16
Definition: Mdl.h:19
Array< Mesh > meshes
Definition: Mdl.h:26
Str_8 id
Definition: Mdl.h:25
Array< Animation > animations
Definition: Mdl.h:28
Mdl(const Mdl &model)=default
UInt_64 hashId
Definition: Mdl.h:24
Mdl & operator=(const Mdl &model)=default
Bone skeleton
Definition: Mdl.h:27
Definition: Mesh.h:11
Definition: Anchor.h:6
unsigned char UInt_8
Definition: Types.h:43
bool EncodeEHM(const MdlCodec *codec, Serializer< UInt_64 > &data, const Mdl *mdl)
Definition: Mdl.cpp:220
bool DecodeEHM(const MdlCodec *codec, Serializer< UInt_64 > &data, Mdl *mdl)
Definition: Mdl.cpp:246
ModelEncoding
Definition: Mdl.h:14