From 09fb51189ea9c67c7d03717f1271bae3546a34a4 Mon Sep 17 00:00:00 2001 From: timoore Date: Mon, 24 Mar 2008 21:41:30 +0000 Subject: [PATCH] Change the tile light group node mask to traverse VASI lights too. The change to set the light group node mask to LIGHTS_BITS caused VASI/PAPI lights to not be displayed during the day. This patch fixes that and optimizes VASI creation a bit. --- simgear/scene/tgdb/obj.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/simgear/scene/tgdb/obj.cxx b/simgear/scene/tgdb/obj.cxx index 4f3a3be0..7576c049 100644 --- a/simgear/scene/tgdb/obj.cxx +++ b/simgear/scene/tgdb/obj.cxx @@ -691,8 +691,9 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool lightGroup->addChild(groundLights2); } } - + if (!tileGeometryBin.vasiLights.empty()) { + osg::Geode* vasiGeode = new osg::Geode; SGVec4f red(1, 0, 0, 1); SGMaterial* mat = matlib->find("RWY_RED_LIGHTS"); if (mat) @@ -702,17 +703,14 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool if (mat) white = mat->get_light_color(); - osg::Geode* geode = new osg::Geode; SGDirectionalLightListBin::const_iterator i; for (i = tileGeometryBin.vasiLights.begin(); i != tileGeometryBin.vasiLights.end(); ++i) { - geode->addDrawable(SGLightFactory::getVasi(up, *i, red, white)); + vasiGeode->addDrawable(SGLightFactory::getVasi(up, *i, red, white)); } - osg::Group* vasiLights = new osg::Group; - vasiLights->setCullCallback(new SGPointSpriteLightCullCallback(osg::Vec3(1, 0.0001, 0.000001), 6)); - vasiLights->setStateSet(lightManager->getRunwayLightStateSet()); - vasiLights->addChild(geode); - lightGroup->addChild(vasiLights); + vasiGeode->setCullCallback(new SGPointSpriteLightCullCallback(osg::Vec3(1, 0.0001, 0.000001), 6)); + vasiGeode->setStateSet(lightManager->getRunwayLightStateSet()); + lightGroup->addChild(vasiGeode); } if (tileGeometryBin.runwayLights.getNumLights() > 0 @@ -765,7 +763,8 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool if (lightGroup->getNumChildren() > 0) { osg::LOD* lightLOD = new osg::LOD; lightLOD->addChild(lightGroup.get(), 0, 30000); - lightLOD->setNodeMask(LIGHTS_BITS); + // VASI is always on, so doesn't use light bits. + lightLOD->setNodeMask(LIGHTS_BITS | MODEL_BIT); transform->addChild(lightLOD); } -- 2.39.5