From 4ea4bbfcb03091cb987dc151d41980ec16f3d18d Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 8 Apr 2019 22:31:12 +0800 Subject: *misc --- source/modules/asura-core/graphics/gl.h | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'source/modules/asura-core/graphics/gl.h') diff --git a/source/modules/asura-core/graphics/gl.h b/source/modules/asura-core/graphics/gl.h index e3c2ffc..82b9821 100644 --- a/source/modules/asura-core/graphics/gl.h +++ b/source/modules/asura-core/graphics/gl.h @@ -22,8 +22,14 @@ namespace AsuraEngine enum MatrixMode { - MATRIX_PROJECTION = 0, - MATRIX_MODELVIEW = 1, + MATRIX_MODE_PROJECTION = 0, + MATRIX_MODE_MODEL = 1, + MATRIX_MODE_VIEW = 2, + }; + + enum GLPrams + { + GL_PARAM_MAX_TEXTURE_UNIT = 1, }; /// @@ -39,16 +45,24 @@ namespace AsuraEngine OpenGL(); ~OpenGL(); + /// + /// 获得常量值 + /// + int GetParam(GLPrams param); + /// /// 初始化OpenGL上下文参数,发生在创建OpenGL上下文之后。此函数会注册OpenGL函数的地址。 /// bool Init(const AEMath::Recti& viewport); + bool Inited(); void SetViewport(const AEMath::Recti viewport); const AEMath::Recti& GetViewport(); void UseShader(Shader* shader); void UnuseShader(); + + void Draw(); /// /// Matrix stack相关操作 @@ -58,9 +72,9 @@ namespace AsuraEngine 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 Rotate(float angle); + void Translate(float x, float y); + void Scale(float x, float y); void Ortho(float l, float r, float b, float t, float n, float f); AEMath::Matrix44& GetMatrix(MatrixMode mode); uint GetMatrixDepth(); @@ -84,7 +98,7 @@ namespace AsuraEngine { Shader* shader; ///< 当前使用的shader AEMath::Recti viewport; ///< 当前的视区,在切换HDC或者本窗口大小改变或者部分刷新时变动 - MatrixStack matrix[2]; ///< 变换矩阵 + MatrixStack matrix[3]; ///< model, view, projection矩阵 MatrixMode matrixMode; ///< 当前操作的矩阵 } state; @@ -96,7 +110,8 @@ namespace AsuraEngine //----------------------------------------------------------------------------// - LUAX_DECL_ENUM(MatrixMode, 0); + LUAX_DECL_ENUM(MatrixMode, 1); + LUAX_DECL_ENUM(GLPrams, 1); LUAX_DECL_METHOD(_SetMatrixMode); LUAX_DECL_METHOD(_GetMatrixMode); -- cgit v1.1-26-g67d0