From 07dc690837f6a665490e370e8a07410e970384d7 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 16 Mar 2023 23:23:04 +0000 Subject: Simplify calculation of texture position fraction --- assetFactory/assetFactory.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'assetFactory') diff --git a/assetFactory/assetFactory.cpp b/assetFactory/assetFactory.cpp index 77dd554..ed1af58 100644 --- a/assetFactory/assetFactory.cpp +++ b/assetFactory/assetFactory.cpp @@ -123,12 +123,7 @@ AssetFactory::createTexutre() const std::inserter(textureFragmentPositions, textureFragmentPositions.end()), [position = layout.begin(), image = images.begin(), size = imageSizes.begin(), outSize = glm::vec2 {outSize}](const auto & tf) mutable { - glm::vec4 positionFraction { - static_cast(position->x) / outSize.x, - static_cast(position->y) / outSize.y, - static_cast(position->x + size->x) / outSize.x, - static_cast(position->y + size->y) / outSize.y, - }; + const auto positionFraction = glm::vec4 {*position, *position + *size} / outSize.xyxy(); glTexSubImage2D(GL_TEXTURE_2D, 0, static_cast(position->x), static_cast(position->y), static_cast(size->x), static_cast(size->y), GL_RGBA, GL_UNSIGNED_BYTE, image->get()->data.data()); -- cgit v1.2.3