diff options
Diffstat (limited to 'source/modules/asura-core/Graphics/Texture.h')
-rw-r--r-- | source/modules/asura-core/Graphics/Texture.h | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/source/modules/asura-core/Graphics/Texture.h b/source/modules/asura-core/Graphics/Texture.h new file mode 100644 index 0000000..7d37c31 --- /dev/null +++ b/source/modules/asura-core/Graphics/Texture.h @@ -0,0 +1,101 @@ +#ifndef _ASURA_TEXTURE_H_ +#define _ASURA_TEXTURE_H_ + +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Math/Rect.hpp> + +#include "../CoreConfig.h" + +#include "RenderState.h" +#include "GfxDevice.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +class RenderTarget; + +/// UVʽ +enum WrapMode +{ + WRAP_MODE_REPEAT, + WRAP_MODE_MIRROR, + WRAP_MODE_CLAMPTOEDGE, + WRAP_MODE_CLAMPTOBORDER, +}; + +/// ˲ģʽ +enum FilterMode +{ + FILTER_MODE_NEAREST, + FILTER_MODE_LINEAR, +}; + +/// ͼݵɫʽ +enum ColorFormat +{ + COLOR_FORMAT_UNKNOWN, + COLOR_FORMAT_RGBA8, ///< RGBA8bits int + COLOR_FORMAT_RGBA32F, ///< RGBA32bits float +}; + +/// ʽGPUڲCPUⲿʽ +struct TextureFormat +{ + GLenum internalformat; ///< GPUڲʽ + GLenum externalformat; ///< CPUⲿʽ + GLenum type; ///< ⲿʽÿchannelֵ +}; + +/// +/// 2D࣬2d meshrender targetбʹáTextureȾԭϽǣϷϲԵѿ +/// ϵΪEditorҲϽΪԭ㣬Ϊ˷㡣 +/// +ASURA_ABSTRACT class Texture : public AEScripting::Object +{ +public: + + LUAX_DECL_ABSTRACT_FACTORY(Texture); + + Texture(); + virtual ~Texture(); + + GLuint GetGLTexture() const; + + void SetFilterMode(FilterMode min, FilterMode mag); + void SetWrapMode(WrapMode wrapMode); + + void GetFilterMode(); + void GetWrapMode(); + + /// UVfilterΪ + bool IsGenMipmap(); + +protected: + + /// תcolor formatΪtexture format + TextureFormat ConvertColorFormat(const ColorFormat& colorformat); + + GLuint m_TexID; + FilterMode m_MinFilter; + FilterMode m_MagFilter; + WrapMode m_WrapMode; + bool m_IsGenMipmap; + + LUAX_DECL_ENUM(ColorFormat, 1); + LUAX_DECL_ENUM(FilterMode, 1); + LUAX_DECL_ENUM(WrapMode, 1); + + LUAX_DECL_METHOD(_SetFilterMode); + LUAX_DECL_METHOD(_SetWrapMode); + LUAX_DECL_METHOD(_GetFilterMode); + LUAX_DECL_METHOD(_GetWrapMode); + LUAX_DECL_METHOD(_IsGenMipmap); + +}; + +typedef Texture Drawable; + +namespace_end +namespace_end + +#endif
\ No newline at end of file |