Added stack type enums to love.graphics.push (resolves issue #906.) Current enums are "transform" and "all". "transform" is the default (for compatibility.) When love.graphics.push("all") is used, love.graphics.pop() will restore all love.graphics module state to what it was when push was called.

Updated the graphics code to use a custom matrix stack rather than OpenGL1's APIs.
This commit is contained in:
Alex Szpakowski
2014-08-06 22:25:29 -03:00
parent 028108ea64
commit afc505e183
18 changed files with 726 additions and 415 deletions
+14
View File
@@ -194,5 +194,19 @@ void Matrix::transform(Vertex *dst, const Vertex *src, int size) const
}
}
Matrix Matrix::ortho(float left, float right, float bottom, float top)
{
Matrix m;
m.e[0] = 2.0f / (right - left);
m.e[5] = 2.0f / (top - bottom);
m.e[10] = -1.0;
m.e[12] = -(right + left) / (right - left);
m.e[13] = -(top + bottom) / (top - bottom);
return m;
}
} // love
+6
View File
@@ -150,6 +150,12 @@ public:
**/
void transform(Vertex *dst, const Vertex *src, int size) const;
/**
* Creates a new orthographic projection matrix with depth in the range of
* [-1, 1].
**/
static Matrix ortho(float left, float right, float bottom, float top);
private:
/**