summaryrefslogtreecommitdiff
path: root/assetFactory/assetFactory.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-03-16 23:23:04 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-03-16 23:23:04 +0000
commit07dc690837f6a665490e370e8a07410e970384d7 (patch)
treee78062f25d5f20247b57eb9ce2b94b770190fd48 /assetFactory/assetFactory.cpp
parentAllow specifiying the texture type/target (diff)
downloadilt-07dc690837f6a665490e370e8a07410e970384d7.tar.bz2
ilt-07dc690837f6a665490e370e8a07410e970384d7.tar.xz
ilt-07dc690837f6a665490e370e8a07410e970384d7.zip
Simplify calculation of texture position fraction
Diffstat (limited to 'assetFactory/assetFactory.cpp')
-rw-r--r--assetFactory/assetFactory.cpp7
1 files changed, 1 insertions, 6 deletions
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<float>(position->x) / outSize.x,
- static_cast<float>(position->y) / outSize.y,
- static_cast<float>(position->x + size->x) / outSize.x,
- static_cast<float>(position->y + size->y) / outSize.y,
- };
+ const auto positionFraction = glm::vec4 {*position, *position + *size} / outSize.xyxy();
glTexSubImage2D(GL_TEXTURE_2D, 0, static_cast<GLint>(position->x), static_cast<GLint>(position->y),
static_cast<GLint>(size->x), static_cast<GLint>(size->y), GL_RGBA, GL_UNSIGNED_BYTE,
image->get()->data.data());