From 5e561d390dc82b08c20532de0952f428e7b14283 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 21 Feb 2023 19:34:16 +0000 Subject: Rename ModelFactory to AssetFactory --- assetFactory/assetFactory.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 assetFactory/assetFactory.h (limited to 'assetFactory/assetFactory.h') diff --git a/assetFactory/assetFactory.h b/assetFactory/assetFactory.h new file mode 100644 index 0000000..5cf90dd --- /dev/null +++ b/assetFactory/assetFactory.h @@ -0,0 +1,19 @@ +#pragma once + +#include "persistence.h" +#include "shape.h" +#include + +class AssetFactory : public Persistence::Persistable { +public: + using Shapes = std::map>; + + AssetFactory(); + [[nodiscard]] static std::shared_ptr loadXML(const std::filesystem::path &); + + Shapes shapes; + +private: + friend Persistence::SelectionPtrBase, true>; + bool persist(Persistence::PersistenceStore & store) override; +}; -- cgit v1.2.3 From df2a078c51cee464905c6fb1d1c7c4aa7873f6a1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 22 Feb 2023 23:40:46 +0000 Subject: Implement loading asset, mesh and face definitions --- assetFactory/assetFactory.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'assetFactory/assetFactory.h') diff --git a/assetFactory/assetFactory.h b/assetFactory/assetFactory.h index 5cf90dd..9d79827 100644 --- a/assetFactory/assetFactory.h +++ b/assetFactory/assetFactory.h @@ -1,17 +1,33 @@ #pragma once +#include "factoryMesh.h" #include "persistence.h" #include "shape.h" #include +#include + +class Asset : public Persistence::Persistable, public StdTypeDefs { +public: + std::string id; + std::string name; + + FactoryMesh::Collection meshes; + +private: + friend Persistence::SelectionPtrBase, true>; + bool persist(Persistence::PersistenceStore & store) override; +}; class AssetFactory : public Persistence::Persistable { public: - using Shapes = std::map>; + using Shapes = std::map>; + using Assets = std::map>; AssetFactory(); [[nodiscard]] static std::shared_ptr loadXML(const std::filesystem::path &); Shapes shapes; + Assets assets; private: friend Persistence::SelectionPtrBase, true>; -- cgit v1.2.3 From b7b9eb7bb9deb6704f276fb3b8fd67ba370caf3e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 27 Feb 2023 19:38:14 +0000 Subject: Load the X11 RGB colour definitions into a map --- assetFactory/assetFactory.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'assetFactory/assetFactory.h') diff --git a/assetFactory/assetFactory.h b/assetFactory/assetFactory.h index 9d79827..a68b460 100644 --- a/assetFactory/assetFactory.h +++ b/assetFactory/assetFactory.h @@ -22,12 +22,18 @@ class AssetFactory : public Persistence::Persistable { public: using Shapes = std::map>; using Assets = std::map>; + using Colour = glm::u8vec3; + using Colours = std::map>; AssetFactory(); [[nodiscard]] static std::shared_ptr loadXML(const std::filesystem::path &); Shapes shapes; Assets assets; + Colours colours; + + static Colours parseX11RGB(const char * rgbtxtpath); + static void normalizeColourName(std::string &); private: friend Persistence::SelectionPtrBase, true>; -- cgit v1.2.3 From 7a70e75656d31428c9bbbd51fbf1ca920e577ed1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 28 Feb 2023 01:24:18 +0000 Subject: Remove to specify if the Selection pointer type is shared or not Inferred based on whether the pointer is copyable or not. --- assetFactory/assetFactory.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'assetFactory/assetFactory.h') diff --git a/assetFactory/assetFactory.h b/assetFactory/assetFactory.h index a68b460..42082eb 100644 --- a/assetFactory/assetFactory.h +++ b/assetFactory/assetFactory.h @@ -14,7 +14,7 @@ public: FactoryMesh::Collection meshes; private: - friend Persistence::SelectionPtrBase, true>; + friend Persistence::SelectionPtrBase>; bool persist(Persistence::PersistenceStore & store) override; }; @@ -36,6 +36,6 @@ public: static void normalizeColourName(std::string &); private: - friend Persistence::SelectionPtrBase, true>; + friend Persistence::SelectionPtrBase>; bool persist(Persistence::PersistenceStore & store) override; }; -- cgit v1.2.3 From 98df33e0a52e086b68df2a62ce2f41cc6b67db63 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 2 Mar 2023 18:18:38 +0000 Subject: Parse colour values as they're read --- assetFactory/assetFactory.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'assetFactory/assetFactory.h') diff --git a/assetFactory/assetFactory.h b/assetFactory/assetFactory.h index 42082eb..2bd576b 100644 --- a/assetFactory/assetFactory.h +++ b/assetFactory/assetFactory.h @@ -22,11 +22,13 @@ class AssetFactory : public Persistence::Persistable { public: using Shapes = std::map>; using Assets = std::map>; - using Colour = glm::u8vec3; + using Colour = glm::vec3; + using ColourAlpha = glm::vec4; using Colours = std::map>; AssetFactory(); [[nodiscard]] static std::shared_ptr loadXML(const std::filesystem::path &); + [[nodiscard]] ColourAlpha parseColour(std::string_view) const; Shapes shapes; Assets assets; -- cgit v1.2.3 From 5b7f5f2de723d30d3461f653e90fa4ae95941786 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 3 Mar 2023 19:52:55 +0000 Subject: Split Asset into its own file --- assetFactory/assetFactory.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'assetFactory/assetFactory.h') diff --git a/assetFactory/assetFactory.h b/assetFactory/assetFactory.h index 2bd576b..b47d408 100644 --- a/assetFactory/assetFactory.h +++ b/assetFactory/assetFactory.h @@ -1,22 +1,9 @@ #pragma once -#include "factoryMesh.h" +#include "asset.h" #include "persistence.h" #include "shape.h" #include -#include - -class Asset : public Persistence::Persistable, public StdTypeDefs { -public: - std::string id; - std::string name; - - FactoryMesh::Collection meshes; - -private: - friend Persistence::SelectionPtrBase>; - bool persist(Persistence::PersistenceStore & store) override; -}; class AssetFactory : public Persistence::Persistable { public: -- cgit v1.2.3