From d7a07bdd58f3a2740d4672837be73ecc2ec10e3c Mon Sep 17 00:00:00 2001 From: timoore Date: Wed, 15 Jul 2009 23:16:21 +0000 Subject: [PATCH] Find material from EffectGeode and Effect The scenery now uses the Effect class. --- src/Scenery/scenery.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Scenery/scenery.cxx b/src/Scenery/scenery.cxx index 04319fbe8..f16e34ff8 100644 --- a/src/Scenery/scenery.cxx +++ b/src/Scenery/scenery.cxx @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include #include @@ -44,6 +46,7 @@ #include "scenery.hxx" using namespace flightgear; +using namespace simgear; class FGGroundPickCallback : public SGPickCallback { public: @@ -154,8 +157,11 @@ FGScenery::get_elevation_m(const SGGeod& geod, double& alt, if (alt < elevation) { alt = elevation; if (material) { - const osg::StateSet* stateSet = hit.getDrawable()->getStateSet(); - *material = SGMaterialLib::findMaterial(stateSet); + *material = 0; + const EffectGeode* eg + = dynamic_cast(hit.getGeode()); + if (eg) + *material = SGMaterialLib::findMaterial(eg->getEffect()); } } } -- 2.39.5