Transform:setOrthographic; Transform:setPerspective;
@@ -130,6 +130,30 @@ int l_lovrTransformScale(lua_State* L) {
return 1;
}
+int l_lovrTransformSetOrthographic(lua_State* L) {
+ Transform* transform = luax_checktype(L, 1, Transform);
+ float left = luaL_checknumber(L, 2);
+ float right = luaL_checknumber(L, 3);
+ float top = luaL_checknumber(L, 4);
+ float bottom = luaL_checknumber(L, 5);
+ float near = luaL_checknumber(L, 6);
+ float far = luaL_checknumber(L, 7);
+ mat4_orthographic(transform->matrix, left, right, top, bottom, near, far);
+ lua_pushvalue(L, 1);
+ return 1;
+}
+
+int l_lovrTransformSetPerspective(lua_State* L) {
+ Transform* transform = luax_checktype(L, 1, Transform);
+ float near = luaL_checknumber(L, 2);
+ float far = luaL_checknumber(L, 3);
+ float fov = luaL_checknumber(L, 4);
+ float aspect = luaL_checknumber(L, 5);
+ mat4_perspective(transform->matrix, near, far, fov, aspect);
+ lua_pushvalue(L, 1);
+ return 1;
+}
+
int l_lovrTransformSetTransformation(lua_State* L) {
Transform* transform = luax_checktype(L, 1, Transform);
lovrTransformOrigin(transform); // Dirty the Transform
@@ -172,7 +196,8 @@ const luaL_Reg lovrTransform[] = {
{ "translate", l_lovrTransformTranslate },
{ "rotate", l_lovrTransformRotate },
{ "scale", l_lovrTransformScale },
- { "setTransformation", l_lovrTransformSetTransformation },
+ { "setOrthographic", l_lovrTransformSetOrthographic },
+ { "setPerspective", l_lovrTransformSetPerspective },
{ "transformPoint", l_lovrTransformTransformPoint },
{ "inverseTransformPoint", l_lovrTransformInverseTransformPoint },
{ NULL, NULL }
