From 88c9d66352c2f4856682efd48482b5b72aca18bf Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 12 Mar 2023 00:54:24 +0000 Subject: Support loading references to texture fragments --- assetFactory/assetFactory.cpp | 3 +++ assetFactory/assetFactory.h | 3 +++ assetFactory/textureFragment.cpp | 7 +++++++ assetFactory/textureFragment.h | 14 ++++++++++++++ res/brush47.xml | 2 ++ res/rail/roofSideWithVents.png | Bin 0 -> 17011 bytes res/rail/roofTopWithVents.png | Bin 0 -> 11921 bytes 7 files changed, 29 insertions(+) create mode 100644 assetFactory/textureFragment.cpp create mode 100644 assetFactory/textureFragment.h create mode 100644 res/rail/roofSideWithVents.png create mode 100644 res/rail/roofTopWithVents.png diff --git a/assetFactory/assetFactory.cpp b/assetFactory/assetFactory.cpp index f5fc2b3..de13579 100644 --- a/assetFactory/assetFactory.cpp +++ b/assetFactory/assetFactory.cpp @@ -75,11 +75,14 @@ AssetFactory::parseColour(std::string_view in) const } throw std::runtime_error("No such asset factory colour"); } + bool AssetFactory::persist(Persistence::PersistenceStore & store) { using MapObjects = Persistence::MapByMember>; using MapAssets = Persistence::MapByMember; + using MapTextureFragments = Persistence::MapByMember; return STORE_TYPE && STORE_NAME_HELPER("object", shapes, MapObjects) + && STORE_NAME_HELPER("textureFragment", textureFragments, MapTextureFragments) && STORE_NAME_HELPER("asset", assets, MapAssets); } diff --git a/assetFactory/assetFactory.h b/assetFactory/assetFactory.h index b47d408..3d52f7f 100644 --- a/assetFactory/assetFactory.h +++ b/assetFactory/assetFactory.h @@ -3,12 +3,14 @@ #include "asset.h" #include "persistence.h" #include "shape.h" +#include "textureFragment.h" #include class AssetFactory : public Persistence::Persistable { public: using Shapes = std::map>; using Assets = std::map>; + using TextureFragments = std::map>; using Colour = glm::vec3; using ColourAlpha = glm::vec4; using Colours = std::map>; @@ -20,6 +22,7 @@ public: Shapes shapes; Assets assets; Colours colours; + TextureFragments textureFragments; static Colours parseX11RGB(const char * rgbtxtpath); static void normalizeColourName(std::string &); diff --git a/assetFactory/textureFragment.cpp b/assetFactory/textureFragment.cpp new file mode 100644 index 0000000..72107a5 --- /dev/null +++ b/assetFactory/textureFragment.cpp @@ -0,0 +1,7 @@ +#include "textureFragment.h" + +bool +TextureFragment::persist(Persistence::PersistenceStore & store) +{ + return STORE_TYPE && STORE_MEMBER(id) && STORE_MEMBER(path); +} diff --git a/assetFactory/textureFragment.h b/assetFactory/textureFragment.h new file mode 100644 index 0000000..52f2591 --- /dev/null +++ b/assetFactory/textureFragment.h @@ -0,0 +1,14 @@ +#pragma once + +#include "persistence.h" +#include "stdTypeDefs.hpp" + +class TextureFragment : public Persistence::Persistable, public StdTypeDefs { +public: + std::string id; + std::string path; + +private: + friend Persistence::SelectionPtrBase; + bool persist(Persistence::PersistenceStore & store) override; +}; diff --git a/res/brush47.xml b/res/brush47.xml index dbd3327..a7e3894 100644 --- a/res/brush47.xml +++ b/res/brush47.xml @@ -59,6 +59,8 @@ + + diff --git a/res/rail/roofSideWithVents.png b/res/rail/roofSideWithVents.png new file mode 100644 index 0000000..67ed851 Binary files /dev/null and b/res/rail/roofSideWithVents.png differ diff --git a/res/rail/roofTopWithVents.png b/res/rail/roofTopWithVents.png new file mode 100644 index 0000000..0f64ced Binary files /dev/null and b/res/rail/roofTopWithVents.png differ -- cgit v1.2.3