From ba9342cd4b6ff2b89412cdccae82f5bdcd3b2716 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Tue, 6 Nov 2018 17:01:01 +0000 Subject: [PATCH] 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. --- simgear/scene/model/modellib.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/simgear/scene/model/modellib.cxx b/simgear/scene/model/modellib.cxx index 34707957..7ce382d3 100644 --- a/simgear/scene/model/modellib.cxx +++ b/simgear/scene/model/modellib.cxx @@ -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 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;