]> git.mxchange.org Git - flightgear.git/commitdiff
add shadows to FGModelMgr managed models
authormfranz <mfranz>
Thu, 30 Mar 2006 14:34:16 +0000 (14:34 +0000)
committermfranz <mfranz>
Thu, 30 Mar 2006 14:34:16 +0000 (14:34 +0000)
src/Model/modelmgr.cxx

index 1b66a2b5830d004ffd7fe03ac8a3da87ed093199..bc69ad7a0e0034ed23c9dfd78d8e706153272410 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <simgear/scene/model/placement.hxx>
 #include <simgear/scene/model/modellib.hxx>
+#include <simgear/scene/model/shadowvolume.hxx>
 #include <simgear/structure/exception.hxx>
 
 #include <Main/fg_props.hxx>
@@ -25,6 +26,8 @@
 
 SG_USING_STD(vector);
 
+extern SGShadowVolume *shadows;
+
 
 FGModelMgr::FGModelMgr ()
   : _models(fgGetNode("/models", true)),
@@ -78,6 +81,7 @@ FGModelMgr::add_model (SGPropertyNode * node)
       globals->get_sim_time_sec(), /*cache_object=*/false);
 
   model->init( object );
+  shadows->addOccluder((ssgBranch *)object, SGShadowVolume::occluderTypeTileObject);
 
                                // Set position and orientation either
                                // indirectly through property refs
@@ -253,8 +257,9 @@ FGModelMgr::Listener::childRemoved(SGPropertyNode * parent, SGPropertyNode * chi
       continue;
 
     _mgr->_instances.erase(it);
-    globals->get_scenery()->get_scene_graph()
-        ->removeKid(instance->model->getSceneGraph());
+    ssgBranch *branch = (ssgBranch *)instance->model->getSceneGraph();
+    shadows->deleteOccluder(branch);
+    globals->get_scenery()->get_scene_graph()->removeKid(branch);
 
     delete instance;
     break;