summaryrefslogtreecommitdiff
path: root/assetFactory/mutation.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-03-09 18:25:39 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-03-09 18:25:39 +0000
commit001be698401ef488cb3d30fb71c1a13c809407c8 (patch)
tree25f2f2634fcd7432092aa07f644dd00d1293f8d9 /assetFactory/mutation.cpp
parentAdd a generic persistence perf test (diff)
parentRewrite asset factory cylinder generator (diff)
downloadilt-001be698401ef488cb3d30fb71c1a13c809407c8.tar.bz2
ilt-001be698401ef488cb3d30fb71c1a13c809407c8.tar.xz
ilt-001be698401ef488cb3d30fb71c1a13c809407c8.zip
Merge branch 'model-factory-fixup'
Diffstat (limited to 'assetFactory/mutation.cpp')
-rw-r--r--assetFactory/mutation.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/assetFactory/mutation.cpp b/assetFactory/mutation.cpp
index 21d2a24..9722dc3 100644
--- a/assetFactory/mutation.cpp
+++ b/assetFactory/mutation.cpp
@@ -1,4 +1,5 @@
#include "mutation.h"
+#include <algorithm>
#include <glm/gtx/transform.hpp>
#include <maths.h>
@@ -8,3 +9,21 @@ Mutation::getMatrix() const
return glm::translate(glm::identity<Matrix>(), position) * rotate_ypr(rotation)
* glm::scale(glm::identity<Matrix>(), scale);
}
+
+Mutation::Matrix
+Mutation::getDeformationMatrix() const
+{
+ return glm::scale(glm::identity<Matrix>(), scale);
+}
+
+Mutation::Matrix
+Mutation::getLocationMatrix() const
+{
+ return glm::translate(glm::identity<Matrix>(), position) * rotate_ypr(rotation);
+}
+
+float
+Mutation::relativeLevelOfDetail() const
+{
+ return std::max({scale.x, scale.y, scale.z});
+}