EHS
Loading...
Searching...
No Matches
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 {
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
46
48
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
70
71 Mesh* GetMesh(UInt_64 inHashId);
72
73 Mesh* GetMesh(const Str_8& inId);
74
75 const Bone& GetSkeleton() const;
76
78
79 Animation* GetAnimation(UInt_64 inHashId);
80
81 const Array<Animation>& GetAnimations() const;
82
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
BaseObj()
Definition BaseObj.cpp:10
Definition Bone.h:10
Definition MdlCodec.h:16
Definition Mdl.h:19
Mdl & operator=(Mdl &&model) noexcept
Definition Mdl.cpp:99
Array< Mesh > meshes
Definition Mdl.h:26
const Array< Animation > & GetAnimations() const
Definition Mdl.cpp:183
static bool HasCodec(UInt_64 hashExt)
Definition Mdl.cpp:7
void Calculate()
Definition Mdl.cpp:193
Mdl()
Definition Mdl.cpp:45
static bool AddCodec(MdlCodec codec)
Definition Mdl.cpp:21
bool Export(const Str_8 &filePath) const
Definition Mdl.cpp:199
Str_8 id
Definition Mdl.h:25
Animation * GetAnimation(UInt_64 inHashId)
Definition Mdl.cpp:174
Array< Animation > animations
Definition Mdl.h:28
void Release()
Definition Mdl.cpp:117
static const MdlCodec * GetCodec(UInt_64 hashExt)
Definition Mdl.cpp:31
Mdl(const Mdl &model)=default
Str_8 GetId() const
Definition Mdl.cpp:135
const Bone & GetSkeleton() const
Definition Mdl.cpp:164
UInt_64 hashId
Definition Mdl.h:24
void SetId(Str_8 newId)
Definition Mdl.cpp:129
Mdl & operator=(const Mdl &model)=default
Bone skeleton
Definition Mdl.h:27
const Array< Mesh > & GetMeshes() const
Definition Mdl.cpp:140
UInt_64 GetHashId() const
Definition Mdl.cpp:124
Mesh * GetMesh(UInt_64 inHashId)
Definition Mdl.cpp:150
Definition Mesh.h:11
Definition Serializer.h:25
Definition Anchor.h:6
unsigned char UInt_8
Definition Types.h:43
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1902
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
@ EHM
Definition Mdl.h:15