From 70c3268225bbb985079ec6715ae598dce5605a4e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 14 Apr 2023 16:38:05 +0100 Subject: Pass texture fragment mapmode to texture atlas --- assetFactory/assetFactory.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'assetFactory') 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> images; + std::map> 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 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}; }); } } -- cgit v1.2.3