From af7bdaa10ee71a319dc55c3c7556fa43a95c9dc9 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 2 Apr 2019 21:45:33 +0800 Subject: *misc --- .../modules/asura-core/graphics/matrix_stack.cpp | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 source/modules/asura-core/graphics/matrix_stack.cpp (limited to 'source/modules/asura-core/graphics/matrix_stack.cpp') diff --git a/source/modules/asura-core/graphics/matrix_stack.cpp b/source/modules/asura-core/graphics/matrix_stack.cpp new file mode 100644 index 0000000..72ffb7d --- /dev/null +++ b/source/modules/asura-core/graphics/matrix_stack.cpp @@ -0,0 +1,61 @@ +#include "matrix_stack.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + MatrixStack::MatrixStack() + : top(0) + { + // 栈的最下面初始就是栈顶,并用此保证栈永远非空(即可以取值) + mStack[top].SetIdentity(); + } + + MatrixStack::~MatrixStack() + { + } + + void MatrixStack::LoadIdentity() + { + mStack[top].SetIdentity(); + } + + bool MatrixStack::Push() + { + if (top == ASURA_MAX_MATRIX_STACK_DEPTH - 1) + return false; + ++top; + mStack[top] = mStack[top - 1]; + return true; + } + + bool MatrixStack::Pop() + { + if (top == 0) + return false; + --top; + return true; + } + + AEMath::Matrix44& MatrixStack::GetTop() + { + return mStack[top]; + } + + uint MatrixStack::GetTopIndex() + { + return top; + } + + uint MatrixStack::GetCapacity() + { + return ASURA_MAX_MATRIX_STACK_DEPTH; + } + + void MatrixStack::Ortho(float left, float right, float bottom, float top, float near, float far) + { + } + + } +} \ No newline at end of file -- cgit v1.1-26-g67d0