Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
GeometryNode.h
Go to the documentation of this file.
1#ifndef ULT_GEOMETRY_NODE_H_INCLUDED
2#define ULT_GEOMETRY_NODE_H_INCLUDED
3
4#include "DynamicModel.h"
5#include "Node.h"
6#include "Effect/Effect.h"
8
9namespace Ult
10{
11
16class GeometryNode : public Node
17{
18public:
23 DynamicModel* model,
24 ULT_MODEL_RESOURCE_MANAGER* modelManager,
25 ULT_EFFECT_RESOURCE_MANAGER* effectManager,
26 RenderInterface* renderer) :
27 mModel(model),
28 mModelManager(modelManager),
29 mEffectManager(effectManager),
30 mRenderer(renderer)
31 {}
32
35 virtual ~GeometryNode() {
36 mModel = nullptr;
37 mModelManager = nullptr;
38 mEffectManager = nullptr;
39 mRenderer = nullptr;
40 }
41
46 void Process() {
47 if (mModel && mModelManager && mRenderer) {
48 ModelResource* modelResPtr = nullptr;
49 ModelData* mPtr = nullptr;
50 EffectResource* effectResPtr = nullptr;
51 Effect* effectPtr = nullptr;
52
53 modelResPtr = mModelManager->GetResource(mModel->GetModelHandle());
54 if (mEffectManager) {
55 effectResPtr = mEffectManager->GetResource(mModel->GetEffectHandle());
56 }
57 if (effectResPtr) {
58 effectPtr = effectResPtr->GetEffect();
59 }
60 if (modelResPtr) {
61 mPtr = modelResPtr->GetModel();
62 if (mPtr) {
63 mRenderer->PushMatrix();
64 mRenderer->MultiplyToCurrentMatrix(mModel->GetTransformation());
65 if (effectPtr) {
66 effectPtr->ApplyEffect();
67 }
69 mRenderer->PopMatrix();
70 }
71 }
72 }
73
75 }
76protected:
81};
82
83} // namespace Ult
84
85#endif // ULT_GEOMETRY_NODE_H_INCLUDED
86
#define ULT_EFFECT_RESOURCE_MANAGER
Definition Effect.h:7
#define ULT_RENDER_MODEL_DATA_PARAMS(model)
Definition ModelData.h:7
#define ULT_MODEL_RESOURCE_MANAGER
Definition ModelData.h:13
Definition DynamicModel.h:20
Definition Effect.h:25
virtual void ApplyEffect()=0
Definition Effect.h:56
Effect * GetEffect()
Definition Effect.h:73
virtual ~GeometryNode()
Definition GeometryNode.h:35
DynamicModel * mModel
Definition GeometryNode.h:77
ULT_EFFECT_RESOURCE_MANAGER * mEffectManager
Definition GeometryNode.h:79
void Process()
Definition GeometryNode.h:46
GeometryNode(DynamicModel *model, ULT_MODEL_RESOURCE_MANAGER *modelManager, ULT_EFFECT_RESOURCE_MANAGER *effectManager, RenderInterface *renderer)
Definition GeometryNode.h:22
ULT_MODEL_RESOURCE_MANAGER * mModelManager
Definition GeometryNode.h:78
RenderInterface * mRenderer
Definition GeometryNode.h:80
Definition ModelData.h:26
Definition ModelData.h:108
ModelData * GetModel()
Definition ModelData.h:117
Node()
Definition Node.h:17
virtual void Process()
Definition Node.h:67
Definition RenderInterface.h:34
Definition Archive.h:13