summaryrefslogtreecommitdiff
path: root/source/modules/asura-core/graphics/texture.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-core/graphics/texture.h')
-rw-r--r--source/modules/asura-core/graphics/texture.h74
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 meshºÍrender targetÖб»Ê¹Óá£TextureµÄäÖȾԭµãÔÚ×óÉϽǣ¬ÓÎÏ·ÀïÃæµÄÉϲã»áÒԵѿ¨¶û×ø±êϵΪ±ê×¼¡£
- /// ÔÚEditorÀïÃæ½çÃæºÍ×é¼þÒ²ÊÇÒÔ×óÉϽÇΪԭµã£¬ÕâÑùÊÇΪÁË·½±ã¡£
+ /// ͼÏñÊý¾ÝµÄÑÕÉ«¸ñʽ
+ ///
+ enum ColorFormat
+ {
+ COLOR_FORMAT_UNKNOWN,
+
+ COLOR_FORMAT_RGBA8, ///< RGBA¶¼ÊÇ8bits int
+ COLOR_FORMAT_RGBA32F, ///< RGBA¶¼ÊÇ32bits float
+ };
+
+ ///
+ /// 2DÎÆÀí³éÏóÀ࣬ÔÚ2d meshºÍrender 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();
+
+ ///
+ /// Èç¹ûÉèÖÃU»òV·½ÏòfilterΪ
+ ///
+ void IsGenMipmap();
+
///
/// äÖȾÕû¸ötextureµ½rtÉÏ£¬Ô­µãÔÚ×óÉϽǣ¬ÏòÓÒ£¬ÏòÏÂÑÓÉì
///
@@ -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;
};