Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
TransformationNode.h
Go to the documentation of this file.
1#ifndef ULT_TRANSFORMATION_NODE_H_INCLUDED
2#define ULT_TRANSFORMATION_NODE_H_INCLUDED
3
4#include "Math/Quaternion.h"
5#include "Math/Vector3D.h"
6#include "Node.h"
8
9namespace Ult
10{
11
18{
19public:
24 const Vector3D& position,
25 const Quaternion& q,
26 RenderInterface* renderer) :
27 mPosition(position),
28 mQuaternion(q),
29 mRenderer(renderer)
30 {}
31
35 {}
36
42 void Process() {
43 if (mRenderer) {
44 mRenderer->PushMatrix();
45 float matrix[16] = {0};
46 mQuaternion.CreateMatrix(matrix);
47 matrix[12] = mPosition.x;
48 matrix[13] = mPosition.y;
49 matrix[14] = mPosition.z;
50 mRenderer->MultiplyToCurrentMatrix(matrix);
51 }
52 if (mChild) {
53 mChild->Process();
54 }
55 if (mRenderer) {
56 mRenderer->PopMatrix();
57 }
58 if (mNext) {
59 mNext->Process();
60 }
61 }
62protected:
66};
67
68} // namespace Ult
69
70#endif // ULT_TRANSFORMATION_NODE_H_INCLUDED
71
Node()
Definition Node.h:17
Node * mNext
Definition Node.h:76
Node * mChild
Definition Node.h:78
Definition Quaternion.h:14
Definition RenderInterface.h:34
Quaternion mQuaternion
Definition TransformationNode.h:64
void Process()
Definition TransformationNode.h:42
Vector3D mPosition
Definition TransformationNode.h:63
virtual ~TransformationNode()
Definition TransformationNode.h:34
TransformationNode(const Vector3D &position, const Quaternion &q, RenderInterface *renderer)
Definition TransformationNode.h:23
RenderInterface * mRenderer
Definition TransformationNode.h:65
Definition Vector3D.h:12
Definition Archive.h:13