diff options
author | chai <chaifix@163.com> | 2019-04-03 21:56:51 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-04-03 21:56:51 +0800 |
commit | e13616b5c40f912853be99f0603f0e4c97b22062 (patch) | |
tree | 6663eab986dbf0317f326bce863edc3d7bf3332e /source/modules/asura-core/graphics/gl.cpp | |
parent | c8a6a8e2dd6f015a31b4f8191ad945a78fe77f3d (diff) |
*misc
Diffstat (limited to 'source/modules/asura-core/graphics/gl.cpp')
-rw-r--r-- | source/modules/asura-core/graphics/gl.cpp | 72 |
1 files changed, 68 insertions, 4 deletions
diff --git a/source/modules/asura-core/graphics/gl.cpp b/source/modules/asura-core/graphics/gl.cpp index e199a41..47476a7 100644 --- a/source/modules/asura-core/graphics/gl.cpp +++ b/source/modules/asura-core/graphics/gl.cpp @@ -12,24 +12,24 @@ namespace AsuraEngine namespace Graphics { +#if ASURA_DEBUG static bool _instantiated = false; +#endif - // OpenGL gl; OpenGL::OpenGL() { - // Ҫڶʵ +#if ASURA_DEBUG ASSERT(!_instantiated); _instantiated = true; +#endif } OpenGL::~OpenGL() { } - //------------------------------------------------------------------------------// - void OpenGL::SetViewport(const Recti v) { glViewport(v.x, v.y, v.w, v.h); @@ -52,5 +52,69 @@ namespace AsuraEngine state.shader = nullptr; } + //------------------------------------------------------------------------------// + + void OpenGL::SetMatrixMode(MatrixMode mode) + { + state.matrixMode = mode; + } + + MatrixMode OpenGL::GetMatrixMode() + { + return state.matrixMode; + } + + void OpenGL::PushMatrix() + { + state.matrix[state.matrixMode].Push(); + } + + void OpenGL::PopMatrix() + { + state.matrix[state.matrixMode].Pop(); + } + + void OpenGL::LoadIdentity() + { + state.matrix[state.matrixMode].LoadIdentity(); + } + + void OpenGL::Rotate(float angle, float x, float y, float z) + { + state.matrix[state.matrixMode].Rotate(angle, x, y, z); + } + + void OpenGL::Translate(float x, float y, float z) + { + state.matrix[state.matrixMode].Translate(x, y, z); + } + + void OpenGL::Scale(float x, float y, float z) + { + state.matrix[state.matrixMode].Scale(x, y, z); + } + + void OpenGL::Ortho(float l, float r, float b, float t, float n, float f) + { + state.matrix[state.matrixMode].Ortho(l, r, b, t, n, f); + } + + AEMath::Matrix44& OpenGL::GetMatrix(MatrixMode mode) + { + return state.matrix[state.matrixMode].GetTop(); + } + + uint OpenGL::GetMatrixDepth() + { + return state.matrix[state.matrixMode].GetCapacity(); + } + + uint OpenGL::GetMatrixIndex() + { + return state.matrix[state.matrixMode].GetTopIndex(); + } + + //------------------------------------------------------------------------------// + } }
\ No newline at end of file |