summaryrefslogtreecommitdiff
path: root/assetFactory
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-02-21 19:34:16 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-02-21 19:34:16 +0000
commit5e561d390dc82b08c20532de0952f428e7b14283 (patch)
tree5f213d4eb741e451b913884b6f302470e7b2fc74 /assetFactory
parentSupport for loading objects, uses and model factories from an XML resource (diff)
downloadilt-5e561d390dc82b08c20532de0952f428e7b14283.tar.bz2
ilt-5e561d390dc82b08c20532de0952f428e7b14283.tar.xz
ilt-5e561d390dc82b08c20532de0952f428e7b14283.zip
Rename ModelFactory to AssetFactory
Diffstat (limited to 'assetFactory')
-rw-r--r--assetFactory/assetFactory.cpp (renamed from assetFactory/modelFactory.cpp)12
-rw-r--r--assetFactory/assetFactory.h (renamed from assetFactory/modelFactory.h)8
-rw-r--r--assetFactory/use.cpp4
3 files changed, 12 insertions, 12 deletions
diff --git a/assetFactory/modelFactory.cpp b/assetFactory/assetFactory.cpp
index 2642900..0ee1f94 100644
--- a/assetFactory/modelFactory.cpp
+++ b/assetFactory/assetFactory.cpp
@@ -1,4 +1,4 @@
-#include "modelFactory.h"
+#include "assetFactory.h"
#include "cuboid.h"
#include "cylinder.h"
#include "modelFactoryMesh_fwd.h"
@@ -7,7 +7,7 @@
#include "saxParse-persistence.h"
#include <filesystem.h>
-ModelFactory::ModelFactory() :
+AssetFactory::AssetFactory() :
shapes {
{"plane", std::make_shared<Plane>()},
{"cuboid", std::make_shared<Cuboid>()},
@@ -16,15 +16,15 @@ ModelFactory::ModelFactory() :
{
}
-std::shared_ptr<ModelFactory>
-ModelFactory::loadXML(const std::filesystem::path & filename)
+std::shared_ptr<AssetFactory>
+AssetFactory::loadXML(const std::filesystem::path & filename)
{
filesystem::FileStar file {filename.c_str(), "r"};
- return Persistence::SAXParsePersistence {}.loadState<std::shared_ptr<ModelFactory>>(file);
+ return Persistence::SAXParsePersistence {}.loadState<std::shared_ptr<AssetFactory>>(file);
}
bool
-ModelFactory::persist(Persistence::PersistenceStore & store)
+AssetFactory::persist(Persistence::PersistenceStore & store)
{
using MapObjects = Persistence::MapByMember<Shapes, Object>;
return STORE_TYPE && STORE_NAME_HELPER("object", shapes, MapObjects);
diff --git a/assetFactory/modelFactory.h b/assetFactory/assetFactory.h
index 94db055..5cf90dd 100644
--- a/assetFactory/modelFactory.h
+++ b/assetFactory/assetFactory.h
@@ -4,16 +4,16 @@
#include "shape.h"
#include <filesystem>
-class ModelFactory : public Persistence::Persistable {
+class AssetFactory : public Persistence::Persistable {
public:
using Shapes = std::map<std::string, Shape::CPtr, std::less<>>;
- ModelFactory();
- [[nodiscard]] static std::shared_ptr<ModelFactory> loadXML(const std::filesystem::path &);
+ AssetFactory();
+ [[nodiscard]] static std::shared_ptr<AssetFactory> loadXML(const std::filesystem::path &);
Shapes shapes;
private:
- friend Persistence::SelectionPtrBase<std::shared_ptr<ModelFactory>, true>;
+ friend Persistence::SelectionPtrBase<std::shared_ptr<AssetFactory>, true>;
bool persist(Persistence::PersistenceStore & store) override;
};
diff --git a/assetFactory/use.cpp b/assetFactory/use.cpp
index 21e26f3..3b574c3 100644
--- a/assetFactory/use.cpp
+++ b/assetFactory/use.cpp
@@ -1,5 +1,5 @@
#include "use.h"
-#include "modelFactory.h"
+#include "assetFactory.h"
Shape::CreatedFaces
Use::createMesh(ModelFactoryMesh & mesh, const Mutation::Matrix & mutation) const
@@ -17,7 +17,7 @@ struct Lookup : public Persistence::SelectionV<Shape::CPtr> {
void
setValue(std::string && str) override
{
- if (auto mf = std::dynamic_pointer_cast<const ModelFactory>(Persistence::sharedObjects.at("modelFactory"))) {
+ if (auto mf = std::dynamic_pointer_cast<const AssetFactory>(Persistence::sharedObjects.at("assetFactory"))) {
v = mf->shapes.at(str);
}
}