From 592a4de1e5c4b276ddf765bfa328f1f24e14760e Mon Sep 17 00:00:00 2001 From: samcake Date: Wed, 11 Oct 2017 15:56:22 -0700 Subject: [PATCH] Fix the HDR generation of cube maps from equirect images (1x2) --- libraries/image/src/image/Image.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/image/src/image/Image.cpp b/libraries/image/src/image/Image.cpp index 58b920da4d..59ec4776a6 100644 --- a/libraries/image/src/image/Image.cpp +++ b/libraries/image/src/image/Image.cpp @@ -1202,10 +1202,6 @@ gpu::TexturePointer TextureUsage::processCubeTextureColorFromImage(const QImage& formatGPU = HDR_FORMAT; } - if (image.format() != QIMAGE_HDR_FORMAT) { - image = convertToHDRFormat(image, HDR_FORMAT); - } - // Find the layout of the cubemap in the 2D image // Use the original image size since processSourceImage may have altered the size / aspect ratio int foundLayout = CubeLayout::findLayout(srcImage.width(), srcImage.height()); @@ -1233,6 +1229,13 @@ gpu::TexturePointer TextureUsage::processCubeTextureColorFromImage(const QImage& faces.push_back(faceImage); } } + + if (image.format() != QIMAGE_HDR_FORMAT) { + for (auto& face : faces) { + face = convertToHDRFormat(face, HDR_FORMAT); + } + } + } else { qCDebug(imagelogging) << "Failed to find a known cube map layout from this image:" << QString(srcImageName.c_str()); return nullptr;