summaryrefslogtreecommitdiff
path: root/Source/modules/asura-core/Graphics/Texture.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-16 08:54:08 +0800
committerchai <chaifix@163.com>2019-08-16 08:54:08 +0800
commita077eb38b01292611f4f6031b75e3e2c1c20f06e (patch)
tree8f760483d7b0290952bbdb5bcd8f3943102aeb3a /Source/modules/asura-core/Graphics/Texture.h
parent6a065c913e9308cc72e1ad0723b6167048f439b6 (diff)
Diffstat (limited to 'Source/modules/asura-core/Graphics/Texture.h')
-rw-r--r--Source/modules/asura-core/Graphics/Texture.h38
1 files changed, 31 insertions, 7 deletions
diff --git a/Source/modules/asura-core/Graphics/Texture.h b/Source/modules/asura-core/Graphics/Texture.h
index 76b9a8f..572fad4 100644
--- a/Source/modules/asura-core/Graphics/Texture.h
+++ b/Source/modules/asura-core/Graphics/Texture.h
@@ -3,6 +3,7 @@
#include <asura-base/Math/Vector2.hpp>
#include <asura-base/Math/Rect.hpp>
+#include <asura-base/Type.h>
#include "../CoreConfig.h"
@@ -14,6 +15,17 @@ namespace_begin(Graphics)
class RenderTarget;
+/// ͼƬ
+class ImageData
+{
+public:
+ uint8* GetData();
+private:
+ int m_Format;
+ uint8* m_ImageData;
+ Vector2i m_ImageSize;
+};
+
/// UVʽ
enum WrapMode
{
@@ -34,8 +46,8 @@ enum FilterMode
enum ColorFormat
{
COLOR_FORMAT_UNKNOWN,
- COLOR_FORMAT_RGBA8, ///< RGBA8bits int
- COLOR_FORMAT_RGBA32F, ///< RGBA32bits float
+ COLOR_FORMAT_RGBA8,
+ COLOR_FORMAT_RGBA32F,
};
/// ʽGPUڲCPUⲿʽ
@@ -50,11 +62,14 @@ struct TextureFormat
/// 2D࣬2d meshrender targetбʹáTextureȾԭϽǣϷϲԵѿ
/// ϵΪ׼EditorҲϽΪԭ㣬Ϊ˷㡣
///
-ASURA_ABSTRACT class Texture : public AEScripting::Object
+class Texture : public AEScripting::Object
{
public:
- LUAX_DECL_ABSTRACT_FACTORY(Texture);
+ LUAX_DECL_FACTORY(Texture);
+
+ // Texture generator
+ static Texture* GenerateTexture();
Texture();
virtual ~Texture();
@@ -67,9 +82,12 @@ public:
void GetFilterMode();
void GetWrapMode();
- /// UVfilterΪ
bool IsGenMipmap();
+ int GetWidth();
+ int GetHeight();
+ Vector2i GetSize();
+
protected:
/// תcolor formatΪtexture format
@@ -79,7 +97,12 @@ protected:
FilterMode m_MinFilter;
FilterMode m_MagFilter;
WrapMode m_WrapMode;
+ int m_UsageMode;
bool m_IsGenMipmap;
+ Vector2f m_TexelSize;
+ Vector2f m_UVScale;
+
+luaxport:
LUAX_DECL_ENUM(ColorFormat, 1);
LUAX_DECL_ENUM(FilterMode, 1);
@@ -90,11 +113,12 @@ protected:
LUAX_DECL_METHOD(_GetFilterMode);
LUAX_DECL_METHOD(_GetWrapMode);
LUAX_DECL_METHOD(_IsGenMipmap);
+ LUAX_DECL_METHOD(_GetWidth);
+ LUAX_DECL_METHOD(_GetHeight);
+ LUAX_DECL_METHOD(_GetSize);
};
-typedef Texture Drawable;
-
namespace_end
namespace_end