From a077eb38b01292611f4f6031b75e3e2c1c20f06e Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Aug 2019 08:54:08 +0800 Subject: *misc --- .../asura-core/Graphics/binding/Canvas.binding.cpp | 48 +++++++ .../asura-core/Graphics/binding/Color.binding.cpp | 130 ++++++++++++++++++ .../Graphics/binding/Color32.binding.cpp | 66 +++++++++ .../Graphics/binding/GPUBuffer.binding.cpp | 118 ++++++++++++++++ .../Graphics/binding/GfxDevice.binding.cpp | 151 +++++++++++++++++++++ .../asura-core/Graphics/binding/Image.binding.cpp | 71 ++++++++++ .../Graphics/binding/IndexBuffer.binding.cpp | 31 +++++ .../asura-core/Graphics/binding/Mesh.binding.cpp | 20 +++ .../asura-core/Graphics/binding/Shader.binding.cpp | 131 ++++++++++++++++++ .../Graphics/binding/SpriteBatch.binding.cpp | 20 +++ .../Graphics/binding/Texture.binding.cpp | 85 ++++++++++++ .../Graphics/binding/VertexBuffer.binding.cpp | 38 ++++++ .../asura-core/Graphics/binding/_canvas.cpp | 48 ------- .../modules/asura-core/Graphics/binding/_color.cpp | 130 ------------------ .../asura-core/Graphics/binding/_color32.cpp | 66 --------- .../asura-core/Graphics/binding/_gfx_device.cpp | 151 --------------------- .../asura-core/Graphics/binding/_gpu_buffer.cpp | 118 ---------------- .../modules/asura-core/Graphics/binding/_image.cpp | 71 ---------- .../asura-core/Graphics/binding/_index_buffer.cpp | 31 ----- .../asura-core/Graphics/binding/_mesh2d.cpp | 20 --- .../asura-core/Graphics/binding/_shader.cpp | 131 ------------------ .../asura-core/Graphics/binding/_sprite_batch.cpp | 20 --- .../asura-core/Graphics/binding/_texture.cpp | 85 ------------ .../asura-core/Graphics/binding/_vertex_buffer.cpp | 38 ------ 24 files changed, 909 insertions(+), 909 deletions(-) create mode 100644 Source/modules/asura-core/Graphics/binding/Canvas.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/Color.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/Color32.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/GPUBuffer.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/GfxDevice.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/Image.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/IndexBuffer.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/Mesh.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/Shader.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/SpriteBatch.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/Texture.binding.cpp create mode 100644 Source/modules/asura-core/Graphics/binding/VertexBuffer.binding.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_canvas.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_color.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_color32.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_gfx_device.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_image.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_index_buffer.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_mesh2d.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_shader.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_sprite_batch.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_texture.cpp delete mode 100644 Source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp (limited to 'Source/modules/asura-core/Graphics/binding') diff --git a/Source/modules/asura-core/Graphics/binding/Canvas.binding.cpp b/Source/modules/asura-core/Graphics/binding/Canvas.binding.cpp new file mode 100644 index 0000000..a038e67 --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/Canvas.binding.cpp @@ -0,0 +1,48 @@ +#include "../Canvas.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + +LUAX_REGISTRY(Canvas) +{ + LUAX_REGISTER_METHODS(state, + { "SetSize", _SetSize }, + { "Bind", _Bind }, + { "Unbind", _Unbind } + ); +} + +LUAX_POSTPROCESS(Canvas) +{ + +} + +// canvas:SetSize() +LUAX_IMPL_METHOD(Canvas, _SetSize) +{ + LUAX_PREPARE(L, Canvas); + return 0; + +} + +// canvas:Bind() +LUAX_IMPL_METHOD(Canvas, _Bind) +{ + LUAX_PREPARE(L, Canvas); + + return 0; +} + +// canvas:Unbind() +LUAX_IMPL_METHOD(Canvas, _Unbind) +{ + LUAX_PREPARE(L, Canvas); + return 0; + +} + +namespace_end +namespace_end \ No newline at end of file diff --git a/Source/modules/asura-core/Graphics/binding/Color.binding.cpp b/Source/modules/asura-core/Graphics/binding/Color.binding.cpp new file mode 100644 index 0000000..008d9c2 --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/Color.binding.cpp @@ -0,0 +1,130 @@ +#include "../Color.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + +LUAX_REGISTRY(Color) +{ + LUAX_REGISTER_METHODS(state, + { "ToColor32", _ToColor32 }, + { "SetColor", _SetColor }, + { "GetColor", _GetColor }, + { "GetR", _GetR }, + { "GetG", _GetG }, + { "GetB", _GetB }, + { "GetA", _GetA }, + { "__eq", ___eq }, + { "__add", ___add }, + { "__sub", ___sub }, + { "__mul", ___mul }, + { "__div", ___div } + ); +} + +LUAX_POSTPROCESS(Color) +{ + +} + +// color:ToColor32() +LUAX_IMPL_METHOD(Color, _ToColor32) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:SetColor() +LUAX_IMPL_METHOD(Color, _SetColor) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:GetColor() +LUAX_IMPL_METHOD(Color, _GetColor) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:GetR() +LUAX_IMPL_METHOD(Color, _GetR) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:GetG() +LUAX_IMPL_METHOD(Color, _GetG) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:GetB() +LUAX_IMPL_METHOD(Color, _GetB) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:GetA() +LUAX_IMPL_METHOD(Color, _GetA) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:__eq() +LUAX_IMPL_METHOD(Color, ___eq) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:__add() +LUAX_IMPL_METHOD(Color, ___add) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:__sub() +LUAX_IMPL_METHOD(Color, ___sub) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:__mul() +LUAX_IMPL_METHOD(Color, ___mul) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:__div() +LUAX_IMPL_METHOD(Color, ___div) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +} +} \ No newline at end of file diff --git a/Source/modules/asura-core/Graphics/binding/Color32.binding.cpp b/Source/modules/asura-core/Graphics/binding/Color32.binding.cpp new file mode 100644 index 0000000..7613361 --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/Color32.binding.cpp @@ -0,0 +1,66 @@ +#include "../Color32.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(Color32) + { + LUAX_REGISTER_METHODS(state, + { "ToColor", _ToColor }, + { "GetRed", _GetRed }, + { "GetGreen", _GetGreen }, + { "GetBlue", _GetBlue }, + { "GetAlpha", _GetAlpha } + ); + } + + LUAX_POSTPROCESS(Color32) + { + + } + + // color32:ToColor() + LUAX_IMPL_METHOD(Color32, _ToColor) + { + LUAX_PREPARE(L, Color32); + return 0; + + } + + // color32:GetRed() + LUAX_IMPL_METHOD(Color32, _GetRed) + { + LUAX_PREPARE(L, Color32); + return 0; + } + + // color32:GetGreen() + LUAX_IMPL_METHOD(Color32, _GetGreen) + { + LUAX_PREPARE(L, Color32); + + return 0; + } + + // color32:GetBlue() + LUAX_IMPL_METHOD(Color32, _GetBlue) + { + LUAX_PREPARE(L, Color32); + + return 0; + } + + // color32:GetAlpha() + LUAX_IMPL_METHOD(Color32, _GetAlpha) + { + LUAX_PREPARE(L, Color32); + + return 0; + } + + } +} + \ No newline at end of file diff --git a/Source/modules/asura-core/Graphics/binding/GPUBuffer.binding.cpp b/Source/modules/asura-core/Graphics/binding/GPUBuffer.binding.cpp new file mode 100644 index 0000000..8c39a59 --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/GPUBuffer.binding.cpp @@ -0,0 +1,118 @@ +#include + +#include "../image.h" +#include "../GPUBuffer.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(GPUBuffer) + { + LUAX_REGISTER_METHODS(state, + { "Fill", _Fill }, + { "GetSize", _GetSize }, + { "GetCount", _GetCount } + ); + } + + LUAX_POSTPROCESS(GPUBuffer) + { + LUAX_REGISTER_ENUM(state, "EBufferType", + { "VERTEX", BUFFER_TYPE_VERTEX }, + { "INDEX", BUFFER_TYPE_INDEX } + ); + LUAX_REGISTER_ENUM(state, "EBufferUsage", + { "STREAM", BUFFER_USAGE_STREAM }, + { "DYNAMIC", BUFFER_USAGE_DYNAMIC }, + { "STATIC", BUFFER_USAGE_STATIC } + ); + LUAX_REGISTER_ENUM(state, "EBufferDataType", + { "INT", BUFFER_DATA_TYPE_INT }, + { "FLOAT", BUFFER_DATA_TYPE_FLOAT }, + { "UNSIGNED_BYTE", BUFFER_DATA_TYPE_UNSIGNED_BYTE } + ); + + } + + // buffer = GPUBuffer.New(bufferType, bufferUsage, bufferDataType, size) + // buffer = GPUBuffer.New(image) + // buffer = GPUBuffer.New(mesh2d) + // buffer = GPUBuffer.New(canvas) + // buffer = GPUBuffer.New(shape) + //LUAX_IMPL_METHOD(GPUBuffer, _New) + //{ + // LUAX_STATE(L); + + // return 0; + //} + + // gpubuffer:Fill({data_unit_list}, offseti) + // data_unit_list :存放数据的table + // offseti : 开始覆盖的地方所在的索引(从0开始) + LUAX_IMPL_METHOD(GPUBuffer, _Fill) + { + LUAX_PREPARE(L, GPUBuffer); + + // 使用buffer对应的类型数据修改buffer,在第一次调用时会初始化size大小的buffer,然后填充。 + int offset = state.GetValue(3, 0); + int count = lua_objlen(L, 2); + int size = count * self->GetDataTypeSize(); + byte* data = (byte*)malloc(size); + int unit = self->GetDataTypeSize(); + int i = 1; + lua_rawgeti(L, 2, i); + while (!lua_isnil(L, -1)) + { + switch (self->m_DataType) + { + case GL_INT: + { + int n = state.CheckValue(-1); + memcpy(data + (i - 1)*unit, &n, unit); + break; + } + case GL_FLOAT: + { + float n = state.CheckValue(-1); + memcpy(data + (i - 1)*unit, &n, unit); + break; + } + case GL_UNSIGNED_BYTE: + { + unsigned char n = state.CheckValue(-1); + memcpy(data + (i - 1)*unit, &n, unit); + break; + } + } + state.Pop(1); // value + lua_rawgeti(L, 2, ++i); + } + state.Pop(); // nil + + self->Fill(data, size, offset * unit); + + free(data); + return 0; + } + + // gpubuffer:GetSize() + LUAX_IMPL_METHOD(GPUBuffer, _GetSize) + { + LUAX_PREPARE(L, GPUBuffer); + state.Push(self->m_Size); + return 0; + } + + LUAX_IMPL_METHOD(GPUBuffer, _GetCount) + { + LUAX_PREPARE(L, GPUBuffer); + state.Push(self->m_Size / self->GetDataTypeSize()); + return 0; + } + + } +} diff --git a/Source/modules/asura-core/Graphics/binding/GfxDevice.binding.cpp b/Source/modules/asura-core/Graphics/binding/GfxDevice.binding.cpp new file mode 100644 index 0000000..f6c2004 --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/GfxDevice.binding.cpp @@ -0,0 +1,151 @@ +#include "../GfxDevice.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(GfxDevice) + { + LUAX_REGISTER_METHODS(state, + { "SetMatrixMode", _SetMatrixMode }, + { "GetMatrixMode", _GetMatrixMode }, + { "PushMatrix", _PushMatrix }, + { "PopMatrix", _PopMatrix }, + { "LoadIdentity", _LoadIdentity }, + { "Rotate", _Rotate }, + { "Translate", _Translate }, + { "Scale", _Scale }, + { "Ortho", _Ortho }, + { "GetMatrixDepth", _GetMatrixDepth }, + { "GetMatrixIndex", _GetMatrixIndex }, + { "UseShader", _UseShader }, + { "UnuseShader", _UnuseShader } + ); + } + + LUAX_POSTPROCESS(GfxDevice) + { + LUAX_REGISTER_ENUM(state, "EMatrixMode", + { "PROJECTION", MATRIX_MODE_PROJECTION }, + { "0", 0 }, + { "MODEL", MATRIX_MODE_MODEL }, + { "1", 1 }, + { "VIEW", MATRIX_MODE_VIEW }, + { "2", 2 } + ); + LUAX_REGISTER_ENUM(state, "EGLParams", + { "MAX_TEXTURE_UNIT", GL_PARAM_MAX_TEXTURE_UNIT }, + { "1", 1 } + ); + + } + + // gfxdevice:SetMatrixMode() + LUAX_IMPL_METHOD(GfxDevice, _SetMatrixMode) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:GetMatrixMode() + LUAX_IMPL_METHOD(GfxDevice, _GetMatrixMode) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:PushMatrix() + LUAX_IMPL_METHOD(GfxDevice, _PushMatrix) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:PopMatrix() + LUAX_IMPL_METHOD(GfxDevice, _PopMatrix) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:LoadIdentity() + LUAX_IMPL_METHOD(GfxDevice, _LoadIdentity) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:Rotate() + LUAX_IMPL_METHOD(GfxDevice, _Rotate) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:Translate() + LUAX_IMPL_METHOD(GfxDevice, _Translate) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:Scale() + LUAX_IMPL_METHOD(GfxDevice, _Scale) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:Ortho() + LUAX_IMPL_METHOD(GfxDevice, _Ortho) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:GetMatrixDepth() + LUAX_IMPL_METHOD(GfxDevice, _GetMatrixDepth) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:GetMatrixIndex() + LUAX_IMPL_METHOD(GfxDevice, _GetMatrixIndex) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:UseShader() + LUAX_IMPL_METHOD(GfxDevice, _UseShader) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:UnuseShader() + LUAX_IMPL_METHOD(GfxDevice, _UnuseShader) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + } +} diff --git a/Source/modules/asura-core/Graphics/binding/Image.binding.cpp b/Source/modules/asura-core/Graphics/binding/Image.binding.cpp new file mode 100644 index 0000000..94f88b8 --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/Image.binding.cpp @@ -0,0 +1,71 @@ +#include "../image.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + +LUAX_REGISTRY(Image) +{ + LUAX_INHERIT(state, Texture); + + LUAX_REGISTER_METHODS(state, + { "New", _New }, + { "GetWidth", _GetWidth }, + { "GetHeight", _GetHeight }, + { "GetSize", _GetSize }, + { "Render", _Render } + ); +} + +LUAX_POSTPROCESS(Image) +{ +} + +// image = Image.New() +LUAX_IMPL_METHOD(Image, _New) +{ + LUAX_STATE(L); + Image* img = new Image(); + img->PushLuaxUserdata(state); + return 1; +} + +// width = image:GetWidth() +LUAX_IMPL_METHOD(Image, _GetWidth) +{ + LUAX_PREPARE(L, Image); + state.Push(self->GetWidth()); + return 1; +} + +// height = image:GetHeight() +LUAX_IMPL_METHOD(Image, _GetHeight) +{ + LUAX_PREPARE(L, Image); + state.Push(self->GetHeight()); + return 1; +} + +// width, height = image:GetSize() +LUAX_IMPL_METHOD(Image, _GetSize) +{ + LUAX_PREPARE(L, Image); + int width = self->GetWidth(); + int height = self->GetHeight(); + state.Push(width); + state.Push(height); + return 2; +} + +// image:Render() +LUAX_IMPL_METHOD(Image, _Render) +{ + LUAX_PREPARE(L, Image); + + return 0; +} + +} +} diff --git a/Source/modules/asura-core/Graphics/binding/IndexBuffer.binding.cpp b/Source/modules/asura-core/Graphics/binding/IndexBuffer.binding.cpp new file mode 100644 index 0000000..151dc98 --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/IndexBuffer.binding.cpp @@ -0,0 +1,31 @@ +#include "../IndexBuffer.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(IndexBuffer) + { + LUAX_REGISTER_METHODS(state, + { "New", _New } + ); + } + + LUAX_POSTPROCESS(IndexBuffer) + { + + } + + // IndexBuffer.New() + LUAX_IMPL_METHOD(IndexBuffer, _New) + { + LUAX_STATE(L); + + return 0; + } + + } +} diff --git a/Source/modules/asura-core/Graphics/binding/Mesh.binding.cpp b/Source/modules/asura-core/Graphics/binding/Mesh.binding.cpp new file mode 100644 index 0000000..4e3f426 --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/Mesh.binding.cpp @@ -0,0 +1,20 @@ +#include "../mesh2d.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(Mesh2D) + { + + } + + LUAX_POSTPROCESS(Mesh2D) + { + + } + + } +} diff --git a/Source/modules/asura-core/Graphics/binding/Shader.binding.cpp b/Source/modules/asura-core/Graphics/binding/Shader.binding.cpp new file mode 100644 index 0000000..85fd388 --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/Shader.binding.cpp @@ -0,0 +1,131 @@ +#include "../shader.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(Shader) + { + LUAX_REGISTER_METHODS(state, + { "New", _New }, + { "Load", _Load }, + { "Update", _Update }, + { "HasUniform", _HasUniform }, + { "GetUniformLocation", _GetUniformLocation }, + { "SetBuiltInUniforms", _SetBuiltInUniforms }, + { "SetUniformFloat", _SetUniformFloat }, + { "SetUniformTexture", _SetUniformTexture }, + { "SetUniformVector2", _SetUniformVector2 }, + { "SetUniformVector3", _SetUniformVector3 }, + { "SetUniformVector4", _SetUniformVector4 }, + { "SetUniformColor", _SetUniformColor }, + { "SetBuiltInUniforms", _SetBuiltInUniforms } + ); + } + + LUAX_POSTPROCESS(Shader) + { + + } + + // Shader.New() + LUAX_IMPL_METHOD(Shader, _New) + { + LUAX_STATE(L); + + return 0; + } + + // shader:Load() + LUAX_IMPL_METHOD(Shader, _Load) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:Update() + LUAX_IMPL_METHOD(Shader, _Update) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:HasUniform() + LUAX_IMPL_METHOD(Shader, _HasUniform) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:GetUniformLocation() + LUAX_IMPL_METHOD(Shader, _GetUniformLocation) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetBuiltInUniforms() + LUAX_IMPL_METHOD(Shader, _SetBuiltInUniforms) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformFloat() + LUAX_IMPL_METHOD(Shader, _SetUniformFloat) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformTexture() + LUAX_IMPL_METHOD(Shader, _SetUniformTexture) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformVector2() + LUAX_IMPL_METHOD(Shader, _SetUniformVector2) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformVector3() + LUAX_IMPL_METHOD(Shader, _SetUniformVector3) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformVector4() + LUAX_IMPL_METHOD(Shader, _SetUniformVector4) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformColor() + LUAX_IMPL_METHOD(Shader, _SetUniformColor) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + } +} diff --git a/Source/modules/asura-core/Graphics/binding/SpriteBatch.binding.cpp b/Source/modules/asura-core/Graphics/binding/SpriteBatch.binding.cpp new file mode 100644 index 0000000..6b7d25c --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/SpriteBatch.binding.cpp @@ -0,0 +1,20 @@ +#include "../SpriteBatch.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(SpriteBatch) + { + + } + + LUAX_POSTPROCESS(SpriteBatch) + { + + } + + } +} diff --git a/Source/modules/asura-core/Graphics/binding/Texture.binding.cpp b/Source/modules/asura-core/Graphics/binding/Texture.binding.cpp new file mode 100644 index 0000000..f5e5f17 --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/Texture.binding.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(2); + FilterMode mag = (FilterMode)state.CheckValue(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(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 diff --git a/Source/modules/asura-core/Graphics/binding/VertexBuffer.binding.cpp b/Source/modules/asura-core/Graphics/binding/VertexBuffer.binding.cpp new file mode 100644 index 0000000..8ed487b --- /dev/null +++ b/Source/modules/asura-core/Graphics/binding/VertexBuffer.binding.cpp @@ -0,0 +1,38 @@ +#include "../VertexBuffer.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(VertexBuffer) + { + LUAX_REGISTER_METHODS(state, + { "New", _New } + ); + } + + LUAX_POSTPROCESS(VertexBuffer) + { + + } + + // vbo = VertexBuffer.New(usage, data_type, count) + LUAX_IMPL_METHOD(VertexBuffer, _New) + { + LUAX_STATE(L); + + BufferUsage usage = (BufferUsage)state.CheckValue(1); + BufferDataType datatype = (BufferDataType)state.CheckValue(2); + uint count = state.CheckValue(3); + + VertexBuffer* vbo = new VertexBuffer(usage, datatype, count * GPUBuffer::GetDataTypeSize(datatype)); + vbo->PushLuaxUserdata(state); + + return 1; + } + + } +} diff --git a/Source/modules/asura-core/Graphics/binding/_canvas.cpp b/Source/modules/asura-core/Graphics/binding/_canvas.cpp deleted file mode 100644 index 44841f5..0000000 --- a/Source/modules/asura-core/Graphics/binding/_canvas.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "../Canvas.h" - -using namespace std; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - - LUAX_REGISTRY(Canvas) - { - LUAX_REGISTER_METHODS(state, - { "SetSize", _SetSize }, - { "Bind", _Bind }, - { "Unbind", _Unbind } - ); - } - - LUAX_POSTPROCESS(Canvas) - { - - } - - // canvas:SetSize() - LUAX_IMPL_METHOD(Canvas, _SetSize) - { - LUAX_PREPARE(L, Canvas); - return 0; - - } - - // canvas:Bind() - LUAX_IMPL_METHOD(Canvas, _Bind) - { - LUAX_PREPARE(L, Canvas); - - return 0; - } - - // canvas:Unbind() - LUAX_IMPL_METHOD(Canvas, _Unbind) - { - LUAX_PREPARE(L, Canvas); - return 0; - - } - - } -} diff --git a/Source/modules/asura-core/Graphics/binding/_color.cpp b/Source/modules/asura-core/Graphics/binding/_color.cpp deleted file mode 100644 index 008d9c2..0000000 --- a/Source/modules/asura-core/Graphics/binding/_color.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#include "../Color.h" - -using namespace std; -using namespace Luax; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - -LUAX_REGISTRY(Color) -{ - LUAX_REGISTER_METHODS(state, - { "ToColor32", _ToColor32 }, - { "SetColor", _SetColor }, - { "GetColor", _GetColor }, - { "GetR", _GetR }, - { "GetG", _GetG }, - { "GetB", _GetB }, - { "GetA", _GetA }, - { "__eq", ___eq }, - { "__add", ___add }, - { "__sub", ___sub }, - { "__mul", ___mul }, - { "__div", ___div } - ); -} - -LUAX_POSTPROCESS(Color) -{ - -} - -// color:ToColor32() -LUAX_IMPL_METHOD(Color, _ToColor32) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:SetColor() -LUAX_IMPL_METHOD(Color, _SetColor) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:GetColor() -LUAX_IMPL_METHOD(Color, _GetColor) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:GetR() -LUAX_IMPL_METHOD(Color, _GetR) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:GetG() -LUAX_IMPL_METHOD(Color, _GetG) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:GetB() -LUAX_IMPL_METHOD(Color, _GetB) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:GetA() -LUAX_IMPL_METHOD(Color, _GetA) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:__eq() -LUAX_IMPL_METHOD(Color, ___eq) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:__add() -LUAX_IMPL_METHOD(Color, ___add) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:__sub() -LUAX_IMPL_METHOD(Color, ___sub) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:__mul() -LUAX_IMPL_METHOD(Color, ___mul) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -// color:__div() -LUAX_IMPL_METHOD(Color, ___div) -{ - LUAX_PREPARE(L, Color); - - return 0; -} - -} -} \ No newline at end of file diff --git a/Source/modules/asura-core/Graphics/binding/_color32.cpp b/Source/modules/asura-core/Graphics/binding/_color32.cpp deleted file mode 100644 index 7613361..0000000 --- a/Source/modules/asura-core/Graphics/binding/_color32.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "../Color32.h" - -using namespace std; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - - LUAX_REGISTRY(Color32) - { - LUAX_REGISTER_METHODS(state, - { "ToColor", _ToColor }, - { "GetRed", _GetRed }, - { "GetGreen", _GetGreen }, - { "GetBlue", _GetBlue }, - { "GetAlpha", _GetAlpha } - ); - } - - LUAX_POSTPROCESS(Color32) - { - - } - - // color32:ToColor() - LUAX_IMPL_METHOD(Color32, _ToColor) - { - LUAX_PREPARE(L, Color32); - return 0; - - } - - // color32:GetRed() - LUAX_IMPL_METHOD(Color32, _GetRed) - { - LUAX_PREPARE(L, Color32); - return 0; - } - - // color32:GetGreen() - LUAX_IMPL_METHOD(Color32, _GetGreen) - { - LUAX_PREPARE(L, Color32); - - return 0; - } - - // color32:GetBlue() - LUAX_IMPL_METHOD(Color32, _GetBlue) - { - LUAX_PREPARE(L, Color32); - - return 0; - } - - // color32:GetAlpha() - LUAX_IMPL_METHOD(Color32, _GetAlpha) - { - LUAX_PREPARE(L, Color32); - - return 0; - } - - } -} - \ No newline at end of file diff --git a/Source/modules/asura-core/Graphics/binding/_gfx_device.cpp b/Source/modules/asura-core/Graphics/binding/_gfx_device.cpp deleted file mode 100644 index f6c2004..0000000 --- a/Source/modules/asura-core/Graphics/binding/_gfx_device.cpp +++ /dev/null @@ -1,151 +0,0 @@ -#include "../GfxDevice.h" - -using namespace std; -using namespace Luax; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - - LUAX_REGISTRY(GfxDevice) - { - LUAX_REGISTER_METHODS(state, - { "SetMatrixMode", _SetMatrixMode }, - { "GetMatrixMode", _GetMatrixMode }, - { "PushMatrix", _PushMatrix }, - { "PopMatrix", _PopMatrix }, - { "LoadIdentity", _LoadIdentity }, - { "Rotate", _Rotate }, - { "Translate", _Translate }, - { "Scale", _Scale }, - { "Ortho", _Ortho }, - { "GetMatrixDepth", _GetMatrixDepth }, - { "GetMatrixIndex", _GetMatrixIndex }, - { "UseShader", _UseShader }, - { "UnuseShader", _UnuseShader } - ); - } - - LUAX_POSTPROCESS(GfxDevice) - { - LUAX_REGISTER_ENUM(state, "EMatrixMode", - { "PROJECTION", MATRIX_MODE_PROJECTION }, - { "0", 0 }, - { "MODEL", MATRIX_MODE_MODEL }, - { "1", 1 }, - { "VIEW", MATRIX_MODE_VIEW }, - { "2", 2 } - ); - LUAX_REGISTER_ENUM(state, "EGLParams", - { "MAX_TEXTURE_UNIT", GL_PARAM_MAX_TEXTURE_UNIT }, - { "1", 1 } - ); - - } - - // gfxdevice:SetMatrixMode() - LUAX_IMPL_METHOD(GfxDevice, _SetMatrixMode) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:GetMatrixMode() - LUAX_IMPL_METHOD(GfxDevice, _GetMatrixMode) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:PushMatrix() - LUAX_IMPL_METHOD(GfxDevice, _PushMatrix) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:PopMatrix() - LUAX_IMPL_METHOD(GfxDevice, _PopMatrix) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:LoadIdentity() - LUAX_IMPL_METHOD(GfxDevice, _LoadIdentity) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:Rotate() - LUAX_IMPL_METHOD(GfxDevice, _Rotate) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:Translate() - LUAX_IMPL_METHOD(GfxDevice, _Translate) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:Scale() - LUAX_IMPL_METHOD(GfxDevice, _Scale) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:Ortho() - LUAX_IMPL_METHOD(GfxDevice, _Ortho) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:GetMatrixDepth() - LUAX_IMPL_METHOD(GfxDevice, _GetMatrixDepth) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:GetMatrixIndex() - LUAX_IMPL_METHOD(GfxDevice, _GetMatrixIndex) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:UseShader() - LUAX_IMPL_METHOD(GfxDevice, _UseShader) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - // gfxdevice:UnuseShader() - LUAX_IMPL_METHOD(GfxDevice, _UnuseShader) - { - LUAX_PREPARE(L, GfxDevice); - - return 0; - } - - } -} diff --git a/Source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp b/Source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp deleted file mode 100644 index 8c39a59..0000000 --- a/Source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include - -#include "../image.h" -#include "../GPUBuffer.h" - -using namespace std; -using namespace Luax; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - - LUAX_REGISTRY(GPUBuffer) - { - LUAX_REGISTER_METHODS(state, - { "Fill", _Fill }, - { "GetSize", _GetSize }, - { "GetCount", _GetCount } - ); - } - - LUAX_POSTPROCESS(GPUBuffer) - { - LUAX_REGISTER_ENUM(state, "EBufferType", - { "VERTEX", BUFFER_TYPE_VERTEX }, - { "INDEX", BUFFER_TYPE_INDEX } - ); - LUAX_REGISTER_ENUM(state, "EBufferUsage", - { "STREAM", BUFFER_USAGE_STREAM }, - { "DYNAMIC", BUFFER_USAGE_DYNAMIC }, - { "STATIC", BUFFER_USAGE_STATIC } - ); - LUAX_REGISTER_ENUM(state, "EBufferDataType", - { "INT", BUFFER_DATA_TYPE_INT }, - { "FLOAT", BUFFER_DATA_TYPE_FLOAT }, - { "UNSIGNED_BYTE", BUFFER_DATA_TYPE_UNSIGNED_BYTE } - ); - - } - - // buffer = GPUBuffer.New(bufferType, bufferUsage, bufferDataType, size) - // buffer = GPUBuffer.New(image) - // buffer = GPUBuffer.New(mesh2d) - // buffer = GPUBuffer.New(canvas) - // buffer = GPUBuffer.New(shape) - //LUAX_IMPL_METHOD(GPUBuffer, _New) - //{ - // LUAX_STATE(L); - - // return 0; - //} - - // gpubuffer:Fill({data_unit_list}, offseti) - // data_unit_list :存放数据的table - // offseti : 开始覆盖的地方所在的索引(从0开始) - LUAX_IMPL_METHOD(GPUBuffer, _Fill) - { - LUAX_PREPARE(L, GPUBuffer); - - // 使用buffer对应的类型数据修改buffer,在第一次调用时会初始化size大小的buffer,然后填充。 - int offset = state.GetValue(3, 0); - int count = lua_objlen(L, 2); - int size = count * self->GetDataTypeSize(); - byte* data = (byte*)malloc(size); - int unit = self->GetDataTypeSize(); - int i = 1; - lua_rawgeti(L, 2, i); - while (!lua_isnil(L, -1)) - { - switch (self->m_DataType) - { - case GL_INT: - { - int n = state.CheckValue(-1); - memcpy(data + (i - 1)*unit, &n, unit); - break; - } - case GL_FLOAT: - { - float n = state.CheckValue(-1); - memcpy(data + (i - 1)*unit, &n, unit); - break; - } - case GL_UNSIGNED_BYTE: - { - unsigned char n = state.CheckValue(-1); - memcpy(data + (i - 1)*unit, &n, unit); - break; - } - } - state.Pop(1); // value - lua_rawgeti(L, 2, ++i); - } - state.Pop(); // nil - - self->Fill(data, size, offset * unit); - - free(data); - return 0; - } - - // gpubuffer:GetSize() - LUAX_IMPL_METHOD(GPUBuffer, _GetSize) - { - LUAX_PREPARE(L, GPUBuffer); - state.Push(self->m_Size); - return 0; - } - - LUAX_IMPL_METHOD(GPUBuffer, _GetCount) - { - LUAX_PREPARE(L, GPUBuffer); - state.Push(self->m_Size / self->GetDataTypeSize()); - return 0; - } - - } -} diff --git a/Source/modules/asura-core/Graphics/binding/_image.cpp b/Source/modules/asura-core/Graphics/binding/_image.cpp deleted file mode 100644 index 0e4cb16..0000000 --- a/Source/modules/asura-core/Graphics/binding/_image.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "../image.h" - -using namespace std; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - - LUAX_REGISTRY(Image) - { - LUAX_INHERIT(state, Texture); - - LUAX_REGISTER_METHODS(state, - { "New", _New }, - { "GetWidth", _GetWidth }, - { "GetHeight", _GetHeight }, - { "GetSize", _GetSize }, - { "Render", _Render } - ); - } - - LUAX_POSTPROCESS(Image) - { - } - - // image = Image.New() - LUAX_IMPL_METHOD(Image, _New) - { - LUAX_STATE(L); - Image* img = new Image(); - img->PushLuaxUserdata(state); - return 1; - } - - // width = image:GetWidth() - LUAX_IMPL_METHOD(Image, _GetWidth) - { - LUAX_PREPARE(L, Image); - state.Push(self->GetWidth()); - return 1; - } - - // height = image:GetHeight() - LUAX_IMPL_METHOD(Image, _GetHeight) - { - LUAX_PREPARE(L, Image); - state.Push(self->GetHeight()); - return 1; - } - - // width, height = image:GetSize() - LUAX_IMPL_METHOD(Image, _GetSize) - { - LUAX_PREPARE(L, Image); - int width = self->GetWidth(); - int height = self->GetHeight(); - state.Push(width); - state.Push(height); - return 2; - } - - // image:Render() - LUAX_IMPL_METHOD(Image, _Render) - { - LUAX_PREPARE(L, Image); - - return 0; - } - - } -} diff --git a/Source/modules/asura-core/Graphics/binding/_index_buffer.cpp b/Source/modules/asura-core/Graphics/binding/_index_buffer.cpp deleted file mode 100644 index 151dc98..0000000 --- a/Source/modules/asura-core/Graphics/binding/_index_buffer.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "../IndexBuffer.h" - -using namespace std; -using namespace Luax; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - - LUAX_REGISTRY(IndexBuffer) - { - LUAX_REGISTER_METHODS(state, - { "New", _New } - ); - } - - LUAX_POSTPROCESS(IndexBuffer) - { - - } - - // IndexBuffer.New() - LUAX_IMPL_METHOD(IndexBuffer, _New) - { - LUAX_STATE(L); - - return 0; - } - - } -} diff --git a/Source/modules/asura-core/Graphics/binding/_mesh2d.cpp b/Source/modules/asura-core/Graphics/binding/_mesh2d.cpp deleted file mode 100644 index 4e3f426..0000000 --- a/Source/modules/asura-core/Graphics/binding/_mesh2d.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "../mesh2d.h" - -using namespace std; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - - LUAX_REGISTRY(Mesh2D) - { - - } - - LUAX_POSTPROCESS(Mesh2D) - { - - } - - } -} diff --git a/Source/modules/asura-core/Graphics/binding/_shader.cpp b/Source/modules/asura-core/Graphics/binding/_shader.cpp deleted file mode 100644 index 85fd388..0000000 --- a/Source/modules/asura-core/Graphics/binding/_shader.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#include "../shader.h" - -using namespace std; -using namespace Luax; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - - LUAX_REGISTRY(Shader) - { - LUAX_REGISTER_METHODS(state, - { "New", _New }, - { "Load", _Load }, - { "Update", _Update }, - { "HasUniform", _HasUniform }, - { "GetUniformLocation", _GetUniformLocation }, - { "SetBuiltInUniforms", _SetBuiltInUniforms }, - { "SetUniformFloat", _SetUniformFloat }, - { "SetUniformTexture", _SetUniformTexture }, - { "SetUniformVector2", _SetUniformVector2 }, - { "SetUniformVector3", _SetUniformVector3 }, - { "SetUniformVector4", _SetUniformVector4 }, - { "SetUniformColor", _SetUniformColor }, - { "SetBuiltInUniforms", _SetBuiltInUniforms } - ); - } - - LUAX_POSTPROCESS(Shader) - { - - } - - // Shader.New() - LUAX_IMPL_METHOD(Shader, _New) - { - LUAX_STATE(L); - - return 0; - } - - // shader:Load() - LUAX_IMPL_METHOD(Shader, _Load) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:Update() - LUAX_IMPL_METHOD(Shader, _Update) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:HasUniform() - LUAX_IMPL_METHOD(Shader, _HasUniform) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:GetUniformLocation() - LUAX_IMPL_METHOD(Shader, _GetUniformLocation) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetBuiltInUniforms() - LUAX_IMPL_METHOD(Shader, _SetBuiltInUniforms) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetUniformFloat() - LUAX_IMPL_METHOD(Shader, _SetUniformFloat) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetUniformTexture() - LUAX_IMPL_METHOD(Shader, _SetUniformTexture) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetUniformVector2() - LUAX_IMPL_METHOD(Shader, _SetUniformVector2) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetUniformVector3() - LUAX_IMPL_METHOD(Shader, _SetUniformVector3) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetUniformVector4() - LUAX_IMPL_METHOD(Shader, _SetUniformVector4) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetUniformColor() - LUAX_IMPL_METHOD(Shader, _SetUniformColor) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - } -} diff --git a/Source/modules/asura-core/Graphics/binding/_sprite_batch.cpp b/Source/modules/asura-core/Graphics/binding/_sprite_batch.cpp deleted file mode 100644 index 6b7d25c..0000000 --- a/Source/modules/asura-core/Graphics/binding/_sprite_batch.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "../SpriteBatch.h" - -using namespace std; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - - LUAX_REGISTRY(SpriteBatch) - { - - } - - LUAX_POSTPROCESS(SpriteBatch) - { - - } - - } -} diff --git a/Source/modules/asura-core/Graphics/binding/_texture.cpp b/Source/modules/asura-core/Graphics/binding/_texture.cpp deleted file mode 100644 index f5e5f17..0000000 --- a/Source/modules/asura-core/Graphics/binding/_texture.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#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(2); - FilterMode mag = (FilterMode)state.CheckValue(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(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 diff --git a/Source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp b/Source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp deleted file mode 100644 index 8ed487b..0000000 --- a/Source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "../VertexBuffer.h" - -using namespace std; -using namespace Luax; - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - - - LUAX_REGISTRY(VertexBuffer) - { - LUAX_REGISTER_METHODS(state, - { "New", _New } - ); - } - - LUAX_POSTPROCESS(VertexBuffer) - { - - } - - // vbo = VertexBuffer.New(usage, data_type, count) - LUAX_IMPL_METHOD(VertexBuffer, _New) - { - LUAX_STATE(L); - - BufferUsage usage = (BufferUsage)state.CheckValue(1); - BufferDataType datatype = (BufferDataType)state.CheckValue(2); - uint count = state.CheckValue(3); - - VertexBuffer* vbo = new VertexBuffer(usage, datatype, count * GPUBuffer::GetDataTypeSize(datatype)); - vbo->PushLuaxUserdata(state); - - return 1; - } - - } -} -- cgit v1.1-26-g67d0