]> git.mxchange.org Git - simgear.git/commitdiff
Implement blinking hold-short line lights
authorChristian Schmitt <chris@ilovelinux.de>
Fri, 30 Mar 2012 17:17:59 +0000 (19:17 +0200)
committerJames Turner <zakalawe@mac.com>
Thu, 26 Apr 2012 14:02:33 +0000 (15:02 +0100)
This is supported by the apt.dat 850 format and latest TG

simgear/scene/tgdb/obj.cxx
simgear/scene/tgdb/pt_lights.cxx
simgear/scene/tgdb/pt_lights.hxx

index 29b78fba0ad219e92c4035fbbfe1de1ec156c2f7..3cef61ba9d5c196fe3073cb97620ed320ed200de 100644 (file)
@@ -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) {
index 2aa6606acbdc56c0cca96914621771ea2e641c47..925d3e20b85118dd5c8ec1fbb362158724a06a92 100644 (file)
@@ -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;
+}
index 6357c14c23c090ab907f052ff6c43ef83ca2954b..af066f808cb75fead5e890f017a3f1517c1ea0bf 100644 (file)
@@ -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,