diff options
author | chai <chaifix@163.com> | 2019-04-03 09:00:13 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-04-03 09:00:13 +0800 |
commit | c8a6a8e2dd6f015a31b4f8191ad945a78fe77f3d (patch) | |
tree | 8060458d7aa5e514cdef32f6f92e157221efde4a /source/modules/asura-core/graphics/gl.h | |
parent | af7bdaa10ee71a319dc55c3c7556fa43a95c9dc9 (diff) |
*misc
Diffstat (limited to 'source/modules/asura-core/graphics/gl.h')
-rw-r--r-- | source/modules/asura-core/graphics/gl.h | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/source/modules/asura-core/graphics/gl.h b/source/modules/asura-core/graphics/gl.h index 9ca1f44..3104288 100644 --- a/source/modules/asura-core/graphics/gl.h +++ b/source/modules/asura-core/graphics/gl.h @@ -5,6 +5,7 @@ #include <glad/glad.h> +#include <asura-utils/scripting/portable.hpp> #include <asura-utils/math/rect.hpp> #include <asura-utils/math/matrix44.h> @@ -18,15 +19,25 @@ namespace AsuraEngine class Profiler; class Shader; + enum MatrixMode + { + MATRIX_PROJECTION = 0, + MATRIX_MODELVIEW, + _MATRIX_COUNT + }; + /// /// OpenGLģһЩopengl״̬١ڱ༭രڻ£һڶӦһhwnd /// һhdcԼopengl contextʹwglMakeCurrent(hdc, glc)ָǰ̶߳ /// Ⱦhdcopenglglcglм¼ľһ̵߳һڵһOpenGL /// ĵ״̬ /// - class OpenGL + class OpenGL : public AEScripting::Portable<OpenGL> { public: + + LUAX_DECL_SINGLETON(GL); + OpenGL(); ~OpenGL(); @@ -36,6 +47,19 @@ namespace AsuraEngine void UseShader(Shader* shader); void UnuseShader(); + void SetMatrixMode(MatrixMode mode); + MatrixMode GetMatrixMode(); + void PushMatrix(); + void PopMatrix(); + void LoadIdentity(); + 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 l, float r, float b, float t, float n, float f); + AEMath::Matrix44& GetMatrix(MatrixMode mode); + uint GetMatrixDepth(); + uint GetMatrixIndex(); + /// /// OpenGL3.0Ժû任ӿڡshaderȲﱣһЩOpenGL״̬ע /// ƺȫ̵ģҲ˵Asuraֶ֧߳ȾOpenGLĵĴʹһ @@ -45,16 +69,37 @@ namespace AsuraEngine /// struct { - Shader* shader; ///< ǰʹõshader - AEMath::Recti viewport; ///< ǰлHDC߱ڴСı߲ˢʱ䶯 - MatrixStack projectionMatrix; ///< ͶӰ - MatrixStack modelViewMatrix; ///< 任 + Shader* shader; ///< ǰʹõshader + AEMath::Recti viewport; ///< ǰлHDC߱ڴСı߲ˢʱ䶯 + MatrixStack matrix[_MATRIX_COUNT]; ///< ͶӰ + MatrixMode matrixMode; ///< ǰľ } state; private: friend class Profiler; + //----------------------------------------------------------------------------// + + LUAX_DECL_ENUM(MatrixMode, 0); + + LUAX_DECL_METHOD(_SetMatrixMode); + LUAX_DECL_METHOD(_GetMatrixMode); + LUAX_DECL_METHOD(_PushMatrix); + LUAX_DECL_METHOD(_PopMatrix); + LUAX_DECL_METHOD(_LoadIdentity); + LUAX_DECL_METHOD(_Rotate); + LUAX_DECL_METHOD(_Translate); + LUAX_DECL_METHOD(_Scale); + LUAX_DECL_METHOD(_Ortho); + LUAX_DECL_METHOD(_GetMatrixDepth); + LUAX_DECL_METHOD(_GetMatrixIndex); + + LUAX_DECL_METHOD(_UseShader); + LUAX_DECL_METHOD(_UnuseShader); + + //----------------------------------------------------------------------------// + }; /// |