src/linetypes/subfilereference.cpp

changeset 33
4c41bfe2ec6e
parent 26
3a9e761e4faa
child 35
98906a94732f
--- a/src/linetypes/subfilereference.cpp	Sun Jan 26 01:06:27 2020 +0200
+++ b/src/linetypes/subfilereference.cpp	Sun Jan 26 14:29:30 2020 +0200
@@ -2,7 +2,7 @@
 #include "documentmanager.h"
 #include "invert.h"
 
-linetypes::SubfileReference::SubfileReference(const Matrix4x4& transformation,
+linetypes::SubfileReference::SubfileReference(const glm::mat4& transformation,
 	const QString& referenceName,
 	const Color color) :
 	ColoredObject{color},
@@ -32,7 +32,7 @@
 	switch (property)
 	{
 	case Property::Transformation:
-		this->transformation = value.value<Matrix4x4>();
+		this->transformation = value.value<glm::mat4>();
 		return SetPropertyResult::Success;
 	case Property::ReferenceName:
 		this->referenceName = value.toString();
@@ -44,7 +44,7 @@
 
 QString linetypes::SubfileReference::textRepresentation() const
 {
-	return referenceName + " " + vertexToStringParens(this->position());
+	return referenceName + " " + utility::vertexToStringParens(this->position());
 }
 
 void linetypes::SubfileReference::getPolygons(
@@ -54,14 +54,16 @@
 	Model* model = this->resolve(context->documents);
 	if (model != nullptr)
 	{
-		const bool needInverting = math::det(this->transformation) < 0;
+		const bool needInverting = glm::determinant(this->transformation) < 0;
 		const std::vector<gl::Polygon> modelPolygons = model->getPolygons(context->documents);
 		polygons.reserve(polygons.size() + modelPolygons.size());
 		for (gl::Polygon polygon : modelPolygons)
 		{
 			for (unsigned int i = 0; i < polygon.numPolygonVertices(); i += 1)
 			{
-				polygon.vertices[i] = math::transform(polygon.vertices[i], this->transformation);
+				glm::vec4 vertex {polygon.vertices[i], 1};
+				vertex = this->transformation * vertex;
+				polygon.vertices[i] = vertex;
 			}
 			if (needInverting != this->isInverted)
 			{
@@ -77,9 +79,9 @@
 	}
 }
 
-Point3D linetypes::SubfileReference::position() const
+glm::vec3 linetypes::SubfileReference::position() const
 {
-	return {this->transformation(0, 3), this->transformation(1, 3), this->transformation(2, 3)};
+	return {this->transformation[3][0], this->transformation[3][1], this->transformation[3][2]};
 }
 
 void linetypes::SubfileReference::invert()

mercurial