From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/Graphics/MatrixStack.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Runtime/Graphics/MatrixStack.h (limited to 'Runtime/Graphics/MatrixStack.h') 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; +}; -- cgit v1.1-26-g67d0