From f71811083427d7359ee240c623d5472a19681b2b Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Thu, 12 May 2022 10:59:20 -0700 Subject: [PATCH] Always write png instead of jpg. --- src/gltf/TextureBuilder.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/gltf/TextureBuilder.cpp b/src/gltf/TextureBuilder.cpp index 0a930dc..e0ca6f7 100644 --- a/src/gltf/TextureBuilder.cpp +++ b/src/gltf/TextureBuilder.cpp @@ -118,24 +118,16 @@ std::shared_ptr TextureBuilder::combine( } } - // write a .png iff we need transparency in the destination texture - bool png = includeAlphaChannel; - std::vector imgBuffer; int res; - if (png) { - res = stbi_write_png_to_func( - WriteToVectorContext, - &imgBuffer, - width, - height, - channels, - mergedPixels.data(), - width * channels); - } else { - res = stbi_write_jpg_to_func( - WriteToVectorContext, &imgBuffer, width, height, channels, mergedPixels.data(), 80); - } + res = stbi_write_png_to_func( + WriteToVectorContext, + &imgBuffer, + width, + height, + channels, + mergedPixels.data(), + width * channels); if (!res) { fmt::printf("Warning: failed to generate merge texture '%s'.\n", mergedFilename); return nullptr;