Skip to content

Commit

Permalink
Remove love.graphics.setOrthoProjection and setPerspectiveProjection
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Mar 23, 2024
1 parent 565eab4 commit 698d305
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 47 deletions.
21 changes: 0 additions & 21 deletions src/modules/graphics/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2802,27 +2802,6 @@ Vector2 Graphics::inverseTransformPoint(Vector2 point)
return p;
}

void Graphics::setOrthoProjection(float w, float h, float near, float far)
{
if (near >= far)
throw love::Exception("Orthographic projection Z far value must be greater than the Z near value.");

Matrix4 m = Matrix4::ortho(0.0f, w, 0.0f, h, near, far);
setCustomProjection(m);
}

void Graphics::setPerspectiveProjection(float verticalfov, float aspect, float near, float far)
{
if (near <= 0.0f)
throw love::Exception("Perspective projection Z near value must be greater than 0.");

if (near >= far)
throw love::Exception("Perspective projection Z far value must be greater than the Z near value.");

Matrix4 m = Matrix4::perspective(verticalfov, aspect, near, far);
setCustomProjection(m);
}

void Graphics::setCustomProjection(const Matrix4 &m)
{
flushBatchedDraws();
Expand Down
2 changes: 0 additions & 2 deletions src/modules/graphics/Graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,6 @@ class Graphics : public Module
Vector2 transformPoint(Vector2 point);
Vector2 inverseTransformPoint(Vector2 point);

void setOrthoProjection(float w, float h, float near, float far);
void setPerspectiveProjection(float verticalfov, float aspect, float near, float far);
void setCustomProjection(const Matrix4 &m);
void resetProjection();

Expand Down
24 changes: 0 additions & 24 deletions src/modules/graphics/wrap_Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3900,28 +3900,6 @@ int w_inverseTransformPoint(lua_State *L)
return 2;
}

int w_setOrthoProjection(lua_State *L)
{
float w = (float) luaL_checknumber(L, 1);
float h = (float) luaL_checknumber(L, 2);
float near = (float) luaL_optnumber(L, 3, -10.0);
float far = (float) luaL_optnumber(L, 4, 10.0);

luax_catchexcept(L, [&]() { instance()->setOrthoProjection(w, h, near, far); });
return 0;
}

int w_setPerspectiveProjection(lua_State *L)
{
float verticalfov = (float) luaL_checknumber(L, 1);
float aspect = (float) luaL_checknumber(L, 2);
float near = (float) luaL_checknumber(L, 3);
float far = (float) luaL_checknumber(L, 4);

luax_catchexcept(L, [&]() { instance()->setPerspectiveProjection(verticalfov, aspect, near, far); });
return 0;
}

int w_resetProjection(lua_State */*L*/)
{
instance()->resetProjection();
Expand Down Expand Up @@ -4074,8 +4052,6 @@ static const luaL_Reg functions[] =
{ "transformPoint", w_transformPoint },
{ "inverseTransformPoint", w_inverseTransformPoint },

{ "setOrthoProjection", w_setOrthoProjection },
{ "setPerspectiveProjection", w_setPerspectiveProjection },
{ "resetProjection", w_resetProjection },

// Deprecated
Expand Down

0 comments on commit 698d305

Please sign in to comment.