diff options
Diffstat (limited to 'source/modules/asura-core/graphics/binding')
-rw-r--r-- | source/modules/asura-core/graphics/binding/_gfx_device.cpp | 152 | ||||
-rw-r--r-- | source/modules/asura-core/graphics/binding/_gl.cpp | 128 | ||||
-rw-r--r-- | source/modules/asura-core/graphics/binding/_shader.cpp | 104 |
3 files changed, 173 insertions, 211 deletions
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..5ae475c --- /dev/null +++ b/source/modules/asura-core/graphics/binding/_gfx_device.cpp @@ -0,0 +1,152 @@ +#include "../gfx_device.h" + +using namespace std; +using namespace Luax; + +namespace AsuraEngine +{ + namespace 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/_gl.cpp b/source/modules/asura-core/graphics/binding/_gl.cpp deleted file mode 100644 index 0c3a18f..0000000 --- a/source/modules/asura-core/graphics/binding/_gl.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include "../gl.h" - -using namespace std; -using namespace Luax; - -namespace AsuraEngine -{ - namespace Graphics - { - - LUAX_REGISTRY(OpenGL) - { - 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 } - ); - } - - LUAX_POSTPROCESS(OpenGL) - { - LUAX_REGISTER_ENUM(state, "EMatrixMode", - { "PROJECTION", MATRIX_MODE_PROJECTION }, - { "MODEL", MATRIX_MODE_MODEL }, - { "VIEW", MATRIX_MODE_VIEW } - ); - - } - - // GL.SetMatrixMode() - LUAX_IMPL_METHOD(OpenGL, _SetMatrixMode) - { - LUAX_PREPARE(L, OpenGL); - MatrixMode mode = (MatrixMode)state.CheckValue<int>(1); - gl.SetMatrixMode(mode); - return 0; - } - - // GL.GetMatrixMode() - LUAX_IMPL_METHOD(OpenGL, _GetMatrixMode) - { - LUAX_PREPARE(L, OpenGL); - - return 0; - } - - // GL.PushMatrix() - LUAX_IMPL_METHOD(OpenGL, _PushMatrix) - { - LUAX_PREPARE(L, OpenGL); - - return 0; - } - - // GL.PopMatrix() - LUAX_IMPL_METHOD(OpenGL, _PopMatrix) - { - LUAX_PREPARE(L, OpenGL); - - return 0; - } - - // GL.LoadIdentity() - LUAX_IMPL_METHOD(OpenGL, _LoadIdentity) - { - LUAX_PREPARE(L, OpenGL); - - return 0; - } - - // GL.Rotate() - LUAX_IMPL_METHOD(OpenGL, _Rotate) - { - LUAX_PREPARE(L, OpenGL); - - return 0; - } - - // GL.Translate() - LUAX_IMPL_METHOD(OpenGL, _Translate) - { - LUAX_PREPARE(L, OpenGL); - - return 0; - } - - // GL.Scale() - LUAX_IMPL_METHOD(OpenGL, _Scale) - { - LUAX_PREPARE(L, OpenGL); - - return 0; - } - - // GL.Ortho() - LUAX_IMPL_METHOD(OpenGL, _Ortho) - { - LUAX_PREPARE(L, OpenGL); - - return 0; - } - - // GL.GetMatrixDepth() - LUAX_IMPL_METHOD(OpenGL, _GetMatrixDepth) - { - LUAX_PREPARE(L, OpenGL); - - return 0; - } - - // GL.GetMatrixIndex() - LUAX_IMPL_METHOD(OpenGL, _GetMatrixIndex) - { - LUAX_PREPARE(L, OpenGL); - - return 0; - } - - } -} diff --git a/source/modules/asura-core/graphics/binding/_shader.cpp b/source/modules/asura-core/graphics/binding/_shader.cpp index 34bc98b..71f4e28 100644 --- a/source/modules/asura-core/graphics/binding/_shader.cpp +++ b/source/modules/asura-core/graphics/binding/_shader.cpp @@ -11,25 +11,19 @@ namespace AsuraEngine LUAX_REGISTRY(Shader) { LUAX_REGISTER_METHODS(state, - { "New", _New }, - { "Load", _Load }, - { "Update", _Update }, - { "HasUniform", _HasUniform }, - { "GetUniformLocation", _GetUniformLocation }, - { "SetUniformFloat", _SetUniformFloat }, - { "SetUniformTexture", _SetUniformTexture }, - { "SetUniformVector2", _SetUniformVector2 }, - { "SetUniformVector3", _SetUniformVector3 }, - { "SetUniformVector4", _SetUniformVector4 }, - { "SetUniformColor", _SetUniformColor }, - { "GetAttributeLocation", _GetAttributeLocation }, - { "SetAttribute", _SetAttribute }, - { "DisableAttribute", _DisableAttribute }, - { "SetBuiltInModelMatrix", _SetBuiltInModelMatrix }, - { "SetBuiltInViewMatrix", _SetBuiltInViewMatrix }, - { "SetBuiltInProjectionMatrix", _SetBuiltInProjectionMatrix }, - { "SetBuiltInMVPMatrix", _SetBuiltInMVPMatrix }, - { "SetBuiltInDrawColor", _SetBuiltInDrawColor } + { "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 } ); } @@ -78,6 +72,14 @@ namespace AsuraEngine return 0; } + // shader:SetBuiltInUniforms() + LUAX_IMPL_METHOD(Shader, _SetBuiltInUniforms) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + // shader:SetUniformFloat() LUAX_IMPL_METHOD(Shader, _SetUniformFloat) { @@ -126,69 +128,5 @@ namespace AsuraEngine return 0; } - // shader:GetAttributeLocation() - LUAX_IMPL_METHOD(Shader, _GetAttributeLocation) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetAttribute() - LUAX_IMPL_METHOD(Shader, _SetAttribute) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:DisableAttribute() - LUAX_IMPL_METHOD(Shader, _DisableAttribute) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetBuiltInModelMatrix() - LUAX_IMPL_METHOD(Shader, _SetBuiltInModelMatrix) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetBuiltInViewMatrix() - LUAX_IMPL_METHOD(Shader, _SetBuiltInViewMatrix) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetBuiltInProjectionMatrix() - LUAX_IMPL_METHOD(Shader, _SetBuiltInProjectionMatrix) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetBuiltInMVPMatrix() - LUAX_IMPL_METHOD(Shader, _SetBuiltInMVPMatrix) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - - // shader:SetBuiltInColor() - LUAX_IMPL_METHOD(Shader, _SetBuiltInDrawColor) - { - LUAX_PREPARE(L, Shader); - - return 0; - } - } } |