src/glShared.h

changeset 1151
0eddb5bcf25b
parent 1123
15e46ea3151f
child 1173
6cd85b28f43b
--- a/src/glShared.h	Sat Feb 18 02:02:29 2017 +0200
+++ b/src/glShared.h	Mon Feb 20 07:56:21 2017 +0200
@@ -19,8 +19,33 @@
 #pragma once
 
 #include <QOpenGLFunctions>
+#include <QGenericMatrix>
 #include "basics.h"
 
+class GLRotationMatrix : public QGenericMatrix<4, 4, GLfloat>
+{
+public:
+	GLRotationMatrix() {}
+	GLRotationMatrix(GLfloat values[16]) :
+	    QGenericMatrix<4, 4, GLfloat> {values} {}
+	GLRotationMatrix(std::initializer_list<GLfloat>&& values)
+	{
+		auto iterator = values.begin();
+
+		for (int i = 0; i < 4; ++i)
+		for (int j = 0; j < 4; ++j)
+		{
+			(*this)(i, j) = *iterator;
+			++iterator;
+		}
+	}
+};
+
+inline void glMultMatrixf(const GLRotationMatrix& matrix)
+{
+	glMultMatrixf(matrix.constData());
+}
+
 class LDObject;
 
 struct LDPolygon

mercurial