]> git.mxchange.org Git - flightgear.git/commitdiff
only call occluder if the shadows were already initialized. This lead to
authormfranz <mfranz>
Wed, 12 Apr 2006 11:12:36 +0000 (11:12 +0000)
committermfranz <mfranz>
Wed, 12 Apr 2006 11:12:36 +0000 (11:12 +0000)
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

index bc69ad7a0e0034ed23c9dfd78d8e706153272410..4359a70b5037740900ad531935c227f1b81547da 100644 (file)
@@ -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;