summaryrefslogtreecommitdiff
path: root/assetFactory/asset.cpp
blob: 3ab2f1c8023387bb17bb5705436a1bcf1fff6787 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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);
}