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.
This commit is contained in:
timoore
2008-03-24 21:41:30 +00:00
parent bd19899bbc
commit 09fb51189e
+7 -8
View File
@@ -693,6 +693,7 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool
} }
if (!tileGeometryBin.vasiLights.empty()) { if (!tileGeometryBin.vasiLights.empty()) {
osg::Geode* vasiGeode = new osg::Geode;
SGVec4f red(1, 0, 0, 1); SGVec4f red(1, 0, 0, 1);
SGMaterial* mat = matlib->find("RWY_RED_LIGHTS"); SGMaterial* mat = matlib->find("RWY_RED_LIGHTS");
if (mat) if (mat)
@@ -702,17 +703,14 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool
if (mat) if (mat)
white = mat->get_light_color(); white = mat->get_light_color();
osg::Geode* geode = new osg::Geode;
SGDirectionalLightListBin::const_iterator i; SGDirectionalLightListBin::const_iterator i;
for (i = tileGeometryBin.vasiLights.begin(); for (i = tileGeometryBin.vasiLights.begin();
i != tileGeometryBin.vasiLights.end(); ++i) { 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; vasiGeode->setCullCallback(new SGPointSpriteLightCullCallback(osg::Vec3(1, 0.0001, 0.000001), 6));
vasiLights->setCullCallback(new SGPointSpriteLightCullCallback(osg::Vec3(1, 0.0001, 0.000001), 6)); vasiGeode->setStateSet(lightManager->getRunwayLightStateSet());
vasiLights->setStateSet(lightManager->getRunwayLightStateSet()); lightGroup->addChild(vasiGeode);
vasiLights->addChild(geode);
lightGroup->addChild(vasiLights);
} }
if (tileGeometryBin.runwayLights.getNumLights() > 0 if (tileGeometryBin.runwayLights.getNumLights() > 0
@@ -765,7 +763,8 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool
if (lightGroup->getNumChildren() > 0) { if (lightGroup->getNumChildren() > 0) {
osg::LOD* lightLOD = new osg::LOD; osg::LOD* lightLOD = new osg::LOD;
lightLOD->addChild(lightGroup.get(), 0, 30000); 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); transform->addChild(lightLOD);
} }