From 70b82d1981c0de3c7b77670ff8abcfeb26815142 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 12 Mar 2019 00:39:26 +0800 Subject: *misc --- Source/Asura.Engine/Graphics/Canvas.h | 45 ++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'Source/Asura.Engine/Graphics/Canvas.h') diff --git a/Source/Asura.Engine/Graphics/Canvas.h b/Source/Asura.Engine/Graphics/Canvas.h index c258793..c4e0f65 100644 --- a/Source/Asura.Engine/Graphics/Canvas.h +++ b/Source/Asura.Engine/Graphics/Canvas.h @@ -8,15 +8,18 @@ #include "Texture.h" #include "RenderTarget.h" -namespace AsuraEngine +namespace AsuraEngine { - namespace Graphics + namespace Graphics { - + /// /// Canvas也可以称为render texture,自身也可以作为texture渲染。 /// - class Canvas final : public Drawable, public RenderTarget, public Scripting::Portable + class Canvas ASURA_FINAL + : public Drawable + , public RenderTarget + , public Scripting::Portable { public: @@ -29,25 +32,17 @@ namespace AsuraEngine /// void SetSize(uint w, uint h); - /// - /// 渲染整个texture到rt上,原点在左上角,向右,向下延伸 - /// - void Render(const RenderTarget* rt, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot); + void Clear(const Color& col = Color::Black) override; - /// - /// 渲染texture的一部分到rt上,原点在左上角,向右,向下延伸。 - /// - void Render(const RenderTarget* rt, const Math::Rectf& quad, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot); + void Clear(const Math::Recti& quad, const Color& col = Color::Black) override; - //---------------------------------------------------------------------------------------------------------- + void Render(const RenderTarget* rt, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot); - LUAX_DECL_FACTORY(SimCanvas); + void Render(const RenderTarget* rt, const Math::Rectf& quad, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot); - LUAX_DECL_METHOD(l_SetSize); - LUAX_DECL_METHOD(l_Bind); - LUAX_DECL_METHOD(l_Unbind); + void Draw(const Drawable* texture, const RenderState& state); - //---------------------------------------------------------------------------------------------------------- + void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state); private: @@ -61,8 +56,20 @@ namespace AsuraEngine /// uint mWidth, mHeight; + public: + + //---------------------------------------------------------------------------------------------------------- + + LUAX_DECL_FACTORY(SimCanvas); + + LUAX_DECL_METHOD(l_SetSize); + LUAX_DECL_METHOD(l_Bind); + LUAX_DECL_METHOD(l_Unbind); + + //---------------------------------------------------------------------------------------------------------- + }; - + /// /// Canvas别名为RenderTexture /// -- cgit v1.1-26-g67d0