Fix effects for MP models - ticket 2076
https://sourceforge.net/p/flightgear/codetickets/2076/ Effects were being instantiated by the loader for all models, rather than just simple .ac/.obj models.
This commit is contained in:
@@ -169,6 +169,7 @@ SGModelLib::loadDeferredModel(const string &path, SGPropertyNode *prop_root,
|
||||
osg::PagedLOD*
|
||||
SGModelLib::loadPagedModel(SGPropertyNode *prop_root, SGModelData *data, SGModelLOD model_lods)
|
||||
{
|
||||
unsigned int simple_models = 0;
|
||||
osg::PagedLOD *plod = new osg::PagedLOD;
|
||||
|
||||
osg::ref_ptr<SGReaderWriterOptions> opt;
|
||||
@@ -189,15 +190,15 @@ SGModelLib::loadPagedModel(SGPropertyNode *prop_root, SGModelData *data, SGModel
|
||||
plod->setMinimumExpiryTime(i, prop_root->getDoubleValue("/sim/rendering/plod-minimum-expiry-time-secs", 180.0 ) );
|
||||
|
||||
std::string lext = SGPath(lod.path).lower_extension();
|
||||
|
||||
// We can only have one set of ReaderWriterOptions for the PagedLOD, so
|
||||
// we will just have to assume that if one of the defined models can
|
||||
// handle instantiated effects, then the other can as well.
|
||||
if ((lext == "ac") || (lext == "obj")) {
|
||||
opt->setInstantiateEffects(true);
|
||||
simple_models++;
|
||||
}
|
||||
}
|
||||
|
||||
// If all we have are simple models, then we can instantiate effects in
|
||||
// the loader.
|
||||
if (simple_models == model_lods.getNumLODs()) opt->setInstantiateEffects(true);
|
||||
|
||||
plod->setDatabaseOptions(opt.get());
|
||||
|
||||
return plod;
|
||||
|
||||
Reference in New Issue
Block a user