From 9e103fe7bfb581d8b170b6e34ec584fdef693951 Mon Sep 17 00:00:00 2001 From: Nathaniel Warner Date: Sat, 12 Dec 2020 13:59:52 -0800 Subject: [PATCH] Prefer DDS over PNG for orthophoto --- simgear/scene/util/OrthophotoManager.cxx | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/simgear/scene/util/OrthophotoManager.cxx b/simgear/scene/util/OrthophotoManager.cxx index 3a8a8429..51db95db 100644 --- a/simgear/scene/util/OrthophotoManager.cxx +++ b/simgear/scene/util/OrthophotoManager.cxx @@ -224,7 +224,19 @@ namespace simgear { for (const auto& scenery_path : scenery_paths) { SGPath path = scenery_path / "Orthophotos" / bucket_path / std::to_string(bucket.gen_index()); - + + SGPath dds_path = path; + dds_path.concat(".dds"); + if (dds_path.exists()) { + ImageRef image = osgDB::readRefImageFile(dds_path.str()); + if (!image) { + return nullptr; + } + 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()) { @@ -237,18 +249,6 @@ namespace simgear { const OrthophotoBounds bbox = OrthophotoBounds::fromBucket(bucket); return new Orthophoto(texture, bbox); } - - SGPath dds_path = path; - dds_path.concat(".dds"); - if (dds_path.exists()) { - ImageRef image = osgDB::readRefImageFile(dds_path.str()); - if (!image) { - return nullptr; - } - const Texture2DRef texture = textureFromImage(image); - const OrthophotoBounds bbox = OrthophotoBounds::fromBucket(bucket); - return new Orthophoto(texture, bbox); - } } return nullptr;