Merge branch 'master' of gitorious.org:fg/fgdata
This commit is contained in:
commit
f14ba2466f
16 changed files with 1626 additions and 202 deletions
|
@ -81,7 +81,7 @@ var update_loop = func {
|
|||
# and the aircraft maximum rate. Both are expressed
|
||||
# in lbs/min
|
||||
var fuel_rate = math.min(tankers[0].getNode("refuel/max-fuel-transfer-lbs-min", 1).getValue() or 6000,
|
||||
refuelingN.getNode("max-fuel-transfer-lbs-min", 1).getValue());
|
||||
refuelingN.getNode("max-fuel-transfer-lbs-min", 1).getValue() or 6000);
|
||||
var received = UPDATE_PERIOD * fuel_rate / 60;
|
||||
consumed -= received;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<altitude><use>/sim/rendering/eye-altitude-m</use></altitude>
|
||||
<cloud_self_shading><use>/environment/cloud-self-shading</use></cloud_self_shading>
|
||||
<moonlight><use>/environment/moonlight</use></moonlight>
|
||||
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
|
||||
<visibility><use>/environment/visibility-m</use></visibility>
|
||||
</parameters>
|
||||
|
||||
|
@ -107,6 +108,11 @@
|
|||
<type>float</type>
|
||||
<value><use>moonlight</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>air_pollution</name>
|
||||
<type>float</type>
|
||||
<value><use>air_pollution</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
<type>float</type>
|
||||
|
|
33
Materials/regions/madagascar.xml
Normal file
33
Materials/regions/madagascar.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- General settings for all Madagascar materials -->
|
||||
<PropertyList>
|
||||
<!-- Define Madagascar as a box with given latitude/longitude -->
|
||||
<condition>
|
||||
<and>
|
||||
<equals>
|
||||
<property>sim/startup/season</property>
|
||||
<value>summer</value>
|
||||
</equals>
|
||||
<and>
|
||||
<greater-than>
|
||||
<property>position/longitude-deg</property>
|
||||
<value>40.0</value>
|
||||
</greater-than>
|
||||
<less-than>
|
||||
<property>position/longitude-deg</property>
|
||||
<value>50.0</value>
|
||||
</less-than>
|
||||
<greater-than>
|
||||
<property>position/latitude-deg</property>
|
||||
<value>-35.0</value>
|
||||
</greater-than>
|
||||
<less-than>
|
||||
<property>position/latitude-deg</property>
|
||||
<value>-10.0</value>
|
||||
</less-than>
|
||||
</and>
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
|
||||
</PropertyList>
|
|
@ -2627,6 +2627,186 @@
|
|||
</material>
|
||||
|
||||
|
||||
|
||||
<!-- REGIONAL DEFINITION MADAGASCAR -->
|
||||
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>EvergreenBroadCover</name>
|
||||
<name>EvergreenForest</name>
|
||||
<effect>Effects/forest</effect>
|
||||
<texture-set>
|
||||
<texture>Terrain/rainforest-hawaii.png</texture>
|
||||
<texture n="11">Terrain/rainforest-hawaii.png</texture>
|
||||
<texture n="12">Terrain/shrub-hawaii.png</texture>
|
||||
</texture-set>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<light-coverage>10000000.0</light-coverage>
|
||||
<wood-coverage>4000.0</wood-coverage>
|
||||
<tree-texture>Trees/tropical-summer.png</tree-texture>
|
||||
<tree-varieties>8</tree-varieties>
|
||||
<tree-range-m alias="/params/forest/tree-range-m"/>
|
||||
<tree-height-m>35.0</tree-height-m>
|
||||
<tree-width-m>30.0</tree-width-m>
|
||||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>1</bumpiness>
|
||||
</material>
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>GrassCover</name>
|
||||
<name>BareTundraCover</name>
|
||||
<name>MixedTundraCover</name>
|
||||
<name>Cemetery</name>
|
||||
<effect>Effects/landmass-nowood</effect>
|
||||
<texture-set>
|
||||
<texture>Terrain/tundra-hawaii.png</texture>
|
||||
<texture n="11">Terrain/rainforest-hawaii.png</texture>
|
||||
<texture n="12">Terrain/shrub-hawaii.png</texture>
|
||||
<texture n="15">Terrain/airport_grass2.png</texture>
|
||||
</texture-set>
|
||||
<parameters>
|
||||
<hires_overlay_bias>0.0</hires_overlay_bias>
|
||||
</parameters>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<light-coverage>4000000.0</light-coverage>
|
||||
<diffuse>
|
||||
<r>0.93</r>
|
||||
<g>0.95</g>
|
||||
<b>0.93</b>
|
||||
<a>1.0</a>
|
||||
</diffuse>
|
||||
<specular>
|
||||
<r>0.1</r>
|
||||
<g>0.12</g>
|
||||
<b>0.1</b>
|
||||
<a>1.0</a>
|
||||
</specular>
|
||||
<shininess>1.2</shininess>
|
||||
<solid>1</solid>
|
||||
<friction-factor>0.7</friction-factor>
|
||||
<rolling-friction>0.1</rolling-friction>
|
||||
<bumpiness>0.15</bumpiness>
|
||||
<load-resistance>1e30</load-resistance>
|
||||
</material>
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>MixedCropPastureCover</name>
|
||||
<name>MixedCrop</name>
|
||||
<name>ComplexCrop</name>
|
||||
<texture-set>
|
||||
<texture>Terrain/cropgrass-madagascar.png</texture>
|
||||
<texture n="12">Terrain/shrub-hawaii.png</texture>
|
||||
</texture-set>
|
||||
<parameters>
|
||||
<transition_model>0.5</transition_model>
|
||||
</parameters>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<light-coverage>2000000.0</light-coverage>
|
||||
<solid>1</solid>
|
||||
<friction-factor>0.9</friction-factor>
|
||||
<rolling-friction>0.1</rolling-friction>
|
||||
<bumpiness>0.7</bumpiness>
|
||||
<load-resistance>1e30</load-resistance>
|
||||
</material>
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<effect>Effects/crop</effect>
|
||||
<name>DryCropPastureCover</name>
|
||||
<name>DryCrop</name>
|
||||
<texture-set>
|
||||
<texture>Terrain/tundra-hawaii.png</texture>
|
||||
<texture n="11">Terrain/rainforest-hawaii.png</texture>
|
||||
<texture n="12">Terrain/shrub-hawaii.png</texture>
|
||||
</texture-set>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<solid>1</solid>
|
||||
<friction-factor>0.9</friction-factor>
|
||||
<rolling-friction>0.1</rolling-friction>
|
||||
<bumpiness>0.6</bumpiness>
|
||||
<load-resistance>1e30</load-resistance>
|
||||
<light-coverage>2000000.0</light-coverage>
|
||||
<wood-coverage>50000.0</wood-coverage>
|
||||
<tree-texture>Trees/tropical-summer.png</tree-texture>
|
||||
<tree-varieties>8</tree-varieties>
|
||||
<tree-range-m alias="/params/forest/tree-range-m"/>
|
||||
<tree-height-m>20.0</tree-height-m>
|
||||
<tree-width-m>12.0</tree-width-m>
|
||||
</material>
|
||||
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>BuiltUpCover</name>
|
||||
<name>Urban</name>
|
||||
<texture>Terrain/town-madagascar.png</texture>
|
||||
<object-mask>Terrain/town-europe.mask.png</object-mask>
|
||||
<xsize>1024</xsize>
|
||||
<ysize>1024</ysize>
|
||||
<light-coverage>100000.0</light-coverage>
|
||||
<emissive>
|
||||
<r>0.05</r>
|
||||
<g>0.05</g>
|
||||
<b>0.02</b>
|
||||
<a>1.0</a>
|
||||
</emissive>
|
||||
<object-group include="Materials/base/town-buildings.xml"/>
|
||||
<building-coverage>500.0</building-coverage>
|
||||
<building-small-ratio>0.9</building-small-ratio>
|
||||
<building-medium-ratio>0.1</building-medium-ratio>
|
||||
<building-large-ratio>0.0</building-large-ratio>
|
||||
<building-medium-max-floors>4</building-medium-max-floors>
|
||||
<wood-coverage>1000.0</wood-coverage>
|
||||
<tree-texture>Trees/tropical-alt-summer.png</tree-texture>
|
||||
<tree-varieties>8</tree-varieties>
|
||||
<tree-range-m alias="/params/forest/tree-range-m"/>
|
||||
<tree-height-m>15.0</tree-height-m>
|
||||
<tree-width-m>10.0</tree-width-m>
|
||||
</material>
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>DeciduousBroadCover</name>
|
||||
<name>DeciduousForest</name>
|
||||
<name>Bog</name>
|
||||
<name>Heath</name>
|
||||
<texture-set>
|
||||
<texture>Terrain/rainforest-hawaii.png</texture>
|
||||
<texture n="12">Terrain/marsh2a.png</texture>
|
||||
</texture-set>
|
||||
<parameters>
|
||||
<intrinsic_wetness>0.4</intrinsic_wetness>
|
||||
</parameters>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<light-coverage>10000000.0</light-coverage>
|
||||
<wood-coverage>4000.0</wood-coverage>
|
||||
<tree-texture>Trees/tropical-summer.png</tree-texture>
|
||||
<tree-varieties>8</tree-varieties>
|
||||
<tree-range-m alias="/params/forest/tree-range-m"/>
|
||||
<tree-height-m>25.0</tree-height-m>
|
||||
<tree-width-m>15.0</tree-width-m>
|
||||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>0.85</bumpiness>
|
||||
</material>
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>Sand</name>
|
||||
<texture-set>
|
||||
<texture>Terrain/sand-hawaii4.png</texture>
|
||||
<texture n="11">Terrain/sand-hawaii4.png</texture>
|
||||
</texture-set>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<light-coverage>10000000.0</light-coverage>
|
||||
<shininess>2.5</shininess>
|
||||
<rolling-friction>0.1</rolling-friction>
|
||||
<friction-factor>0.7</friction-factor>
|
||||
<bumpiness>0.1</bumpiness>
|
||||
</material>
|
||||
|
||||
|
||||
<!-- DEFAULT SUMMER DEFINITIONS -->
|
||||
|
||||
<material>
|
||||
|
|
|
@ -163,6 +163,12 @@ var Coord = {
|
|||
me._pupdate();
|
||||
course *= D2R;
|
||||
dist /= ERAD;
|
||||
|
||||
if (dist < 0.0) {
|
||||
dist = abs(dist);
|
||||
course = course - math.pi;
|
||||
}
|
||||
|
||||
me._lat = math.asin(math.sin(me._lat) * math.cos(dist)
|
||||
+ math.cos(me._lat) * math.sin(dist) * math.cos(course));
|
||||
|
||||
|
|
|
@ -384,13 +384,13 @@ else if (type == "Altocumulus"){
|
|||
|
||||
#characterize the cloud
|
||||
cloudAssembly.bottom_shade = 0.7;
|
||||
cloudAssembly.n_sprites = 10;
|
||||
cloudAssembly.min_width = 400.0 * mult;
|
||||
cloudAssembly.max_width = 700.0 * mult;
|
||||
cloudAssembly.n_sprites = 6;
|
||||
cloudAssembly.min_width = 40.0 * mult;
|
||||
cloudAssembly.max_width = 600.0 * mult;
|
||||
cloudAssembly.min_height = 400.0 * mult;
|
||||
cloudAssembly.max_height = 700.0 * mult;
|
||||
cloudAssembly.min_cloud_width = 1200 * mult * mult;
|
||||
cloudAssembly.min_cloud_height = 1200 * mult * mult;
|
||||
cloudAssembly.max_height = 600.0 * mult;
|
||||
cloudAssembly.min_cloud_width = 1000 * mult * mult;
|
||||
cloudAssembly.min_cloud_height = 1000 * mult * mult;
|
||||
cloudAssembly.z_scale = 0.8;
|
||||
|
||||
#signal that new routines are used
|
||||
|
@ -424,16 +424,15 @@ else if (type == "Stratus (structured)"){
|
|||
|
||||
#signal that new routines are used
|
||||
path = "new";
|
||||
|
||||
}
|
||||
else if (type == "Altocumulus perlucidus"){
|
||||
|
||||
# new code
|
||||
else if (type == "Stratus structured CS"){
|
||||
|
||||
cloudAssembly = local_weather.cloud.new(type, subtype);
|
||||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.7;}
|
||||
else {mult = 1.0;}
|
||||
|
||||
mult = mult * local_weather.cloud_size_scale;
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/altocumulus_sheet1.rgb";
|
||||
|
@ -441,7 +440,36 @@ else if (type == "Altocumulus perlucidus"){
|
|||
cloudAssembly.num_tex_y = 3;
|
||||
|
||||
#characterize the cloud
|
||||
cloudAssembly.bottom_shade = 0.8;
|
||||
cloudAssembly.bottom_shade = 0.4;
|
||||
cloudAssembly.n_sprites = 6;
|
||||
cloudAssembly.min_width = 1000.0 * mult;
|
||||
cloudAssembly.max_width = 1000.0 * mult;
|
||||
cloudAssembly.min_height = 1000.0 * mult;
|
||||
cloudAssembly.max_height = 1000.0 * mult;
|
||||
cloudAssembly.min_cloud_width = 1305 * mult;
|
||||
cloudAssembly.min_cloud_height = 1305.0 * mult;
|
||||
cloudAssembly.z_scale = 0.3;
|
||||
|
||||
#signal that new routines are used
|
||||
path = "new";
|
||||
}
|
||||
|
||||
else if (type == "Altocumulus perlucidus"){
|
||||
|
||||
# new code
|
||||
cloudAssembly = local_weather.cloud.new(type, subtype);
|
||||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.7;}
|
||||
else if (subtype == "huge") {mult = 1.5;}
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/altocumulus_sheet1.rgb";
|
||||
cloudAssembly.num_tex_x = 3;
|
||||
cloudAssembly.num_tex_y = 3;
|
||||
|
||||
#characterize the cloud
|
||||
cloudAssembly.bottom_shade = 0.7;
|
||||
cloudAssembly.n_sprites = 25;
|
||||
cloudAssembly.min_width = 1700.0 * mult;
|
||||
cloudAssembly.max_width = 2500.0 * mult;
|
||||
|
@ -508,7 +536,7 @@ else if (type == "Cirrocumulus (cloudlet)") {
|
|||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.6;}
|
||||
else {mult = 1.0;}
|
||||
else if (subtype == "huge") {mult = 1.5;}
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/cirrocumulus_sheet1.rgb";
|
||||
|
@ -527,9 +555,6 @@ else if (type == "Cirrocumulus (cloudlet)") {
|
|||
cloudAssembly.z_scale = 0.3;
|
||||
|
||||
path = "new";
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (type == "Cirrocumulus (new)") {
|
||||
|
||||
|
@ -537,7 +562,7 @@ else if (type == "Cirrocumulus (new)") {
|
|||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.7;}
|
||||
else {mult = 1.0;}
|
||||
else {mult = 1.3;}
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/cirrocumulus_sheet1.rgb";
|
||||
|
@ -559,6 +584,36 @@ else if (type == "Cirrocumulus (new)") {
|
|||
path = "new";
|
||||
}
|
||||
|
||||
else if (type == "Fogpatch") {
|
||||
|
||||
cloudAssembly = local_weather.cloud.new(type, subtype);
|
||||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.7;}
|
||||
else {mult = 1.0;}
|
||||
|
||||
mult = mult * local_weather.cloud_size_scale;
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/fogpatch_sheet1.rgb";
|
||||
cloudAssembly.num_tex_x = 1;
|
||||
cloudAssembly.num_tex_y = 1;
|
||||
|
||||
#characterize the cloud
|
||||
cloudAssembly.bottom_shade = 1.0;
|
||||
cloudAssembly.n_sprites = 1;
|
||||
cloudAssembly.min_width = 300.0 * mult;
|
||||
cloudAssembly.max_width = 300.0 * mult;
|
||||
cloudAssembly.min_height = 300.0 * mult;
|
||||
cloudAssembly.max_height = 300.0 * mult;
|
||||
cloudAssembly.min_cloud_width = 305.0 * mult;
|
||||
cloudAssembly.min_cloud_height = 305.0 * mult;
|
||||
cloudAssembly.z_scale = 0.5;
|
||||
|
||||
#signal that new routines are used
|
||||
path = "new";
|
||||
}
|
||||
|
||||
else if (type == "Nimbus") {
|
||||
|
||||
cloudAssembly = local_weather.cloud.new(type, subtype);
|
||||
|
@ -698,6 +753,35 @@ else if (type == "Cirrostratus") {
|
|||
path = "new";
|
||||
|
||||
}
|
||||
else if (type == "Cirrostratus (small)") {
|
||||
|
||||
cloudAssembly = local_weather.cloud.new(type, subtype);
|
||||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.45;}
|
||||
else {mult = 0.7;}
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/cirrostratus_sheet1.rgb";
|
||||
cloudAssembly.num_tex_x = 2;
|
||||
cloudAssembly.num_tex_y = 2;
|
||||
|
||||
#characterize the cloud
|
||||
cloudAssembly.bottom_shade = 1.0;
|
||||
cloudAssembly.n_sprites = 2;
|
||||
cloudAssembly.min_width = 3500.0 * mult;
|
||||
cloudAssembly.max_width = 4000.0 * mult;
|
||||
cloudAssembly.min_height = 3500.0 * mult;
|
||||
cloudAssembly.max_height = 4000.0 * mult;
|
||||
cloudAssembly.min_cloud_width = 4500.0 * mult;
|
||||
cloudAssembly.min_cloud_height = 4500.0 * mult;
|
||||
cloudAssembly.z_scale = 0.5;
|
||||
|
||||
#signal that new routines are used
|
||||
path = "new";
|
||||
|
||||
}
|
||||
|
||||
else if (type == "Fog (thin)") {
|
||||
if (subtype == "small") {
|
||||
if (rn > 0.8) {path = "Models/Weather/stratus_thin1.xml";}
|
||||
|
|
|
@ -80,6 +80,190 @@ for (var i=0; i<ny; i=i+1)
|
|||
}
|
||||
|
||||
|
||||
###########################################################
|
||||
# place an advanced undulatus pattern
|
||||
###########################################################
|
||||
|
||||
var create_adv_undulatus = func (arg) {
|
||||
|
||||
var markov_array = [];
|
||||
var rnd_array = [];
|
||||
var max_num_clouds = int(arg.xsize/arg.cloud_spacing)+1;
|
||||
var max_num_streaks = int(arg.ysize/arg.undulatus_spacing)+1;
|
||||
var path = "Models/Weather/blank.ac";
|
||||
var counter = 0;
|
||||
|
||||
append(markov_array,0.0);
|
||||
|
||||
var rn = 0.0;
|
||||
arg.dir = arg.dir + 90.0;
|
||||
|
||||
for (var i=1; i<max_num_clouds; i=i+1)
|
||||
{
|
||||
rn = rand();
|
||||
append(markov_array, markov_array[i-1] + 2.0 * (rn -0.5) * arg.undulatus_amplitude + arg.undulatus_slant);
|
||||
append(rnd_array, rn);
|
||||
}
|
||||
|
||||
for (i=0; i< max_num_streaks; i=i+1)
|
||||
{
|
||||
var streak_ypos = -0.5 * arg.ysize + i * arg.undulatus_spacing;
|
||||
var aspect_num_clouds = int((arg.aspect + (1.0-arg.aspect) * i/max_num_streaks) * max_num_clouds);
|
||||
|
||||
for (var j = 0; j< aspect_num_clouds; j=j+1)
|
||||
{
|
||||
var y = streak_ypos + markov_array[j];
|
||||
var x = -0.5 * arg.xsize + j * arg.cloud_spacing;
|
||||
|
||||
x = x - arg.Dx + 2.0 * rand() * arg.Dx;
|
||||
y = y - arg.Dy + 2.0 * rand() * arg.Dy;
|
||||
|
||||
var flag = 0;
|
||||
var bias =1.0 - (1.0* abs(i-0.5 * max_num_streaks)/max_num_streaks + 1.0* abs(j-0.5 * aspect_num_clouds)/aspect_num_clouds);
|
||||
var comp = -.25 * rnd_array[j] + 0.75 * bias;
|
||||
|
||||
comp = comp + arg.size_bias;
|
||||
if (comp > 0.7)
|
||||
{
|
||||
flag = 1;
|
||||
path = select_cloud_model(arg.type,"large")
|
||||
}
|
||||
else if (comp > 0.4)
|
||||
{
|
||||
flag = 1;
|
||||
path = select_cloud_model(arg.type,"small")
|
||||
}
|
||||
|
||||
var lat = arg.blat + m_to_lat * (y * math.cos(arg.dir) - x * math.sin(arg.dir));
|
||||
var lon = arg.blon + m_to_lon * (x * math.cos(arg.dir) + y * math.sin(arg.dir));
|
||||
|
||||
var alt = arg.balt + arg.alt_var * 2 * (rand() - 0.5);
|
||||
|
||||
if (flag > 0)
|
||||
{create_cloud_vec(path, lat, lon, alt, 0.0); counter = counter +1;}
|
||||
}
|
||||
|
||||
}
|
||||
print("Cloud count: ",counter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
###########################################################
|
||||
# place a stick bundle pattern
|
||||
###########################################################
|
||||
|
||||
var sgn = func (x) {
|
||||
|
||||
if (x<0.0) {return -1.0;}
|
||||
else {return 1.0;}
|
||||
}
|
||||
|
||||
var create_stick_bundle = func (arg) {
|
||||
|
||||
var path = "Models/Weather/blank.ac";
|
||||
var base_size_scale = local_weather.cloud_size_scale;
|
||||
|
||||
for (var i = 0; i<arg.n_sticks; i=i+1)
|
||||
{
|
||||
var stick_x = 0.5 * math.pow(rand(),2.0) * arg.xsize * sgn(rand()-0.5);
|
||||
var stick_y = 0.5 * math.pow(rand(),2.0) * arg.ysize * sgn(rand()-0.5);
|
||||
|
||||
var stick_length = arg.stick_length_min + int(rand() * (arg.stick_length_max - arg.stick_length_min) );
|
||||
var stick_Dphi = arg.stick_Dphi_min + rand() * (arg.stick_Dphi_max - arg.stick_Dphi_min);
|
||||
var stick_size_scale = 0.8 + 0.2 * rand();
|
||||
for (var j=0; j<stick_length;j=j+1)
|
||||
{
|
||||
var y = stick_y;
|
||||
var x = stick_x - 0.5 * stick_length * arg.cloud_spacing;
|
||||
var inc = j * arg.cloud_spacing;
|
||||
var pos_size_scale = base_size_scale + base_size_scale * 2.0* (1.0 - 2.0* abs(0.5 * stick_length - j)/stick_length);
|
||||
local_weather.cloud_size_scale = pos_size_scale;
|
||||
local_weather.cloud_size_scale = stick_size_scale * local_weather.cloud_size_scale;
|
||||
inc = inc * stick_size_scale;
|
||||
|
||||
x = x + inc * math.cos(stick_Dphi);
|
||||
y = y + inc * math.sin(stick_Dphi);
|
||||
|
||||
x = x - arg.Dx + 2.0 * rand() * arg.Dx;
|
||||
y = y - arg.Dy + 2.0 * rand() * arg.Dy;
|
||||
|
||||
path = select_cloud_model(arg.type,"large");
|
||||
|
||||
var lat = arg.blat + m_to_lat * (y * math.cos(arg.dir) - x * math.sin(arg.dir));
|
||||
var lon = arg.blon + m_to_lon * (x * math.cos(arg.dir) + y * math.sin(arg.dir));
|
||||
|
||||
var alt = arg.balt + arg.alt_var * 2 * (rand() - 0.5);
|
||||
|
||||
create_cloud_vec(path, lat, lon, alt, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###########################################################
|
||||
# place a nested domains pattern
|
||||
###########################################################
|
||||
|
||||
var create_domains = func (arg) {
|
||||
|
||||
var path = "Models/Weather/blank.ac";
|
||||
|
||||
for (var j=0; j<arg.n_domains; j=j+1)
|
||||
{
|
||||
var domain_pos_x = -0.5 * arg.xsize + rand() * arg.xsize;
|
||||
var domain_pos_y = -0.5 * arg.ysize + rand() * arg.ysize;
|
||||
|
||||
var domain_size_x = arg.min_domain_size_x + rand() * (arg.max_domain_size_x - arg.min_domain_size_x);
|
||||
var domain_size_y = arg.min_domain_size_y + rand() * (arg.max_domain_size_y - arg.min_domain_size_y);
|
||||
|
||||
var n_node = int(arg.node_fraction * arg.n);
|
||||
var n_halo = int(arg.halo_fraction * arg.n);
|
||||
var n_bulk = arg.n - n_node - n_halo;
|
||||
|
||||
for (var i=0; i<n_halo; i=i+1)
|
||||
{
|
||||
var x = domain_pos_x - 0.5 * domain_size_x + rand() * domain_size_x;
|
||||
var y = domain_pos_y - 0.5 * domain_size_y + rand() * domain_size_y;
|
||||
var lat = arg.blat + m_to_lat * (y * math.cos(arg.dir) - x * math.sin(arg.dir));
|
||||
var lon = arg.blon + m_to_lon * (x * math.cos(arg.dir) + y * math.sin(arg.dir));
|
||||
var alt = arg.balt + arg.alt_var * 2 * (rand() - 0.5);
|
||||
if ((abs(x-domain_pos_x) < 0.3 * domain_size_x) or (abs(y-domain_pos_y) < 0.3 * domain_size_y))
|
||||
{path = select_cloud_model(arg.htype,arg.hsubtype);
|
||||
create_cloud_vec(path, lat, lon, alt, 0.0);}
|
||||
}
|
||||
for (i=0; i<n_bulk; i=i+1)
|
||||
{
|
||||
x = domain_pos_x - 0.5 * 0.4* domain_size_x + rand() * 0.4* domain_size_x;
|
||||
y = domain_pos_y - 0.5 * 0.4* domain_size_y + rand() * 0.4* domain_size_y;
|
||||
lat = arg.blat + m_to_lat * (y * math.cos(arg.dir) - x * math.sin(arg.dir));
|
||||
lon = arg.blon + m_to_lon * (x * math.cos(arg.dir) + y * math.sin(arg.dir));
|
||||
alt = arg.balt + arg.alt_var * 2 * (rand() - 0.5);
|
||||
if ((abs(x-domain_pos_x) < 0.4 * domain_size_x) or (abs(y-domain_pos_y) < 0.4 * domain_size_y))
|
||||
{
|
||||
path = select_cloud_model(arg.type,arg.subtype);
|
||||
create_cloud_vec(path, lat, lon, alt, 0.0);
|
||||
}
|
||||
}
|
||||
for (i=0; i<n_node; i=i+1)
|
||||
{
|
||||
x = domain_pos_x - 0.5 * 0.1* domain_size_x + rand() * 0.1* domain_size_x;
|
||||
y = domain_pos_y - 0.5 * 0.1* domain_size_y + rand() * 0.1* domain_size_y;
|
||||
lat = arg.blat + m_to_lat * (y * math.cos(arg.dir) - x * math.sin(arg.dir));
|
||||
lon = arg.blon + m_to_lon * (x * math.cos(arg.dir) + y * math.sin(arg.dir));
|
||||
alt = arg.balt + arg.alt_var * 2 * (rand() - 0.5);
|
||||
path = select_cloud_model(arg.ntype,arg.nsubtype);
|
||||
create_cloud_vec(path, lat, lon, alt, 0.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
###########################################################
|
||||
# place a Cumulus alley pattern
|
||||
|
|
|
@ -699,7 +699,7 @@ else
|
|||
# compute the cloud layer self shading correction
|
||||
|
||||
var sun_angle = 1.57079632675 - getprop("/sim/time/sun-angle-rad");
|
||||
var cloud_layer_shading = 1.0 - ((1.0 - scatt_max) * math.pow(math.cos(sun_angle),100.0));
|
||||
var cloud_layer_shading = 1.0 - (0.8*(1.0 - scatt_max) * math.pow(math.cos(sun_angle),100.0));
|
||||
|
||||
# compute the overcast haze
|
||||
|
||||
|
@ -1224,7 +1224,7 @@ if (ev.vis_flag ==1)
|
|||
# then set the new value in current and execute change
|
||||
cNode.getNode("visibility-m").setValue(vis);
|
||||
#compat_layer.setVisibility(vis);
|
||||
#print(vis);
|
||||
print(vis);
|
||||
compat_layer.setVisibilitySmoothly(vis);
|
||||
|
||||
# then count the number of active volumes on entry (we need that to determine
|
||||
|
@ -4488,6 +4488,10 @@ if (lowest_layer_turbulence < 0.0) {lowest_layer_turbulence = 0.0;}
|
|||
|
||||
var top_shade = 1.0;
|
||||
|
||||
# global cloud size scale;
|
||||
|
||||
var cloud_size_scale = 1.0;
|
||||
|
||||
# globals keeping track of the lifetime when building a Cumulus from individual cloudlets
|
||||
|
||||
var cloud_fractional_lifetime = 0.0;
|
||||
|
@ -4582,7 +4586,7 @@ setprop(lw~"effect-volumes/number-active-sat",0);
|
|||
# setprop(lw~"config/max-vis-range-m", 120000.0);
|
||||
setprop(lw~"config/temperature-offset-degc", 0.0);
|
||||
|
||||
# setprop("/sim/rendering/eye-altitude-m", getprop("/position/altitude-ft") * ft_to_m);
|
||||
setprop("/sim/rendering/eye-altitude-m", getprop("/position/altitude-ft") * ft_to_m);
|
||||
|
||||
# create properties for tile management
|
||||
|
||||
|
|
|
@ -122,8 +122,10 @@ time_lw = time_lw + dt_lw;
|
|||
#var terminator_offset = sun_angle / 0.017451 * 110000.0;# + 250000.0;
|
||||
#setprop("/environment/terminator-relative-position-m",terminator_offset);
|
||||
|
||||
# var viewpos = geo.viewer_position();
|
||||
var viewpos = geo.viewer_position();
|
||||
|
||||
# setprop("/environment/alt-in-haze-m", getprop("/environment/ground-haze-thickness-m")-viewpos.alt());
|
||||
|
||||
#setprop("/sim/rendering/eye-altitude-m", viewpos.alt());
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +1,11 @@
|
|||
# route_manager.nas - default FlightPlan delegate corresponding to the build
|
||||
# in route-manager dialog. Intended to provide a sensible default behaviour,
|
||||
# but be disabled by an aircraft-specific FMS / GPS system.
|
||||
# route_manager.nas - FlightPlan delegate(s) corresponding to the built-
|
||||
# in route-manager dialog and GPS. Intended to provide a sensible default behaviour,
|
||||
# but can be disabled by an aircraft-specific FMS / GPS system.
|
||||
|
||||
var RouteManagerDelegate = {
|
||||
new: func(fp) {
|
||||
# if this property is set, don't build a delegate at all
|
||||
if (getprop('/autopilot/route-manager/disable-fms'))
|
||||
if (getprop('/autopilot/route-manager/disable-route-manager'))
|
||||
return nil;
|
||||
|
||||
var m = { parents: [RouteManagerDelegate] };
|
||||
|
@ -82,17 +82,70 @@ var RouteManagerDelegate = {
|
|||
fgcommand("activate-flightplan", props.Node.new({"activate": 0}));
|
||||
},
|
||||
|
||||
endOfFlightPlan: func
|
||||
{
|
||||
debug.dump("end of flight-plan, deactivating");
|
||||
fgcommand("activate-flightplan", props.Node.new({"activate": 0}));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var FMSDelegate = {
|
||||
new: func(fp) {
|
||||
# if this property is set, don't build a delegate at all
|
||||
if (getprop('/autopilot/route-manager/disable-fms'))
|
||||
return nil;
|
||||
|
||||
var m = { parents: [FMSDelegate], flightplan:fp, landingCheck:nil };
|
||||
return m;
|
||||
},
|
||||
|
||||
_landingCheckTimeout: func
|
||||
{
|
||||
var cur = me.flightplan.currentWP();
|
||||
var wow = getprop('gear/gear[0]/wow');
|
||||
var gs = getprop('velocities/groundspeed-kt');
|
||||
if (wow and (gs < 25)) {
|
||||
debug.dump('touchdown on destination runway, end of route.');
|
||||
me.landingCheck.stop();
|
||||
# record touch-down time?
|
||||
me.flightplan.finish();
|
||||
}
|
||||
},
|
||||
|
||||
waypointsChanged: func
|
||||
{
|
||||
},
|
||||
|
||||
endOfFlightPlan: func
|
||||
{
|
||||
debug.dump('end of flight-plan');
|
||||
},
|
||||
|
||||
currentWaypointChanged: func
|
||||
{
|
||||
debug.dump('saw current WP changed, now ' ~ me.flightplan.current);
|
||||
if (me.landingCheck != nil) {
|
||||
me.landingCheck.stop();
|
||||
me.landingCheck = nil; # delete timer
|
||||
}
|
||||
|
||||
#debug.dump('saw current WP changed, now ' ~ me.flightplan.current);
|
||||
var active = me.flightplan.currentWP();
|
||||
if (active == nil) return;
|
||||
|
||||
if (active.alt_cstr_type != 'none') {
|
||||
debug.dump('new WP has valid altitude restriction, setting on AP');
|
||||
setprop('/autopilot/settings/target-altitude-ft', active.alt_cstr);
|
||||
}
|
||||
|
||||
var activeRunway = active.runway();
|
||||
if ((activeRunway != nil) and (activeRunway.id == me.flightplan.destination_runway.id)) {
|
||||
me.landingCheck = maketimer(2.0, me, FMSDelegate._landingCheckTimeout);
|
||||
me.landingCheck.start();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
# debug.dump('register routemanager delegate factory');
|
||||
|
||||
registerFlightPlanDelegate(FMSDelegate.new);
|
||||
registerFlightPlanDelegate(RouteManagerDelegate.new);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ var identity = {
|
|||
|
||||
|
||||
var Tanker = {
|
||||
new: func(aiid, callsign, tacan, type, model, kias, maxfuel, pattern, heading, coord) {
|
||||
new: func(aiid, callsign, tacan, type, model, kias, maxfuel, pattern, contacts, heading, coord) {
|
||||
var m = { parents: [Tanker] };
|
||||
m.callsign = callsign;
|
||||
m.tacan = tacan;
|
||||
|
@ -79,6 +79,7 @@ var Tanker = {
|
|||
m.out_of_range_time = 0;
|
||||
m.interval = 10;
|
||||
m.length = pattern;
|
||||
m.contacts = contacts;
|
||||
m.roll = 0;
|
||||
m.coord = geo.Coord.new(coord);
|
||||
m.anchor = geo.Coord.new(coord).apply_course_distance(m.track_course, m.length); # ARCP
|
||||
|
@ -155,7 +156,7 @@ var Tanker = {
|
|||
}
|
||||
|
||||
var distance = dt * (me.ktas - me.headwind) * NM2M / 3600;
|
||||
var deviation = me.roll ? 0.5 * dt * 1085.941 * math.tan(me.roll * D2R) / me.ktas : 0;
|
||||
var deviation = me.roll ? dt * 1085.941 * math.tan(me.roll * D2R) / me.ktas : 0;
|
||||
|
||||
if (me.mode == "leg") {
|
||||
if (me.lastmode != "leg") {
|
||||
|
@ -218,9 +219,43 @@ var Tanker = {
|
|||
me.brgN.setDoubleValue(me.bearing);
|
||||
me.elevN.setDoubleValue(elev);
|
||||
|
||||
me.contactN.setBoolValue(me.distance < ac_contact_dist and
|
||||
dalt > 0 and
|
||||
abs(view.normdeg(me.bearing - ac_hdg)) < 20);
|
||||
# Determine if any of the contact points are in contact
|
||||
var offset_x = getprop("/systems/refuel/offset-x-m") or 0;
|
||||
var offset_y = getprop("/systems/refuel/offset-y-m") or 0;
|
||||
var offset_z = getprop("/systems/refuel/offset-z-m") or 0;
|
||||
var roll = getprop("/orientation/roll-deg") * globals.D2R;
|
||||
|
||||
# Determine contact position
|
||||
var probe_pos = geo.Coord.new(me.ac);
|
||||
|
||||
probe_pos.apply_course_distance(ac_hdg, offset_x);
|
||||
probe_pos.apply_course_distance(ac_hdg + 90, offset_y * math.cos(roll) + offset_z * math.sin(roll));
|
||||
probe_pos.set_alt(me.ac.alt() + offset_z * math.cos(roll) - offset_y * math.sin(roll));
|
||||
|
||||
me.contactN.setBoolValue(0);
|
||||
|
||||
foreach (var c; me.contacts) {
|
||||
var drogue_pos = geo.Coord.new(me.coord);
|
||||
|
||||
# Offset longitudonally
|
||||
drogue_pos.apply_course_distance(me.course, c.x);
|
||||
|
||||
var r = me.roll * globals.D2R;
|
||||
|
||||
# Offset laterally, taking into account any roll
|
||||
drogue_pos.apply_course_distance(me.course +90, c.y * math.cos(r) + c.z * math.sin(r));
|
||||
|
||||
# Offset vertically, again, taking into account any roll
|
||||
drogue_pos.set_alt(drogue_pos.alt() + c.z * math.cos(r) - c.y * math.sin(r));
|
||||
|
||||
#print("Distance: " ~ probe_pos.distance_to(drogue_pos) ~ " vs. " ~ me.distance);
|
||||
|
||||
if (probe_pos.distance_to(drogue_pos) < ac_contact_dist and
|
||||
abs(view.normdeg(me.course - ac_hdg)) < 20) {
|
||||
# Contact!
|
||||
me.contactN.setBoolValue(1);
|
||||
}
|
||||
}
|
||||
|
||||
me.hOffsetN.setDoubleValue(me.bearing - ac_hdg);
|
||||
me.vOffsetN.setDoubleValue(elev - ac_pitch);
|
||||
|
@ -279,12 +314,26 @@ var create_tanker = func(tanker_node, course) {
|
|||
var pattern = (tanker_node.getNode("pattern-length-nm", 1).getValue() or 50) * NM2M;
|
||||
var maxfuel = tanker_node.getNode("max-fuel-transfer-lbs-min", 1).getValue() or 6000;
|
||||
|
||||
var contacts = [];
|
||||
|
||||
foreach (var contact; tanker_node.getChildren("contact")) {
|
||||
var x = (contact.getNode("x-m") != nil) ? contact.getNode("x-m").getValue() : 0;
|
||||
var y = (contact.getNode("y-m") != nil) ? contact.getNode("y-m").getValue() : 0;
|
||||
var z = (contact.getNode("z-m") != nil) ? contact.getNode("z-m").getValue() : 0;
|
||||
append(contacts, { "x" : x, "y" : y, "z" : z });
|
||||
}
|
||||
|
||||
|
||||
if (size(contacts) == 0) {
|
||||
append(contacts, {x: 0, y:0, z:0});
|
||||
}
|
||||
|
||||
var alt = int(10 + rand() * 15) * 1000; # FL100--FL250
|
||||
alt = skip_cloud_layer(alt * FT2M);
|
||||
var dist = 6000 + rand() * 4000;
|
||||
var coord = geo.aircraft_position().apply_course_distance(course, dist).set_alt(alt);
|
||||
|
||||
Tanker.new(aiid, callsign, tacanid, type, model, spd, maxfuel, pattern, course, coord);
|
||||
Tanker.new(aiid, callsign, tacanid, type, model, spd, maxfuel, pattern, contacts, course, coord);
|
||||
}
|
||||
|
||||
# Request a new tanker
|
||||
|
|
|
@ -12,6 +12,7 @@ uniform float altitude;
|
|||
uniform float cloud_self_shading;
|
||||
uniform float visibility;
|
||||
uniform float moonlight;
|
||||
uniform float air_pollution;
|
||||
|
||||
attribute vec3 usrAttr1;
|
||||
attribute vec3 usrAttr2;
|
||||
|
@ -151,8 +152,8 @@ void main(void)
|
|||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0);
|
||||
light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
light_diffuse.b = light_func(lightArg -1.2 * air_pollution, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0);
|
||||
light_diffuse.g = light_func(lightArg -0.6 * air_pollution, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
light_diffuse.a = 1.0;
|
||||
|
||||
|
@ -160,9 +161,9 @@ void main(void)
|
|||
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, (1.0 - smoothstep(0.5,0.9, min(scattering, cloud_self_shading) ))));
|
||||
|
||||
// correct ambient light intensity and hue before sunrise
|
||||
if (earthShade < 0.8)
|
||||
if (earthShade < 0.6)
|
||||
{
|
||||
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade ) ));
|
||||
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.6,earthShade ) ));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -148,6 +148,9 @@
|
|||
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Snow thickness</label>
|
||||
<halign>left</halign>
|
||||
<row>3</row>
|
||||
|
@ -155,6 +158,9 @@
|
|||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>thin</label>
|
||||
<halign>right</halign>
|
||||
<row>3</row>
|
||||
|
@ -162,6 +168,9 @@
|
|||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>snow-thickness</name>
|
||||
<row>3</row>
|
||||
<col>2</col>
|
||||
|
@ -176,6 +185,9 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>thick</label>
|
||||
<halign>left</halign>
|
||||
<row>3</row>
|
||||
|
@ -183,6 +195,9 @@
|
|||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Dust cover</label>
|
||||
<halign>left</halign>
|
||||
<row>4</row>
|
||||
|
@ -190,6 +205,9 @@
|
|||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>none</label>
|
||||
<halign>right</halign>
|
||||
<row>4</row>
|
||||
|
@ -197,6 +215,9 @@
|
|||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>dust-level</name>
|
||||
<row>4</row>
|
||||
<col>2</col>
|
||||
|
@ -211,6 +232,9 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>dusty</label>
|
||||
<halign>left</halign>
|
||||
<row>4</row>
|
||||
|
@ -218,6 +242,9 @@
|
|||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Wetness</label>
|
||||
<halign>left</halign>
|
||||
<row>5</row>
|
||||
|
@ -225,6 +252,9 @@
|
|||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>dry</label>
|
||||
<halign>right</halign>
|
||||
<row>5</row>
|
||||
|
@ -232,6 +262,9 @@
|
|||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>wetness</name>
|
||||
<row>5</row>
|
||||
<col>2</col>
|
||||
|
@ -246,6 +279,9 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>wet</label>
|
||||
<halign>left</halign>
|
||||
<row>5</row>
|
||||
|
@ -254,6 +290,9 @@
|
|||
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Vegetation</label>
|
||||
<halign>left</halign>
|
||||
<row>6</row>
|
||||
|
@ -261,6 +300,9 @@
|
|||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>none</label>
|
||||
<halign>right</halign>
|
||||
<row>6</row>
|
||||
|
@ -268,6 +310,9 @@
|
|||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>lichen-level</name>
|
||||
<row>6</row>
|
||||
<col>2</col>
|
||||
|
@ -282,6 +327,9 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>mossy</label>
|
||||
<halign>left</halign>
|
||||
<row>6</row>
|
||||
|
@ -290,13 +338,19 @@
|
|||
|
||||
|
||||
<text>
|
||||
<label>Season</label>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Season (experimental)</label>
|
||||
<halign>left</halign>
|
||||
<row>7</row>
|
||||
<col>0</col>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>summer</label>
|
||||
<halign>right</halign>
|
||||
<row>7</row>
|
||||
|
@ -304,6 +358,9 @@
|
|||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>season</name>
|
||||
<row>7</row>
|
||||
<col>2</col>
|
||||
|
@ -318,6 +375,9 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>late autumn</label>
|
||||
<halign>left</halign>
|
||||
<row>7</row>
|
||||
|
|
|
@ -4,23 +4,134 @@
|
|||
<height>430</height>
|
||||
<modal>false</modal>
|
||||
<nasal>
|
||||
<open>
|
||||
<open><![CDATA[
|
||||
|
||||
var gps = props.globals.getNode("/instrumentation/gps/", 1);
|
||||
var dlg = props.globals.getNode("/sim/gui/dialogs/gps", 1);
|
||||
var cmd = gps.getNode("command", 1);
|
||||
var scratch = gps.getNode("scratch");
|
||||
var scratch = gps.getNode("scratch", 1);
|
||||
var scratchValid = scratch.getNode("valid", 1);
|
||||
var searchIsWaypoints = 0;
|
||||
var anySpec = 'vor,airport,heliport,ils,seaport,fix,ndb,waypoint,tacan,city,town';
|
||||
|
||||
scratch.getNode("exact", 1).setBoolValue(0);
|
||||
var searchType = scratch.getNode("type", 1);
|
||||
var searchQuery = scratch.getNode("query", 1);
|
||||
var updateSearchResults = func(isWpts, index = 0)
|
||||
{
|
||||
searchIsWaypoints = isWpts;
|
||||
dlg.getNode("scratch-index", 1).setValue(index);
|
||||
|
||||
var copySearchArgs = func {
|
||||
searchType.setValue(dlg.getNode("search-type").getValue());
|
||||
searchQuery.setValue(dlg.getNode("search-query").getValue());
|
||||
var lastIndex = size(searchResults) - 1;
|
||||
dlg.getNode("scratch-has-next", 1).setValue((index + 1) < lastIndex);
|
||||
|
||||
if (size(searchResults) < 1) {
|
||||
scratchValid.setBoolValue(0);
|
||||
return;
|
||||
}
|
||||
|
||||
updateScratch();
|
||||
}
|
||||
|
||||
var updateScratch = func
|
||||
{
|
||||
var result = searchResults[dlg.getNode("scratch-index").getValue()];
|
||||
if (result == nil) {
|
||||
scratchValid.setBoolValue(0);
|
||||
return;
|
||||
}
|
||||
|
||||
scratchValid.setBoolValue(1);
|
||||
scratch.getNode("latitude-deg", 1).setValue(result.lat);
|
||||
scratch.getNode("longitude-deg", 1).setValue(result.lon);
|
||||
scratch.getNode("ident", 1).setValue(result.id);
|
||||
var cd = nil;
|
||||
|
||||
if (searchIsWaypoints) {
|
||||
scratch.getNode("type", 1).setValue('WPT');
|
||||
|
||||
cd = result.courseAndDistanceFrom(geo.aircraft_position());
|
||||
} else {
|
||||
var ty = result.type;
|
||||
scratch.getNode("type", 1).setValue(ty);
|
||||
scratch.getNode("name", 1).setValue(result.name);
|
||||
scratch.getNode("altitude-ft", 1).setValue(result.elevation);
|
||||
|
||||
if (ty == 'vor') {
|
||||
scratch.getNode("frequency-mhz", 1).setValue(result.frequency);
|
||||
} elsif (ty == 'ndb') {
|
||||
scratch.getNode("frequency-khz", 1).setValue(result.frequency);
|
||||
}
|
||||
|
||||
cd = positioned.courseAndDistance(result);
|
||||
}
|
||||
|
||||
|
||||
scratch.getNode("mag-bearing-deg", 1).setValue(cd[0] + magvar());
|
||||
scratch.getNode("distance-nm", 1).setValue(cd[1]);
|
||||
|
||||
gui.dialog_update("gps");
|
||||
}
|
||||
|
||||
var doSearch = func()
|
||||
{
|
||||
var ty = dlg.getNode("search-type").getValue();
|
||||
if (ty == 'any') ty = anySpec;
|
||||
|
||||
var query = dlg.getNode("search-query").getValue();
|
||||
searchResults = positioned.sortByRange(positioned.findByIdent(query, ty));
|
||||
updateSearchResults(0);
|
||||
}
|
||||
|
||||
var doSearchNames = func
|
||||
{
|
||||
var ty = dlg.getNode("search-type").getValue();
|
||||
if (ty == 'any') ty = anySpec;
|
||||
var query = dlg.getNode("search-query").getValue();
|
||||
searchResults = positioned.sortByRange(positioned.findByName(query, ty));
|
||||
updateSearchResults(0);
|
||||
}
|
||||
|
||||
var doSearchNearest = func
|
||||
{
|
||||
var ty = dlg.getNode("search-type").getValue();
|
||||
searchResults = positioned.findWithinRange(200.0, ty);
|
||||
updateSearchResults(0);
|
||||
}
|
||||
|
||||
var doLoadRouteWaypoint = func
|
||||
{
|
||||
var fp = flightplan();
|
||||
searchResults = [];
|
||||
for (var i=0; i < fp.getPlanSize(); i+=1) {
|
||||
append(searchResults, fp.getWP(i));
|
||||
}
|
||||
updateSearchResults(1, fp.current);
|
||||
}
|
||||
|
||||
var doScratchPrevious = func
|
||||
{
|
||||
var index = dlg.getNode("scratch-index").getValue();
|
||||
if (index == 0) return;
|
||||
dlg.getNode("scratch-index").setValue(index - 1);
|
||||
dlg.getNode("scratch-has-next", 1).setValue(size(searchResults) > 1);
|
||||
updateScratch();
|
||||
}
|
||||
|
||||
var doScratchNext = func
|
||||
{
|
||||
var index = dlg.getNode("scratch-index").getValue();
|
||||
var lastIndex = size(searchResults) - 1;
|
||||
if (index == lastIndex) return;
|
||||
|
||||
dlg.getNode("scratch-has-next", 1).setValue((index + 1) < lastIndex);
|
||||
dlg.getNode("scratch-index").setValue(index + 1);
|
||||
updateScratch();
|
||||
}
|
||||
|
||||
var searchResults = [];
|
||||
updateSearchResults(0);
|
||||
|
||||
var slaved = props.globals.getNode("/instrumentation/nav[0]/slaved-to-gps", 1);
|
||||
</open>
|
||||
]]></open>
|
||||
|
||||
</nasal>
|
||||
<name>gps</name>
|
||||
<layout>vbox</layout>
|
||||
|
@ -304,6 +415,8 @@
|
|||
<value>ndb</value>
|
||||
<value>fix</value>
|
||||
<value>wpt</value>
|
||||
<value>city</value>
|
||||
<value>town</value>
|
||||
<live>true</live>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
|
@ -336,36 +449,21 @@
|
|||
<legend>Search</legend>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
copySearchArgs();
|
||||
cmd.setValue("search");
|
||||
</script>
|
||||
<script>doSearch()</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
<legend>Search Names</legend>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
copySearchArgs();
|
||||
cmd.setValue("search-names");
|
||||
</script>
|
||||
<script>doSearchNames()</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
<legend>Nrst</legend>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
copySearchArgs();
|
||||
scratch.getNode("max-results", 1).setIntValue(10);
|
||||
|
||||
# ensure scratch pos is invalid, so we use current GPS
|
||||
# position as the search origin
|
||||
scratch.getNode("longitude-deg", 1).setDoubleValue(-9999);
|
||||
scratch.getNode("latitude-deg", 1).setDoubleValue(-9999);
|
||||
cmd.setValue("nearest")
|
||||
</script>
|
||||
<script>doSearchNearest()</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
|
@ -375,11 +473,7 @@
|
|||
<legend>Actv RTE WPT</legend>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
scratch.getNode("results", 1).clearValue();
|
||||
scratch.getNode("index", 1).setIntValue(-1);
|
||||
cmd.setValue("load-route-wpt")
|
||||
</script>
|
||||
<script>doLoadRouteWaypoint()</script>
|
||||
</binding>
|
||||
</button>
|
||||
<empty>
|
||||
|
@ -484,7 +578,7 @@
|
|||
<button>
|
||||
<enable>
|
||||
<greater-than>
|
||||
<property>/instrumentation/gps/scratch/index</property>
|
||||
<property>/sim/gui/dialogs/gps/scratch-index</property>
|
||||
<value>0</value>
|
||||
</greater-than>
|
||||
</enable>
|
||||
|
@ -494,12 +588,12 @@
|
|||
<key>left</key>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>cmd.setValue("previous")</script>
|
||||
<script>doScratchPrevious()</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
<enable>
|
||||
<property>/instrumentation/gps/scratch/has-next</property>
|
||||
<property>/sim/gui/dialogs/gps/scratch-has-next</property>
|
||||
</enable>
|
||||
<row>5</row>
|
||||
<col>1</col>
|
||||
|
@ -507,7 +601,7 @@
|
|||
<key>right</key>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>cmd.setValue("next")</script>
|
||||
<script>doScratchNext()</script>
|
||||
</binding>
|
||||
</button>
|
||||
</group>
|
||||
|
|
|
@ -224,9 +224,38 @@ command interface /autopilot/route-manager/input:
|
|||
gui.dialog_update("route-manager", "approach");
|
||||
}
|
||||
|
||||
var initPosition = func {
|
||||
var routeActive = routem.getNode("active").getValue();
|
||||
if (routeActive) return;
|
||||
|
||||
# FIXME have user waypoints check
|
||||
var fp = flightplan();
|
||||
|
||||
var airborne = getprop('/gear/gear[0]/wow') == 0;
|
||||
if (airborne) {
|
||||
debug.dump('route-manager dialog, init in-air, clearing departure settings');
|
||||
fp.departure = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
# we're on the ground, find the nearest airport to start from
|
||||
if (fp.departure == nil) {
|
||||
var apts = findAirportsWithinRange(25.0);
|
||||
if (size(apts) == 0) return; # no airports nearby
|
||||
fp.departure = apts[0]; # use the closest one
|
||||
}
|
||||
|
||||
if (fp.departure_runway == nil) {
|
||||
debug.dump('selecting departure runway');
|
||||
var rwy = fp.departure.findBestRunwayForPos( geo.aircraft_position() );
|
||||
fp.departure_runway = rwy;
|
||||
}
|
||||
}
|
||||
|
||||
# initialise departure values based on current position
|
||||
cmd.setValue("@posinit");
|
||||
initPosition();
|
||||
|
||||
updateRunways();
|
||||
updateSIDs();
|
||||
|
|
Loading…
Reference in a new issue