Prefer DDS over PNG for orthophoto

This commit is contained in:
Nathaniel Warner
2020-12-12 13:59:52 -08:00
parent 88be307540
commit 9e103fe7bf

View File

@@ -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;