summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-03-10 00:01:06 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-03-10 00:01:06 +0000
commit1a8323b8f91bb30d64f8b79d77e43e8a9bc0af1d (patch)
treeb24de0c366e79946a20dd9b8d802324a266c3347
parentMerge branch 'model-factory-fixup' (diff)
downloadilt-1a8323b8f91bb30d64f8b79d77e43e8a9bc0af1d.tar.bz2
ilt-1a8323b8f91bb30d64f8b79d77e43e8a9bc0af1d.tar.xz
ilt-1a8323b8f91bb30d64f8b79d77e43e8a9bc0af1d.zip
Mutation persists its own members
-rw-r--r--assetFactory/faceController.cpp2
-rw-r--r--assetFactory/mutation.cpp5
-rw-r--r--assetFactory/mutation.h4
-rw-r--r--assetFactory/use.cpp3
4 files changed, 11 insertions, 3 deletions
diff --git a/assetFactory/faceController.cpp b/assetFactory/faceController.cpp
index b485c80..b6d3d34 100644
--- a/assetFactory/faceController.cpp
+++ b/assetFactory/faceController.cpp
@@ -86,6 +86,6 @@ bool
FaceController::persist(Persistence::PersistenceStore & store)
{
return STORE_TYPE && STORE_MEMBER(id) && Style::persist(store) && STORE_MEMBER(type) && STORE_MEMBER(smooth)
- && STORE_MEMBER(scale) && STORE_MEMBER(position) && STORE_MEMBER(rotation)
+ && Mutation::persist(store)
&& STORE_NAME_HELPER("face", faceControllers, Persistence::MapByMember<FaceControllers>);
}
diff --git a/assetFactory/mutation.cpp b/assetFactory/mutation.cpp
index 9722dc3..9a6a988 100644
--- a/assetFactory/mutation.cpp
+++ b/assetFactory/mutation.cpp
@@ -27,3 +27,8 @@ Mutation::relativeLevelOfDetail() const
{
return std::max({scale.x, scale.y, scale.z});
}
+bool
+Mutation::persist(Persistence::PersistenceStore & store)
+{
+ return STORE_MEMBER(scale) && STORE_MEMBER(position) && STORE_MEMBER(rotation);
+}
diff --git a/assetFactory/mutation.h b/assetFactory/mutation.h
index e620955..2432174 100644
--- a/assetFactory/mutation.h
+++ b/assetFactory/mutation.h
@@ -1,5 +1,6 @@
#pragma once
+#include "persistence.h"
#include <glm/mat4x4.hpp>
#include <glm/vec3.hpp>
@@ -15,4 +16,7 @@ struct Mutation {
glm::vec3 position {};
glm::vec3 rotation {};
glm::vec3 scale {1};
+
+protected:
+ bool persist(Persistence::PersistenceStore & store);
};
diff --git a/assetFactory/use.cpp b/assetFactory/use.cpp
index 898b736..5e45c87 100644
--- a/assetFactory/use.cpp
+++ b/assetFactory/use.cpp
@@ -49,7 +49,6 @@ struct Lookup : public Persistence::SelectionV<Shape::CPtr> {
bool
Use::persist(Persistence::PersistenceStore & store)
{
- return STORE_TYPE && STORE_HELPER(type, Lookup) && STORE_MEMBER(position) && STORE_MEMBER(scale)
- && STORE_MEMBER(rotation) && Style::persist(store)
+ return STORE_TYPE && STORE_HELPER(type, Lookup) && Mutation::persist(store) && Style::persist(store)
&& STORE_NAME_HELPER("face", faceControllers, Persistence::MapByMember<FaceControllers>);
}