From 3f457498b9c39d40a16a0ec6328880854f8cf4de Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 26 Feb 2019 08:48:54 +0800 Subject: *misc --- Source/Asura.Engine/Graphics/Texture.h | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'Source/Asura.Engine/Graphics/Texture.h') diff --git a/Source/Asura.Engine/Graphics/Texture.h b/Source/Asura.Engine/Graphics/Texture.h index 06461ce..e5b713c 100644 --- a/Source/Asura.Engine/Graphics/Texture.h +++ b/Source/Asura.Engine/Graphics/Texture.h @@ -1,8 +1,10 @@ #ifndef __ASURA_ENGINE_TEXTURE_H__ #define __ASURA_ENGINE_TEXTURE_H__ +#include "Math/Rect.h" +#include "Scripting/Luax.hpp" #include "Object.h" -#include "Luax/luax.h" +#include "GL.h" namespace AsuraEngine { @@ -10,13 +12,40 @@ namespace AsuraEngine { /// - /// 2D纹理抽象类,在2d mesh和render target中被使用 + /// 2D纹理抽象类,在2d mesh和render target中被使用。Texture的渲染原点在左上角,游戏里面的上层会以笛卡尔坐标系为标准。 + /// 在Editor里面界面和组件也是以左上角为原点,这样是为了方便。 /// class Texture : virtual public Object { + public: + + Texture(); + + virtual ~Texture(); + + GLuint GetGLTextureHandle() const; + + /// + /// 渲染整个texture到rt上,原点在左上角,向右,向下延伸 + /// + virtual void Render(int x, int y, int sx, int sy, int ox, int oy, int r) = 0; + + /// + /// 渲染texture的一部分到rt上,原点在左上角,向右,向下延伸。 + /// + virtual void Render(const Math::Rect& quad, int x, int y, int sx, int sy, int ox, int oy, int r) = 0; + + protected: + + /// + /// OpenGL texture handle。 + /// + GLuint mTextureHandle; }; + using Renderable = Texture; + } } -- cgit v1.1-26-g67d0