From bad78945ceba425f6a80e3b8dca2414d592970eb Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 2 Aug 2019 20:51:00 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E5=90=8D=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/modules/asura-core/graphics/gfx_device.h | 139 ------------------------ 1 file changed, 139 deletions(-) delete mode 100644 source/modules/asura-core/graphics/gfx_device.h (limited to 'source/modules/asura-core/graphics/gfx_device.h') diff --git a/source/modules/asura-core/graphics/gfx_device.h b/source/modules/asura-core/graphics/gfx_device.h deleted file mode 100644 index fa22dd4..0000000 --- a/source/modules/asura-core/graphics/gfx_device.h +++ /dev/null @@ -1,139 +0,0 @@ -#ifndef __ASURA_ENGINE_GFX_DEVICE_H__ -#define __ASURA_ENGINE_GFX_DEVICE_H__ - -#include - -#include - -#include -#include -#include -#include - -#include "color.h" -#include "matrix_stack.h" - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - -class Profiler; -class Shader; -class GPUBuffer; -class Canvas; - -enum MatrixMode -{ - MATRIX_MODE_PROJECTION = 0, - MATRIX_MODE_MODEL = 1, - MATRIX_MODE_VIEW = 2, -}; - -enum GLParams -{ - GL_PARAM_MAX_TEXTURE_UNIT = 1, -}; - -class GfxDevice : public AEScripting::Portable -{ -public: - - GfxDevice(); - ~GfxDevice(); - - static GfxDevice& Get(); - - int GetParam(GLParams param); - - bool Init(const AEMath::Recti& viewport); - bool Inited(); - - void SetViewport(const AEMath::Recti viewport); - - const AEMath::Recti& GetViewport(); - - void SetMatrixMode(MatrixMode mode); - MatrixMode GetMatrixMode(); - - void PushMatrix(); - void PopMatrix(); - - void LoadIdentity(); - 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); - - uint GetMatrixDepth(); - uint GetMatrixIndex(); - - AEMath::Matrix44& GetMatrix(MatrixMode mode); - AEMath::Matrix44 GetMVPMatrix(); - - void SetDrawColor(float r, float g, float b, float a); - Color& GetDrawColor(); - - void SetActiveCanvas(Canvas* = NULL); - Canvas* GetActiveCanvas() const; - - void SetActiveShader(Shader* = NULL); - Shader* GetActiveShader() const; - - void DrawArrays(GLenum mode, GLint first, GLsizei count); - - void WipeError(); - bool HasError(); - GLenum GetError(); - -private: - - friend class Profiler; - - struct - { - AEMath::Recti viewport; ///< 当前的视区,在切换HDC或者本窗口大小改变或者部分刷新时变动 - MatrixStack matrix[3]; ///< model, view, projection矩阵 - MatrixMode matrixMode; ///< 当前操作的矩阵 - Color drawColor; ///< 绘制的颜色 - Canvas* canvas; ///< 当前canvas - Shader* shader; ///< 当前使用的shader - } state; - -#if ASURA_GL_PROFILE - struct - { - uint drawCall; ///< 统计drawcall - uint canvasSwitch; ///< 切换texture的次数 - uint shaderSwitch; ///< 切换shader的次数 - } stats; -#endif - -luaxport: - - LUAX_DECL_SINGLETON(GfxDevice); - - LUAX_DECL_ENUM(MatrixMode, 1); - LUAX_DECL_ENUM(GLParams, 1); - - 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); - -}; - -// 全局 GfxDevice 对象 -extern GfxDevice g_Device; - -namespace_end -namespace_end - -#endif \ No newline at end of file -- cgit v1.1-26-g67d0