diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Graphics/MatrixStack.h |
Diffstat (limited to 'Runtime/Graphics/MatrixStack.h')
-rw-r--r-- | Runtime/Graphics/MatrixStack.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Runtime/Graphics/MatrixStack.h b/Runtime/Graphics/MatrixStack.h new file mode 100644 index 0000000..fe11a18 --- /dev/null +++ b/Runtime/Graphics/MatrixStack.h @@ -0,0 +1,32 @@ +#pragma once + +#include "Runtime/Math/Matrix4x4.h" + + +class MatrixStack +{ +public: + enum { kStackDepth = 16 }; + +public: + MatrixStack() { Reset(); } + + void Reset(); + + void SetMatrix( const float matrix[16] ); + void SetCurrentIdentity(); + void MultMatrix( const float matrix[16] ); + const Matrix4x4f& GetMatrix() const; + + void Push(const float* matrix); + void Push(); + void Pop(); + + int GetCurrentDepth() const { return m_Depth; } + +private: + Matrix4x4f& GetMatrix4x4f (int index); + + Matrix4x4f m_Matrices[kStackDepth]; + int m_Depth; +}; |