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.h101
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, ///< RGBA¶¼ÊÇ8bits int
+ COLOR_FORMAT_RGBA32F, ///< RGBA¶¼ÊÇ32bits float
+};
+
+/// ÎÆÀí¸ñʽ£¬GPUÄÚ²¿ºÍCPUÍⲿ¸ñʽ
+struct TextureFormat
+{
+ GLenum internalformat; ///< GPUÄÚ²¿¸ñʽ
+ GLenum externalformat; ///< CPUÍⲿ¸ñʽ
+ GLenum type; ///< Íⲿ¸ñʽÿ¸öchannelÊýÖµÀàÐÍ
+};
+
+///
+/// 2DÎÆÀí³éÏóÀ࣬ÔÚ2d meshºÍrender 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();
+
+ /// Èç¹ûÉèÖÃU»òV·½ÏòfilterΪ
+ 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