diff options
Diffstat (limited to 'source/modules/asura-core/graphics/gfx_device.h')
-rw-r--r-- | source/modules/asura-core/graphics/gfx_device.h | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/source/modules/asura-core/graphics/gfx_device.h b/source/modules/asura-core/graphics/gfx_device.h index 3c5b383..385f703 100644 --- a/source/modules/asura-core/graphics/gfx_device.h +++ b/source/modules/asura-core/graphics/gfx_device.h @@ -20,6 +20,8 @@ namespace AsuraEngine class Profiler; class Shader; + class GPUBuffer; + class Canvas; enum MatrixMode { @@ -40,50 +42,62 @@ namespace AsuraEngine GfxDevice(); ~GfxDevice(); - static GfxDevice& Get(); + static GfxDevice& Get(); - int GetParam(GLParams param); + int GetParam(GLParams param); - bool Init(const AEMath::Recti& viewport); - bool Inited(); + bool Init(const AEMath::Recti& viewport); + bool Inited(); + + void SetViewport(const AEMath::Recti viewport); - void SetViewport(const AEMath::Recti viewport); const AEMath::Recti& GetViewport(); - void UseShader(Shader* shader); - void UnuseShader(); - Shader* GetShader(); + void SetMatrixMode(MatrixMode mode); + MatrixMode GetMatrixMode(); - void DrawArrays(GLenum mode, GLint first, GLsizei count); + 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(); - 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(); + 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 SetDrawColor(float r, float g, float b, float a); - Color& GetDrawColor(); + void WipeError(); + bool HasError(); + GLenum GetError(); - void WipeError(); - bool HasError(); - GLenum GetError(); + private: + + friend class Profiler; struct { - Shader* shader; ///< ǰʹõshader 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 @@ -95,10 +109,6 @@ namespace AsuraEngine } stats; #endif - private: - - friend class Profiler; - luaxport: LUAX_DECL_SINGLETON(GfxDevice); @@ -122,7 +132,7 @@ namespace AsuraEngine }; - // ȫgfx device + // ȫ GfxDevice extern GfxDevice gfx; } |