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/Asura.Editor/Graphics/Brush.cpp | 0 source/Asura.Editor/Graphics/Brush.h | 20 +++++++++++ source/Asura.Editor/Graphics/DrawInfo.cpp | 0 source/Asura.Editor/Graphics/DrawInfo.h | 16 +++++++++ source/Asura.Editor/Graphics/Drawer.cpp | 16 +++++++++ source/Asura.Editor/Graphics/Drawer.h | 40 ++++++++++++++++++++++ source/Asura.Editor/Graphics/Pen.cpp | 0 source/Asura.Editor/Graphics/Pen.h | 7 ++++ source/Asura.Editor/Graphics/Shader.h | 18 ++++++++++ source/Asura.Editor/Graphics/Style.cpp | 0 source/Asura.Editor/Graphics/Style.h | 15 ++++++++ .../Asura.Editor/Graphics/shaders/image.shader.h | 35 +++++++++++++++++++ .../Asura.Editor/Graphics/shaders/polygon.shader.h | 29 ++++++++++++++++ 13 files changed, 196 insertions(+) create mode 100644 source/Asura.Editor/Graphics/Brush.cpp create mode 100644 source/Asura.Editor/Graphics/Brush.h create mode 100644 source/Asura.Editor/Graphics/DrawInfo.cpp create mode 100644 source/Asura.Editor/Graphics/DrawInfo.h create mode 100644 source/Asura.Editor/Graphics/Drawer.cpp create mode 100644 source/Asura.Editor/Graphics/Drawer.h create mode 100644 source/Asura.Editor/Graphics/Pen.cpp create mode 100644 source/Asura.Editor/Graphics/Pen.h create mode 100644 source/Asura.Editor/Graphics/Shader.h create mode 100644 source/Asura.Editor/Graphics/Style.cpp create mode 100644 source/Asura.Editor/Graphics/Style.h create mode 100644 source/Asura.Editor/Graphics/shaders/image.shader.h create mode 100644 source/Asura.Editor/Graphics/shaders/polygon.shader.h (limited to 'source/Asura.Editor/Graphics') diff --git a/source/Asura.Editor/Graphics/Brush.cpp b/source/Asura.Editor/Graphics/Brush.cpp new file mode 100644 index 0000000..e69de29 diff --git a/source/Asura.Editor/Graphics/Brush.h b/source/Asura.Editor/Graphics/Brush.h new file mode 100644 index 0000000..4290926 --- /dev/null +++ b/source/Asura.Editor/Graphics/Brush.h @@ -0,0 +1,20 @@ +#ifndef _ASURA_EDITOR_BRUSH_H_ +#define _ASURA_EDITOR_BRUSH_H_ + +namespace AsuraEditor +{ + namespace Graphics + { + + /// + /// 画刷,指定填充模式 + /// + class Brush + { + + }; + + } +} + +#endif \ No newline at end of file diff --git a/source/Asura.Editor/Graphics/DrawInfo.cpp b/source/Asura.Editor/Graphics/DrawInfo.cpp new file mode 100644 index 0000000..e69de29 diff --git a/source/Asura.Editor/Graphics/DrawInfo.h b/source/Asura.Editor/Graphics/DrawInfo.h new file mode 100644 index 0000000..ee38319 --- /dev/null +++ b/source/Asura.Editor/Graphics/DrawInfo.h @@ -0,0 +1,16 @@ +#ifndef _ASURA_EDITOR_DRAW_INFO_H_ +#define _ASURA_EDITOR_DRAW_INFO_H_ + +#include + +namespace_begin(AsuraEditor) + +class DrawInfo +{ + +}; + + +namespace_end + +#endif \ No newline at end of file diff --git a/source/Asura.Editor/Graphics/Drawer.cpp b/source/Asura.Editor/Graphics/Drawer.cpp new file mode 100644 index 0000000..6482aeb --- /dev/null +++ b/source/Asura.Editor/Graphics/Drawer.cpp @@ -0,0 +1,16 @@ +#include "Drawer.h" + +using namespace AEGraphics; + +namespace AsuraEditor +{ + namespace Graphics + { + + void Drawer::DrawImage(Image* img) + { + + } + + } +} \ No newline at end of file diff --git a/source/Asura.Editor/Graphics/Drawer.h b/source/Asura.Editor/Graphics/Drawer.h new file mode 100644 index 0000000..638ce08 --- /dev/null +++ b/source/Asura.Editor/Graphics/Drawer.h @@ -0,0 +1,40 @@ +#ifndef _ASURA_EDITOR_PAINTER_H_ +#define _ASURA_EDITOR_PAINTER_H_ + +#include +#include +#include + +namespace AsuraEditor +{ + namespace Graphics + { + + /// + /// 基于AsuraEngine的渲染部分的绘画类,用于绘制控件和文字。之所以不直接用引擎部分的渲染, + /// 是因为引擎的渲染在framework中实现,有更高级的抽象,而控件的渲染不需要复杂的pass。在 + /// 编辑器下,引擎的渲染和编辑器的渲染可以混编。 + /// + class Drawer + : public AsuraEngine::Singleton + , public AEScripting::Portable + { + public: + + void DrawLine(int x1, int y1, int x2, int y2); + void DrawImage(AEGraphics::Image* img, int x, int y, float sx, float sy, float r, int ox, int oy); + void DrawTexts(); + void DrawCircle(int x, int y, float d); + void DrawPoint(int x, int y); + void DrawPolyline(); + + private: + + LUAX_DECL_SINGLETON(Drawer); + + }; + + } +} + +#endif \ No newline at end of file diff --git a/source/Asura.Editor/Graphics/Pen.cpp b/source/Asura.Editor/Graphics/Pen.cpp new file mode 100644 index 0000000..e69de29 diff --git a/source/Asura.Editor/Graphics/Pen.h b/source/Asura.Editor/Graphics/Pen.h new file mode 100644 index 0000000..b949d14 --- /dev/null +++ b/source/Asura.Editor/Graphics/Pen.h @@ -0,0 +1,7 @@ +#ifndef _ASURA_EDITOR_PEN_H_ +#define _ASURA_EDITOR_PEN_H_ + + + + +#endif \ No newline at end of file diff --git a/source/Asura.Editor/Graphics/Shader.h b/source/Asura.Editor/Graphics/Shader.h new file mode 100644 index 0000000..a3abec1 --- /dev/null +++ b/source/Asura.Editor/Graphics/Shader.h @@ -0,0 +1,18 @@ +#ifndef _ASURA_EDITOR_SHADER_H_ +#define _ASURA_EDITOR_SHADER_H_ + +namespace AsuraEditor +{ + namespace Graphics + { + + struct ShaderProgram + { + const char* vert; + const char* frag; + }; + + } +} + +#endif \ No newline at end of file diff --git a/source/Asura.Editor/Graphics/Style.cpp b/source/Asura.Editor/Graphics/Style.cpp new file mode 100644 index 0000000..e69de29 diff --git a/source/Asura.Editor/Graphics/Style.h b/source/Asura.Editor/Graphics/Style.h new file mode 100644 index 0000000..b6ed2c5 --- /dev/null +++ b/source/Asura.Editor/Graphics/Style.h @@ -0,0 +1,15 @@ +#ifndef _ASURA_EDITOR_GUI_STYLE_H_ +#define _ASURA_EDITOR_GUI_STYLE_H_ + +#include + +namespace_begin(AsuraEditor) + +class GUIStyle +{ + +}; + +namespace_end + +#endif \ No newline at end of file diff --git a/source/Asura.Editor/Graphics/shaders/image.shader.h b/source/Asura.Editor/Graphics/shaders/image.shader.h new file mode 100644 index 0000000..cbdd542 --- /dev/null +++ b/source/Asura.Editor/Graphics/shaders/image.shader.h @@ -0,0 +1,35 @@ +#ifndef _ASURA_EDITOR_SHADER_H_ +#include "../shader.h" +#endif + +// 绘制 +static AsuraEditor::Graphics::ShaderProgram image_shader = +{ +R"( +in vec2 asura_position; +in vec2 asura_texcoord0; + +uniform mat4 asura_model_matrix; +uniform mat4 asura_view_matrix; +uniform mat4 asura_projection_matrix; + +void main() +{ + gl_Position = asura_projection_matrix * asura_view_matrix * asura_model_matrix * vec4(asura_position, 0, 1); + uv = asura_texcoord0; +} + +)", + +R"( +in vec2 uv; + +uniform sampler2D asura_maintex; + +void main() +{ + +} + +)" +}; \ No newline at end of file diff --git a/source/Asura.Editor/Graphics/shaders/polygon.shader.h b/source/Asura.Editor/Graphics/shaders/polygon.shader.h new file mode 100644 index 0000000..a92e9a6 --- /dev/null +++ b/source/Asura.Editor/Graphics/shaders/polygon.shader.h @@ -0,0 +1,29 @@ +#ifndef _ASURA_EDITOR_SHADER_H_ +#include "../shader.h" +#endif + +// 绘制 +static AsuraEditor::Graphics::ShaderProgram polygon_shader = +{ + R"( +in vec2 position; + +uniform mat4 mvp_matrix; + +void main() +{ + gl_Position = mvp_matrix * vec4(position, 0, 1); +} + +)", + +R"( +uniform vec4 color; + +void main() +{ + gl_FragColor = color; +} + +)" +}; \ No newline at end of file -- cgit v1.1-26-g67d0