1
0
Fork 0

Find material from EffectGeode and Effect

The scenery now uses the Effect class.
This commit is contained in:
timoore 2009-07-15 23:16:21 +00:00 committed by Tim Moore
parent 890b584b8f
commit d7a07bdd58

View file

@ -33,6 +33,8 @@
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/scene/tgdb/userdata.hxx> #include <simgear/scene/tgdb/userdata.hxx>
#include <simgear/scene/material/Effect.hxx>
#include <simgear/scene/material/EffectGeode.hxx>
#include <simgear/scene/material/matlib.hxx> #include <simgear/scene/material/matlib.hxx>
#include <simgear/scene/util/SGNodeMasks.hxx> #include <simgear/scene/util/SGNodeMasks.hxx>
#include <simgear/scene/util/SGSceneUserData.hxx> #include <simgear/scene/util/SGSceneUserData.hxx>
@ -44,6 +46,7 @@
#include "scenery.hxx" #include "scenery.hxx"
using namespace flightgear; using namespace flightgear;
using namespace simgear;
class FGGroundPickCallback : public SGPickCallback { class FGGroundPickCallback : public SGPickCallback {
public: public:
@ -154,8 +157,11 @@ FGScenery::get_elevation_m(const SGGeod& geod, double& alt,
if (alt < elevation) { if (alt < elevation) {
alt = elevation; alt = elevation;
if (material) { if (material) {
const osg::StateSet* stateSet = hit.getDrawable()->getStateSet(); *material = 0;
*material = SGMaterialLib::findMaterial(stateSet); const EffectGeode* eg
= dynamic_cast<const EffectGeode*>(hit.getGeode());
if (eg)
*material = SGMaterialLib::findMaterial(eg->getEffect());
} }
} }
} }