From c2aecdc0d6089a3c41b3d15c45cdb49fee6a45cc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 7 Apr 2025 20:48:14 +0100 Subject: Add Asset interface to create an arbitrarily placed instance InstanceProxy is returned out via a std::any containing a std::shared_ptr because any can only contain copyable things. --- assetFactory/asset.cpp | 6 ++++++ assetFactory/asset.h | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'assetFactory') diff --git a/assetFactory/asset.cpp b/assetFactory/asset.cpp index e3f5feb..0254943 100644 --- a/assetFactory/asset.cpp +++ b/assetFactory/asset.cpp @@ -7,6 +7,12 @@ Asset::persist(Persistence::PersistenceStore & store) return STORE_MEMBER(id) && STORE_MEMBER(name); } +std::any +Asset::createAt(const Location &) const +{ + return {}; +} + Asset::TexturePtr Asset::getTexture() const { diff --git a/assetFactory/asset.h b/assetFactory/asset.h index b5de056..061a7c8 100644 --- a/assetFactory/asset.h +++ b/assetFactory/asset.h @@ -2,17 +2,22 @@ #include "factoryMesh.h" #include "persistence.h" +#include #include #include class TextureAtlas; class Renderable; +class Location; class Asset : public Persistence::Persistable, public StdTypeDefs { public: using ManyPtr = ManySharedPtr; using TexturePtr = std::shared_ptr; + /// Used only for the asset viewer + [[nodiscard]] virtual std::any createAt(const Location &) const; + std::string id; std::string name; -- cgit v1.2.3