summaryrefslogtreecommitdiff
path: root/assetFactory/asset.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'assetFactory/asset.cpp')
-rw-r--r--assetFactory/asset.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/assetFactory/asset.cpp b/assetFactory/asset.cpp
new file mode 100644
index 0000000..3ab2f1c
--- /dev/null
+++ b/assetFactory/asset.cpp
@@ -0,0 +1,34 @@
+#include "asset.h"
+
+bool
+Asset::persist(Persistence::PersistenceStore & store)
+{
+ return STORE_MEMBER(id) && STORE_MEMBER(name);
+}
+
+Asset::MeshConstruct::MeshConstruct(Mesh::Ptr & m) :
+ Persistence::SelectionPtrBase<FactoryMesh::Ptr> {fmesh}, out {m} { }
+
+void
+Asset::MeshConstruct::endObject(Persistence::Stack & stk)
+{
+ out = fmesh->createMesh();
+ Persistence::SelectionPtrBase<FactoryMesh::Ptr>::endObject(stk);
+}
+
+Asset::MeshArrayConstruct::MeshArrayConstruct(std::span<Mesh::Ptr> m) :
+ Persistence::SelectionPtrBase<FactoryMesh::Ptr> {fmesh}, out {m}
+{
+}
+
+void
+Asset::MeshArrayConstruct::endObject(Persistence::Stack & stk)
+{
+ for (auto & outMesh : out) {
+ if (!outMesh) {
+ outMesh = fmesh->createMesh();
+ break;
+ }
+ }
+ Persistence::SelectionPtrBase<FactoryMesh::Ptr>::endObject(stk);
+}