diff options
Diffstat (limited to 'source/modules/asura-core/graphics/texture.h')
-rw-r--r-- | source/modules/asura-core/graphics/texture.h | 74 |
1 files changed, 55 insertions, 19 deletions
diff --git a/source/modules/asura-core/graphics/texture.h b/source/modules/asura-core/graphics/texture.h index 81ced9f..a76e1d4 100644 --- a/source/modules/asura-core/graphics/texture.h +++ b/source/modules/asura-core/graphics/texture.h @@ -1,9 +1,8 @@ -#ifndef __ASURA_ENGINE_TEXTURE_H__ -#define __ASURA_ENGINE_TEXTURE_H__ +#ifndef __ASURA_TEXTURE_H__ +#define __ASURA_TEXTURE_H__ #include <asura-utils/math/rect.hpp> #include <asura-utils/math/vector2.hpp> -#include <asura-utils/scripting/portable.hpp> #include "../core_config.h" @@ -17,20 +16,59 @@ namespace AsuraEngine class RenderTarget; + enum WrapMode + { + WRAP_MODE_REPEAT, + WRAP_MODE_MIRROR, + WRAP_MODE_CLAMPTOEDGE, + WRAP_MODE_CLAMPTOBORDER, + //WRAP_MODE_PERAXIS, // UVвͬ4ֵ + }; + + enum FilterMode + { + FILTER_MODE_NEAREST, + FILTER_MODE_LINEAR, + }; + /// - /// 2D࣬2d meshrender targetбʹáTextureȾԭϽǣϷϲԵѿϵΪ - /// EditorҲϽΪԭ㣬Ϊ˷㡣 + /// ͼݵɫʽ + /// + enum ColorFormat + { + COLOR_FORMAT_UNKNOWN, + + COLOR_FORMAT_RGBA8, ///< RGBA8bits int + COLOR_FORMAT_RGBA32F, ///< RGBA32bits float + }; + + /// + /// 2D࣬2d meshrender targetбʹáTextureȾԭϽǣϷ + /// ϲԵѿϵΪEditorҲϽΪԭ㣬Ϊ + /// 㡣 /// ASURA_ABSTRACT class Texture { public: - Texture(); + LUAX_DECL_ABSTRACT_FACTORY(); + Texture(); virtual ~Texture(); GLuint GetGLTextureHandle() const; + void SetFilterMode(FilterMode min, FilterMode mag); + void SetWrapMode(WrapMode wrapMode); + + void GetFilterMode(); + void GetWrapMode(); + + /// + /// UVfilterΪ + /// + void IsGenMipmap(); + /// /// ȾtexturertϣԭϽǣң /// @@ -41,22 +79,20 @@ namespace AsuraEngine /// virtual void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) = 0; - /// - /// ù˷ʽ - /// - void SetSmooth(bool smooth); + protected: - /// - /// ظʽ - /// - void SetRepeated(); + LUAX_DECL_ENUM(ColorFormat); + LUAX_DECL_ENUM(FilterMode); + LUAX_DECL_ENUM(WrapMode); - protected: + GLuint mTexHandle; - /// - /// OpenGL texture handle - /// - GLuint mTextureHandle; + FilterMode mMinFilter; + FilterMode mMagFilter; + + WrapMode mWrapMode; + + bool mIsGenMipmap; }; |