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