More robust checking of file extensions courtesy of the SGPath. Thanks to Mathias FROHLICH.
This commit is contained in:
parent
39d45e9e0a
commit
a72d858034
@ -128,14 +128,6 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
tname = "unknown.rgb";
|
tname = "unknown.rgb";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tname.rfind(".dds") == (tname.length() - 4)) ||
|
|
||||||
(tname.rfind(".DDS") == (tname.length() - 4)) )
|
|
||||||
{
|
|
||||||
dds.push_back(true);
|
|
||||||
} else {
|
|
||||||
dds.push_back(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
SGPath tpath("Textures.high");
|
SGPath tpath("Textures.high");
|
||||||
tpath.append(tname);
|
tpath.append(tname);
|
||||||
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||||
@ -145,6 +137,12 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tpath.lower_extension() == "dds") {
|
||||||
|
dds.push_back(true);
|
||||||
|
} else {
|
||||||
|
dds.push_back(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (!fullTexPath.empty() ) {
|
if (!fullTexPath.empty() ) {
|
||||||
_internal_state st( NULL, fullTexPath, false, options );
|
_internal_state st( NULL, fullTexPath, false, options );
|
||||||
_status.push_back( st );
|
_status.push_back( st );
|
||||||
@ -163,16 +161,6 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
tname = "unknown.rgb";
|
tname = "unknown.rgb";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j == 0) {
|
|
||||||
if ((tname.rfind(".dds") == (tname.length() - 4)) ||
|
|
||||||
(tname.rfind(".DDS") == (tname.length() - 4)) )
|
|
||||||
{
|
|
||||||
dds.push_back(true);
|
|
||||||
} else {
|
|
||||||
dds.push_back(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SGPath tpath("Textures.high");
|
SGPath tpath("Textures.high");
|
||||||
tpath.append(tname);
|
tpath.append(tname);
|
||||||
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||||
@ -182,6 +170,14 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (j == 0) {
|
||||||
|
if (tpath.lower_extension() == "dds") {
|
||||||
|
dds.push_back(true);
|
||||||
|
} else {
|
||||||
|
dds.push_back(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
st.add_texture(fullTexPath, textures[j]->getIndex());
|
st.add_texture(fullTexPath, textures[j]->getIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,8 +215,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
{
|
{
|
||||||
osg::Texture2D* object_mask = new osg::Texture2D;
|
osg::Texture2D* object_mask = new osg::Texture2D;
|
||||||
|
|
||||||
bool dds_mask = ((omname.rfind(".dds") == (omname.length() - 4)) ||
|
bool dds_mask = (ompath.lower_extension() == "dds");
|
||||||
(omname.rfind(".DDS") == (omname.length() - 4)) );
|
|
||||||
|
|
||||||
if (dds[i] != dds_mask) {
|
if (dds[i] != dds_mask) {
|
||||||
// Texture format does not match mask format. This is relevant for
|
// Texture format does not match mask format. This is relevant for
|
||||||
|
Loading…
Reference in New Issue
Block a user