From 7dc8a86524d0050c24626a3d81fe8eec6e122d04 Mon Sep 17 00:00:00 2001 From: Nathaniel MacArthur-Warner Date: Thu, 24 Dec 2020 12:26:30 -0800 Subject: [PATCH] Warn when loading uncompressed DDS files since it causes problems on some systems --- simgear/scene/util/OrthophotoManager.cxx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/simgear/scene/util/OrthophotoManager.cxx b/simgear/scene/util/OrthophotoManager.cxx index aeac6448..28b1c3ca 100644 --- a/simgear/scene/util/OrthophotoManager.cxx +++ b/simgear/scene/util/OrthophotoManager.cxx @@ -231,25 +231,26 @@ namespace simgear { dds_path.concat(".dds"); if (dds_path.exists()) { ImageRef image = osgDB::readRefImageFile(dds_path.str()); - if (!image) { - return nullptr; + if (image) { + if (!image->isCompressed()) { + SG_LOG(SG_OSG, SG_WARN, "Loading uncompressed DDS orthophoto. This is known to cause problems on some systems."); + } + const Texture2DRef texture = textureFromImage(image); + const OrthophotoBounds bbox = OrthophotoBounds::fromBucket(bucket); + return new Orthophoto(texture, bbox); } - const Texture2DRef texture = textureFromImage(image); - const OrthophotoBounds bbox = OrthophotoBounds::fromBucket(bucket); - return new Orthophoto(texture, bbox); } SGPath png_path = path; png_path.concat(".png"); if (png_path.exists()) { ImageRef image = osgDB::readRefImageFile(png_path.str()); - if (!image) { - return nullptr; + if (image) { + image->flipVertical(); + const Texture2DRef texture = textureFromImage(image); + const OrthophotoBounds bbox = OrthophotoBounds::fromBucket(bucket); + return new Orthophoto(texture, bbox); } - image->flipVertical(); - const Texture2DRef texture = textureFromImage(image); - const OrthophotoBounds bbox = OrthophotoBounds::fromBucket(bucket); - return new Orthophoto(texture, bbox); } }