From 4ea4bbfcb03091cb987dc151d41980ec16f3d18d Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 8 Apr 2019 22:31:12 +0800 Subject: *misc --- source/Asura.Editor/graphics/draw_info.cpp | 0 source/Asura.Editor/graphics/draw_info.h | 14 ++++++++ source/Asura.Editor/graphics/drawer.cpp | 16 +++++++++ source/Asura.Editor/graphics/drawer.h | 39 ++++++++++++++++++++++ source/Asura.Editor/graphics/shader.h | 18 ++++++++++ .../Asura.Editor/graphics/shaders/image.shader.h | 35 +++++++++++++++++++ .../graphics/shaders/poly_line.shader.h | 15 +++++++++ .../graphics/shaders/poly_shape.shader.h | 0 8 files changed, 137 insertions(+) create mode 100644 source/Asura.Editor/graphics/draw_info.cpp create mode 100644 source/Asura.Editor/graphics/draw_info.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/shader.h create mode 100644 source/Asura.Editor/graphics/shaders/image.shader.h create mode 100644 source/Asura.Editor/graphics/shaders/poly_line.shader.h create mode 100644 source/Asura.Editor/graphics/shaders/poly_shape.shader.h (limited to 'source/Asura.Editor/graphics') diff --git a/source/Asura.Editor/graphics/draw_info.cpp b/source/Asura.Editor/graphics/draw_info.cpp new file mode 100644 index 0000000..e69de29 diff --git a/source/Asura.Editor/graphics/draw_info.h b/source/Asura.Editor/graphics/draw_info.h new file mode 100644 index 0000000..442b92d --- /dev/null +++ b/source/Asura.Editor/graphics/draw_info.h @@ -0,0 +1,14 @@ +#ifndef __ASURA_EDITOR_DRAW_INFO_H__ +#define __ASURA_EDITOR_DRAW_INFO_H__ + +namespace AsuraEditor +{ + namespace Graphics + { + + + + } +} + +#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..f2fca31 --- /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..a61a7f2 --- /dev/null +++ b/source/Asura.Editor/graphics/drawer.h @@ -0,0 +1,39 @@ +#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); + + private: + + LUAX_DECL_SINGLETON(Drawer); + + }; + + } +} + +#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..6f5a8cc --- /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/shaders/image.shader.h b/source/Asura.Editor/graphics/shaders/image.shader.h new file mode 100644 index 0000000..6274f56 --- /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 img; + +void main() +{ + +} + +)" +}; \ No newline at end of file diff --git a/source/Asura.Editor/graphics/shaders/poly_line.shader.h b/source/Asura.Editor/graphics/shaders/poly_line.shader.h new file mode 100644 index 0000000..763fd45 --- /dev/null +++ b/source/Asura.Editor/graphics/shaders/poly_line.shader.h @@ -0,0 +1,15 @@ + +const char* s = 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_model_ +} + +)"; \ No newline at end of file diff --git a/source/Asura.Editor/graphics/shaders/poly_shape.shader.h b/source/Asura.Editor/graphics/shaders/poly_shape.shader.h new file mode 100644 index 0000000..e69de29 -- cgit v1.1-26-g67d0