summaryrefslogtreecommitdiff
path: root/Runtime/Scripting
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-11-19 21:56:08 +0800
committerchai <chaifix@163.com>2021-11-19 21:56:08 +0800
commit850d9c034792b96e2ff5ff3bbfbcc30661757aed (patch)
tree4ff5d1df7dc1917bb89b97463e4112f14b639eb9 /Runtime/Scripting
parent1cd31d14c95f9d52e30fbc611df5da4b46f048d9 (diff)
*misc
Diffstat (limited to 'Runtime/Scripting')
-rw-r--r--Runtime/Scripting/GL/GL.bind.cpp67
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;