From 866e00474be3bfe0e7dac73b720af0b9ebf7109a Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 13 Apr 2019 20:15:07 +0800 Subject: *misc --- source/modules/asura-core/graphics/gl.h | 34 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 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 f28b983..6bb1ee0 100644 --- a/source/modules/asura-core/graphics/gl.h +++ b/source/modules/asura-core/graphics/gl.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "matrix_stack.h" @@ -18,7 +19,6 @@ namespace AsuraEngine class Profiler; class Shader; - class GPUBuffer; enum MatrixMode { @@ -27,7 +27,7 @@ namespace AsuraEngine MATRIX_MODE_VIEW = 2, }; - enum GLPrams + enum GLParams { GL_PARAM_MAX_TEXTURE_UNIT = 1, }; @@ -48,7 +48,7 @@ namespace AsuraEngine /// /// 获得常量值 /// - int GetParam(GLPrams param); + int GetParam(GLParams param); /// /// 初始化OpenGL上下文参数,发生在创建OpenGL上下文之后。此函数会注册OpenGL函数的地址。 @@ -84,6 +84,9 @@ namespace AsuraEngine uint GetMatrixDepth(); uint GetMatrixIndex(); + void SetDrawColor(float r, float g, float b, float a); + AEMath::Vector4f& GetDrawColor(); + /// /// 清理错误提示 /// @@ -100,23 +103,32 @@ namespace AsuraEngine /// struct { - Shader* shader; ///< 当前使用的shader - AEMath::Recti viewport; ///< 当前的视区,在切换HDC或者本窗口大小改变或者部分刷新时变动 - MatrixStack matrix[3]; ///< model, view, projection矩阵 - MatrixMode matrixMode; ///< 当前操作的矩阵 - uint drawcall; ///< 统计drawcall + Shader* shader; ///< 当前使用的shader + AEMath::Recti viewport; ///< 当前的视区,在切换HDC或者本窗口大小改变或者部分刷新时变动 + MatrixStack matrix[3]; ///< model, view, projection矩阵 + MatrixMode matrixMode; ///< 当前操作的矩阵 + AEMath::Vector4f drawColor; ///< 绘制的颜色 } state; +#if ASURA_GL_PROFILE + struct + { + uint drawCall; ///< 统计drawcall + uint canvasSwitch; ///< 切换texture的次数 + uint shaderSwitch; ///< 切换shader的次数 + } stats; +#endif + private: friend class Profiler; - LUAX_DECL_SINGLETON(OpenGL); - //----------------------------------------------------------------------------// + LUAX_DECL_SINGLETON(OpenGL); + LUAX_DECL_ENUM(MatrixMode, 1); - LUAX_DECL_ENUM(GLPrams, 1); + LUAX_DECL_ENUM(GLParams, 1); LUAX_DECL_METHOD(_SetMatrixMode); LUAX_DECL_METHOD(_GetMatrixMode); -- cgit v1.1-26-g67d0