summaryrefslogtreecommitdiff
path: root/Runtime/Graphics/MatrixStack.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Graphics/MatrixStack.h
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/Graphics/MatrixStack.h')
-rw-r--r--Runtime/Graphics/MatrixStack.h32
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;
+};