diff options
Diffstat (limited to 'source/modules/asura-core/Graphics')
-rw-r--r-- | source/modules/asura-core/Graphics/DrawInfo.h | 1 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/DrawUtil.cpp | 0 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/DrawUtil.h | 0 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/GPUBuffer.h | 10 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/GfxDevice.cpp | 20 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/GfxDevice.h | 52 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/GraphicsHelper.cpp | 0 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/GraphicsHelper.h | 15 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/Polygon2D.cpp | 0 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/Polygon2D.h | 0 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/VBO.cpp | 0 | ||||
-rw-r--r-- | source/modules/asura-core/Graphics/VBO.h | 27 |
12 files changed, 74 insertions, 51 deletions
diff --git a/source/modules/asura-core/Graphics/DrawInfo.h b/source/modules/asura-core/Graphics/DrawInfo.h index f0e375b..9042f2f 100644 --- a/source/modules/asura-core/Graphics/DrawInfo.h +++ b/source/modules/asura-core/Graphics/DrawInfo.h @@ -6,6 +6,7 @@ namespace_begin(AsuraEngine) namespace_begin(Graphics) +/// struct DrawInfo { diff --git a/source/modules/asura-core/Graphics/DrawUtil.cpp b/source/modules/asura-core/Graphics/DrawUtil.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Graphics/DrawUtil.cpp diff --git a/source/modules/asura-core/Graphics/DrawUtil.h b/source/modules/asura-core/Graphics/DrawUtil.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Graphics/DrawUtil.h diff --git a/source/modules/asura-core/Graphics/GPUBuffer.h b/source/modules/asura-core/Graphics/GPUBuffer.h index bb40055..0aa3c29 100644 --- a/source/modules/asura-core/Graphics/GPUBuffer.h +++ b/source/modules/asura-core/Graphics/GPUBuffer.h @@ -31,8 +31,7 @@ enum BufferDataType }; /// -/// VRAM壬ֶ㻺vboebo֣ÿζڴԴϴݡframeworkrenderers -/// +/// VRAM壬ֶ㻺vboebo֣ÿζڴԴϴݡframeworkrenderersй /// ASURA_ABSTRACT class GPUBuffer { @@ -62,10 +61,9 @@ private: GLenum m_Target; GLuint m_Buffer; - /// openglԴ滺岢ûж͵ҪֻglVertexAttribPointerʱָdrawcall ʱݸ - /// ʼַʹbufferȡඥݣԲͬͿԱһbufferСΪ˱ - /// ӿڵļ࣬ڳʼbufferʱָͣڱ͵һ£Բͬ - /// ͷͬbuffer + /// openglԴ滺岢ûж͵ҪֻglVertexAttribPointerʱָdrawcall ʱݸ + /// ʼַʹbufferȡඥݣԲͬͿԱһbufferСΪ˱ֽӿڵļ࣬ + /// ʼbufferʱָͣڱ͵һ£Բͬͷͬbuffer GLenum m_DataType; GLuint m_Usage; diff --git a/source/modules/asura-core/Graphics/GfxDevice.cpp b/source/modules/asura-core/Graphics/GfxDevice.cpp index ef324e3..ea95f54 100644 --- a/source/modules/asura-core/Graphics/GfxDevice.cpp +++ b/source/modules/asura-core/Graphics/GfxDevice.cpp @@ -82,16 +82,6 @@ Color& GfxDevice::GetDrawColor() return state.drawColor; } -Canvas* GfxDevice::GetActiveCanvas() const -{ - return state.canvas; -} - -void GfxDevice::SetActiveCanvas(Canvas* canvas) -{ - state.canvas = canvas; -} - void GfxDevice::SetViewport(const Recti v) { state.viewport = v; @@ -136,16 +126,6 @@ void GfxDevice::DrawArrays(GLenum mode, GLint first, GLsizei count) state.shader->OnUsed(); } -void GfxDevice::SetMatrixMode (MatrixMode mode) -{ - state.matrixMode = mode; -} - -MatrixMode GfxDevice::GetMatrixMode () -{ - return state.matrixMode; -} - void GfxDevice::PushMatrix () { state.matrix[state.matrixMode].Push (); diff --git a/source/modules/asura-core/Graphics/GfxDevice.h b/source/modules/asura-core/Graphics/GfxDevice.h index 1f50b57..02c7392 100644 --- a/source/modules/asura-core/Graphics/GfxDevice.h +++ b/source/modules/asura-core/Graphics/GfxDevice.h @@ -42,47 +42,44 @@ public: 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 SetMatrixMode(MatrixMode mode); - MatrixMode GetMatrixMode(); + void PushMatrix(); + void PopMatrix(); - 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); - 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(); - uint GetMatrixDepth(); - uint GetMatrixIndex(); + void DrawArrays(GLenum mode, GLint first, GLsizei count); 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 SetDrawColor(float r, float g, float b, float a); + Color& GetDrawColor(); void SetActiveShader(Shader* = NULL); Shader* GetActiveShader() const; - void DrawArrays(GLenum mode, GLint first, GLsizei count); + void WipeError(); + bool HasError(); + GLenum GetError(); - void WipeError(); - bool HasError(); - GLenum GetError(); + GET_SET(MatrixMode, MatrixMode, state.matrixMode); + GET_SET(Canvas*, ActiveCanvas, state.canvas); private: @@ -130,9 +127,14 @@ luaxport: }; -// ȫ GfxDevice extern GfxDevice g_Device; + +#define GL_CALL(x) do { x; /*GLAssert(); */} while(0) + + + + namespace_end namespace_end diff --git a/source/modules/asura-core/Graphics/GraphicsHelper.cpp b/source/modules/asura-core/Graphics/GraphicsHelper.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Graphics/GraphicsHelper.cpp diff --git a/source/modules/asura-core/Graphics/GraphicsHelper.h b/source/modules/asura-core/Graphics/GraphicsHelper.h new file mode 100644 index 0000000..b93756a --- /dev/null +++ b/source/modules/asura-core/Graphics/GraphicsHelper.h @@ -0,0 +1,15 @@ +#ifndef _ASURA_GRAPHICS_HELPER_H_ +#define _ASURA_GRAPHICS_HELPER_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + + +namespace_end +namespace_end + +#endif diff --git a/source/modules/asura-core/Graphics/Polygon2D.cpp b/source/modules/asura-core/Graphics/Polygon2D.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Graphics/Polygon2D.cpp diff --git a/source/modules/asura-core/Graphics/Polygon2D.h b/source/modules/asura-core/Graphics/Polygon2D.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Graphics/Polygon2D.h diff --git a/source/modules/asura-core/Graphics/VBO.cpp b/source/modules/asura-core/Graphics/VBO.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Graphics/VBO.cpp diff --git a/source/modules/asura-core/Graphics/VBO.h b/source/modules/asura-core/Graphics/VBO.h new file mode 100644 index 0000000..80f405f --- /dev/null +++ b/source/modules/asura-core/Graphics/VBO.h @@ -0,0 +1,27 @@ +#ifndef _ASURA_ENGINE_VBO_H_ +#define _ASURA_ENGINE_VBO_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +struct VertexBufferData +{ + +}; + +struct IndexBufferData +{ + +}; + +class VBO +{ + +}; + +namespace_end +namespace_end + +#endif
\ No newline at end of file |