summaryrefslogtreecommitdiff
path: root/assetFactory
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-14 16:38:05 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-14 16:38:05 +0100
commit70c3268225bbb985079ec6715ae598dce5605a4e (patch)
tree2c0c254df9b0df560e47f69085e6927c09559818 /assetFactory
parentAdjust test render view to get a closer view of our tree (diff)
downloadilt-70c3268225bbb985079ec6715ae598dce5605a4e.tar.bz2
ilt-70c3268225bbb985079ec6715ae598dce5605a4e.tar.xz
ilt-70c3268225bbb985079ec6715ae598dce5605a4e.zip
Pass texture fragment mapmode to texture atlas
Diffstat (limited to 'assetFactory')
-rw-r--r--assetFactory/assetFactory.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/assetFactory/assetFactory.cpp b/assetFactory/assetFactory.cpp
index e27e575..05f0634 100644
--- a/assetFactory/assetFactory.cpp
+++ b/assetFactory/assetFactory.cpp
@@ -99,10 +99,10 @@ AssetFactory::createTexutre() const
{
if (!textureFragments.empty() && !texture) {
// * layout images
- std::map<std::string_view, std::unique_ptr<const Image>> images;
+ std::map<const TextureFragment *, std::unique_ptr<const Image>> images;
std::transform(
textureFragments.begin(), textureFragments.end(), std::inserter(images, images.end()), [](auto && tf) {
- return decltype(images)::value_type {tf.first, tf.second->image->get()};
+ return decltype(images)::value_type {tf.second.get(), tf.second->image->get()};
});
std::vector<TexturePacker::Image> imageSizes;
std::transform(images.begin(), images.end(), std::back_inserter(imageSizes), [](const auto & i) {
@@ -114,10 +114,14 @@ AssetFactory::createTexutre() const
std::transform(images.begin(), images.end(),
std::inserter(textureFragmentPositions, textureFragmentPositions.end()),
[position = layout.begin(), size = imageSizes.begin(), this](const auto & i) mutable {
- const auto m = texture->add(*position, *size, i.second->data.data());
+ const auto m = texture->add(*position, *size, i.second->data.data(),
+ {
+ .wrapU = i.first->mapmodeU,
+ .wrapV = i.first->mapmodeV,
+ });
position++;
size++;
- return decltype(textureFragmentPositions)::value_type {i.first, m};
+ return decltype(textureFragmentPositions)::value_type {i.first->id, m};
});
}
}