diff options
author | chai <chaifix@163.com> | 2019-08-02 20:51:00 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-02 20:51:00 +0800 |
commit | bad78945ceba425f6a80e3b8dca2414d592970eb (patch) | |
tree | 8bf7540766349c534bf9e5746b24fd7507ba034e /source/modules/asura-core/Graphics/binding/_texture.cpp | |
parent | 99b90496765df21c5f377f42b9ed073ccb34c1fd (diff) |
*修改文件名格式
Diffstat (limited to 'source/modules/asura-core/Graphics/binding/_texture.cpp')
-rw-r--r-- | source/modules/asura-core/Graphics/binding/_texture.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/source/modules/asura-core/Graphics/binding/_texture.cpp b/source/modules/asura-core/Graphics/binding/_texture.cpp new file mode 100644 index 0000000..f5e5f17 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_texture.cpp @@ -0,0 +1,85 @@ +#include "../texture.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(Texture) + { + LUAX_REGISTER_METHODS(state, + { "SetFilterMode", _SetFilterMode }, + { "SetWrapMode", _SetWrapMode }, + { "GetFilterMode", _GetFilterMode }, + { "GetWrapMode", _GetWrapMode }, + { "IsGenMipmap", _IsGenMipmap } + ); + } + + LUAX_POSTPROCESS(Texture) + { + LUAX_REGISTER_ENUM(state, "EColorFormat", + { "UNKNOWN", COLOR_FORMAT_UNKNOWN }, + { "RGBA8", COLOR_FORMAT_RGBA8 }, + { "RGBA32F", COLOR_FORMAT_RGBA32F } + ); + LUAX_REGISTER_ENUM(state, "EFilterMode", + { "NEAREST", FILTER_MODE_NEAREST }, + { "LINEAR", FILTER_MODE_LINEAR } + ); + LUAX_REGISTER_ENUM(state, "EWrapMode", + { "REPEAT", WRAP_MODE_REPEAT }, + { "MIRROR", WRAP_MODE_MIRROR }, + { "CLAMPTOEDGE", WRAP_MODE_CLAMPTOEDGE }, + { "CLAMPTOBORDER", WRAP_MODE_CLAMPTOBORDER } + ); + + } + + // texture:SetFilterMode(minFilter, magFilter) + LUAX_IMPL_METHOD(Texture, _SetFilterMode) + { + LUAX_PREPARE(L, Texture); + FilterMode min = (FilterMode)state.CheckValue<int>(2); + FilterMode mag = (FilterMode)state.CheckValue<int>(3); + self->SetFilterMode(min, mag); + return 0; + } + + // texture:SetWrapMode(wrap_mode) + LUAX_IMPL_METHOD(Texture, _SetWrapMode) + { + LUAX_PREPARE(L, Texture); + WrapMode wrap_mode = (WrapMode)state.CheckValue<int>(2); + self->SetWrapMode(wrap_mode); + return 0; + } + + // min, mag = texture:GetFilterMode() + LUAX_IMPL_METHOD(Texture, _GetFilterMode) + { + LUAX_PREPARE(L, Texture); + state.Push((int)self->m_MinFilter); + state.Push((int)self->m_MagFilter); + return 2; + } + + // wrapmode= texture:GetWrapMode() + LUAX_IMPL_METHOD(Texture, _GetWrapMode) + { + LUAX_PREPARE(L, Texture); + state.Push((int)self->m_WrapMode); + return 1; + } + + // texture:IsGenMipmap() + LUAX_IMPL_METHOD(Texture, _IsGenMipmap) + { + LUAX_PREPARE(L, Texture); + state.Push(self->IsGenMipmap()); + return 1; + } + + } +}
\ No newline at end of file |