diff options
Diffstat (limited to 'Runtime')
-rw-r--r-- | Runtime/Scripting/GL/GL.bind.cpp | 67 |
1 files changed, 41 insertions, 26 deletions
diff --git a/Runtime/Scripting/GL/GL.bind.cpp b/Runtime/Scripting/GL/GL.bind.cpp index f97b1e0..caf3877 100644 --- a/Runtime/Scripting/GL/GL.bind.cpp +++ b/Runtime/Scripting/GL/GL.bind.cpp @@ -175,6 +175,21 @@ int Color(lua_State* L) return 0; } +// left, bottom, width, height +int Viewport(lua_State* L) +{ + LUA_BIND_STATE(L); + + float left = state.GetValue<float>(1, 0); + float right = state.GetValue<float>(2, 0); + float width = state.GetValue<float>(3, 0); + float height = state.GetValue<float>(4, 0); + + glViewport(left, right, width, height); + + return 0; +} + int LoadIdentity(lua_State* L) { glLoadIdentity(); @@ -397,25 +412,25 @@ int Translate(lua_State* L) } static luaL_Reg glFuncs[] = { - {"ClearColor", ClearColor}, - {"Clear", Clear}, - // immediate mode apis - {"Color", Color}, - {"Begin", Begin}, - {"End", End}, - {"Vertex", Vertex }, - {"LoadIdentity", LoadIdentity}, - {"PushMatrix", PushMatrix}, - {"PopMatrix", PopMatrix}, - {"MatrixMode", MatrixMode}, - {"LoadMatrix", LoadMatrix}, - {"LoadOrthoMatrix", OrthoMatrix}, - {"LoadFrustumMatrix", FrustumMatrix}, - {"MultMatrix", MultMatrix}, - {"Scale", Scale}, - {"Rotate", Rotate}, - {"Translate", Translate}, - {0, 0} + { "ClearColor", ClearColor }, + { "Clear", Clear }, + { "Color", Color }, + { "Viewport", Viewport }, + { "Begin", Begin }, + { "End", End }, + { "Vertex", Vertex }, + { "LoadIdentity", LoadIdentity }, + { "PushMatrix", PushMatrix }, + { "PopMatrix", PopMatrix }, + { "MatrixMode", MatrixMode }, + { "LoadMatrix", LoadMatrix }, + { "LoadOrthoMatrix", OrthoMatrix }, + { "LoadFrustumMatrix", FrustumMatrix }, + { "MultMatrix", MultMatrix }, + { "Scale", Scale }, + { "Rotate", Rotate }, + { "Translate", Translate }, + { 0, 0} }; // GameLab.Engine.GL @@ -433,20 +448,20 @@ int luaopen_GameLab_Engine_GL(lua_State* L) state.RegisterMethods(glFuncs); LUA_BIND_REGISTER_ENUM(state, "EBufferType", - { "ColorBuffer", EBufferType::ColorBuffer }, - { "DepthBuffer", EBufferType::DepthBuffer}, - { "StencilBuffer", EBufferType::StencilBuffer} + { "ColorBuffer", EBufferType::ColorBuffer }, + { "DepthBuffer", EBufferType::DepthBuffer }, + { "StencilBuffer", EBufferType::StencilBuffer } ); LUA_BIND_REGISTER_ENUM(state, "EPrimitiveType", { "Triangles", EPrimitiveType::Triangles }, - { "Lines", EPrimitiveType::Lines }, - { "Points", EPrimitiveType::Points } + { "Lines", EPrimitiveType::Lines }, + { "Points", EPrimitiveType::Points } ); LUA_BIND_REGISTER_ENUM(state, "EMatrixMode", - { "MatrixView", EMatrixMode::ModelView }, - { "Projection", EMatrixMode::Projection} + { "MatrixView", EMatrixMode::ModelView }, + { "Projection", EMatrixMode::Projection } ); return 1; |