summaryrefslogtreecommitdiff
path: root/assetFactory/use.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-02-21 01:25:34 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-02-21 01:25:34 +0000
commited7c2a6a73f24f97a0f04c2e6be6862ffe54b585 (patch)
tree810350a653292d54621b7c4e72275bcd48dc6785 /assetFactory/use.cpp
parentAdd missing override (diff)
downloadilt-ed7c2a6a73f24f97a0f04c2e6be6862ffe54b585.tar.bz2
ilt-ed7c2a6a73f24f97a0f04c2e6be6862ffe54b585.tar.xz
ilt-ed7c2a6a73f24f97a0f04c2e6be6862ffe54b585.zip
Support for loading objects, uses and model factories from an XML resource
Diffstat (limited to 'assetFactory/use.cpp')
-rw-r--r--assetFactory/use.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/assetFactory/use.cpp b/assetFactory/use.cpp
index d191329..21e26f3 100644
--- a/assetFactory/use.cpp
+++ b/assetFactory/use.cpp
@@ -1,4 +1,5 @@
#include "use.h"
+#include "modelFactory.h"
Shape::CreatedFaces
Use::createMesh(ModelFactoryMesh & mesh, const Mutation::Matrix & mutation) const
@@ -9,3 +10,22 @@ Use::createMesh(ModelFactoryMesh & mesh, const Mutation::Matrix & mutation) cons
}
return faces;
}
+
+struct Lookup : public Persistence::SelectionV<Shape::CPtr> {
+ using Persistence::SelectionV<Shape::CPtr>::SelectionV;
+ using Persistence::SelectionV<Shape::CPtr>::setValue;
+ void
+ setValue(std::string && str) override
+ {
+ if (auto mf = std::dynamic_pointer_cast<const ModelFactory>(Persistence::sharedObjects.at("modelFactory"))) {
+ v = mf->shapes.at(str);
+ }
+ }
+};
+
+bool
+Use::persist(Persistence::PersistenceStore & store)
+{
+ return STORE_TYPE && STORE_HELPER(type, Lookup) && STORE_MEMBER(position) && STORE_MEMBER(scale)
+ && STORE_MEMBER(rotation);
+}