Implement blinking hold-short line lights
This is supported by the apt.dat 850 format and latest TG
This commit is contained in:
committed by
James Turner
parent
2d174d0b14
commit
f712bc9294
@@ -85,6 +85,7 @@ struct SGTileGeometryBin {
|
||||
SGDirectionalLightListBin vasiLights;
|
||||
SGDirectionalLightListBin rabitLights;
|
||||
SGLightListBin odalLights;
|
||||
SGDirectionalLightListBin holdshortLights;
|
||||
SGDirectionalLightListBin reilLights;
|
||||
SGMatModelBin randomModels;
|
||||
SGBuildingBinList randomBuildings;
|
||||
@@ -164,6 +165,11 @@ struct SGTileGeometryBin {
|
||||
odalLights.push_back(SGLightBin());
|
||||
addPointGeometry(odalLights.back(), obj.get_wgs84_nodes(),
|
||||
color, obj.get_pts_v()[grp]);
|
||||
} else if (materialName == "RWY_YELLOW_PULSE_LIGHTS") {
|
||||
holdshortLights.push_back(SGDirectionalLightBin());
|
||||
addPointGeometry(holdshortLights.back(), obj.get_wgs84_nodes(),
|
||||
obj.get_normals(), color, obj.get_pts_v()[grp],
|
||||
obj.get_pts_n()[grp]);
|
||||
} else if (materialName == "RWY_REIL_LIGHTS") {
|
||||
reilLights.push_back(SGDirectionalLightBin());
|
||||
addPointGeometry(reilLights.back(), obj.get_wgs84_nodes(),
|
||||
@@ -1044,7 +1050,8 @@ SGLoadBTG(const std::string& path, const simgear::SGReaderWriterOptions* options
|
||||
if (tileGeometryBin.runwayLights.getNumLights() > 0
|
||||
|| !tileGeometryBin.rabitLights.empty()
|
||||
|| !tileGeometryBin.reilLights.empty()
|
||||
|| !tileGeometryBin.odalLights.empty()) {
|
||||
|| !tileGeometryBin.odalLights.empty()
|
||||
|| !tileGeometryBin.holdshortLights.empty()) {
|
||||
osg::Group* rwyLights = new osg::Group;
|
||||
rwyLights->setStateSet(lightManager->getRunwayLightStateSet());
|
||||
rwyLights->setNodeMask(RUNWAYLIGHTS_BIT);
|
||||
@@ -1064,6 +1071,10 @@ SGLoadBTG(const std::string& path, const simgear::SGReaderWriterOptions* options
|
||||
i != tileGeometryBin.reilLights.end(); ++i) {
|
||||
rwyLights->addChild(SGLightFactory::getSequenced(*i));
|
||||
}
|
||||
for (i = tileGeometryBin.holdshortLights.begin();
|
||||
i != tileGeometryBin.holdshortLights.end(); ++i) {
|
||||
rwyLights->addChild(SGLightFactory::getHoldShort(*i));
|
||||
}
|
||||
SGLightListBin::const_iterator j;
|
||||
for (j = tileGeometryBin.odalLights.begin();
|
||||
j != tileGeometryBin.odalLights.end(); ++j) {
|
||||
|
||||
@@ -540,3 +540,34 @@ SGLightFactory::getOdal(const SGLightBin& lights)
|
||||
|
||||
return sequence;
|
||||
}
|
||||
|
||||
// Blinking hold short line lights
|
||||
osg::Node*
|
||||
SGLightFactory::getHoldShort(const SGDirectionalLightBin& lights)
|
||||
{
|
||||
if (lights.getNumLights() < 2)
|
||||
return 0;
|
||||
|
||||
float flashTime = 2;
|
||||
osg::Sequence* sequence = new osg::Sequence;
|
||||
sequence->setDefaultTime(flashTime);
|
||||
Effect* effect = getLightEffect(6, osg::Vec3(1, 0.001, 0.000002),
|
||||
0, 6, true);
|
||||
// Lights on
|
||||
EffectGeode* egeode = new EffectGeode;
|
||||
for (int i = lights.getNumLights(); 0 <= i; --i) {
|
||||
egeode->setEffect(effect);
|
||||
egeode->addDrawable(getLightDrawable(lights.getLight(i)));
|
||||
}
|
||||
sequence->addChild(egeode, flashTime);
|
||||
|
||||
// Lights off
|
||||
sequence->addChild(new osg::Group, flashTime);
|
||||
|
||||
sequence->setInterval(osg::Sequence::LOOP, 0, -1);
|
||||
sequence->setDuration(1.0f, -1);
|
||||
sequence->setMode(osg::Sequence::START);
|
||||
sequence->setSync(true);
|
||||
|
||||
return sequence;
|
||||
}
|
||||
|
||||
@@ -89,6 +89,9 @@ public:
|
||||
|
||||
static osg::Node*
|
||||
getOdal(const SGLightBin& lights);
|
||||
|
||||
static osg::Node*
|
||||
getHoldShort(const SGDirectionalLightBin& lights);
|
||||
};
|
||||
|
||||
simgear::Effect* getLightEffect(float size, const osg::Vec3& attenuation,
|
||||
|
||||
Reference in New Issue
Block a user