Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
DynamicModel.h
Go to the documentation of this file.
1#ifndef ULT_DYNAMIC_MODEL_H_INCLUDED
2#define ULT_DYNAMIC_MODEL_H_INCLUDED
3
4#include "Math/Matrix4x4.h"
5#include "ModelData.h"
6#include "Effect/Effect.h"
8#include "ResourceManager.h"
9
10#define ULT_MAX_LOD 3
11
12namespace Ult
13{
14
20{
21public:
26 {
27 for (int i=0; i<ULT_MAX_LOD; i++) {
28 mModelHandle[i].Nullify();
29 }
30 mEffectHandle.Nullify();
31 mIsVisible = true;
32 mCurrentLOD = 0;
33 }
34
37 virtual ~DynamicModel() {
38 for (int i=0; i<ULT_MAX_LOD; i++) {
39 mModelHandle[i].Nullify();
40 }
41 mEffectHandle.Nullify();
42 }
43
47 float* GetTransformation() { return mTransformationMatrix.matrix; }
51 void SetTransformation(const Matrix4x4& m) { mTransformationMatrix = m; }
52
56 Handle<ModelResourceTag>& GetModelHandle() { return mModelHandle[mCurrentLOD]; }
60 Handle<EffectResourceTag>& GetEffectHandle() { return mEffectHandle; }
61
66 mModelHandle[mCurrentLOD].Initialize(handle.GetIndex());
67 }
68
72 mEffectHandle.Initialize(handle.GetIndex());
73 }
74
78 void SetCurrentLOD(const int index) {
79 if (index >= 0 && index < ULT_MAX_LOD) {
80 mCurrentLOD = index;
81 }
82 }
83
86 int GetCurrentLOD() const { return mCurrentLOD; }
87
91 void SetIsVisible(const bool val) { mIsVisible = val; }
95 bool GetIsVisible() const { return mIsVisible; }
96
97private:
99 Handle<EffectResourceTag> mEffectHandle;
100 Matrix4x4 mTransformationMatrix;
101
102 int mCurrentLOD;
103 bool mIsVisible;
104};
105
106} // namespace Ult
107
108#endif // ULT_DYNAMIC_MODEL_H_INCLUDED
109
#define ULT_MAX_LOD
Definition DynamicModel.h:10
int GetCurrentLOD() const
Definition DynamicModel.h:86
DynamicModel()
Definition DynamicModel.h:25
float * GetTransformation()
Definition DynamicModel.h:47
bool GetIsVisible() const
Definition DynamicModel.h:95
void SetEffectHandle(Handle< EffectResourceTag > &handle)
Definition DynamicModel.h:71
Handle< ModelResourceTag > & GetModelHandle()
Definition DynamicModel.h:56
Handle< EffectResourceTag > & GetEffectHandle()
Definition DynamicModel.h:60
void SetModelHandle(Handle< ModelResourceTag > &handle)
Definition DynamicModel.h:65
void SetTransformation(const Matrix4x4 &m)
Definition DynamicModel.h:51
virtual ~DynamicModel()
Definition DynamicModel.h:37
void SetIsVisible(const bool val)
Definition DynamicModel.h:91
void SetCurrentLOD(const int index)
Definition DynamicModel.h:78
Definition Handle.h:13
int GetIndex() const
Definition Handle.h:36
Definition Matrix4x4.h:14
Definition Archive.h:13