From c302f5ae5f9e30a28e487e8a764d9cc31546bbea Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 29 Mar 2019 22:51:04 +0800 Subject: *rename --- source/modules/asura-core/graphics/texture.h | 68 ++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 source/modules/asura-core/graphics/texture.h (limited to 'source/modules/asura-core/graphics/texture.h') diff --git a/source/modules/asura-core/graphics/texture.h b/source/modules/asura-core/graphics/texture.h new file mode 100644 index 0000000..81ced9f --- /dev/null +++ b/source/modules/asura-core/graphics/texture.h @@ -0,0 +1,68 @@ +#ifndef __ASURA_ENGINE_TEXTURE_H__ +#define __ASURA_ENGINE_TEXTURE_H__ + +#include +#include +#include + +#include "../core_config.h" + +#include "render_state.h" +#include "gl.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + class RenderTarget; + + /// + /// 2D纹理抽象类,在2d mesh和render target中被使用。Texture的渲染原点在左上角,游戏里面的上层会以笛卡尔坐标系为标准。 + /// 在Editor里面界面和组件也是以左上角为原点,这样是为了方便。 + /// + ASURA_ABSTRACT class Texture + { + public: + + Texture(); + + virtual ~Texture(); + + GLuint GetGLTextureHandle() const; + + /// + /// 渲染整个texture到rt上,原点在左上角,向右,向下延伸 + /// + virtual void Render(const RenderTarget* rt, const RenderState& state) = 0; + + /// + /// 渲染texture的一部分到rt上,原点在左上角,向右,向下延伸。 + /// + virtual void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) = 0; + + /// + /// 设置过滤方式 + /// + void SetSmooth(bool smooth); + + /// + /// 设置重复方式 + /// + void SetRepeated(); + + protected: + + /// + /// OpenGL texture handle。 + /// + GLuint mTextureHandle; + + }; + + using Drawable = Texture; + + } +} + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0