Warn when loading uncompressed DDS files since it causes problems on some systems

This commit is contained in:
Nathaniel MacArthur-Warner 2020-12-24 12:26:30 -08:00
parent 3fc6df203c
commit 7dc8a86524

View File

@ -231,25 +231,26 @@ namespace simgear {
dds_path.concat(".dds"); dds_path.concat(".dds");
if (dds_path.exists()) { if (dds_path.exists()) {
ImageRef image = osgDB::readRefImageFile(dds_path.str()); ImageRef image = osgDB::readRefImageFile(dds_path.str());
if (!image) { if (image) {
return nullptr; 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; SGPath png_path = path;
png_path.concat(".png"); png_path.concat(".png");
if (png_path.exists()) { if (png_path.exists()) {
ImageRef image = osgDB::readRefImageFile(png_path.str()); ImageRef image = osgDB::readRefImageFile(png_path.str());
if (!image) { if (image) {
return nullptr; 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);
} }
} }