mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
We don’t need a list of projection matrices..
--HG-- branch : minor
This commit is contained in:
@@ -217,7 +217,7 @@ void Graphics::setViewportSize(int width, int height)
|
||||
gl.setViewport({0, 0, width, height}, false);
|
||||
|
||||
// Set up the projection matrix
|
||||
gl.matrices.projection.back() = Matrix4::ortho(0.0, (float) width, (float) height, 0.0);
|
||||
gl.matrices.projection = Matrix4::ortho(0.0, (float) width, (float) height, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ void Graphics::beginPass(PassInfo::BeginAction beginAction, Colorf clearColor)
|
||||
|
||||
// The projection matrix is flipped compared to rendering to a canvas, due
|
||||
// to OpenGL considering (0,0) bottom-left instead of top-left.
|
||||
gl.matrices.projection.back() = Matrix4::ortho(0.0, (float) width, (float) height, 0.0);
|
||||
gl.matrices.projection = Matrix4::ortho(0.0, (float) width, (float) height, 0.0);
|
||||
|
||||
if (GLAD_VERSION_1_0 || GLAD_EXT_sRGB_write_control)
|
||||
{
|
||||
@@ -523,7 +523,7 @@ void Graphics::beginPass(const PassInfo &info)
|
||||
int h = firstcanvas->getHeight();
|
||||
|
||||
gl.setViewport({0, 0, w, h}, true);
|
||||
gl.matrices.projection.back() = Matrix4::ortho(0.0, (float) w, 0.0, (float) h);
|
||||
gl.matrices.projection = Matrix4::ortho(0.0, (float) w, 0.0, (float) h);
|
||||
|
||||
// Make sure the correct sRGB setting is used when drawing to the canvases.
|
||||
if (GLAD_VERSION_1_0 || GLAD_EXT_sRGB_write_control)
|
||||
|
||||
@@ -74,7 +74,6 @@ OpenGL::OpenGL()
|
||||
, state()
|
||||
{
|
||||
matrices.transform.reserve(10);
|
||||
matrices.projection.reserve(2);
|
||||
}
|
||||
|
||||
bool OpenGL::initContext()
|
||||
@@ -307,10 +306,9 @@ void OpenGL::initMaxValues()
|
||||
void OpenGL::initMatrices()
|
||||
{
|
||||
matrices.transform.clear();
|
||||
matrices.projection.clear();
|
||||
|
||||
matrices.transform.push_back(Matrix4());
|
||||
matrices.projection.push_back(Matrix4());
|
||||
matrices.projection = Matrix4();
|
||||
}
|
||||
|
||||
void OpenGL::createDefaultTexture()
|
||||
@@ -364,7 +362,7 @@ void OpenGL::prepareDraw()
|
||||
// because uniform uploads can be significantly slower than glLoadMatrix.
|
||||
if (GLAD_VERSION_1_0)
|
||||
{
|
||||
const Matrix4 &curproj = matrices.projection.back();
|
||||
const Matrix4 &curproj = matrices.projection;
|
||||
const Matrix4 &curxform = matrices.transform.back();
|
||||
|
||||
const Matrix4 &lastproj = state.lastProjectionMatrix;
|
||||
@@ -377,7 +375,7 @@ void OpenGL::prepareDraw()
|
||||
glLoadMatrixf(curproj.getElements());
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
state.lastProjectionMatrix = matrices.projection.back();
|
||||
state.lastProjectionMatrix = matrices.projection;
|
||||
}
|
||||
|
||||
// Same with the transform matrix.
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
struct
|
||||
{
|
||||
std::vector<Matrix4> transform;
|
||||
std::vector<Matrix4> projection;
|
||||
Matrix4 projection;
|
||||
} matrices;
|
||||
|
||||
class TempTransform
|
||||
|
||||
@@ -753,7 +753,7 @@ void Shader::checkSetBuiltinUniforms()
|
||||
checkSetPointSize(gl.getPointSize());
|
||||
|
||||
const Matrix4 &curxform = gl.matrices.transform.back();
|
||||
const Matrix4 &curproj = gl.matrices.projection.back();
|
||||
const Matrix4 &curproj = gl.matrices.projection;
|
||||
|
||||
TemporaryAttacher attacher(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user