From 989b10986f1626d1a50fceb8a33174108c03da93 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 10 Apr 2023 14:46:18 +0100 Subject: Load texture fragment images as we go, make the image a member --- assetFactory/textureFragment.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'assetFactory/textureFragment.cpp') diff --git a/assetFactory/textureFragment.cpp b/assetFactory/textureFragment.cpp index 72107a5..d153688 100644 --- a/assetFactory/textureFragment.cpp +++ b/assetFactory/textureFragment.cpp @@ -1,7 +1,15 @@ #include "textureFragment.h" +#include "resource.h" +#include bool TextureFragment::persist(Persistence::PersistenceStore & store) { return STORE_TYPE && STORE_MEMBER(id) && STORE_MEMBER(path); } + +void +TextureFragment::postLoad() +{ + image = std::make_unique(Resource::mapPath(path), STBI_rgb_alpha); +} -- cgit v1.2.3 From 1cdd7753d37bcf8f626298c3df97a02cc73f266c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 14 Apr 2023 14:48:59 +0100 Subject: Load texture images in Worker --- assetFactory/textureFragment.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'assetFactory/textureFragment.cpp') diff --git a/assetFactory/textureFragment.cpp b/assetFactory/textureFragment.cpp index d153688..0a4ec1d 100644 --- a/assetFactory/textureFragment.cpp +++ b/assetFactory/textureFragment.cpp @@ -11,5 +11,7 @@ TextureFragment::persist(Persistence::PersistenceStore & store) void TextureFragment::postLoad() { - image = std::make_unique(Resource::mapPath(path), STBI_rgb_alpha); + image = Worker::addWork([this]() { + return std::make_unique(Resource::mapPath(path), STBI_rgb_alpha); + }); } -- cgit v1.2.3