From a077eb38b01292611f4f6031b75e3e2c1c20f06e Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Aug 2019 08:54:08 +0800 Subject: *misc --- .../Graphics/binding/VertexBuffer.binding.cpp | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Source/modules/asura-core/Graphics/binding/VertexBuffer.binding.cpp (limited to 'Source/modules/asura-core/Graphics/binding/VertexBuffer.binding.cpp') 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; + } + + } +} -- cgit v1.1-26-g67d0