summaryrefslogtreecommitdiff
path: root/assetFactory/asset.h
blob: 8dd1ecb5f33f6e835b10b72d0fd5fe7528a88151 (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
35
36
37
38
39
#pragma once

#include "factoryMesh.h"
#include "persistence.h"
#include <stdTypeDefs.hpp>

class Asset : public Persistence::Persistable, public StdTypeDefs<Asset> {
public:
	std::string id;
	std::string name;

	FactoryMesh::Collection meshes;

protected:
	struct MeshConstruct : public Persistence::SelectionPtrBase<FactoryMesh::Ptr> {
		using Persistence::SelectionPtrBase<FactoryMesh::Ptr>::setValue;

		MeshConstruct(Mesh::Ptr & m);

		void endObject(Persistence::Stack & stk) override;

		FactoryMesh::Ptr fmesh;
		Mesh::Ptr & out;
	};

	struct MeshArrayConstruct : public Persistence::SelectionPtrBase<FactoryMesh::Ptr> {
		using Persistence::SelectionPtrBase<FactoryMesh::Ptr>::setValue;

		MeshArrayConstruct(std::span<Mesh::Ptr> m);

		void endObject(Persistence::Stack & stk) override;

		FactoryMesh::Ptr fmesh;
		std::span<Mesh::Ptr> out;
	};

	friend Persistence::SelectionPtrBase<std::shared_ptr<Asset>>;
	bool persist(Persistence::PersistenceStore & store) override;
};