summaryrefslogtreecommitdiff
path: root/Source/modules/asura-core/Graphics/binding/VertexBuffer.binding.cpp
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/binding/VertexBuffer.binding.cpp
parent6a065c913e9308cc72e1ad0723b6167048f439b6 (diff)
Diffstat (limited to 'Source/modules/asura-core/Graphics/binding/VertexBuffer.binding.cpp')
-rw-r--r--Source/modules/asura-core/Graphics/binding/VertexBuffer.binding.cpp38
1 files changed, 38 insertions, 0 deletions
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<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;
+ }
+
+ }
+}