- if ( vasi_lights_transform ) {
- // we need to lift the lights above the terrain to avoid
- // z-buffer fighting. We do this based on our altitude and
- // the distance this tile is away from scenery center.
-
- sgVec3 lift_vec;
- sgCopyVec3( lift_vec, up );
-
- // we fudge agl by 30 meters so that the lifting function
- // doesn't phase in until we are > 30m agl.
- double agl;
- agl = globals->get_current_view()->getAltitudeASL_ft()*SG_FEET_TO_METER
- - globals->get_current_view()->getSGLocation()->get_cur_elev_m()
- - 30.0;
- if ( agl < 0.0 ) {
- agl = 0.0;
- }
-
- if ( general.get_glDepthBits() > 16 ) {
- sgScaleVec3( lift_vec, 0.25 + agl / 400.0 + agl*agl / 5000000.0 );
- } else {
- sgScaleVec3( lift_vec, 0.25 + agl / 150.0 );
- }
-
- sgdVec3 dlt_trans;
- sgdCopyVec3( dlt_trans, sgdTrans );
- sgdVec3 dlift_vec;
- sgdSetVec3( dlift_vec, lift_vec );
- sgdAddVec3( dlt_trans, dlift_vec );
- vasi_lights_transform->setTransform( dlt_trans );
-
- // generally, vasi lights are always on
- vasi_lights_selector->select(0x01);
- }
-
- if ( rwy_lights_transform ) {
- // we need to lift the lights above the terrain to avoid
- // z-buffer fighting. We do this based on our altitude and
- // the distance this tile is away from scenery center.
-
- sgVec3 lift_vec;
- sgCopyVec3( lift_vec, up );
-
- // we fudge agl by 30 meters so that the lifting function
- // doesn't phase in until we are > 30m agl.
- double agl;
- agl = globals->get_current_view()->getAltitudeASL_ft()*SG_FEET_TO_METER
- - globals->get_current_view()->getSGLocation()->get_cur_elev_m()
- - 30.0;
- if ( agl < 0.0 ) {
- agl = 0.0;
- }
-
- if ( general.get_glDepthBits() > 16 ) {
- sgScaleVec3( lift_vec, 0.01 + agl / 400.0 + agl*agl / 5000000.0 );
- } else {
- sgScaleVec3( lift_vec, 0.25 + agl / 150.0 );
- }
-
- sgdVec3 dlt_trans;
- sgdCopyVec3( dlt_trans, sgdTrans );
- sgdVec3 dlift_vec;
- sgdSetVec3( dlift_vec, lift_vec );
- sgdAddVec3( dlt_trans, dlift_vec );
- rwy_lights_transform->setTransform( dlt_trans );
-