Browse Source

Renamed the internal 'Matrix' class to 'Matrix4'.

Alex Szpakowski 10 years ago
parent
commit
d8fd1413d6

+ 24 - 24
src/common/Matrix.cpp

@@ -32,17 +32,17 @@ namespace love
 // | e2 e6 e10 e14 |
 // | e2 e6 e10 e14 |
 // | e3 e7 e11 e15 |
 // | e3 e7 e11 e15 |
 
 
-Matrix::Matrix()
+Matrix4::Matrix4()
 {
 {
 	setIdentity();
 	setIdentity();
 }
 }
 
 
-Matrix::Matrix(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
+Matrix4::Matrix4(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 {
 {
 	setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky);
 	setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky);
 }
 }
 
 
-Matrix::~Matrix()
+Matrix4::~Matrix4()
 {
 {
 }
 }
 
 
@@ -55,9 +55,9 @@ Matrix::~Matrix()
 // | e2 e6 e10 e14 |
 // | e2 e6 e10 e14 |
 // | e3 e7 e11 e15 |
 // | e3 e7 e11 e15 |
 
 
-Matrix Matrix::operator * (const Matrix &m) const
+Matrix4 Matrix4::operator * (const Matrix4 &m) const
 {
 {
-	Matrix t;
+	Matrix4 t;
 
 
 	t.e[0] = (e[0]*m.e[0]) + (e[4]*m.e[1]) + (e[8]*m.e[2]) + (e[12]*m.e[3]);
 	t.e[0] = (e[0]*m.e[0]) + (e[4]*m.e[1]) + (e[8]*m.e[2]) + (e[12]*m.e[3]);
 	t.e[4] = (e[0]*m.e[4]) + (e[4]*m.e[5]) + (e[8]*m.e[6]) + (e[12]*m.e[7]);
 	t.e[4] = (e[0]*m.e[4]) + (e[4]*m.e[5]) + (e[8]*m.e[6]) + (e[12]*m.e[7]);
@@ -82,31 +82,31 @@ Matrix Matrix::operator * (const Matrix &m) const
 	return t;
 	return t;
 }
 }
 
 
-void Matrix::operator *= (const Matrix &m)
+void Matrix4::operator *= (const Matrix4 &m)
 {
 {
-	Matrix t = (*this) * m;
+	Matrix4 t = (*this) * m;
 	memcpy((void *)this->e, (void *)t.e, sizeof(float)*16);
 	memcpy((void *)this->e, (void *)t.e, sizeof(float)*16);
 }
 }
 
 
-const float *Matrix::getElements() const
+const float *Matrix4::getElements() const
 {
 {
 	return e;
 	return e;
 }
 }
 
 
-void Matrix::setIdentity()
+void Matrix4::setIdentity()
 {
 {
 	memset(e, 0, sizeof(float)*16);
 	memset(e, 0, sizeof(float)*16);
 	e[0] = e[5] = e[10] = e[15] = 1;
 	e[0] = e[5] = e[10] = e[15] = 1;
 }
 }
 
 
-void Matrix::setTranslation(float x, float y)
+void Matrix4::setTranslation(float x, float y)
 {
 {
 	setIdentity();
 	setIdentity();
 	e[12] = x;
 	e[12] = x;
 	e[13] = y;
 	e[13] = y;
 }
 }
 
 
-void Matrix::setRotation(float rad)
+void Matrix4::setRotation(float rad)
 {
 {
 	setIdentity();
 	setIdentity();
 	float c = cosf(rad), s = sinf(rad);
 	float c = cosf(rad), s = sinf(rad);
@@ -116,21 +116,21 @@ void Matrix::setRotation(float rad)
 	e[5] = c;
 	e[5] = c;
 }
 }
 
 
-void Matrix::setScale(float sx, float sy)
+void Matrix4::setScale(float sx, float sy)
 {
 {
 	setIdentity();
 	setIdentity();
 	e[0] = sx;
 	e[0] = sx;
 	e[5] = sy;
 	e[5] = sy;
 }
 }
 
 
-void Matrix::setShear(float kx, float ky)
+void Matrix4::setShear(float kx, float ky)
 {
 {
 	setIdentity();
 	setIdentity();
 	e[1] = ky;
 	e[1] = ky;
 	e[4] = kx;
 	e[4] = kx;
 }
 }
 
 
-void Matrix::setTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
+void Matrix4::setTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 {
 {
 	memset(e, 0, sizeof(float)*16); // zero out matrix
 	memset(e, 0, sizeof(float)*16); // zero out matrix
 	float c = cosf(angle), s = sinf(angle);
 	float c = cosf(angle), s = sinf(angle);
@@ -149,37 +149,37 @@ void Matrix::setTransformation(float x, float y, float angle, float sx, float sy
 	e[13] = y - ox * e[1] - oy * e[5];
 	e[13] = y - ox * e[1] - oy * e[5];
 }
 }
 
 
-void Matrix::translate(float x, float y)
+void Matrix4::translate(float x, float y)
 {
 {
-	Matrix t;
+	Matrix4 t;
 	t.setTranslation(x, y);
 	t.setTranslation(x, y);
 	this->operator *=(t);
 	this->operator *=(t);
 }
 }
 
 
-void Matrix::rotate(float rad)
+void Matrix4::rotate(float rad)
 {
 {
-	Matrix t;
+	Matrix4 t;
 	t.setRotation(rad);
 	t.setRotation(rad);
 	this->operator *=(t);
 	this->operator *=(t);
 }
 }
 
 
-void Matrix::scale(float sx, float sy)
+void Matrix4::scale(float sx, float sy)
 {
 {
-	Matrix t;
+	Matrix4 t;
 	t.setScale(sx, sy);
 	t.setScale(sx, sy);
 	this->operator *=(t);
 	this->operator *=(t);
 }
 }
 
 
-void Matrix::shear(float kx, float ky)
+void Matrix4::shear(float kx, float ky)
 {
 {
-	Matrix t;
+	Matrix4 t;
 	t.setShear(kx,ky);
 	t.setShear(kx,ky);
 	this->operator *=(t);
 	this->operator *=(t);
 }
 }
 
 
-Matrix Matrix::ortho(float left, float right, float bottom, float top)
+Matrix4 Matrix4::ortho(float left, float right, float bottom, float top)
 {
 {
-	Matrix m;
+	Matrix4 m;
 
 
 	m.e[0] = 2.0f / (right - left);
 	m.e[0] = 2.0f / (right - left);
 	m.e[5] = 2.0f / (top - bottom);
 	m.e[5] = 2.0f / (top - bottom);

+ 9 - 9
src/common/Matrix.h

@@ -32,37 +32,37 @@ namespace love
  * really needed for 2D, it contains 4x4 elements to be compatible with
  * really needed for 2D, it contains 4x4 elements to be compatible with
  * OpenGL without conversions.
  * OpenGL without conversions.
  **/
  **/
-class Matrix
+class Matrix4
 {
 {
 public:
 public:
 
 
 	/**
 	/**
 	 * Creates a new identity matrix.
 	 * Creates a new identity matrix.
 	 **/
 	 **/
-	Matrix();
+	Matrix4();
 
 
 	/**
 	/**
 	 * Creates a new matrix set to a transformation.
 	 * Creates a new matrix set to a transformation.
 	 **/
 	 **/
-	Matrix(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky);
+	Matrix4(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky);
 
 
 	/**
 	/**
 	 * Destructor.
 	 * Destructor.
 	 **/
 	 **/
-	~Matrix();
+	~Matrix4();
 
 
 	/**
 	/**
 	 * Multiplies this Matrix with another Matrix, changing neither.
 	 * Multiplies this Matrix with another Matrix, changing neither.
 	 * @param m The Matrix to multiply with this Matrix.
 	 * @param m The Matrix to multiply with this Matrix.
 	 * @return The combined matrix.
 	 * @return The combined matrix.
 	 **/
 	 **/
-	Matrix operator * (const Matrix &m) const;
+	Matrix4 operator * (const Matrix4 &m) const;
 
 
 	/**
 	/**
 	 * Multiplies a Matrix into this Matrix.
 	 * Multiplies a Matrix into this Matrix.
 	 * @param m The Matrix to combine into this Matrix.
 	 * @param m The Matrix to combine into this Matrix.
 	 **/
 	 **/
-	void operator *= (const Matrix &m);
+	void operator *= (const Matrix4 &m);
 
 
 	/**
 	/**
 	 * Gets a pointer to the 16 array elements.
 	 * Gets a pointer to the 16 array elements.
@@ -160,7 +160,7 @@ public:
 	 * Creates a new orthographic projection matrix with depth in the range of
 	 * Creates a new orthographic projection matrix with depth in the range of
 	 * [-1, 1].
 	 * [-1, 1].
 	 **/
 	 **/
-	static Matrix ortho(float left, float right, float bottom, float top);
+	static Matrix4 ortho(float left, float right, float bottom, float top);
 
 
 private:
 private:
 
 
@@ -172,7 +172,7 @@ private:
 	 **/
 	 **/
 	float e[16];
 	float e[16];
 
 
-}; // Matrix
+}; // Matrix4
 
 
 //                 | x |
 //                 | x |
 //                 | y |
 //                 | y |
@@ -184,7 +184,7 @@ private:
 // | e3 e7 e11 e15 |
 // | e3 e7 e11 e15 |
 
 
 template <typename V>
 template <typename V>
-void Matrix::transform(V *dst, const V *src, int size) const
+void Matrix4::transform(V *dst, const V *src, int size) const
 {
 {
 	for (int i = 0; i < size; i++)
 	for (int i = 0; i < size; i++)
 	{
 	{

+ 4 - 4
src/modules/graphics/opengl/Canvas.cpp

@@ -298,7 +298,7 @@ void Canvas::unloadVolatile()
 	texture_memory = 0;
 	texture_memory = 0;
 }
 }
 
 
-void Canvas::drawv(const Matrix &t, const Vertex *v)
+void Canvas::drawv(const Matrix4 &t, const Vertex *v)
 {
 {
 	OpenGL::TempDebugGroup debuggroup("Canvas draw");
 	OpenGL::TempDebugGroup debuggroup("Canvas draw");
 
 
@@ -318,14 +318,14 @@ void Canvas::drawv(const Matrix &t, const Vertex *v)
 
 
 void Canvas::draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 void Canvas::draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 {
 {
-	Matrix t(x, y, angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(x, y, angle, sx, sy, ox, oy, kx, ky);
 
 
 	drawv(t, vertices);
 	drawv(t, vertices);
 }
 }
 
 
 void Canvas::drawq(Quad *quad, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 void Canvas::drawq(Quad *quad, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 {
 {
-	Matrix t(x, y, angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(x, y, angle, sx, sy, ox, oy, kx, ky);
 
 
 	const Vertex *v = quad->getVertices();
 	const Vertex *v = quad->getVertices();
 	drawv(t, v);
 	drawv(t, v);
@@ -390,7 +390,7 @@ void Canvas::setupGrab()
 	gl.setViewport({0, 0, width, height});
 	gl.setViewport({0, 0, width, height});
 
 
 	// Set up the projection matrix
 	// Set up the projection matrix
-	gl.matrices.projection.push_back(Matrix::ortho(0.0, (float) width, 0.0, (float) height));
+	gl.matrices.projection.push_back(Matrix4::ortho(0.0, (float) width, 0.0, (float) height));
 }
 }
 
 
 void Canvas::startGrab(const std::vector<Canvas *> &canvases)
 void Canvas::startGrab(const std::vector<Canvas *> &canvases)

+ 1 - 1
src/modules/graphics/opengl/Canvas.h

@@ -142,7 +142,7 @@ private:
 	bool createMSAAFBO(GLenum internalformat);
 	bool createMSAAFBO(GLenum internalformat);
 	bool resolveMSAA(bool restoreprev);
 	bool resolveMSAA(bool restoreprev);
 
 
-	void drawv(const Matrix &t, const Vertex *v);
+	void drawv(const Matrix4 &t, const Vertex *v);
 
 
 	static Format getSizedFormat(Format format);
 	static Format getSizedFormat(Format format);
 	static void convertFormat(Format format, GLenum &internalformat, GLenum &externalformat, GLenum &type);
 	static void convertFormat(Format format, GLenum &internalformat, GLenum &externalformat, GLenum &type);

+ 3 - 3
src/modules/graphics/opengl/Font.cpp

@@ -554,7 +554,7 @@ void Font::drawVertices(const std::vector<DrawCommand> &drawcommands)
 	}
 	}
 }
 }
 
 
-void Font::printv(const Matrix &t, const std::vector<DrawCommand> &drawcommands, const std::vector<GlyphVertex> &vertices)
+void Font::printv(const Matrix4 &t, const std::vector<DrawCommand> &drawcommands, const std::vector<GlyphVertex> &vertices)
 {
 {
 	if (vertices.empty() || drawcommands.empty())
 	if (vertices.empty() || drawcommands.empty())
 		return;
 		return;
@@ -577,7 +577,7 @@ void Font::print(const std::string &text, float x, float y, float angle, float s
 	std::vector<GlyphVertex> vertices;
 	std::vector<GlyphVertex> vertices;
 	std::vector<DrawCommand> drawcommands = generateVertices(text, vertices);
 	std::vector<DrawCommand> drawcommands = generateVertices(text, vertices);
 
 
-	Matrix t(ceilf(x), ceilf(y), angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(ceilf(x), ceilf(y), angle, sx, sy, ox, oy, kx, ky);
 
 
 	printv(t, drawcommands, vertices);
 	printv(t, drawcommands, vertices);
 }
 }
@@ -587,7 +587,7 @@ void Font::printf(const std::string &text, float x, float y, float wrap, AlignMo
 	std::vector<GlyphVertex> vertices;
 	std::vector<GlyphVertex> vertices;
 	std::vector<DrawCommand> drawcommands = generateVerticesFormatted(text, wrap, align, vertices);
 	std::vector<DrawCommand> drawcommands = generateVerticesFormatted(text, wrap, align, vertices);
 
 
-	Matrix t(ceilf(x), ceilf(y), angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(ceilf(x), ceilf(y), angle, sx, sy, ox, oy, kx, ky);
 
 
 	printv(t, drawcommands, vertices);
 	printv(t, drawcommands, vertices);
 }
 }

+ 1 - 1
src/modules/graphics/opengl/Font.h

@@ -211,7 +211,7 @@ private:
 	love::font::GlyphData *getRasterizerGlyphData(uint32 glyph);
 	love::font::GlyphData *getRasterizerGlyphData(uint32 glyph);
 	const Glyph &addGlyph(uint32 glyph);
 	const Glyph &addGlyph(uint32 glyph);
 	const Glyph &findGlyph(uint32 glyph);
 	const Glyph &findGlyph(uint32 glyph);
-	void printv(const Matrix &t, const std::vector<DrawCommand> &drawcommands, const std::vector<GlyphVertex> &vertices);
+	void printv(const Matrix4 &t, const std::vector<DrawCommand> &drawcommands, const std::vector<GlyphVertex> &vertices);
 
 
 	std::vector<StrongRef<love::font::Rasterizer>> rasterizers;
 	std::vector<StrongRef<love::font::Rasterizer>> rasterizers;
 
 

+ 1 - 1
src/modules/graphics/opengl/Graphics.cpp

@@ -230,7 +230,7 @@ void Graphics::setViewportSize(int width, int height)
 	Canvas::systemViewport = gl.getViewport();
 	Canvas::systemViewport = gl.getViewport();
 
 
 	// Set up the projection matrix
 	// Set up the projection matrix
-	gl.matrices.projection.back() = Matrix::ortho(0.0, (float) width, (float) height, 0.0);
+	gl.matrices.projection.back() = Matrix4::ortho(0.0, (float) width, (float) height, 0.0);
 
 
 	// Restore the previously active Canvas.
 	// Restore the previously active Canvas.
 	setCanvas(canvases);
 	setCanvas(canvases);

+ 3 - 3
src/modules/graphics/opengl/Image.cpp

@@ -351,7 +351,7 @@ bool Image::refresh(int xoffset, int yoffset, int w, int h)
 	return true;
 	return true;
 }
 }
 
 
-void Image::drawv(const Matrix &t, const Vertex *v)
+void Image::drawv(const Matrix4 &t, const Vertex *v)
 {
 {
 	OpenGL::TempDebugGroup debuggroup("Image draw");
 	OpenGL::TempDebugGroup debuggroup("Image draw");
 
 
@@ -371,14 +371,14 @@ void Image::drawv(const Matrix &t, const Vertex *v)
 
 
 void Image::draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 void Image::draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 {
 {
-	Matrix t(x, y, angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(x, y, angle, sx, sy, ox, oy, kx, ky);
 
 
 	drawv(t, vertices);
 	drawv(t, vertices);
 }
 }
 
 
 void Image::drawq(Quad *quad, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 void Image::drawq(Quad *quad, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 {
 {
-	Matrix t(x, y, angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(x, y, angle, sx, sy, ox, oy, kx, ky);
 
 
 	drawv(t, quad->getVertices());
 	drawv(t, quad->getVertices());
 }
 }

+ 1 - 1
src/modules/graphics/opengl/Image.h

@@ -136,7 +136,7 @@ public:
 
 
 private:
 private:
 
 
-	void drawv(const Matrix &t, const Vertex *v);
+	void drawv(const Matrix4 &t, const Vertex *v);
 
 
 	void preload();
 	void preload();
 
 

+ 1 - 1
src/modules/graphics/opengl/Mesh.cpp

@@ -600,7 +600,7 @@ void Mesh::draw(float x, float y, float angle, float sx, float sy, float ox, flo
 	else
 	else
 		gl.bindTexture(gl.getDefaultTexture());
 		gl.bindTexture(gl.getDefaultTexture());
 
 
-	Matrix m(x, y, angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 m(x, y, angle, sx, sy, ox, oy, kx, ky);
 
 
 	OpenGL::TempTransform transform(gl);
 	OpenGL::TempTransform transform(gl);
 	transform.get() *= m;
 	transform.get() *= m;

+ 7 - 7
src/modules/graphics/opengl/OpenGL.cpp

@@ -274,8 +274,8 @@ void OpenGL::initMatrices()
 	matrices.transform.clear();
 	matrices.transform.clear();
 	matrices.projection.clear();
 	matrices.projection.clear();
 
 
-	matrices.transform.push_back(Matrix());
-	matrices.projection.push_back(Matrix());
+	matrices.transform.push_back(Matrix4());
+	matrices.projection.push_back(Matrix4());
 }
 }
 
 
 void OpenGL::createDefaultTexture()
 void OpenGL::createDefaultTexture()
@@ -312,7 +312,7 @@ void OpenGL::popTransform()
 	matrices.transform.pop_back();
 	matrices.transform.pop_back();
 }
 }
 
 
-Matrix &OpenGL::getTransform()
+Matrix4 &OpenGL::getTransform()
 {
 {
 	return matrices.transform.back();
 	return matrices.transform.back();
 }
 }
@@ -329,11 +329,11 @@ 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 Matrix &curproj = matrices.projection.back();
-		const Matrix &curxform = matrices.transform.back();
+		const Matrix4 &curproj = matrices.projection.back();
+		const Matrix4 &curxform = matrices.transform.back();
 
 
-		const Matrix &lastproj = state.lastProjectionMatrix;
-		const Matrix &lastxform = state.lastTransformMatrix;
+		const Matrix4 &lastproj = state.lastProjectionMatrix;
+		const Matrix4 &lastxform = state.lastTransformMatrix;
 
 
 		// We only need to re-upload the projection matrix if it's changed.
 		// We only need to re-upload the projection matrix if it's changed.
 		if (memcmp(curproj.getElements(), lastproj.getElements(), sizeof(float) * 16) != 0)
 		if (memcmp(curproj.getElements(), lastproj.getElements(), sizeof(float) * 16) != 0)

+ 6 - 6
src/modules/graphics/opengl/OpenGL.h

@@ -111,8 +111,8 @@ public:
 
 
 	struct
 	struct
 	{
 	{
-		std::vector<Matrix> transform;
-		std::vector<Matrix> projection;
+		std::vector<Matrix4> transform;
+		std::vector<Matrix4> projection;
 	} matrices;
 	} matrices;
 
 
 	class TempTransform
 	class TempTransform
@@ -130,7 +130,7 @@ public:
 			gl.popTransform();
 			gl.popTransform();
 		}
 		}
 
 
-		Matrix &get()
+		Matrix4 &get()
 		{
 		{
 			return gl.getTransform();
 			return gl.getTransform();
 		}
 		}
@@ -191,7 +191,7 @@ public:
 
 
 	void pushTransform();
 	void pushTransform();
 	void popTransform();
 	void popTransform();
-	Matrix &getTransform();
+	Matrix4 &getTransform();
 
 
 	/**
 	/**
 	 * Set up necessary state (LOVE-provided shader uniforms, etc.) for drawing.
 	 * Set up necessary state (LOVE-provided shader uniforms, etc.) for drawing.
@@ -382,8 +382,8 @@ private:
 
 
 		GLuint defaultTexture;
 		GLuint defaultTexture;
 
 
-		Matrix lastProjectionMatrix;
-		Matrix lastTransformMatrix;
+		Matrix4 lastProjectionMatrix;
+		Matrix4 lastTransformMatrix;
 
 
 	} state;
 	} state;
 
 

+ 1 - 1
src/modules/graphics/opengl/ParticleSystem.cpp

@@ -854,7 +854,7 @@ void ParticleSystem::draw(float x, float y, float angle, float sx, float sy, flo
 
 
 	OpenGL::TempDebugGroup debuggroup("ParticleSystem draw");
 	OpenGL::TempDebugGroup debuggroup("ParticleSystem draw");
 
 
-	Matrix t(x, y, angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(x, y, angle, sx, sy, ox, oy, kx, ky);
 
 
 	OpenGL::TempTransform transform(gl);
 	OpenGL::TempTransform transform(gl);
 	transform.get() *= t;
 	transform.get() *= t;

+ 4 - 4
src/modules/graphics/opengl/Shader.cpp

@@ -51,7 +51,7 @@ namespace
 		~TemporaryAttacher()
 		~TemporaryAttacher()
 		{
 		{
 			if (prevShader != nullptr)
 			if (prevShader != nullptr)
-				prevShader->attach(true);
+				prevShader->attach();
 			else
 			else
 				curShader->detach();
 				curShader->detach();
 		}
 		}
@@ -702,8 +702,8 @@ void Shader::checkSetBuiltinUniforms()
 	{
 	{
 		checkSetPointSize(gl.getPointSize());
 		checkSetPointSize(gl.getPointSize());
 
 
-		const Matrix &curxform = gl.matrices.transform.back();
-		const Matrix &curproj = gl.matrices.projection.back();
+		const Matrix4 &curxform = gl.matrices.transform.back();
+		const Matrix4 &curproj = gl.matrices.projection.back();
 
 
 		TemporaryAttacher attacher(this);
 		TemporaryAttacher attacher(this);
 
 
@@ -735,7 +735,7 @@ void Shader::checkSetBuiltinUniforms()
 			GLint location = builtinUniforms[BUILTIN_TRANSFORM_PROJECTION_MATRIX];
 			GLint location = builtinUniforms[BUILTIN_TRANSFORM_PROJECTION_MATRIX];
 			if (location >= 0)
 			if (location >= 0)
 			{
 			{
-				Matrix tp_matrix(curproj * curxform);
+				Matrix4 tp_matrix(curproj * curxform);
 				glUniformMatrix4fv(location, 1, GL_FALSE, tp_matrix.getElements());
 				glUniformMatrix4fv(location, 1, GL_FALSE, tp_matrix.getElements());
 			}
 			}
 		}
 		}

+ 2 - 2
src/modules/graphics/opengl/Shader.h

@@ -259,8 +259,8 @@ private:
 
 
 	float lastPointSize;
 	float lastPointSize;
 
 
-	Matrix lastTransformMatrix;
-	Matrix lastProjectionMatrix;
+	Matrix4 lastTransformMatrix;
+	Matrix4 lastProjectionMatrix;
 
 
 	// Counts total number of textures bound to each texture unit in all shaders
 	// Counts total number of textures bound to each texture unit in all shaders
 	static std::vector<int> textureCounters;
 	static std::vector<int> textureCounters;

+ 4 - 4
src/modules/graphics/opengl/SpriteBatch.cpp

@@ -86,7 +86,7 @@ int SpriteBatch::add(float x, float y, float a, float sx, float sy, float ox, fl
 	if ((index == -1 && next >= size) || index < -1 || index >= size)
 	if ((index == -1 && next >= size) || index < -1 || index >= size)
 		return -1;
 		return -1;
 
 
-	Matrix t(x, y, a, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(x, y, a, sx, sy, ox, oy, kx, ky);
 
 
 	addv(texture->getVertices(), t, (index == -1) ? next : index);
 	addv(texture->getVertices(), t, (index == -1) ? next : index);
 
 
@@ -103,7 +103,7 @@ int SpriteBatch::addq(Quad *quad, float x, float y, float a, float sx, float sy,
 	if ((index == -1 && next >= size) || index < -1 || index >= next)
 	if ((index == -1 && next >= size) || index < -1 || index >= next)
 		return -1;
 		return -1;
 
 
-	Matrix t(x, y, a, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(x, y, a, sx, sy, ox, oy, kx, ky);
 
 
 	addv(quad->getVertices(), t, (index == -1) ? next : index);
 	addv(quad->getVertices(), t, (index == -1) ? next : index);
 
 
@@ -222,7 +222,7 @@ void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float
 
 
 	OpenGL::TempDebugGroup debuggroup("SpriteBatch draw");
 	OpenGL::TempDebugGroup debuggroup("SpriteBatch draw");
 
 
-	Matrix t(x, y, angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(x, y, angle, sx, sy, ox, oy, kx, ky);
 
 
 	OpenGL::TempTransform transform(gl);
 	OpenGL::TempTransform transform(gl);
 	transform.get() *= t;
 	transform.get() *= t;
@@ -254,7 +254,7 @@ void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float
 	gl.drawElements(GL_TRIANGLES, (GLsizei) quad_indices.getIndexCount(next), quad_indices.getType(), quad_indices.getPointer(0));
 	gl.drawElements(GL_TRIANGLES, (GLsizei) quad_indices.getIndexCount(next), quad_indices.getType(), quad_indices.getPointer(0));
 }
 }
 
 
-void SpriteBatch::addv(const Vertex *v, const Matrix &m, int index)
+void SpriteBatch::addv(const Vertex *v, const Matrix4 &m, int index)
 {
 {
 	// Needed for colors.
 	// Needed for colors.
 	Vertex sprite[4] = {v[0], v[1], v[2], v[3]};
 	Vertex sprite[4] = {v[0], v[1], v[2], v[3]};

+ 1 - 1
src/modules/graphics/opengl/SpriteBatch.h

@@ -103,7 +103,7 @@ public:
 
 
 private:
 private:
 
 
-	void addv(const Vertex *v, const Matrix &m, int index);
+	void addv(const Vertex *v, const Matrix4 &m, int index);
 
 
 	/**
 	/**
 	 * Set the color for vertices.
 	 * Set the color for vertices.

+ 5 - 7
src/modules/graphics/opengl/Text.cpp

@@ -170,7 +170,7 @@ void Text::set(const std::string &text)
 	if (text.empty())
 	if (text.empty())
 		return set();
 		return set();
 
 
-	addTextData({text, -1.0f, Font::ALIGN_MAX_ENUM, false, false, Matrix()});
+	addTextData({text, -1.0f, Font::ALIGN_MAX_ENUM, false, false, Matrix4()});
 }
 }
 
 
 void Text::set(const std::string &text, float wrap, Font::AlignMode align)
 void Text::set(const std::string &text, float wrap, Font::AlignMode align)
@@ -178,7 +178,7 @@ void Text::set(const std::string &text, float wrap, Font::AlignMode align)
 	if (text.empty())
 	if (text.empty())
 		return set();
 		return set();
 
 
-	addTextData({text, wrap, align, false, false, Matrix()});
+	addTextData({text, wrap, align, false, false, Matrix4()});
 }
 }
 
 
 void Text::set()
 void Text::set()
@@ -191,8 +191,7 @@ void Text::add(const std::string &text, float x, float y, float angle, float sx,
 	if (text.empty())
 	if (text.empty())
 		return;
 		return;
 
 
-	Matrix m;
-	m.setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 m(x, y, angle, sx, sy, ox, oy, kx, ky);
 
 
 	addTextData({text, -1.0f, Font::ALIGN_MAX_ENUM, true, true, m});
 	addTextData({text, -1.0f, Font::ALIGN_MAX_ENUM, true, true, m});
 }
 }
@@ -202,8 +201,7 @@ void Text::addf(const std::string &text, float wrap, Font::AlignMode align, floa
 	if (text.empty())
 	if (text.empty())
 		return;
 		return;
 
 
-	Matrix m;
-	m.setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 m(x, y, angle, sx, sy, ox, oy, kx, ky);
 
 
 	addTextData({text, wrap, align, true, true, m});
 	addTextData({text, wrap, align, true, true, m});
 }
 }
@@ -232,7 +230,7 @@ void Text::draw(float x, float y, float angle, float sx, float sy, float ox, flo
 	const size_t tex_offset = offsetof(Font::GlyphVertex, s);
 	const size_t tex_offset = offsetof(Font::GlyphVertex, s);
 	const size_t stride = sizeof(Font::GlyphVertex);
 	const size_t stride = sizeof(Font::GlyphVertex);
 
 
-	Matrix t(ceilf(x), ceilf(y), angle, sx, sy, ox, oy, kx, ky);
+	Matrix4 t(ceilf(x), ceilf(y), angle, sx, sy, ox, oy, kx, ky);
 
 
 	OpenGL::TempTransform transform(gl);
 	OpenGL::TempTransform transform(gl);
 	transform.get() *= t;
 	transform.get() *= t;

+ 1 - 1
src/modules/graphics/opengl/Text.h

@@ -74,7 +74,7 @@ private:
 		Font::AlignMode align;
 		Font::AlignMode align;
 		bool use_matrix;
 		bool use_matrix;
 		bool append_vertices;
 		bool append_vertices;
-		Matrix matrix;
+		Matrix4 matrix;
 	};
 	};
 
 
 	void uploadVertices(const std::vector<Font::GlyphVertex> &vertices, size_t vertoffset);
 	void uploadVertices(const std::vector<Font::GlyphVertex> &vertices, size_t vertoffset);