From 189896a7abea7b3498224be5a65c38b5b2688686 Mon Sep 17 00:00:00 2001 From: mfranz Date: Wed, 12 Apr 2006 11:12:36 +0000 Subject: [PATCH] only call occluder if the shadows were already initialized. This lead to a crash when using the model manager from XML files (which apparently nobody does, anyway ;-) Now those models work (again), but have no shadows. Those placed at runtime (e.g. via ufo) still have a shadow. --- src/Model/modelmgr.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Model/modelmgr.cxx b/src/Model/modelmgr.cxx index bc69ad7a0..4359a70b5 100644 --- a/src/Model/modelmgr.cxx +++ b/src/Model/modelmgr.cxx @@ -81,7 +81,8 @@ FGModelMgr::add_model (SGPropertyNode * node) globals->get_sim_time_sec(), /*cache_object=*/false); model->init( object ); - shadows->addOccluder((ssgBranch *)object, SGShadowVolume::occluderTypeTileObject); + if (shadows) + shadows->addOccluder((ssgBranch *)object, SGShadowVolume::occluderTypeTileObject); // Set position and orientation either // indirectly through property refs @@ -258,7 +259,8 @@ FGModelMgr::Listener::childRemoved(SGPropertyNode * parent, SGPropertyNode * chi _mgr->_instances.erase(it); ssgBranch *branch = (ssgBranch *)instance->model->getSceneGraph(); - shadows->deleteOccluder(branch); + if (shadows) + shadows->deleteOccluder(branch); globals->get_scenery()->get_scene_graph()->removeKid(branch); delete instance;