add shadows to FGModelMgr managed models
This commit is contained in:
parent
6f7a9a5b1b
commit
a5b42c7201
1 changed files with 7 additions and 2 deletions
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include <simgear/scene/model/placement.hxx>
|
#include <simgear/scene/model/placement.hxx>
|
||||||
#include <simgear/scene/model/modellib.hxx>
|
#include <simgear/scene/model/modellib.hxx>
|
||||||
|
#include <simgear/scene/model/shadowvolume.hxx>
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/structure/exception.hxx>
|
||||||
|
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
|
@ -25,6 +26,8 @@
|
||||||
|
|
||||||
SG_USING_STD(vector);
|
SG_USING_STD(vector);
|
||||||
|
|
||||||
|
extern SGShadowVolume *shadows;
|
||||||
|
|
||||||
|
|
||||||
FGModelMgr::FGModelMgr ()
|
FGModelMgr::FGModelMgr ()
|
||||||
: _models(fgGetNode("/models", true)),
|
: _models(fgGetNode("/models", true)),
|
||||||
|
@ -78,6 +81,7 @@ FGModelMgr::add_model (SGPropertyNode * node)
|
||||||
globals->get_sim_time_sec(), /*cache_object=*/false);
|
globals->get_sim_time_sec(), /*cache_object=*/false);
|
||||||
|
|
||||||
model->init( object );
|
model->init( object );
|
||||||
|
shadows->addOccluder((ssgBranch *)object, SGShadowVolume::occluderTypeTileObject);
|
||||||
|
|
||||||
// Set position and orientation either
|
// Set position and orientation either
|
||||||
// indirectly through property refs
|
// indirectly through property refs
|
||||||
|
@ -253,8 +257,9 @@ FGModelMgr::Listener::childRemoved(SGPropertyNode * parent, SGPropertyNode * chi
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_mgr->_instances.erase(it);
|
_mgr->_instances.erase(it);
|
||||||
globals->get_scenery()->get_scene_graph()
|
ssgBranch *branch = (ssgBranch *)instance->model->getSceneGraph();
|
||||||
->removeKid(instance->model->getSceneGraph());
|
shadows->deleteOccluder(branch);
|
||||||
|
globals->get_scenery()->get_scene_graph()->removeKid(branch);
|
||||||
|
|
||||||
delete instance;
|
delete instance;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue