src/glcamera.cpp

changeset 1237
40bb00d82e2b
parent 1180
2005e4147ad6
child 1319
39d7a9642eea
--- a/src/glcamera.cpp	Fri Jan 12 00:55:31 2018 +0200
+++ b/src/glcamera.cpp	Sat Jan 13 00:04:54 2018 +0200
@@ -275,3 +275,25 @@
 	// The adapter matrix would be inverted here, but it is its own inverse so let's not bother.
 	return idealCoordinates.transformed(ldrawToIdealAdapterMatrix).transformed(m_rotationMatrix.inverted());
 }
+
+GLRotationMatrix GLCamera::realMatrix() const
+{
+	/* glOrtho(-virtualSize.width(), virtualSize.width(),
+			-virtualSize.height(), virtualSize.height(),
+			-1000.0f, 1000.0f); */
+	GLRotationMatrix ortho {
+		1 / float(m_virtualSize.width()), 0, 0, 0,
+		0, 1 / float(m_virtualSize.height()), 0, 0,
+		0, 0, -0.0001, 0,
+		0, 0, 0, 1
+	};
+
+	GLRotationMatrix panningMatrix {
+		1, 0, 0, float(m_panningX),
+		0, 1, 0, float(m_panningY),
+		0, 0, 1, 0,
+		0, 0, 0, 1
+	};
+
+	return ortho * panningMatrix * m_rotationMatrix;
+}

mercurial