From 492d5fbd8daaf11883810cc882362cc3ba093ed0 Mon Sep 17 00:00:00 2001 From: curt Date: Sun, 11 Jan 2004 19:45:29 +0000 Subject: [PATCH] Fix a small mistake in the scene graph arrangement for vasi lights. --- scripts/perl/autopilot/flyplan.pl | 91 ------------------------------- scripts/perl/autopilot/telnet.pl | 69 ----------------------- scripts/perl/examples/reset.pl | 2 +- src/Main/main.cxx | 2 + src/Scenery/scenery.cxx | 3 + src/Scenery/scenery.hxx | 8 +++ src/Scenery/tilemgr.cxx | 2 +- 7 files changed, 15 insertions(+), 162 deletions(-) delete mode 100755 scripts/perl/autopilot/flyplan.pl delete mode 100644 scripts/perl/autopilot/telnet.pl diff --git a/scripts/perl/autopilot/flyplan.pl b/scripts/perl/autopilot/flyplan.pl deleted file mode 100755 index 3924241c4..000000000 --- a/scripts/perl/autopilot/flyplan.pl +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/perl -# -# Written by Curtis L. Olson, started January 2003 -# -# This file is in the Public Domain and comes with no warranty. -# -# $Id$ -# ---------------------------------------------------------------------------- - - -use strict; - -require "telnet.pl"; - -my( $server ) = "localhost"; -my( $port ) = 5401; -my( $timeout ) = 10; - -my( %Route ); -$Route{0} = "OAK:116.80:020"; -$Route{1} = "OAK:116.80:019:27"; -$Route{2} = "SAC:115.20:020"; -$Route{3} = "SAC:115.20:080:43"; -$Route{4} = "ECA:116.0:209"; - -my( $i ); - -foreach $i ( keys(%Route) ) { - &fly_to( $Route{$i} ); -} - - -sub fly_to() { - my( $waypoint ) = shift; - - # decode waypoint - my( $id, $freq, $radial, $dist ) = split( /:/, $waypoint ); - - print "Next way point is $id - $freq\n"; - print " Target radial is $radial\n"; - if ( $dist ne "" ) { - print " Flying outbound for $dist nm\n"; - } else { - print " Flying inbound to station\n"; - } - - # tune radio and set autopilot - my( $fgfs ); - if ( !( $fgfs = &connect($server, $port, $timeout) ) ) { - print "Error: can't open socket\n"; - return; - } - &send( $fgfs, "data" ); # switch to raw data mode - set_prop( $fgfs, "/radios/nav[0]/frequencies/selected-mhz", $freq ); - set_prop( $fgfs, "/radios/nav[0]/radials/selected-deg", $radial ); - set_prop( $fgfs, "/radios/dme/switch-position", "1" ); - set_prop( $fgfs, "/autopilot/locks/nav", "true" ); - - # monitor progress until goal is achieved - my( $done ) = 0; - my( $last_range ) = 9999.0; - while ( !$done ) { - my( $inrange ) = get_prop( $fgfs, "/radios/nav[0]/in-range" ); - if ( $inrange eq "false" ) { - print "Warning, VOR not in range, we are lost!\n"; - } - my( $cur_range ) = get_prop( $fgfs, "/radios/dme/distance-nm" ); - print " range = $cur_range\n"; - if ( $dist ne "" ) { - # a target dist is specified so assume we are flying outbound - if ( $cur_range > $dist ) { - $done = 1; - } - } else { - # no target dist is specified, assume we are flying - # inbound to the station - if ( $cur_range < 0.25 && $cur_range > 0.0 ) { - $done = 1; - } elsif ( $last_range < $cur_range ) { - $done = 1; - } - } - $last_range = $cur_range; - - # loop once per second - sleep(1); - } - - &send( $fgfs, "quit"); - close $fgfs; -} diff --git a/scripts/perl/autopilot/telnet.pl b/scripts/perl/autopilot/telnet.pl deleted file mode 100644 index c42bd30c8..000000000 --- a/scripts/perl/autopilot/telnet.pl +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/perl -# -# Written by Curtis L. Olson, started December 2002 -# Some code portions courtesy of Melchior FRANZ -# -# This file is in the Public Domain and comes with no warranty. -# -# $Id$ -# ---------------------------------------------------------------------------- - - -use IO::Socket; - -use strict; - - -sub get_prop() { - my( $handle ) = shift; - - &send( $handle, "get " . shift ); - eof $handle and die "\nconnection closed by host"; - $_ = <$handle>; - s/\015?\012$//; - /^-ERR (.*)/ and die "\nfgfs error: $1\n"; - - return $_; -} - - -sub set_prop() { - my( $handle ) = shift; - my( $prop ) = shift; - my( $value ) = shift; - - &send( $handle, "set $prop $value"); - - # eof $handle and die "\nconnection closed by host"; -} - - -sub send() { - my( $handle ) = shift; - - print $handle shift, "\015\012"; -} - - -sub connect() { - my( $host ) = shift; - my( $port ) = shift; - my( $timeout ) = (shift || 120); - my( $socket ); - STDOUT->autoflush(1); - while ($timeout--) { - if ($socket = IO::Socket::INET->new( Proto => 'tcp', - PeerAddr => $host, - PeerPort => $port) ) - { - $socket->autoflush(1); - return $socket; - } - print "Attempting to connect ... " . $timeout . "\n"; - sleep(1); - } - return 0; -} - - -return 1; # make perl happy diff --git a/scripts/perl/examples/reset.pl b/scripts/perl/examples/reset.pl index ed77926e0..1f122d9e4 100755 --- a/scripts/perl/examples/reset.pl +++ b/scripts/perl/examples/reset.pl @@ -6,7 +6,7 @@ use strict; my( $airport_id ) = "KSNA"; my( $rwy_no ) = "19R"; -my( $reset_sec ) = 30; +my( $reset_sec ) = 300; my( $server ) = "localhost"; my( $port ) = 5401; diff --git a/src/Main/main.cxx b/src/Main/main.cxx index f65be189e..5c7d7c94c 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -341,6 +341,7 @@ void trRenderFrame( void ) { // draw the lights glFogf (GL_FOG_DENSITY, rwy_exp2_punch_through); ssgSetNearFar( scene_nearplane, scene_farplane ); + ssgCullAndDraw( globals->get_scenery()->get_vasi_lights_root() ); ssgCullAndDraw( globals->get_scenery()->get_rwy_lights_root() ); ssgCullAndDraw( globals->get_scenery()->get_gnd_lights_root() ); @@ -711,6 +712,7 @@ void fgRenderFrame() { // draw runway lighting if ( draw_otw ) { + ssgCullAndDraw( globals->get_scenery()->get_vasi_lights_root() ); ssgCullAndDraw( globals->get_scenery()->get_rwy_lights_root() ); } diff --git a/src/Scenery/scenery.cxx b/src/Scenery/scenery.cxx index 958e27f32..88435c10c 100644 --- a/src/Scenery/scenery.cxx +++ b/src/Scenery/scenery.cxx @@ -72,6 +72,9 @@ void FGScenery::init() { gnd_lights_root = new ssgRoot; gnd_lights_root->setName( "Ground Lighting Root" ); + vasi_lights_root = new ssgRoot; + vasi_lights_root->setName( "VASI/PAPI Lighting Root" ); + rwy_lights_root = new ssgRoot; rwy_lights_root->setName( "Runway Lighting Root" ); diff --git a/src/Scenery/scenery.hxx b/src/Scenery/scenery.hxx index 020405f83..0ba923cd4 100644 --- a/src/Scenery/scenery.hxx +++ b/src/Scenery/scenery.hxx @@ -63,6 +63,7 @@ class FGScenery : public SGSubsystem { ssgRoot *scene_graph; ssgBranch *terrain_branch; ssgRoot *gnd_lights_root; + ssgRoot *vasi_lights_root; ssgRoot *rwy_lights_root; ssgRoot *taxi_lights_root; ssgBranch *models_branch; @@ -104,6 +105,13 @@ public: gnd_lights_root = r; } + inline ssgRoot *get_vasi_lights_root () const { + return vasi_lights_root; + } + inline void set_vasi_lights_root (ssgRoot *r) { + vasi_lights_root = r; + } + inline ssgRoot *get_rwy_lights_root () const { return rwy_lights_root; } diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx index 313c67fab..29a1350bc 100644 --- a/src/Scenery/tilemgr.cxx +++ b/src/Scenery/tilemgr.cxx @@ -322,7 +322,7 @@ void FGTileMgr::update_queues() #endif e->add_ssg_nodes( globals->get_scenery()->get_terrain_branch(), globals->get_scenery()->get_gnd_lights_root(), - globals->get_scenery()->get_taxi_lights_root(), + globals->get_scenery()->get_vasi_lights_root(), globals->get_scenery()->get_rwy_lights_root(), globals->get_scenery()->get_taxi_lights_root() ); // cout << "Adding ssg nodes for " -- 2.39.5