From 64d9d7b3eb7cece81da8b2cb56eb0f50d87a5964 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 1 Mar 2019 08:50:34 +0800 Subject: *misc --- Source/Asura.Engine/Graphics/Canvas.h | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 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 c8faacf..c258793 100644 --- a/Source/Asura.Engine/Graphics/Canvas.h +++ b/Source/Asura.Engine/Graphics/Canvas.h @@ -3,8 +3,8 @@ #include +#include "Math/Rect.hpp" #include "GL.h" -#include "SimClass.h" #include "Texture.h" #include "RenderTarget.h" @@ -16,35 +16,34 @@ namespace AsuraEngine /// /// Canvas也可以称为render texture,自身也可以作为texture渲染。 /// - class Canvas final : public Texture, public RenderTarget, public SimClass + class Canvas final : public Drawable, public RenderTarget, public Scripting::Portable { public: Canvas(); - /// - /// 设置render texture的大小 - /// - void Init(uint w, uint h); + ~Canvas(); /// - /// 绑定此canvas,设置为活动 + /// 设置render texture的大小 /// - void Bind(); + void SetSize(uint w, uint h); /// - /// 设置为非活动,绑定回screen + /// 渲染整个texture到rt上,原点在左上角,向右,向下延伸 /// - void Unbind(); + void Render(const RenderTarget* rt, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot); - void Render(int x, int y, int sx, int sy, int ox, int oy, int r) override; - - void Render(const Math::Rect& quad, int x, int y, int sx, int sy, int ox, int oy, int r) 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); //---------------------------------------------------------------------------------------------------------- LUAX_DECL_FACTORY(SimCanvas); + LUAX_DECL_METHOD(l_SetSize); LUAX_DECL_METHOD(l_Bind); LUAX_DECL_METHOD(l_Unbind); @@ -57,6 +56,11 @@ namespace AsuraEngine /// GLuint mFBO; + /// + /// canvas的大小 + /// + uint mWidth, mHeight; + }; /// -- cgit v1.1-26-g67d0