diff options
author | chai <chaifix@163.com> | 2019-04-02 21:45:33 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-04-02 21:45:33 +0800 |
commit | af7bdaa10ee71a319dc55c3c7556fa43a95c9dc9 (patch) | |
tree | 58611985001b78c5a76b78ae146fdb07dde31c1d /source/modules/asura-core/graphics/matrix_stack.h | |
parent | 250e30d73f09e9da2b5a81d0fbae63744ae12a73 (diff) |
*misc
Diffstat (limited to 'source/modules/asura-core/graphics/matrix_stack.h')
-rw-r--r-- | source/modules/asura-core/graphics/matrix_stack.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/source/modules/asura-core/graphics/matrix_stack.h b/source/modules/asura-core/graphics/matrix_stack.h new file mode 100644 index 0000000..1923b30 --- /dev/null +++ b/source/modules/asura-core/graphics/matrix_stack.h @@ -0,0 +1,82 @@ +#ifndef __ASURA_MATRIX_STACK_H__ +#define __ASURA_MATRIX_STACK_H__ + +#include <asura-utils/type.h> +#include <asura-utils/math/matrix44.h> + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// ջľȡ + /// +#define ASURA_MAX_MATRIX_STACK_DEPTH 32 // 2KB + + /// + /// ջ״ָ̬֮ǰ״̬ջеһstack[i]ֵstack[0]*..*stack[i-1] + /// ֵһϵtransform + /// + /// TODO: template<uint _capacity> MatrixStack + /// + class MatrixStack + { + public: + + MatrixStack(); + ~MatrixStack(); + + /// + /// ջԪصIJֻͨºʵ + /// + void LoadIdentity(); + bool Push(); + bool Pop(); + + AEMath::Matrix44& GetTop(); + void GetTop(asura_out AEMath::Matrix44& mat44); + + void LoadMatrix(const AEMath::Matrix44& mat44); + void MultMatrix(const AEMath::Matrix44& mat44); + + /// + /// 任 + /// + void Rotate(float angle, float x, float y, float z); + void Translate(float x, float y, float z); + void Scale(float x, float y, float z); + + /// + /// ͶӰ任 + /// + void Ortho(float left, float right, float bottom, float top, float near, float far); + //void Perspective(float fov, float aspect, float near, float far); + //void Frustum(float left, float right, float top, float bottom, float near, float far); + //void LookAt(float x, float y, float z, float cx, float cy, float cz, float ux, float uy, float uz); + + /// + /// ջΧ0~ASURA_MAX_MATRIX_STACK_DEPTH-1 + /// + uint GetTopIndex(); + + /// + /// ջASURA_MAX_MATRIX_STACK_DEPTH + /// + uint GetCapacity(); + + private: + + AEMath::Matrix44 mStack[ASURA_MAX_MATRIX_STACK_DEPTH]; + + /// + /// ջ0~ASURA_MAX_MATRIX_STACK_DEPTH-1 + /// + uint8 top; + + }; + + } +} + +#endif
\ No newline at end of file |