From 1497dccd63a84b7ee2b229b1ad9c5c02718f2a78 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 19 Mar 2019 23:06:27 +0800 Subject: *rename --- source/libs/asura-lib-core/graphics/texture.h | 66 +++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 source/libs/asura-lib-core/graphics/texture.h (limited to 'source/libs/asura-lib-core/graphics/texture.h') diff --git a/source/libs/asura-lib-core/graphics/texture.h b/source/libs/asura-lib-core/graphics/texture.h new file mode 100644 index 0000000..81aa469 --- /dev/null +++ b/source/libs/asura-lib-core/graphics/texture.h @@ -0,0 +1,66 @@ +#ifndef __ASURA_ENGINE_TEXTURE_H__ +#define __ASURA_ENGINE_TEXTURE_H__ + +#include "Config.h" +#include "Math/Rect.hpp" +#include "Math/Vector2.hpp" +#include "Scripting/Luax.hpp" +#include "RenderState.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