#include <simgear/bucket/newbucket.hxx>
#include <simgear/debug/logstream.hxx>
+#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/math/sg_random.h>
#include <simgear/misc/sgstream.hxx>
#include <simgear/scene/material/matlib.hxx>
#include <simgear/scene/tgdb/apt_signs.hxx>
#include <simgear/scene/tgdb/obj.hxx>
+#include <simgear/scene/tgdb/vasi.hxx>
#include <Aircraft/aircraft.hxx>
#include <Include/general.hxx>
taxi_lights_selector->select(0x00);
}
}
+
+ if ( vasi_lights_transform ) {
+ // now we need to traverse the list of vasi lights and update
+ // their coloring
+ for ( int i = 0; i < vasi_lights_transform->getNumKids(); ++i ) {
+ // cout << "vasi root = " << i << endl;
+ ssgBranch *v = (ssgBranch *)vasi_lights_transform->getKid(i);
+ for ( int j = 0; j < v->getNumKids(); ++j ) {
+ // cout << " vasi branch = " << j << endl;
+ ssgTransform *kid = (ssgTransform *)v->getKid(j);
+ SGVASIUserData *vasi = (SGVASIUserData *)kid->getUserData();
+
+ if ( vasi != NULL ) {
+ sgdVec3 s;
+ sgdCopyVec3( s, vasi->get_abs_pos() );
+ Point3D start(s[0], s[1], s[2]);
+
+ sgdVec3 d;
+ sgdCopyVec3( d, globals->get_current_view()->get_absolute_view_pos() );
+
+ double dist = sgdDistanceVec3( s, d );
+
+ double cur_alt = globals->get_current_view()->getAltitudeASL_ft() * SG_FEET_TO_METER;
+
+ double y = cur_alt - vasi->get_alt_m();
+
+ double angle;
+ if ( dist != 0 ) {
+ angle = asin( y / dist );
+ } else {
+ angle = 0.0;
+ }
+
+ if ( angle * SG_RADIANS_TO_DEGREES < 3.0 ) {
+ vasi->set_color(0.0);
+ } else {
+ vasi->set_color(1.0);
+ }
+ // cout << " dist = " << dist
+ // << " angle = " << angle * SG_RADIANS_TO_DEGREES
+ // << endl;
+ } else {
+ SG_LOG( SG_TERRAIN, SG_ALERT, "no vasi data!" );
+ }
+ }
+ }
+ }
}
current_bucket.make_bad();
longitude = latitude = -1000.0;
- last_longitude = last_latitude = -1000.0;
return 1;
}
// save bucket...
previous_bucket = current_bucket;
- // no reason to update this if we haven't moved...
- if ( longitude != last_longitude || latitude != last_latitude ) {
- // update current elevation...
- if ( updateCurrentElevAtPos( abs_pos_vector, altitude_m,
- location->get_tile_center() ) )
- {
- last_longitude = longitude;
- last_latitude = latitude;
- }
- }
+ updateCurrentElevAtPos( abs_pos_vector, altitude_m,
+ location->get_tile_center() );
return 1;
}