summaryrefslogtreecommitdiff
path: root/Source/modules/asura-core/Graphics/binding
diff options
context:
space:
mode:
Diffstat (limited to 'Source/modules/asura-core/Graphics/binding')
-rw-r--r--Source/modules/asura-core/Graphics/binding/_canvas.cpp48
-rw-r--r--Source/modules/asura-core/Graphics/binding/_color.cpp130
-rw-r--r--Source/modules/asura-core/Graphics/binding/_color32.cpp66
-rw-r--r--Source/modules/asura-core/Graphics/binding/_gfx_device.cpp151
-rw-r--r--Source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp118
-rw-r--r--Source/modules/asura-core/Graphics/binding/_image.cpp71
-rw-r--r--Source/modules/asura-core/Graphics/binding/_index_buffer.cpp31
-rw-r--r--Source/modules/asura-core/Graphics/binding/_mesh2d.cpp20
-rw-r--r--Source/modules/asura-core/Graphics/binding/_shader.cpp131
-rw-r--r--Source/modules/asura-core/Graphics/binding/_sprite_batch.cpp20
-rw-r--r--Source/modules/asura-core/Graphics/binding/_texture.cpp85
-rw-r--r--Source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp38
12 files changed, 909 insertions, 0 deletions
diff --git a/Source/modules/asura-core/Graphics/binding/_canvas.cpp b/Source/modules/asura-core/Graphics/binding/_canvas.cpp
new file mode 100644
index 0000000..44841f5
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_canvas.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;
+
+ }
+
+ }
+}
diff --git a/Source/modules/asura-core/Graphics/binding/_color.cpp b/Source/modules/asura-core/Graphics/binding/_color.cpp
new file mode 100644
index 0000000..008d9c2
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_color.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.cpp b/Source/modules/asura-core/Graphics/binding/_color32.cpp
new file mode 100644
index 0000000..7613361
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_color32.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/_gfx_device.cpp b/Source/modules/asura-core/Graphics/binding/_gfx_device.cpp
new file mode 100644
index 0000000..f6c2004
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_gfx_device.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/_gpu_buffer.cpp b/Source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp
new file mode 100644
index 0000000..8c39a59
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp
@@ -0,0 +1,118 @@
+#include <stdlib.h>
+
+#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<int>(-1);
+ memcpy(data + (i - 1)*unit, &n, unit);
+ break;
+ }
+ case GL_FLOAT:
+ {
+ float n = state.CheckValue<float>(-1);
+ memcpy(data + (i - 1)*unit, &n, unit);
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ unsigned char n = state.CheckValue<unsigned char>(-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
new file mode 100644
index 0000000..0e4cb16
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_image.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/_index_buffer.cpp b/Source/modules/asura-core/Graphics/binding/_index_buffer.cpp
new file mode 100644
index 0000000..151dc98
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_index_buffer.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/_mesh2d.cpp b/Source/modules/asura-core/Graphics/binding/_mesh2d.cpp
new file mode 100644
index 0000000..4e3f426
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_mesh2d.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.cpp b/Source/modules/asura-core/Graphics/binding/_shader.cpp
new file mode 100644
index 0000000..85fd388
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_shader.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/_sprite_batch.cpp b/Source/modules/asura-core/Graphics/binding/_sprite_batch.cpp
new file mode 100644
index 0000000..6b7d25c
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_sprite_batch.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.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
diff --git a/Source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp b/Source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp
new file mode 100644
index 0000000..8ed487b
--- /dev/null
+++ b/Source/modules/asura-core/Graphics/binding/_vertex_buffer.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<uint>(1);
+ BufferDataType datatype = (BufferDataType)state.CheckValue<uint>(2);
+ uint count = state.CheckValue<uint>(3);
+
+ VertexBuffer* vbo = new VertexBuffer(usage, datatype, count * GPUBuffer::GetDataTypeSize(datatype));
+ vbo->PushLuaxUserdata(state);
+
+ return 1;
+ }
+
+ }
+}