diff --git a/Aircraft/Instruments-3d/radardist/radardist.nas b/Aircraft/Instruments-3d/radardist/radardist.nas index 0a972ebbb..6e2e0b5be 100644 --- a/Aircraft/Instruments-3d/radardist/radardist.nas +++ b/Aircraft/Instruments-3d/radardist/radardist.nas @@ -185,13 +185,19 @@ var load_data = func { } } +var launched = 0; var init = func { - print("Initializing Radar Data"); - io.read_properties(data_path, props.globals); - load_data(); + if (! launched) { + print("Initializing Radar Data"); + io.read_properties(data_path, props.globals); + load_data(); + launched = 1; + } } + + diff --git a/Aircraft/Instruments-3d/rwr/rwr.nas b/Aircraft/Instruments-3d/rwr/rwr.nas index adbdfcf9b..85050a395 100644 --- a/Aircraft/Instruments-3d/rwr/rwr.nas +++ b/Aircraft/Instruments-3d/rwr/rwr.nas @@ -1,21 +1,7 @@ -# Radar2 and RWR routines. +# RWR routines. # Alexis Bory (xiii) -# Every 0.05 seconde: -# [1] Scans /AI/models for (aircrafts), (carriers), multiplayers. Creates a list of -# these targets, whenever they are in radar overall range and are valid. -# [2] RWR (Radar Warning Receiver) signals are then computed. RWR signal values -# are writen under /instrumentation/radar2/targets for interoperabilty purposes. -# [3] At each loop the targets list is scanned and each target bearing is checked -# against the radar beam heading. If the target is within the radar beam, its -# display properties are updated. Two different displays are possible: -# B-scan like and PPI like. -# The target distance is then scored so the radar system can autotrack the -# nearest target. -# Every 0.1 seconde: -# [4] Computes HUD marker position for the nearest target. - var OurAlt = props.globals.getNode("position/altitude-ft"); var OurHdg = props.globals.getNode("orientation/heading-deg"); var EcmOn = props.globals.getNode("instrumentation/ecm/on-off", 1); @@ -34,9 +20,14 @@ var u_ecm_signal_norm = 0; var u_radar_standby = 0; var u_ecm_type_num = 0; +var launched = 0; + init = func() { - radardist.init(); - settimer(rwr_loop, 0.5); + if (! launched) { + radardist.init(); + settimer(rwr_loop, 0.5); + launched = 1; + } } # Main loop ############### diff --git a/Aircraft/c172p/Models/c172p.xml b/Aircraft/c172p/Models/c172p.xml index 94eb6af57..2f8f51e54 100644 --- a/Aircraft/c172p/Models/c172p.xml +++ b/Aircraft/c172p/Models/c172p.xml @@ -7,6 +7,15 @@ -3.0 -0.065 + + + + var rplayer = cmdarg(); + rplayer.getNode("sim/model/door-positions/rightDoor/position-norm", 1).alias(rplayer.getNode("sim/multiplay/generic/float[0]")); + rplayer.getNode("sim/model/door-positions/leftDoor/position-norm", 1).alias(rplayer.getNode("sim/multiplay/generic/float[1]")); + rplayer.getNode("sim/model/door-positions/baggageDoor/position-norm", 1).alias(rplayer.getNode("sim/multiplay/generic/float[2]")); + + diff --git a/Aircraft/c172p/c172p-set.xml b/Aircraft/c172p/c172p-set.xml index 8a5eeb9b9..36c7867cd 100644 --- a/Aircraft/c172p/c172p-set.xml +++ b/Aircraft/c172p/c172p-set.xml @@ -100,6 +100,9 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net 1 + + + 0 0 0 diff --git a/Effects/cloud-static.eff b/Effects/cloud-static.eff new file mode 100644 index 000000000..52870a571 --- /dev/null +++ b/Effects/cloud-static.eff @@ -0,0 +1,64 @@ + + + Effects/rain-layer + + + + + + + + /sim/rendering/clouds3d-enable + + 1.0 + + + + + + + true + + 0.5 0.5 0.5 1.0 + 0.5 0.5 0.5 1.0 + off + + + greater + 0.01 + + smooth + + src-alpha + one-minus-src-alpha + + + false + + + 9 + DepthSortedBin + + + 0 + texture[0]/type + texture[0]/image + texture[0]/filter + texture[0]/wrap-s + texture[0]/wrap-t + + + + Shaders/cloud-static.vert + Shaders/cloud-static.frag + + + baseTexture + sampler-2d + 0 + + true + + + diff --git a/Effects/rain-layer.eff b/Effects/rain-layer.eff index f0296c360..828237fb6 100644 --- a/Effects/rain-layer.eff +++ b/Effects/rain-layer.eff @@ -4,6 +4,9 @@ + + /sim/rendering/clouds3d-vis-range + @@ -36,7 +39,7 @@ false - 10 + 9 DepthSortedBin @@ -58,6 +61,12 @@ sampler-2d 0 + + range + float + range + + true diff --git a/Environment/local-weather-defaults.xml b/Environment/local-weather-defaults.xml index 88a232232..bd5dcf320 100644 --- a/Environment/local-weather-defaults.xml +++ b/Environment/local-weather-defaults.xml @@ -24,6 +24,8 @@ 25.0 1.0 0.0 + 1.0 + 120000.0 realistic weather diff --git a/Nasal/gui.nas b/Nasal/gui.nas index b661c4cd8..1d52fa82f 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -134,7 +134,6 @@ _setlistener("/sim/signals/nasal-dir-initialized", func { return 1; } menuEnable("autopilot", isAutopilotMenuEnabled() ); - menuEnable("multiplayer", multiplayer.is_active()); menuEnable("joystick-info", size(props.globals.getNode("/input/joysticks").getChildren("js"))); # frame-per-second display diff --git a/Nasal/local_weather/cloud_definitions.nas b/Nasal/local_weather/cloud_definitions.nas index c85db3a3c..495fd4f6b 100644 --- a/Nasal/local_weather/cloud_definitions.nas +++ b/Nasal/local_weather/cloud_definitions.nas @@ -485,7 +485,7 @@ else if (type == "Stratocumulus bottom"){ { cloudAssembly = local_weather.cloud.new(type, subtype); - mult = 1.0; + # characterize the basic texture sheet cloudAssembly.texture_sheet = "/Models/Weather/cumulus_bottom_sheet1.rgb"; @@ -520,6 +520,46 @@ else if (type == "Stratocumulus bottom"){ } else if (type == "Cumulonimbus (cloudlet)"){ + +# new code + + if (local_weather.hardcoded_clouds_flag == 1) + { + cloudAssembly = local_weather.cloud.new(type, subtype); + + # characterize the basic texture sheet + + + cloudAssembly.num_tex_x = 2; + cloudAssembly.num_tex_y = 2; + + if (rand() < 0.5) + {cloudAssembly.texture_sheet = "/Models/Weather/cumulonimbus_sheet2.rgb";} + else + {cloudAssembly.texture_sheet = "/Models/Weather/cumulonimbus_sheet1.rgb";} + + var mult = 1.0; + if (subtype == "small") {mult = 0.7;} + + #characterize the cloud + cloudAssembly.bottom_shade = 0.6; + cloudAssembly.n_sprites = 5; + cloudAssembly.min_width = 1700.0 * mult; + cloudAssembly.max_width = 2200.0 * mult; + cloudAssembly.min_height = 1700.0 * mult; + cloudAssembly.max_height = 2200.0 * mult; + cloudAssembly.min_cloud_width = 3500.0 * mult; + cloudAssembly.min_cloud_height = 3500.0 * mult; + cloudAssembly.z_scale = 1.0; + + #signal that new routines are used + path = "new"; + + } + else + { + + if (subtype == "small") { if (rn > 0.875) {path = "Models/Weather/cumulonimbus_sl1.xml";} else if (rn > 0.75) {path = "Models/Weather/cumulonimbus_sl2.xml";} @@ -540,6 +580,7 @@ else if (type == "Cumulonimbus (cloudlet)"){ else if (rn > 0.125) {path = "Models/Weather/cumulonimbus_sl7.xml";} else {path = "Models/Weather/cumulonimbus_sl8.xml";} } + } } @@ -885,24 +926,34 @@ else if (type == "Stratus") { { cloudAssembly = local_weather.cloud.new(type, subtype); - if (subtype == "small") {var mult = 0.8;} - else {var mult = 1.0;} - - # characterize the basic texture sheet - cloudAssembly.texture_sheet = "/Models/Weather/stratus_sheet1.rgb"; - cloudAssembly.num_tex_x = 3; - cloudAssembly.num_tex_y = 2; + if (subtype == "small") + { + var mult = 0.8; + cloudAssembly.texture_sheet = "/Models/Weather/cirrocumulus_sheet1.rgb"; + cloudAssembly.num_tex_x = 3; + cloudAssembly.num_tex_y = 3; + cloudAssembly.n_sprites = 10; + cloudAssembly.z_scale = 0.6; + } + else + { + var mult = 1.0; + cloudAssembly.texture_sheet = "/Models/Weather/stratus_sheet1.rgb"; + cloudAssembly.num_tex_x = 3; + cloudAssembly.num_tex_y = 2; + cloudAssembly.n_sprites = 10; + cloudAssembly.z_scale = 0.4; + } #characterize the cloud cloudAssembly.bottom_shade = 0.4; - cloudAssembly.n_sprites = 20; - cloudAssembly.min_width = 1900.0 * mult; - cloudAssembly.max_width = 2400.0 * mult; - cloudAssembly.min_height = 1900.0 * mult; - cloudAssembly.max_height = 2400.0 * mult; - cloudAssembly.min_cloud_width = 5000.0 * mult; + cloudAssembly.min_width = 2000.0 * mult; + cloudAssembly.max_width = 2500.0 * mult; + cloudAssembly.min_height = 2000.0 * mult; + cloudAssembly.max_height = 2500.0 * mult; + cloudAssembly.min_cloud_width = 5000.0; cloudAssembly.min_cloud_height = 1.1 * cloudAssembly.max_height; - cloudAssembly.z_scale = 0.4; + #signal that new routines are used path = "new"; @@ -957,11 +1008,11 @@ else if (type == "Stratus (thin)") { #characterize the cloud cloudAssembly.bottom_shade = 0.8; - cloudAssembly.min_width = 1500.0 * mult; - cloudAssembly.max_width = 2000.0 * mult; - cloudAssembly.min_height = 1500.0 * mult; - cloudAssembly.max_height = 2000.0 * mult; - cloudAssembly.min_cloud_width = 2500.0; + cloudAssembly.min_width = 1900.0 * mult; + cloudAssembly.max_width = 2400.0 * mult; + cloudAssembly.min_height = 1900.0 * mult; + cloudAssembly.max_height = 2400.0 * mult; + cloudAssembly.min_cloud_width = 4200.0; cloudAssembly.min_cloud_height = 50.0; @@ -1055,6 +1106,49 @@ else if (type == "Fog (thin)") { } } else if (type == "Fog (thick)") { + + # new code + + if (local_weather.hardcoded_clouds_flag ==1) + { + cloudAssembly = local_weather.cloud.new(type, subtype); + + if (subtype == "small") + { + var mult = 0.8; + cloudAssembly.texture_sheet = "/Models/Weather/stratus_sheet1.rgb"; + cloudAssembly.num_tex_x = 3; + cloudAssembly.num_tex_y = 2; + cloudAssembly.n_sprites = 5; + cloudAssembly.z_scale = 1.0; + } + else + { + var mult = 1.0; + cloudAssembly.texture_sheet = "/Models/Weather/stratus_sheet1.rgb"; + cloudAssembly.num_tex_x = 3; + cloudAssembly.num_tex_y = 2; + cloudAssembly.n_sprites = 5; + cloudAssembly.z_scale = 1.0; + } + + #characterize the cloud + cloudAssembly.bottom_shade = 0.4; + cloudAssembly.min_width = 2000.0 * mult; + cloudAssembly.max_width = 2500.0 * mult; + cloudAssembly.min_height = 2000.0 * mult; + cloudAssembly.max_height = 2500.0 * mult; + cloudAssembly.min_cloud_width = 5000.0; + cloudAssembly.min_cloud_height = 1.1 * cloudAssembly.max_height; + + + #signal that new routines are used + path = "new"; + } + + else # old code + { + if (subtype == "small") { if (rn > 0.8) {path = "Models/Weather/stratus_thick1.xml";} else if (rn > 0.6) {path = "Models/Weather/stratus_thick2.xml";} @@ -1068,6 +1162,7 @@ else if (type == "Fog (thick)") { else if (rn > 0.4) {path = "Models/Weather/stratus_thick3.xml";} else if (rn > 0.2) {path = "Models/Weather/stratus_thick4.xml";} else {path = "Models/Weather/stratus_thick5.xml";} + } } } else if (type == "Test") {path="Models/Weather/single_cloud.xml";} diff --git a/Nasal/local_weather/compat_layer.nas b/Nasal/local_weather/compat_layer.nas index 4038a9a0e..a0b4e985d 100644 --- a/Nasal/local_weather/compat_layer.nas +++ b/Nasal/local_weather/compat_layer.nas @@ -170,7 +170,7 @@ else if (local_weather.hardcoded_clouds_flag == 1) { - # we store that information ourselves, so this should be zero + # we store that information ourselves, so this should be zero, but rain forces us to go for an offset setprop("/environment/clouds/layer[0]/elevation-ft",0.0); # layer wrapping off @@ -347,6 +347,7 @@ else var setTemperature = func (T) { + if (features.can_disable_environment == 1) { setprop("/environment/temperature-sea-level-degc",T); @@ -503,6 +504,14 @@ if (features.can_disable_environment == 1) setprop("/environment/wind-from-heading-deg",dir); setprop("/environment/wind-speed-kt",speed); } + +# this is needed to trigger the cloud drift to pick up the new wind setting +if (local_weather.hardcoded_clouds_flag == 1) + { + setprop("/environment/clouds/layer[0]/elevation-ft",0.0); + } + + else { # this is a workaround for systems which lack hard-coded support @@ -767,7 +776,10 @@ var p = props.Node.new({ "layer" : 0, "min-sprite-height-m": c.min_height, "max-sprite-height-m": c.max_height, "num-sprites": c.n_sprites, - "bottom-shade": c.bottom_shade, + "min-bottom-lighting-factor": c.bottom_shade, + "min-middle-lighting-factor": 0.9, + "min-top-lighting-factor": 1.0, + "min-shade-lighting-factor": c.bottom_shade, "texture": c.texture_sheet, "num-textures-x": c.num_tex_x, "num-textures-y": c.num_tex_y, @@ -777,10 +789,10 @@ var p = props.Node.new({ "layer" : 0, "max-cloud-height-m": c.min_cloud_height, "z-scale": c.z_scale, "height-map-texture": 0, - "alt-ft" : c.alt}); + "alt-ft" : c.alt }); fgcommand("add-cloud", p); -# print("alt: ", c.alt); +#print("alt: ", c.alt); # add other management properties to the hash if dynamics is on @@ -799,6 +811,10 @@ append(weather_tile_management.cloudArray,c); + + + + ########################################################### # place a cloud layer from arrays, split across frames ########################################################### @@ -811,13 +827,22 @@ if ((i < 0) or (i==0)) { if (local_weather.debug_output_flag == 1) {print("Cloud placement from array finished!"); } + + # then place all clouds using the new rendering system + if (local_weather.hardcoded_clouds_flag == 1) + { + var s = size(local_weather.cloudAssemblyArray); + create_new_cloud_array(s,cloudAssemblyArray); + } + setprop(lw~"tmp/thread-status", "idle"); # now set flag that tile has been completely processed var dir_index = props.globals.getNode(lw~"tiles/tmp/dir-index").getValue(); - props.globals.getNode(lw~"tiles").getChild("tile",dir_index).getNode("generated-flag").setValue(2); - + #props.globals.getNode(lw~"tiles").getChild("tile",dir_index).getNode("generated-flag").setValue(2); + setprop(lw~"tiles/tile["~dir_index~"]/generated-flag",2); + return; } @@ -856,9 +881,42 @@ settimer( func {create_cloud_array(i - k, clouds_path, clouds_lat, clouds_lon, c }; +var create_new_cloud_array = func (i, cloudArray) +{ +#if (getprop(lw~"tmp/thread-status") != "placing") {return;} +#if (getprop(lw~"tmp/convective-status") != "idle") {return;} + +if ((i < 0) or (i==0)) + { + if (local_weather.debug_output_flag == 1) + {print("Processing add-cloud calls finished!"); } + return; + } + +#print("Hello world! i is now: ",i); + +var k_max = 20; +var s = size(cloudArray); + +if (s < k_max) {k_max = s;} + +for (var k = 0; k < k_max; k = k+1) + { + local_weather.create_cloud_new(cloudArray[s-k-1]); + #print(cloudArray[s-k-1].alt); + } + +setsize(cloudArray,s-k_max); + + + +settimer( func {create_new_cloud_array(i - k, cloudArray) }, 0 ); +} + + diff --git a/Nasal/local_weather/local_weather.nas b/Nasal/local_weather/local_weather.nas index 185945f77..8096a8b83 100644 --- a/Nasal/local_weather/local_weather.nas +++ b/Nasal/local_weather/local_weather.nas @@ -410,8 +410,8 @@ else if (debug_output_flag == 1) { - print("Boundary layer thickness: ",base_layer_thickness); - print("Boundary layer slowdown: ", f_slow); + #print("Boundary layer thickness: ",base_layer_thickness); + #print("Boundary layer slowdown: ", f_slow); } return f_slow; } @@ -509,8 +509,8 @@ setprop(lwi~"station-number", i+1); var ialt = sum_alt/sum_norm; var vis = sum_vis/sum_norm; var p = sum_p/sum_norm; -var D = sum_D/sum_norm; -var T = sum_T/sum_norm; +var D = sum_D/sum_norm + temperature_offset; +var T = sum_T/sum_norm + temperature_offset; # get an inverse distance weighted average from all defined atmospheric condition points @@ -586,6 +586,7 @@ var scatt_alt_high = sum_scatt_alt_high/sum_norm; # altitude model for visibility - increase above the lowest inversion layer to simulate ground haze +vis = vis * ground_haze_factor; var altitude = getprop("position/altitude-ft"); current_mean_terrain_elevation = ialt; @@ -593,6 +594,8 @@ current_mean_terrain_elevation = ialt; var alt1 = vis_alt1; var alt2 = alt1 + 1500.0; +setprop("/environment/ground-visibility-m",vis); +setprop("/environment/ground-haze-thickness-m",alt2 * ft_to_m); # compute the visibility gradients @@ -628,10 +631,10 @@ else if (altitude > ovcst_alt_high) vis = vis + inc1 * alt1 + inc2 * (alt2-alt1) + inc3 * (ovcst_alt_high - alt2) + inc4 * (altitude - ovcst_alt_high); } -# limit visibility (otherwise memory consumption is very bad...) +# limit visibility (otherwise memory consumption may be very bad...) -if (vis > 120000.0) - {vis = 120000.0;} +if (vis > max_vis_range) + {vis = max_vis_range;} # determine scattering shader parameters if scattering shader is on @@ -641,6 +644,8 @@ if (scattering_shader_flag == 1) var mie = 0.003; var density = 0.3; + + if (altitude < 30000.0) { rayleigh = 0.0004 - altitude/30000.0 * 0.0001; @@ -660,37 +665,37 @@ if (scattering_shader_flag == 1) {rayleigh = 0.0001; mie = 0.002;} } # otherwise compute normal skydome shader parameters -else + + + +# compute the horizon shading + +if (altitude < scatt_alt_low) { - - # compute the horizon shading - - if (altitude < scatt_alt_low) - { - var scatt = scatt_max; - } - else if (altitude < scatt_alt_high) - { - var scatt = scatt_max + (0.95 - scatt_max) * (altitude - scatt_alt_low)/(scatt_alt_high-scatt_alt_low); - } - else - {var scatt = 0.95;} + var scatt = scatt_max; + } +else if (altitude < scatt_alt_high) + { + var scatt = scatt_max + (0.95 - scatt_max) * (altitude - scatt_alt_low)/(scatt_alt_high-scatt_alt_low); + } +else + {var scatt = 0.95;} # compute the overcast haze - if (altitude < ovcst_alt_low) - { - var ovcst = ovcst_max; - } - else if (altitude < ovcst_alt_high) - { - var ovcst = ovcst_max - ovcst_max * (altitude - ovcst_alt_low)/(ovcst_alt_high-ovcst_alt_low); - } - else - {var ovcst = 0.0;} - +if (altitude < ovcst_alt_low) + { + var ovcst = ovcst_max; + } +else if (altitude < ovcst_alt_high) + { + var ovcst = ovcst_max - ovcst_max * (altitude - ovcst_alt_low)/(ovcst_alt_high-ovcst_alt_low); } +else + {var ovcst = 0.0;} + + # limit relative changes of the visibility, will make for gradual transitions @@ -717,11 +722,10 @@ if (scattering_shader_flag == 1) { local_weather.setSkydomeShader(rayleigh, mie, density); } -else - { - local_weather.setScattering(scatt); - local_weather.setOvercast(ovcst); - } + +local_weather.setScattering(scatt); +local_weather.setOvercast(ovcst); + # now check if an effect volume writes the property and set only if not @@ -766,18 +770,24 @@ if (p>0.0) # now determine the local wind -#var tile_index = props.globals.getNode(lw~"tiles").getChild("tile",4).getNode("tile-index").getValue(); + var tile_index = getprop(lw~"tiles/tile[4]/tile-index"); if (wind_model_flag ==1) # constant { var winddir = weather_dynamics.tile_wind_direction[0]; var windspeed = weather_dynamics.tile_wind_speed[0]; + + wind.cloudlayer = [winddir,windspeed]; + } else if (wind_model_flag ==2) # constant in tile { var winddir = weather_dynamics.tile_wind_direction[tile_index-1]; var windspeed = weather_dynamics.tile_wind_speed[tile_index-1]; + + wind.cloudlayer = [winddir, windspeed]; + } else if (wind_model_flag ==3) # aloft interpolated, constant in tiles { @@ -785,6 +795,9 @@ else if (wind_model_flag ==3) # aloft interpolated, constant in tiles var res = wind_altitude_interpolation(altitude,w); var winddir = res[0]; var windspeed = res[1]; + + wind.cloudlayer = wind_altitude_interpolation(0.0,w); + } else if (wind_model_flag == 5) # aloft waypoint interpolated { @@ -792,9 +805,13 @@ else if (wind_model_flag == 5) # aloft waypoint interpolated var winddir = res[0]; var windspeed = res[1]; + + wind.cloudlayer = wind_interpolation(viewpos.lat(), viewpos.lon(), 0.0); } +wind.surface = [wind.cloudlayer[0], wind.cloudlayer[1] * get_slowdown_fraction()]; + # now do the boundary layer computations var altitude_agl = getprop("/position/altitude-agl-ft"); @@ -843,6 +860,15 @@ else } +var windspeed_ground = (1.0-f_min) * windspeed; + + +# set the wind hash before gusts, it represents mean wind + +wind.current = [winddir,windspeed_current]; + + + # determine gusts and turbulence in the bounday layer var gust_frequency = getprop(lw~"tmp/gust-frequency-hz"); @@ -897,6 +923,13 @@ setprop(lw~"current/wind-from-heading-deg",winddir); setprop(lw~"current/wind-speed-kt",windspeed_current); +# hack to get access to the water shader + +setprop("/environment/config/boundary/entry[0]/wind-from-heading-deg",winddir); +setprop("/environment/config/boundary/entry[0]/wind-speed-kt",windspeed_ground); + +# end hack + if (getprop(lw~"interpolation-loop-flag") ==1) {settimer(interpolation_loop, interpolation_loop_time);} @@ -1472,14 +1505,18 @@ if (path == "new") # we have to switch to new cloud generating routines local_weather.cloudAssembly.lon = long; local_weather.cloudAssembly.alt = alt; + #print(lat," ",long, " ", alt); + if (dynamics_flag == 1) { local_weather.cloudAssembly.mean_alt = cloud_mean_altitude; local_weather.cloudAssembly.flt = cloud_fractional_lifetime; local_weather.cloudAssembly.evolution_timestamp = cloud_evolution_timestamp; - local_weather.cloudAssembly.rel_alt = c.alt - c.mean_alt; + local_weather.cloudAssembly.rel_alt = cloudAssembly.alt - cloud_mean_altitude; } - compat_layer.create_cloud_new(local_weather.cloudAssembly); + #compat_layer.create_cloud_new(local_weather.cloudAssembly); + + append(cloudAssemblyArray,cloudAssembly); return; } @@ -1736,7 +1773,7 @@ else var alpha = rand() * 180.0; edge = edge + edge_bias; - create_streak(type,lat,lon, alt+ 0.3* (height )-600.0, height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); + create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Congestus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); var type = "Cu (volume)"; var height = 400; @@ -1747,12 +1784,12 @@ else edge = edge + edge_bias; - create_streak(type,lat,lon, alt+ 0.3* (height )-600.0, height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); + create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Congestus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); var btype = "Congestus bottom"; var n_b = 6; - create_streak(btype,lat,lon, alt - 1100.0, 100.0,n_b,0.0,edge,0.3*x,1,0.0,0.0,0.3*y,alpha,1.0); + create_streak(btype,lat,lon, alt -offset_map["Congestus"] -200.0, 100.0,n_b,0.0,edge,0.3*x,1,0.0,0.0,0.3*y,alpha,1.0); } else if (size>1.1) @@ -1768,9 +1805,9 @@ else var alpha = rand() * 180.0; edge = edge + edge_bias; - create_streak(type,lat,lon, alt+ 0.3* (height )-600.0, height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); + create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Cumulus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); - create_streak(btype,lat,lon, alt -600.0, 100.0,n_b,0.0,edge,0.3*x,1,0.0,0.0,0.3*y,alpha,1.0); + create_streak(btype,lat,lon, alt -offset_map["Cumulus"] - 200.0, 100.0,n_b,0.0,edge,0.3*x,1,0.0,0.0,0.3*y,alpha,1.0); } else if (size>0.8) @@ -1784,13 +1821,13 @@ else var alpha = rand() * 180.0; edge = edge + edge_bias; - create_streak(type,lat,lon, alt+ 0.3* (height )-600.0, height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); + create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Cumulus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); n = 2; x = 700.0; y = 200.0; edge = 1.0; - create_streak(type,lat,lon, alt+ 0.3* (height )-600.0, height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); + create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Cumulus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); } else if (size>0.4) @@ -1804,7 +1841,7 @@ else var alpha = rand() * 180.0; edge = edge + edge_bias; - create_streak(type,lat,lon, alt+ 0.3* (height)-600.0, height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); + create_streak(type,lat,lon, alt+ 0.3* (height)-offset_map["Cumulus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); } else { @@ -1817,7 +1854,7 @@ else var alpha = rand() * 180.0; edge = edge + edge_bias; - create_streak(type,lat,lon, alt+ 0.3* (height )-600.0, height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); + create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Cumulus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); } } @@ -1833,7 +1870,7 @@ else var create_cumulonimbus_cloud = func(lat, lon, alt, size) { if (hardcoded_clouds_flag == 1) - {create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 3.4, 8, 0.9, 0.2, 8);} + {create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 3.4, 8, 0.8, 0.1, 8);} else {create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 1.4, 4, 0.9, 0.2, 8);} @@ -1848,7 +1885,7 @@ else var create_cumulonimbus_cloud_rain = func(lat, lon, alt, size, rain) { if (hardcoded_clouds_flag == 1) - {create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 3.4, 8, 0.9, 0.2, 8);} + {create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 3.4, 8, 0.8, 0.1, 8);} else {create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 1.4, 4, 0.9, 0.2, 8);} @@ -1939,18 +1976,21 @@ var detail_flag = detailed_clouds_flag; var alpha = getprop(lw~"tmp/tile-orientation-deg") * math.pi/180.0; # the tile orientation -if (detailed_terrain_interaction_flag == 1) - { - var tile_index = getprop(lw~"tiles/tile-counter"); +var tile_index = getprop(lw~"tiles/tile-counter"); +var alt_base = alt_20_array[tile_index -1]; + +#if (detailed_terrain_interaction_flag == 1) +# { + #var tile_index = getprop(lw~"tiles/tile-counter"); #var alt_min = alt_min_array[tile_index-1]; #var alt_mean = alt_mean_array[tile_index -1]; #var alt_median = alt_50_array[tile_index -1]; - #var alt_base = alt_20_array[tile-index -1]; + #var alt_base = alt_20_array[tile_index -1]; #var alt_min = getprop(lw~"tmp/tile-alt-min-ft"); #var alt_mean = getprop(lw~"tmp/tile-alt-mean-ft"); #var alt_median = getprop(lw~"tmp/tile-alt-median-ft"); #var alt_base = getprop(lw~"tmp/tile-alt-offset-ft"); - } +# } var sec_to_rad = 2.0 * math.pi/86400; # conversion factor for sinusoidal dependence on daytime @@ -2003,7 +2043,13 @@ while (i < nc) { if (contains(landcover_map,landcover)) {p = p + landcover_map[landcover];} else {print(p, " ", info[1].names[0]);} }} - else {continue;} + else { + # to avoid gaps, we create default clouds + + p = p + 0.1; + var elevation = alt_base; + # continue; + } # apply some optional corrections, biases clouds towards higher elevations @@ -2056,8 +2102,10 @@ while (i < nc) { } - # now decide on the strength of the thermal - strength = (1.5 * rand() + (2.0 * p * terrain_strength_factor)) * t_factor2; # the strength of thermal activity at the spot + # now decide on the strength of the thermal at the spot and on cloud size + + var rn = rand(); + strength = (1.5 * rn + (2.0 * p * terrain_strength_factor)) * t_factor2; if (strength > 1.0) { # we place a large cloud, and we generate lift @@ -2065,7 +2113,15 @@ while (i < nc) { } else {path = select_cloud_model("Cumulus","small");} - + # the terrain effect cannot create Cb development, so we have to curb + # the strength if it would not have been Cb otherwise + + if (strength > 2.0) + { + if (((1.5 * rn + (2.0 * p)) * t_factor2) < 2.0) + {strength = 1.7 + rand() * 0.2;} + } + cloud_mean_altitude = place_alt; cloud_fractional_lifetime = rand(); @@ -2168,6 +2224,7 @@ nc = t_factor1 * nc * math.cos(blat/180.0*math.pi); var thermal_conditions = getprop(lw~"config/thermal-properties"); +var alt_base = alt_20_array[tile_index -1]; while (i < nc) { @@ -2198,7 +2255,13 @@ while (i < nc) { if (contains(landcover_map,landcover)) {p = p + landcover_map[landcover];} else {print(p, " ", info[1].names[0]);} }} - else {continue;} + else { + # to avoid gaps, we create default clouds + + p = p + 0.1; + var elevation = alt_base; + # continue; + } # apply some optional corrections, biases clouds towards higher elevations @@ -2578,6 +2641,8 @@ var n = int(area/80000000.0 * 100 * density); var m = int(circ/63000.0 * 40 * rain_density); var path = "Models/Weather/blank.ac"; +#print("density: ",n); + phi = phi * math.pi/180.0; if (contains(cloud_vertical_size_map, type)) @@ -2599,7 +2664,10 @@ while(i 0.4) { path = select_cloud_model(type,"small"); - compat_layer.create_cloud(path, lat, lon, alt, 0.0); + if (thread_flag == 1) + {create_cloud_vec(path, lat, lon, alt, 0.0);} + else + {compat_layer.create_cloud(path, lat, lon, alt, 0.0);} } } else { @@ -2617,6 +2685,8 @@ i = 0; if (rainflag ==1){ +if (local_weather.hardcoded_clouds_flag == 1) {balt = balt + local_weather.offset_map[type]; } + while(i 3.0 * current_visibility) - {distance_to_load = 3.0 * current_visibility;} -if (distance_to_load < 29000.0) - {distance_to_load = 29000.0;} +var distance_to_load = current_visibility; + +if (distance_to_load > 65000.0) {distance_to_load = 65000.0;} +if (distance_to_load < 29000.0) {distance_to_load = 29000.0;} + + +#if (distance_to_load > 3.0 * current_visibility) +# {distance_to_load = 3.0 * current_visibility;} +#if (distance_to_load < 29000.0) +# {distance_to_load = 29000.0;} + +var distance_to_remove = distance_to_load + 500.0; # check here if we have a new weather station if METAR is running @@ -473,6 +481,7 @@ if (getprop(lw~"tmp/tile-management") == "repeat tile") else if (code == "cold_sector") {weather_tiles.set_cold_sector_tile();} else if (code == "warm_sector") {weather_tiles.set_warm_sector_tile();} else if (code == "tropical_weather") {weather_tiles.set_tropical_weather_tile();} + else if (code == "thunderstorms") {weather_tiles.set_thunderstorms_tile();} else if (code == "test") {weather_tiles.set_4_8_stratus_tile();} else { diff --git a/Nasal/local_weather/weather_tiles.nas b/Nasal/local_weather/weather_tiles.nas index b7dea927b..bacacaed8 100644 --- a/Nasal/local_weather/weather_tiles.nas +++ b/Nasal/local_weather/weather_tiles.nas @@ -96,22 +96,29 @@ calc_geo(blat); # first weather info for tile center (lat, lon, visibility, temperature, dew point, pressure) -local_weather.set_weather_station(blat, blon, alt_offset, 20000.0, 14.0, 12.0, 29.78); +local_weather.set_weather_station(blat, blon, alt_offset, 30000.0, 14.0, 12.0, 29.78); -#strength = 0.5; +alt_offset = 0.0; + +#var strength = 0.5; #local_weather.create_cumosys(blat,blon, 3000.0, get_n(strength), 20000.0); #create_2_8_altocumulus_streaks(blat, blon, 12000+alt_offset, alpha) ; #create_2_8_altocumulus_streaks(blat, blon, 12000+alt_offset, alpha) ; #create_6_8_stratus(blat, blon, 3000+alt_offset, alpha) ; #create_4_8_tstratus_patches(blat, blon, 5000+alt_offset, alpha) ; -#create_4_8_sstratus_patches(blat, blon, 12000+alt_offset, alpha) ; -#create_4_8_cirrostratus_patches(blat, blon, 20000+alt_offset, alpha) ; +#create_4_8_sstratus_patches(blat, blon, 5000+alt_offset, alpha) ; +#create_4_8_cirrostratus_patches(blat, blon, 5000+alt_offset, alpha) ; #create_4_8_cirrocumulus_streaks(blat, blon, 10000.0 + alt_offset, alpha); -create_4_8_alttstratus_streaks(blat, blon, 5000+alt_offset, alpha) ; +#create_4_8_alttstratus_streaks(blat, blon, 5000+alt_offset, alpha) ; #create_2_8_cirrocumulus_patches(blat, blon, 13000+alt_offset, alpha) ; -#create_8_8_nimbus_rain(blat, blon, 5000+alt_offset, alpha, 0.3) ; + +#create_8_8_nimbus_rain(blat, blon, 3000+alt_offset, alpha, 0.3) ; +#create_8_8_tstratus(blat, blon, 5000+alt_offset, alpha); +#create_8_8_cirrostratus(blat, blon, 5000+alt_offset, alpha); +create_thunderstorm_scenario (blat, blon, 3000.0, alpha); +#create_big_thunderstorm (blat, blon, 3000.0, alpha); #create_4_8_altocumulus_perlucidus(blat, blon, 5000+alt_offset, alpha) ; @@ -121,7 +128,7 @@ create_4_8_alttstratus_streaks(blat, blon, 5000+alt_offset, alpha) ; -local_weather.set_atmosphere_ipoint(blat, blon, 45000.0, 10000.0, 45000.0, 0.0, 25000.0, 30000.0, 0.9, 10000.0, 11000.0); +local_weather.set_atmosphere_ipoint(blat, blon, 45000.0, 15000.0, 45000.0, 0.0, 15000.0, 17000.0, 0.8, 12000.0, 17000.0); append(weather_dynamics.tile_convective_altitude,3000.0); @@ -160,12 +167,14 @@ calc_geo(blat); # get probabilistic values for the weather parameters -var vis = 30000.0 + rand() * 15000.0; +var vis = 25000.0 + rand() * 10000.0; var T = 20.0 + rand() * 10.0; var spread = 14.0 + 8.0 * rand(); var D = T - spread; var p = 1025.0 + rand() * 6.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # and set them at the tile center local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg); @@ -298,12 +307,14 @@ calc_geo(blat); # get probabilistic values for the weather parameters -var vis = 25000.0 + rand() * 15000.0; +var vis = 20000.0 + rand() * 10000.0; var T = 15.0 + rand() * 10.0; var spread = 10.0 + 4.0 * rand(); var D = T - spread; var p = 1019.0 + rand() * 6.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # and set them at the tile center local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg); @@ -445,12 +456,14 @@ calc_geo(blat); # get probabilistic values for the weather parameters -var vis = 20000.0 + rand() * 12000.0; +var vis = 15000.0 + rand() * 7000.0; var T = 12.0 + rand() * 10.0; var spread = 7.0 + 4.0 * rand(); var D = T - spread; var p = 1013.0 + rand() * 6.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # and set them at the tile center local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg); @@ -653,12 +666,14 @@ calc_geo(blat); # get probabilistic values for the weather parameters -var vis = 12000.0 + rand() * 9000.0; +var vis = 8000.0 + rand() * 8000.0; var T = 10.0 + rand() * 10.0; var spread = 6.0 + 2.0 * rand(); var D = T - spread; var p = 1007.0 + rand() * 6.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # and set them at the tile center local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg); @@ -802,7 +817,7 @@ var alpha = getprop(lw~"tmp/tile-orientation-deg"); var phi = alpha * math.pi/180.0; -if (getprop(lw~"tmp/presampling-flag") == 0) +if (local_weather.presampling_flag == 0) {var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");} else {var alt_offset = getprop(lw~"tmp/tile-alt-layered-ft");} @@ -815,13 +830,13 @@ calc_geo(blat); # get probabilistic values for the weather parameters -var vis = 9000.0 + rand() * 10000.0; +var vis = 8000.0 + rand() * 5000.0; var T = 5.0 + rand() * 10.0; var spread = 5.0 + 2.0 * rand(); var D = T - spread; var p = 1001.0 + rand() * 6.0; p = adjust_p(p); - +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} # and set them at the tile center local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg); @@ -832,11 +847,15 @@ var strength = 0.0; var rn = rand(); + + if (rand() < small_scale_persistence) {rn = rnd_store;} else {rnd_store = rn;} +rn = 0.1; + if (rn > 0.8) { @@ -849,7 +868,10 @@ if (rn > 0.8) y = 2.0 * (rand()-0.5) * 11000.0; var beta = rand() * 360.0; - local_weather.create_layer("Nimbus", blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), alt+alt_offset, 500.0, 12000.0, 7000.0, beta, 1.0, 0.2, 1, 1.0); + var alt_eff = alt; + if (local_weather.hardcoded_clouds_flag == 1) {alt_eff = alt_eff - 3000.0;} + + local_weather.create_layer("Nimbus", blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), alt_eff+alt_offset, 500.0, 12000.0, 7000.0, beta, 1.0, 0.2, 1, 1.0); local_weather.create_effect_volume(2, blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 10000.0, 6000.0, beta, 0.0, alt + alt_offset, 5000.0, 0.3, -1, -1, -1,0,-1 ); local_weather.create_effect_volume(2, blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 9000.0, 5000.0, beta, 0.0, alt+alt_offset-300.0, 1500.0, 0.5, -1, -1, -1,0,-1 ); @@ -857,7 +879,7 @@ if (rn > 0.8) y = 2.0 * (rand()-0.5) * 11000.0; var beta = rand() * 360.0; - local_weather.create_layer("Nimbus", blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), alt+alt_offset, 500.0, 10000.0, 6000.0, beta, 1.0, 0.2, 1, 1.0); + local_weather.create_layer("Nimbus", blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), alt_eff+alt_offset, 500.0, 10000.0, 6000.0, beta, 1.0, 0.2, 1, 1.0); local_weather.create_effect_volume(2, blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 9000.0, 5000.0, beta, 0.0, alt + alt_offset, 5000.0, 0.3, -1, -1, -1,0 ,-1); local_weather.create_effect_volume(2, blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 8000.0, 4000.0, beta, 0.0, alt+alt_offset-300.0, 1500.0, 0.5, -1, -1, -1,0,-1 ); @@ -952,7 +974,7 @@ var lon = 0.0; var alpha = getprop(lw~"tmp/tile-orientation-deg"); var phi = alpha * math.pi/180.0; -if (getprop(lw~"tmp/presampling-flag") == 0) +if (local_weather.presampling_flag == 0) {var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");} else {var alt_offset = getprop(lw~"tmp/tile-alt-layered-ft");} @@ -971,6 +993,8 @@ var spread = 4.5 + 1.0 * rand(); var D = T - spread; var p = 995.0 + rand() * 6.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # and set them at the tile center local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg); @@ -980,6 +1004,7 @@ local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_i var alt = spread * 400.0 + local_weather.cloud_vertical_size_map["Nimbus"] * 0.5 * m_to_ft; var strength = 0.0; +#var alt = 3000.0; create_8_8_nimbus_rain(blat, blon, alt+alt_offset, alpha,0.4 + rand()*0.2); @@ -1036,12 +1061,14 @@ calc_geo(blat); # get probabilistic values for the weather parameters -var vis = 45000.0 + rand() * 20000.0; +var vis = 40000.0 + rand() * 15000.0; var T = 8.0 + rand() * 8.0; var spread = 7.0 + 3.0 * rand(); var D = T - spread; var p = 1005.0 + rand() * 10.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # and set them at the tile center local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg); @@ -1131,12 +1158,14 @@ calc_geo(blat); # get probabilistic values for the weather parameters -var vis = 12000.0 + rand() * 10000.0; +var vis = 8000.0 + rand() * 5000.0; var T = 16.0 + rand() * 10.0; var spread = 6.0 + 3.0 * rand(); var D = T - spread; var p = 1005.0 + rand() * 10.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # and set them at the tile center local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg); @@ -1273,6 +1302,8 @@ var spread = 8.0 + 2.0 * rand(); var D = T - spread; var p = 970 + rand() * 10.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # first weather info for tile center (lat, lon, visibility, temperature, dew point, pressure) local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg); @@ -1374,6 +1405,82 @@ tile_finished(); } + + +#################################### +# Thunderstorms +#################################### + +var set_thunderstorms_tile = func { + +setprop(lw~"tiles/code","thunderstorms"); + +tile_start(); + +var x = 0.0; +var y = 0.0; +var lat = 0.0; +var lon = 0.0; + + +var alpha = getprop(lw~"tmp/tile-orientation-deg"); +var phi = alpha * math.pi/180.0; +var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft"); + +# get tile center coordinates + +var blat = getprop(lw~"tiles/tmp/latitude-deg"); +var blon = getprop(lw~"tiles/tmp/longitude-deg"); +calc_geo(blat); + +# get probabilistic values for the weather parameters + +var vis = 9000.0 + rand() * 10000.0; +var T = 10.0 + rand() * 15.0; +var spread = 8.0 + 2.0 * rand(); +var D = T - spread; +var p = 1000 + rand() * 10.0; p = adjust_p(p); + +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + +# first weather info for tile center (lat, lon, visibility, temperature, dew point, pressure) + +local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg); + +# altitude for the lowest layer +var alt = spread * 400.0; +var strength = 0.0; + +# bias Cumulus clouds towards larger sizes due to lots of water vapour +local_weather.convective_size_bias = 0.3 + rand() * 0.3; + + +# and specify the atmosphere + local_weather.set_atmosphere_ipoint(blat, blon, vis + 12000.0, alt+alt_offset, vis + 20000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.65, alt+alt_offset, alt+alt_offset + 2500.0); + +var rn = rand(); + + +if (rand() < small_scale_persistence) + {rn = rnd_store;} +else + {rnd_store = rn;} + +create_thunderstorm_scenario (blat, blon, alt + alt_offset, alpha); + +# store convective altitude and strength + +append(weather_dynamics.tile_convective_altitude,alt); +append(weather_dynamics.tile_convective_strength,strength); + +tile_finished(); + +} + + + + + #################################### # Coldfront #################################### @@ -1410,6 +1517,8 @@ var spread = 8.0 + 2.0 * rand(); var D = T - spread; var p = 1005 + rand() * 10.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # first weather info for tile (lat, lon, visibility, temperature, dew point, pressure) # after the front @@ -1525,7 +1634,7 @@ var lon = 0.0; var alpha = getprop(lw~"tmp/tile-orientation-deg"); var phi = alpha * math.pi/180.0; -if (getprop(lw~"tmp/presampling-flag") == 0) +if (local_weather.presampling_flag == 0) {var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");} else {var alt_offset = getprop(lw~"tmp/tile-alt-layered-ft");} @@ -1544,6 +1653,8 @@ var spread = 9.0 + 4.0 * rand(); var D = T - spread; var p = 1005 + rand() * 10.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # first weather info for tile (lat, lon, visibility, temperature, dew point, pressure) # after the front @@ -1587,7 +1698,10 @@ for (var i=0; i<6; i=i+1) var x = 2.0 * (rand()-0.5) * 15000; var y = 2.0 * (rand()-0.5) * 10000 + 10000; var beta = (rand() -0.5) * 180.0; - local_weather.create_streak("Cirrostratus",blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 18000 + alt + alt_offset,300.0,4,2300.0,0.2,600.0,4,2300.0,0.2,600.0,alpha+beta,1.0); + var alt_shift = 0.0; + if (local_weather.hardcoded_clouds_flag == 1) {alt_shift = local_weather.offset_map["Cirrostratus"];} + + local_weather.create_streak("Cirrostratus",blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 18000 + alt + alt_offset - alt_shift,300.0,4,2300.0,0.2,600.0,4,2300.0,0.2,600.0,alpha+beta,1.0); } @@ -1625,7 +1739,7 @@ var lon = 0.0; var alpha = getprop(lw~"tmp/tile-orientation-deg"); var phi = alpha * math.pi/180.0; -if (getprop(lw~"tmp/presampling-flag") == 0) +if (local_weather.presampling_flag == 0) {var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");} else {var alt_offset = getprop(lw~"tmp/tile-alt-layered-ft");} @@ -1644,6 +1758,8 @@ var spread = 8.0 + 2.0 * rand(); var D = T - spread; var p = 1005 + rand() * 10.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # first weather info for tile (lat, lon, visibility, temperature, dew point, pressure) # after the front @@ -1668,12 +1784,15 @@ var strength = 0.0; # followed by random patches of Cirrostratus +var alt_shift = 0.0; +if (local_weather.hardcoded_clouds_flag == 1) {alt_shift = local_weather.offset_map["Cirrostratus"];} + for (var i=0; i<3; i=i+1) { var x = 2.0 * (rand()-0.5) * 18000; var y = 2.0 * (rand()-0.5) * 5000 - 15000; var beta = (rand() -0.5) * 180.0; - local_weather.create_streak("Cirrostratus",blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 15000 + alt + alt_offset,300.0,4,2300.0,0.2,600.0,4,2300.0,0.2,600.0,alpha+beta,1.0); + local_weather.create_streak("Cirrostratus",blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 15000 + alt + alt_offset - alt_shift,300.0,4,2300.0,0.2,600.0,4,2300.0,0.2,600.0,alpha+beta,1.0); } @@ -1742,7 +1861,7 @@ var lon = 0.0; var alpha = getprop(lw~"tmp/tile-orientation-deg"); var phi = alpha * math.pi/180.0; -if (getprop(lw~"tmp/presampling-flag") == 0) +if (local_weather.presampling_flag == 0) {var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");} else {var alt_offset = getprop(lw~"tmp/tile-alt-layered-ft");} @@ -1761,6 +1880,8 @@ var spread = 7.0 + 2.0 * rand(); var D = T - spread; var p = 1005 + rand() * 10.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # first weather info for tile (lat, lon, visibility, temperature, dew point, pressure) # after the front @@ -1849,7 +1970,7 @@ var lon = 0.0; var alpha = getprop(lw~"tmp/tile-orientation-deg"); var phi = alpha * math.pi/180.0; -if (getprop(lw~"tmp/presampling-flag") == 0) +if (local_weather.presampling_flag == 0) {var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");} else {var alt_offset = getprop(lw~"tmp/tile-alt-layered-ft");} @@ -1868,6 +1989,8 @@ var spread = 5.0 + 2.0 * rand(); var D = T - spread; var p = 1005 + rand() * 10.0; p = adjust_p(p); +if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + # first weather info for tile (lat, lon, visibility, temperature, dew point, pressure) # after the front @@ -1951,7 +2074,10 @@ var lon = 0.0; var alpha = getprop("/environment/metar/base-wind-dir-deg"); var phi = alpha * math.pi/180.0; -var metar_alt_offset = 700.0 + getprop("/environment/metar/station-elevation-ft"); + +# it seems more recent Flightgear versions have absolute altitude +# var metar_alt_offset = 700.0 + getprop("/environment/metar/station-elevation-ft"); +var metar_alt_offset = 700.0; # print("metar_alt_offset", metar_alt_offset); @@ -2263,11 +2389,13 @@ var set_METAR_weather_station = func { if (is_visibility_max == 1) { - if (p * inhg_to_hp < 1000.0) {vis = 10000.0 + 5000 * rand();} - else if (p * inhg_to_hp < 1010.0) {vis = 15000.0 + 7000 * rand();} - else if (p * inhg_to_hp < 1020.0) {vis = 22000.0 + 14000.0 * rand();} - else {vis = 30000.0 + 15000.0 * rand();} - } + if (p * inhg_to_hp < 1000.0) {vis = 10000.0 + 5000 * rand();} + else if (p * inhg_to_hp < 1010.0) {vis = 15000.0 + 7000 * rand();} + else if (p * inhg_to_hp < 1020.0) {vis = 22000.0 + 14000.0 * rand();} + else {vis = 30000.0 + 15000.0 * rand();} + + if (realistic_visibility_flag == 1) {vis = vis * realistic_visibility_multiplyer;} + } @@ -2385,32 +2513,31 @@ var set_METAR_weather_station = func { # mid-level cloud setup calls #################################### -var create_8_8_stratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1500.0;} - -local_weather.create_streak("Stratus",lat, lon, alt,500.0,32,1250.0,0.0,400.0,32,1250.0,0.0,400.0,alpha,1.0); - -} var create_8_8_tstratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 650.0;} - -local_weather.create_streak("Stratus (thin)",lat, lon, alt,500.0,32,1250.0,0.0,400.0,32,1250.0,0.0,400.0,alpha,1.0); - +if (local_weather.hardcoded_clouds_flag == 1) + { + alt = alt - local_weather.offset_map["Stratus_thin"]; + +local_weather.create_streak("Stratus (thin)",lat, lon, alt,500.0,40,1000.0,0.0,400.0,40,1000.0,0.0,400.0,alpha,1.0); + } +else + { + local_weather.create_streak("Stratus (thin)",lat, lon, alt,500.0,32,1250.0,0.0,400.0,32,1250.0,0.0,400.0,alpha,1.0); + } } var create_8_8_cirrostratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1800.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Cirrostratus"];} local_weather.create_streak("Cirrostratus",lat,lon,alt,500.0,30,1250.0,0.0,400.0,30,1250.0,0.0,400.0,alpha,1.0); } var create_8_8_nimbus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1500.0;} local_weather.create_streak("Nimbus",lat, lon, alt,500.0,32,1250.0,0.0,200.0,32,1250.0,0.0,200.0,alpha,1.0); @@ -2419,9 +2546,11 @@ local_weather.create_streak("Nimbus",lat, lon, alt,500.0,32,1250.0,0.0,200.0,32, var create_8_8_nimbus_var1 = func (lat, lon, alt, alpha) { +if (local_weather.hardcoded_clouds_flag == 1) {var alt_eff = alt - local_weather.offset_map["Nimbus"]; } + var phi = alpha * math.pi/180.0; -local_weather.create_streak("Nimbus",lat, lon, alt,500.0,35,1111.0,0.0,200.0,35,1111.0,0.0,200.0,alpha,1.0); +local_weather.create_streak("Nimbus",lat, lon, alt_eff,500.0,35,1150.0,0.0,200.0,35,1150.0,0.0,200.0,alpha,1.0); for (var i = 0; i < 3; i=i+1) { @@ -2434,9 +2563,11 @@ for (var i = 0; i < 3; i=i+1) var create_8_8_nimbus_var2 = func (lat, lon, alt, alpha) { +if (local_weather.hardcoded_clouds_flag == 1) {var alt_eff = alt - local_weather.offset_map["Nimbus"]; } + var phi = alpha * math.pi/180.0; -local_weather.create_streak("Nimbus",lat, lon, alt,500.0,35,1111.0,0.0,200.0,35,1111.0,0.0,200.0,alpha,1.0); +local_weather.create_streak("Nimbus",lat, lon, alt_eff,500.0,35,1150.0,0.0,200.0,35,1150.0,0.0,200.0,alpha,1.0); for (var i=0; i<8; i=i+1) { @@ -2452,10 +2583,12 @@ for (var i=0; i<8; i=i+1) var create_8_8_nimbus_var3 = func (lat, lon, alt, alpha) { +if (local_weather.hardcoded_clouds_flag == 1) {var alt_eff = alt - local_weather.offset_map["Nimbus"]; } + var phi = alpha * math.pi/180.0; -local_weather.create_streak("Nimbus",lat, lon, alt,500.0,35,1111.0,0.0,200.0,35,1111.0,0.0,200.0,alpha,1.0); +local_weather.create_streak("Nimbus",lat, lon, alt_eff,500.0,35,1150.0,0.0,200.0,35,1150.0,0.0,200.0,alpha,1.0); for (var i=0; i<6; i=i+1) { @@ -2465,21 +2598,17 @@ for (var i=0; i<6; i=i+1) local_weather.create_streak("Stratus",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt+1600.0,300.0,6,1200.0,0.2,700.0,6,1200.0,0.2,700.0,alpha+beta,1.0); } -# reduced visibility in layer -#local_weather.create_effect_volume(3, lat, lon, 20000.0, 20000.0, alpha, alt-1500.0, alt+900.0, 2000.0, -1 , -1, -1, -1,0 ,-1); -# cloud shade -#local_weather.create_effect_volume(3, lat, lon, 20000.0, 20000.0, alpha, 0.0, alt, -1, -1 , -1, -1, -1,0 ,0.8); - } var create_8_8_nimbus_rain = func (lat, lon, alt, alpha, rain) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 3000.0;} + if (local_weather.detailed_clouds_flag == 0) {local_weather.create_streak("Nimbus",lat, lon, alt,500.0,32,1250.0,0.0,200.0,32,1250.0,0.0,200.0,alpha,1.0);} else { + #print(local_weather.offset_map["Nimbus"]); var rn = rand(); if (rn > 0.66) {create_8_8_nimbus_var1(lat, lon, alt, alpha);} else if (rn > 0.33) {create_8_8_nimbus_var2(lat, lon, alt, alpha);} @@ -2499,12 +2628,19 @@ else } +var create_8_8_stratus = func (lat, lon, alt, alpha) { + +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus"];} + +local_weather.create_streak("Stratus",lat, lon, alt,500.0,32,1250.0,0.0,400.0,32,1250.0,0.0,400.0,alpha,1.0); +} + var create_8_8_stratus_rain = func (lat, lon, alt, alpha, rain) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1500.0;} -local_weather.create_streak("Stratus",lat, lon, alt,500.0,32,1250.0,0.0,400.0,32,1250.0,0.0,400.0,alpha,1.0); +create_8_8_stratus(lat, lon, alt, alpha); + if (rain > 0.1) { @@ -2520,9 +2656,22 @@ else var create_6_8_stratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1500.0;} +if (local_weather.hardcoded_clouds_flag == 1) + { + alt = alt - local_weather.offset_map["Stratus"]; + + for (var i = 0; i < 20; i = i + 1) + { + var phi = alpha * math.pi/180.0; + var x = 2.0 * (rand()-0.5) * 18000; + var y = 2.0 * (rand()-0.5) * 18000; -local_weather.create_streak("Stratus",lat, lon, alt,500.0,20,0.0,0.2,20000.0,20,0.0,0.2,20000.0,alpha,1.0); + local_weather.create_streak("Stratus",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt,500.0,5,2300.0,0.2,500.0,5,2300.0,0.2,500.0,alpha,1.0); + } + + } +else + {local_weather.create_streak("Stratus",lat, lon, alt,500.0,20,0.0,0.2,20000.0,20,0.0,0.2,20000.0,alpha,1.0);} } @@ -2532,7 +2681,9 @@ var create_6_8_nimbus_rain = func (lat, lon, alt, alpha, rain) { var phi = alpha * math.pi/180.0; -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 3000.0;} +var alt_cloud = alt; + +if (local_weather.hardcoded_clouds_flag == 1) {alt_cloud = alt_cloud - 3000.0;} for (var i = 0; i < 3; i = i + 1) { @@ -2540,7 +2691,7 @@ for (var i = 0; i < 3; i = i + 1) var y = 2.0 * (rand()-0.5) * 12000.0; var beta = rand() * 360.0; - local_weather.create_layer("Nimbus", lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt, 500.0, 12000.0, 7000.0, beta, 1.0, 0.2, 1, 1.0); + local_weather.create_layer("Nimbus", lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt_cloud, 500.0, 12000.0, 7000.0, beta, 1.0, 0.2, 1, 1.0); if (rain > 0.1) { @@ -2562,7 +2713,9 @@ var create_6_8_stratus_rain = func (lat, lon, alt, alpha, rain) { var phi = alpha * math.pi/180.0; -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1500.0;} +var alt_cloud = alt; + +if (local_weather.hardcoded_clouds_flag == 1) {alt_cloud = alt_cloud - local_weather.offset_map["Stratus"];} for (var i = 0; i < 3; i = i + 1) { @@ -2570,7 +2723,7 @@ for (var i = 0; i < 3; i = i + 1) var y = 2.0 * (rand()-0.5) * 12000.0; var beta = rand() * 360.0; - local_weather.create_layer("Stratus", lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt, 500.0, 12000.0, 7000.0, beta, 1.0, 0.2, 0, 0.0); + local_weather.create_layer("Stratus", lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt_cloud, 500.0, 12000.0, 7000.0, beta, 1.0, 0.2, 0, 0.0); if (rain > 0.1) { @@ -2589,21 +2742,21 @@ for (var i = 0; i < 3; i = i + 1) var create_6_8_stratus_undulatus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1500.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus"];} local_weather.create_undulatus("Stratus",lat, lon, alt,300.0,10,4000.0,0.1,400.0,50,800.0,0.1,100.0, 1000.0, alpha,1.0); } var create_6_8_tstratus_undulatus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 650.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_thin"];} local_weather.create_undulatus("Stratus (thin)",lat, lon, alt,300.0,10,4000.0,0.1,400.0,50,800.0,0.1,100.0, 1000.0, alpha,1.0); } var create_6_8_cirrostratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1800.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Cirrostratus"];} local_weather.create_streak("Cirrostratus",lat,lon,alt,500.0,24,1500.0,0.0,900.0,24,1500.0,0.0,900.0,alpha,1.0); } @@ -2633,7 +2786,7 @@ else var create_4_8_stratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1500.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus"];} var phi = alpha * math.pi/180.0; var x = 2.0 * (rand()-0.5) * 15000; @@ -2662,7 +2815,7 @@ var create_4_8_stratus_patches = func (lat, lon, alt, alpha) { var phi = alpha * math.pi/180.0; -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1500.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus"];} for (var i=0; i<16; i=i+1) { @@ -2679,7 +2832,7 @@ var create_4_8_tstratus_patches = func (lat, lon, alt, alpha) { var phi = alpha * math.pi/180.0; -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 650.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_thin"];} for (var i=0; i<22; i=i+1) { @@ -2701,7 +2854,7 @@ var create_4_8_sstratus_patches = func (lat, lon, alt, alpha) { var phi = alpha * math.pi/180.0; -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 800.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_structured"];} for (var i=0; i<22; i=i+1) { @@ -2719,7 +2872,7 @@ for (var i=0; i<22; i=i+1) var create_4_8_cirrostratus_patches = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1800.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Cirrostratus"];} var phi = alpha * math.pi/180.0; @@ -2736,7 +2889,7 @@ for (var i=0; i<6; i=i+1) var create_4_8_cirrostratus_undulatus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1800.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Cirrostratus"];} local_weather.create_undulatus("Cirrostratus",lat, lon, alt,300.0,5,8000.0,0.1,400.0,40,1000.0,0.1,100.0, 1500.0, alpha,1.0); } @@ -2744,7 +2897,7 @@ local_weather.create_undulatus("Cirrostratus",lat, lon, alt,300.0,5,8000.0,0.1,4 var create_4_8_stratus_undulatus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1500.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus"];} var phi = alpha * math.pi/180.0; var x = 2.0 * (rand()-0.5) * 5000; @@ -2760,7 +2913,7 @@ local_weather.create_streak("Stratus",lat+get_lat(x,y-4000,phi), lon+get_lon(x,y var create_4_8_tstratus_undulatus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 650.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_thin"];} var phi = alpha * math.pi/180.0; var x = 2.0 * (rand()-0.5) * 5000; @@ -2776,7 +2929,7 @@ local_weather.create_streak("Stratus (thin)",lat+get_lat(x,y-4000,phi), lon+get_ var create_4_8_sstratus_undulatus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 800.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_structured"];} var phi = alpha * math.pi/180.0; var x = 2.0 * (rand()-0.5) * 5000; @@ -2858,7 +3011,7 @@ for (var i=0; i<20; i=i+1) var create_4_8_alttstratus_streaks = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 300.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_alt"];} var phi = alpha * math.pi/180.0; @@ -2878,7 +3031,7 @@ for (var i=0; i<10; i=i+1) var create_4_8_alttstratus_patches = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 300.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_alt"];} var phi = alpha * math.pi/180.0; @@ -2909,7 +3062,7 @@ else var create_2_8_stratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1500.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus"];} var phi = alpha * math.pi/180.0; @@ -2926,7 +3079,7 @@ for (var i=0; i<8; i=i+1) var create_2_8_tstratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 650.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_thin"];} var phi = alpha * math.pi/180.0; @@ -2944,7 +3097,7 @@ for (var i=0; i<8; i=i+1) var create_2_8_sstratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 800.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_structured"];} var phi = alpha * math.pi/180.0; @@ -2967,7 +3120,7 @@ for (var i=0; i<8; i=i+1) var create_2_8_sstratus_streak = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 800.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_structured"];} var phi = alpha * math.pi/180.0; @@ -2981,7 +3134,7 @@ local_weather.create_streak("Stratus (structured)",lat+get_lat(x,y,phi), lon+get var create_2_8_cirrostratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1800.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Cirrostratus"];} var phi = alpha * math.pi/180.0; @@ -3027,7 +3180,7 @@ local_weather.create_streak("Cirrus",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), var create_2_8_alttstratus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 300.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Stratus_alt"];} var phi = alpha * math.pi/180.0; @@ -3113,7 +3266,7 @@ local_weather.create_streak("Cirrus",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), var create_1_8_cirrostratus_undulatus = func (lat, lon, alt, alpha) { -if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - 1800.0;} +if (local_weather.hardcoded_clouds_flag == 1) {alt = alt - local_weather.offset_map["Cirrostratus"];} local_weather.create_undulatus("Cirrostratus",lat, lon, alt,300.0,1,8000.0,0.0,400.0,40,1000.0,0.1,100.0, 1500.0, alpha,1.0); } @@ -3265,9 +3418,12 @@ var create_small_thunderstorm = func(lat, lon, alt, alpha) { var scale = 0.7 + rand() * 0.3; -local_weather.create_layer("Stratus", lat, lon, alt, 1000.0, 4000.0 * scale, 4000.0 * scale, 0.0, 1.0, 0.3, 1, 1.0); +var alt_eff = alt; +if (local_weather.hardcoded_clouds_flag == 1) {alt_eff = alt - local_weather.offset_map["Stratus"] - 2000.0; } -local_weather.create_layer("Cumulonimbus (cloudlet)", lat, lon, alt+2000, 15000.0, 3000.0 * scale, 3000.0 * scale, 0.0, 2.0, 0.0, 0, 0.0); +local_weather.create_layer("Stratus", lat, lon, alt_eff, 1000.0, 4000.0 * scale, 4000.0 * scale, 0.0, 1.0, 0.3, 1, 1.0); + +local_weather.create_layer("Cumulonimbus (cloudlet)", lat, lon, alt_eff+3000.0, 12000.0, 3000.0 * scale, 3000.0 * scale, 0.0, 2.0, 0.0, 0, 0.0); # set the exclusion region for the Cumulus layer append(elat, lat); append(elon, lon); append(erad, 4000.0 * scale * 1.2); @@ -3282,15 +3438,20 @@ var create_medium_thunderstorm = func(lat, lon, alt, alpha) { var scale = 0.7 + rand() * 0.3; -local_weather.create_layer("Nimbus", lat, lon, alt, 500.0, 6000.0 * scale, 6000.0 * scale, 0.0, 1.0, 0.3, 1, 1.5); +var alt_eff = alt; +if (local_weather.hardcoded_clouds_flag == 1) {alt_eff = alt - local_weather.offset_map["Nimbus"] - 2000.0; } -#local_weather.create_layer("Stratus", lat, lon, alt+1500, 1000.0, 5500.0 * scale, 5500.0 * scale, 0.0, 1.0, 0.3, 0, 0.0); -local_weather.create_hollow_layer("Stratus", lat, lon, alt+1500, 1000.0, 5500.0 * scale, 5500.0 * scale, 0.0, 1.0, 0.3, 0.5); +local_weather.create_layer("Nimbus", lat, lon, alt_eff, 500.0, 6000.0 * scale, 6000.0 * scale, 0.0, 1.0, 0.3, 1, 1.5); -local_weather.create_layer("Fog (thick)", lat, lon, alt+4000, 6000.0, 3400.0 * scale, 3400.0 * scale, 0.0, 1.5, 0.3, 0, 0.0); +#local_weather.create_layer("Stratus", lat, lon, alt_eff+1500, 1000.0, 5500.0 * scale, 5500.0 * scale, 0.0, 1.0, 0.3, 0, 0.0); -local_weather.create_layer("Cumulonimbus (cloudlet)", lat, lon, alt+10000, 10000.0, 3600.0 * scale, 3600.0 * scale, 0.0, 1.2, 0.0, 0, 0.0); +local_weather.create_hollow_layer("Stratus", lat, lon, alt_eff+1500, 1000.0, 5500.0 * scale, 5500.0 * scale, 0.0, 1.0, 0.3, 0.5); + +local_weather.create_layer("Fog (thick)", lat, lon, alt_eff+4000, 6000.0, 3400.0 * scale, 3400.0 * scale, 0.0, 1.5, 0.3, 0, 0.0); + + +local_weather.create_layer("Cumulonimbus (cloudlet)", lat, lon, alt_eff+10000, 10000.0, 3600.0 * scale, 3600.0 * scale, 0.0, 1.2, 0.0, 0, 0.0); # set the exclusion region for the Cumulus layer append(elat, lat); append(elon, lon); append(erad, 6000.0 * scale * 1.2); @@ -3307,23 +3468,26 @@ var phi = alpha * math.pi/180.0; var scale = 0.8; -local_weather.create_layer("Nimbus", lat, lon, alt, 500.0, 7500.0 * scale, 7500.0 * scale, 0.0, 1.0, 0.25, 1, 1.5); +var alt_eff = alt; +if (local_weather.hardcoded_clouds_flag == 1) {alt_eff = alt - local_weather.offset_map["Nimbus"]; } + +local_weather.create_layer("Nimbus", lat, lon, alt_eff, 500.0, 7500.0 * scale, 7500.0 * scale, 0.0, 1.0, 0.25, 1, 1.5); #local_weather.create_layer("Stratus", lat, lon, alt+1500, 1000.0, 7200.0 * scale, 7200.0 * scale, 0.0, 1.0, 0.3, 0, 0.0); -local_weather.create_hollow_layer("Stratus", lat, lon, alt+1500, 1000.0, 7200.0 * scale, 7200.0 * scale, 0.0, 1.0, 0.3, 0.7); +local_weather.create_hollow_layer("Stratus", lat, lon, alt_eff+1500, 1000.0, 7200.0 * scale, 7200.0 * scale, 0.0, 1.0, 0.3, 0.7); -local_weather.create_layer("Fog (thick)", lat, lon, alt+5000, 3000.0, 5500.0 * scale, 5500.0 * scale, 0.0, 0.7, 0.3, 0, 0.0); +local_weather.create_layer("Fog (thick)", lat, lon, alt_eff+5000, 3000.0, 5500.0 * scale, 5500.0 * scale, 0.0, 0.7, 0.3, 0, 0.0); -local_weather.create_layer("Fog (thick)", lat+get_lat(0,-1000,phi), lon+get_lon(0,-1000,phi), alt+12000, 4000.0, 6300.0 * scale, 6300.0 * scale, 0.0, 0.7, 0.3, 0, 0.0); +local_weather.create_layer("Fog (thick)", lat+get_lat(0,-1000,phi), lon+get_lon(0,-1000,phi), alt_eff+12000, 4000.0, 6300.0 * scale, 6300.0 * scale, 0.0, 0.7, 0.3, 0, 0.0); #local_weather.create_layer("Stratus", lat+get_lat(0,-2000,phi), lon+get_lon(0,-2000,phi), alt+17000, 1000.0, 7500.0 * scale, 7500.0 * scale, 0.0, 1.0, 0.3, 0, 0.0); -local_weather.create_hollow_layer("Stratus", lat+get_lat(0,-2000,phi), lon+get_lon(0,-2000,phi), alt+17000, 1000.0, 7500.0 * scale, 7500.0 * scale, 0.0, 1.0, 0.3, 0.5); +local_weather.create_hollow_layer("Stratus", lat+get_lat(0,-2000,phi), lon+get_lon(0,-2000,phi), alt_eff+17000, 1000.0, 7500.0 * scale, 7500.0 * scale, 0.0, 1.0, 0.3, 0.5); -#local_weather.create_layer("Stratus", lat+get_lat(0,-3000,phi), lon+get_lon(0,-3000,phi), alt+20000, 1000.0, 9500.0 * scale, 9500.0 * scale, 0.0, 1.0, 0.3, 0, 0.0); -local_weather.create_hollow_layer("Stratus", lat+get_lat(0,-3000,phi), lon+get_lon(0,-3000,phi), alt+20000, 1000.0, 9500.0 * scale, 9500.0 * scale, 0.0, 1.0, 0.3, 0.5); +#local_weather.create_layer("Stratus", lat+get_lat(0,-3000,phi), lon+get_lon(0,-3000,phi), alt_eff+20000, 1000.0, 9500.0 * scale, 9500.0 * scale, 0.0, 1.0, 0.3, 0, 0.0); +local_weather.create_hollow_layer("Stratus", lat+get_lat(0,-3000,phi), lon+get_lon(0,-3000,phi), alt_eff+20000, 1000.0, 9500.0 * scale, 9500.0 * scale, 0.0, 1.0, 0.3, 0.5); -local_weather.create_layer("Stratus (thin)", lat+get_lat(0,-4000,phi), lon+get_lon(0,-4000,phi), alt+24000, 1000.0, 11500.0 * scale, 11500.0 * scale, 0.0, 2.0, 0.3, 0, 0.0); +local_weather.create_layer("Stratus (thin)", lat+get_lat(0,-4000,phi), lon+get_lon(0,-4000,phi), alt_eff+24000, 1000.0, 11500.0 * scale, 11500.0 * scale, 0.0, 2.0, 0.0, 0, 0.0); # set the exclusion region for the Cumulus layer append(elat, lat); append(elon, lon); append(erad, 7500.0 * scale * 1.2); @@ -3420,6 +3584,8 @@ var lon_to_m = 0.0; # needs to be calculated dynamically var m_to_lon = 0.0; # we do this on startup var lw = "/local-weather/"; +var realistic_visibility_multiplyer = 1.5; + var small_scale_persistence = getprop(lw~"config/small-scale-persistence"); var rnd_store = rand(); diff --git a/Nasal/multiplayer.nas b/Nasal/multiplayer.nas index cb7ef1f56..5f8581076 100644 --- a/Nasal/multiplayer.nas +++ b/Nasal/multiplayer.nas @@ -8,14 +8,11 @@ # # 3) Allow chat messages to be written by the user. - -var is_active = func getprop("/sim/multiplay/txport") or getprop("/sim/multiplay/rxport"); - - var lastmsg = {}; var ignore = {}; var msg_loop_id = 0; var msg_timeout = 0; +var log_file = nil; var check_messages = func(loop_id) { if (loop_id != msg_loop_id) return; @@ -73,35 +70,6 @@ var chat_listener = func(n) } } -settimer(func { - if (is_active()) { - if (getprop("/sim/multiplay/write-message-log")) { - var ac = getprop("/sim/aircraft"); - var cs = getprop("/sim/multiplay/callsign"); - var apt = airportinfo().id; - var t = props.globals.getNode("/sim/time/real").getValues(); - var file = string.normpath(getprop("/sim/fg-home") ~ "/mp-message.log"); - - var f = io.open(file, "a"); - io.write(f, sprintf("\n===== %s %04d/%02d/%02d\t%s\t%s\t%s\n", - ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][t.weekday], - t.year, t.month, t.day, apt, ac, cs)); - - setlistener("/sim/signals/exit", func io.write(f, "=====\n") and io.close(f)); - setlistener("/sim/messages/mp-plane", func(n) { - io.write(f, sprintf("%02d:%02d %s\n", - getprop("/sim/time/real/hour"), - getprop("/sim/time/real/minute"), - n.getValue())); - io.flush(f); - }); - } - check_messages(msg_loop_id += 1); - } - - # Call-back to ensure we see our own messages. - setlistener("/sim/multiplay/chat", chat_listener); -}, 1); # Message composition function, activated using the - key. @@ -469,7 +437,40 @@ var model = { }, }; +_setlistener("/sim/signals/nasal-dir-initialized", func { -_setlistener("sim/signals/nasal-dir-initialized", func model.init()); + model.init(); + setlistener("/sim/multiplay/online", func(n) { + if (n.getBoolValue()) { + if (getprop("/sim/multiplay/write-message-log")) { + var ac = getprop("/sim/aircraft"); + var cs = getprop("/sim/multiplay/callsign"); + var apt = airportinfo().id; + var t = props.globals.getNode("/sim/time/real").getValues(); + if (log_file == nil) { + var file = string.normpath(getprop("/sim/fg-home") ~ "/mp-message.log"); + + log_file = io.open(file, "a"); + io.write(log_file, sprintf("\n===== %s %04d/%02d/%02d\t%s\t%s\t%s\n", + ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][t.weekday], + t.year, t.month, t.day, apt, ac, cs)); + + setlistener("/sim/signals/exit", func io.write(log_file, "=====\n") and io.close(log_file)); + setlistener("/sim/messages/mp-plane", func(n) { + io.write(log_file, sprintf("%02d:%02d %s\n", + getprop("/sim/time/real/hour"), + getprop("/sim/time/real/minute"), + n.getValue())); + io.flush(log_file); + }); + } + } + check_messages(msg_loop_id += 1); + } + }, 1, 0); + + # Call-back to ensure we see our own messages. + setlistener("/sim/multiplay/chat", chat_listener); +}); diff --git a/Nasal/weather-utility.nas b/Nasal/weather-utility.nas index 90e735e61..6c93051b4 100644 --- a/Nasal/weather-utility.nas +++ b/Nasal/weather-utility.nas @@ -3,6 +3,9 @@ # be used with a tied property # +# TODO: Make this optional (when shaders disabled etc), or move computation +# away from Nasal. + #does what it says on the tin var clamp = func(v, min, max) { v < min ? min : v > max ? max : v } @@ -44,7 +47,44 @@ props.globals.initNode("/orientation/model/pitch-deg", 0, "DOUBLE"); props.globals.initNode("/orientation/model/roll-deg", 0, "DOUBLE"); +var update_waves = func (wind) { + var wind = 0; + var amp = 0; + var angle = 0; + var dangle = 0; + var freq = 0; + var factor = 0; + var sharp = 0; + + amp = Amp + 0.02 * wind; + amp = clamp(amp, 1.0, 2.0); + + setprop("/environment/wave/amp", amp); + + angle = Angle + 0.2 * wind; + setprop("/environment/wave/angle", angle); + + dangle = DAngle - 0.4 * wind; + setprop("/environment/wave/dangle", dangle); + + freq = Freq + 0.0008 * wind; + freq = clamp(freq, 0.01, 0.015); + setprop("/environment/wave/freq", freq); + + factor = Factor - 0.00001 * wind; + factor = clamp(factor, 0.0001, 0.0004); + setprop("/environment/wave/factor", factor); + + sharp = Sharp + 0.02 * wind; + sharp = clamp(sharp, 1.0, 2.0); + setprop("/environment/wave/sharp", sharp); +}; + +var is_initialized = 0; var initialize = func { + if (is_initialized) + return; # only install listeners once + is_initialized = 1; var wind_from_east_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-from-east-fps", 1); wind_from_east_Node.setDoubleValue(0); @@ -72,48 +112,14 @@ var initialize = func { # ################## listeners #################### # - setlistener("/environment/sea/surface/wind-speed-kt", func (n) { - var wind = 0; - var amp = 0; - var angle = 0; - var dangle = 0; - var freq = 0; - var factor = 0; - var sharp = 0; - - wind = n.getValue(); - - amp = Amp + 0.02 * wind; - amp = clamp(amp, 1.0, 2.0); - - setprop("/environment/wave/amp", amp); - - angle = Angle + 0.2 * wind; - setprop("/environment/wave/angle", angle); - - dangle = DAngle - 0.4 * wind; - setprop("/environment/wave/dangle", dangle); - - freq = Freq + 0.0008 * wind; - freq = clamp(freq, 0.01, 0.015); - setprop("/environment/wave/freq", freq); - - factor = Factor - 0.00001 * wind; - factor = clamp(factor, 0.0001, 0.0004); - setprop("/environment/wave/factor", factor); - - sharp = Sharp + 0.02 * wind; - sharp = clamp(sharp, 1.0, 2.0); - setprop("/environment/wave/sharp", sharp); - - - }, - 1, - 0);# end listener +# installing a listener to /environment/sea/surface/wind-speed-kt does not make sense, +# since it's currently being written in _every_ update loop anyway). +# setlistener("/environment/sea/surface/wind-speed-kt", func(n) {update_waves(n.getValue())}, +# 1, +# 0);# end listener - print("weather util initialized ..."); + print("weather util initialized ..."); loop(); - }# end init var loop = func { @@ -132,6 +138,9 @@ var loop = func { value = getprop("/environment/config/boundary/entry[0]/wind-speed-kt"); setprop("/environment/sea/surface/wind-speed-kt", value); # print("wind-speed-kt ", getprop("/environment/sea/surface/wind-speed-kt")); + # Direct call to update wave settings (much more effective than using a listener, + # since it's written in every loop anyway. + update_waves(value); value = getprop("/environment/config/enabled"); setprop("/environment/sea/config/enabled", value); diff --git a/Shaders/cloud-static.frag b/Shaders/cloud-static.frag new file mode 100644 index 000000000..b51ff3af4 --- /dev/null +++ b/Shaders/cloud-static.frag @@ -0,0 +1,10 @@ +uniform sampler2D baseTexture; +varying float fogFactor; + +void main(void) +{ + vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); + vec4 finalColor = base * gl_Color; + gl_FragColor.rgb = mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ); + gl_FragColor.a = mix(0.0, finalColor.a, fogFactor); +} diff --git a/Shaders/cloud-static.vert b/Shaders/cloud-static.vert new file mode 100644 index 000000000..96c2ec80a --- /dev/null +++ b/Shaders/cloud-static.vert @@ -0,0 +1,55 @@ +// -*-C++-*- +#version 120 + +varying float fogFactor; + + +float shade = 0.8; +float cloud_height = 1000.0; + +void main(void) +{ + + gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); + vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); + vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); + vec3 u = normalize(ep.xyz - l.xyz); + + gl_Position = vec4(0.0, 0.0, 0.0, 1.0); + gl_Position.x = gl_Vertex.x; + gl_Position.y += gl_Vertex.y; + gl_Position.z += gl_Vertex.z; + gl_Position.xyz += gl_Color.xyz; + + + + // Determine a lighting normal based on the vertex position from the + // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. + float n = dot(normalize(-gl_LightSource[0].position.xyz), + normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; + + // Determine the position - used for fog and shading calculations + vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); + float fogCoord = abs(ecPosition.z); + float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); + + + gl_Position = gl_ModelViewProjectionMatrix * gl_Position; + +// Determine the shading of the sprite based on its vertical position and position relative to the sun. + n = min(smoothstep(-0.5, 0.0, n), fract); +// Determine the shading based on a mixture from the backlight to the front + vec4 backlight = gl_LightSource[0].diffuse * shade; + + gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n); + gl_FrontColor += gl_FrontLightModelProduct.sceneColor; + + // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. + gl_FrontColor.a = min(smoothstep(100.0, 250.0, fogCoord), 1.0 - smoothstep(70000.0, 75000.0, fogCoord)); + gl_BackColor = gl_FrontColor; + + // Fog doesn't affect rain as much as other objects. + fogFactor = exp( -gl_Fog.density * fogCoord * 0.4); + fogFactor = clamp(fogFactor, 0.0, 1.0); +} diff --git a/Shaders/rain-layer.vert b/Shaders/rain-layer.vert index 52c4dbd5c..ef72bf493 100644 --- a/Shaders/rain-layer.vert +++ b/Shaders/rain-layer.vert @@ -3,6 +3,8 @@ varying float fogFactor; +uniform float range; // From /sim/rendering/clouds3d-vis-range + float shade = 0.8; float cloud_height = 1000.0; @@ -45,7 +47,7 @@ void main(void) gl_FrontColor += gl_FrontLightModelProduct.sceneColor; // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(100.0, 250.0, fogCoord), 1.0 - smoothstep(40000.0, 45000.0, fogCoord)); + gl_FrontColor.a = min(smoothstep(100.0, 250.0, fogCoord), 1.0 - smoothstep(range*0.9, range, fogCoord)); gl_BackColor = gl_FrontColor; // Fog doesn't affect rain as much as other objects. diff --git a/gui/dialogs/cockpit-view.xml b/gui/dialogs/cockpit-view.xml index a26a06468..e80fccbf6 100644 --- a/gui/dialogs/cockpit-view.xml +++ b/gui/dialogs/cockpit-view.xml @@ -62,7 +62,7 @@ center - + /sim/rendering/redout/enabled @@ -73,7 +73,7 @@ 0 0 - + /sim/rendering/redout/enabled @@ -86,7 +86,7 @@ %2.1f true /sim/rendering/redout/parameters/blackout-onset-g - + /sim/rendering/redout/enabled @@ -100,7 +100,7 @@ dialog-apply - + /sim/rendering/redout/enabled @@ -109,7 +109,7 @@ 1 0 - + /sim/rendering/redout/enabled @@ -122,7 +122,7 @@ %2.1f true /sim/rendering/redout/parameters/blackout-complete-g - + /sim/rendering/redout/enabled @@ -136,7 +136,7 @@ dialog-apply - + /sim/rendering/redout/enabled @@ -147,7 +147,7 @@ center - + /sim/rendering/redout/enabled @@ -158,7 +158,7 @@ 0 0 - + /sim/rendering/redout/enabled @@ -171,7 +171,7 @@ %2.1f true /sim/rendering/redout/parameters/redout-onset-g - + /sim/rendering/redout/enabled @@ -179,13 +179,13 @@ 0 2 - -1.0 - -15.0 + -15.0 + -1.0 /sim/rendering/redout/parameters/redout-onset-g dialog-apply - + /sim/rendering/redout/enabled @@ -194,7 +194,7 @@ 1 0 - + /sim/rendering/redout/enabled @@ -206,7 +206,7 @@ %2.1f true /sim/rendering/redout/parameters/redout-complete-g - + /sim/rendering/redout/enabled @@ -214,13 +214,13 @@ 1 2 - -1.0 - -15.0 + -15.0 + -1.0 /sim/rendering/redout/parameters/redout-complete-g dialog-apply - + /sim/rendering/redout/enabled diff --git a/gui/dialogs/hud.xml b/gui/dialogs/hud.xml index 60f64b13a..7d894ef2a 100644 --- a/gui/dialogs/hud.xml +++ b/gui/dialogs/hud.xml @@ -56,6 +56,52 @@ + + + + + center + + + + vbox + + left + /sim/gui/dialogs/hud/lon-lat-format-0 + 0 + true + + + nasal + + + + + left + /sim/gui/dialogs/hud/lon-lat-format-1 + 1 + + true + + nasal + + + + + left + /sim/gui/dialogs/hud/lon-lat-format-2 + 2 + true + + + nasal + + + + + + + hbox @@ -192,8 +238,20 @@ - + diff --git a/gui/dialogs/local_weather_tiles.xml b/gui/dialogs/local_weather_tiles.xml index aacc2d387..cbf4acfe1 100644 --- a/gui/dialogs/local_weather_tiles.xml +++ b/gui/dialogs/local_weather_tiles.xml @@ -5,7 +5,7 @@ local_weather_tiles - 310 + 470 385 false @@ -35,6 +35,7 @@ Coldfront Warmfront Tropical + Thunderstorms Test tile dialog-apply @@ -49,6 +50,24 @@ --> + + + 300 + 330 + + + + + + + 390 + 330 + 50 + 25 + /local-weather/tmp/tile-alt-offset-ft + + + 5 295 @@ -77,34 +96,19 @@ /local-weather/tmp/windspeed-kt - - 155 - 295 - - - - - - - 240 - 295 - 50 - 25 - /local-weather/tmp/tile-alt-offset-ft - + - - 5 - 265 + 157 + 295 - 65 - 265 + 225 + 295 50 20 0.0 @@ -118,15 +122,15 @@ - 112 - 265 + 275 + 295 - 167 - 265 + 333 + 295 50 20 0.0 @@ -138,15 +142,15 @@ - 215 - 265 + 380 + 295 - 240 - 265 + 410 + 295 50 20 0.0 @@ -162,14 +166,14 @@ 5 - 235 + 265 150 - 235 + 265 140 25 true @@ -185,15 +189,32 @@ + + 300 + 265 + + + + + + + 390 + 265 + 50 + 25 + /local-weather/config/temperature-offset-degc + + + 5 - 205 + 235 150 - 205 + 235 140 25 true @@ -207,33 +228,10 @@ - - 10 - 175 - 15 - 15 - - /local-weather/config/presampling-flag - - dialog-apply - - - - - 150 - 175 - 15 - 15 - - /local-weather/config/generate-thermal-lift-flag - - dialog-apply - - 10 - 150 + 205 15 15 @@ -243,7 +241,7 @@ - + - + - + - 10 - 100 + 150 + 205 15 15 @@ -292,8 +290,8 @@ - 150 - 100 + 290 + 205 15 15 @@ -303,21 +301,46 @@ - + 10 - 75 + 180 + 15 + 15 + + /local-weather/config/generate-thermal-lift-flag + + dialog-apply + + + + + 150 + 180 + 15 + 15 + + /local-weather/config/presampling-flag + + dialog-apply + + + + + + 5 + 150 - 10 - 50 + 160 + 150 - 80 - 50 + 230 + 150 90 20 0.3 @@ -329,11 +352,147 @@ - 180 - 50 + 330 + 150 + + + 5 + 125 + + + + + 160 + 125 + + + + + 230 + 125 + 90 + 20 + 0.1 + 1.0 + /local-weather/config/ground-haze-factor + + dialog-apply + + + + + 330 + 125 + + + + + + 5 + 100 + + + + + 160 + 100 + + + + + 230 + 100 + 90 + 20 + 30000.0 + 140000.0 + /local-weather/config/max-vis-range-m + + dialog-apply + + + + + 330 + 100 + + + + + + 5 + 75 + + + + + + 15 + 45 + + + + + 78 + 60 + + + + + 60 + 45 + 100 + 20 + 0.5 + 2.0 + /local-weather/config/large-scale-persistence + + dialog-apply + + + + + 165 + 45 + + + + + + 205 + 45 + + + + + 257 + 60 + + + + + 250 + 45 + 100 + 20 + 0.0 + 1.0 + /local-weather/config/small-scale-persistence + + dialog-apply + + + + + 355 + 45 + + + + 10 10 diff --git a/gui/dialogs/location-on-ground.xml b/gui/dialogs/location-on-ground.xml index 45c836314..6ef505ca0 100644 --- a/gui/dialogs/location-on-ground.xml +++ b/gui/dialogs/location-on-ground.xml @@ -32,15 +32,16 @@ var dlg = props.globals.getNode("/sim/gui/dialogs/location-on-ground", 1); var apt = dlg.getNode("airport", 1); - apt.setValue(""); + apt.setValue(getprop("/sim/presets/airport-id")); var rwy = dlg.getNode("runway", 1); rwy.setValue(""); var parkpos = dlg.getNode("parkpos", 1); parkpos.setValue(""); var mode = { - runway: dlg.getNode("use_runway", 1), - parkpos: dlg.getNode("use_parkpos", 1) + runway: dlg.getNode("use_runway", 1), + bestrunway: dlg.getNode("use_best_runway", 1), + parkpos: dlg.getNode("use_parkpos", 1) }; var set_radio = func(m) { @@ -78,6 +79,8 @@ gui.dialog_update("location-on-ground"); } + + updateRunways(); @@ -106,6 +109,33 @@ 10 + /sim/gui/dialogs/location-on-ground/use_best_runway + true + + nasal + + + + + + 11 + right + + + /sim/gui/dialogs/location-on-ground/use_best_runway + + + + 12 + right + + + /sim/gui/dialogs/location-on-ground/use_best_runway + + + + + 20 /sim/gui/dialogs/location-on-ground/use_runway true @@ -115,14 +145,17 @@ - 11 + 21 right + + /sim/gui/dialogs/location-on-ground/use_runway + - + runway - 12 + 22 85 /sim/gui/dialogs/location-on-ground/use_runway @@ -137,7 +170,7 @@ - 20 + 30 /sim/gui/dialogs/location-on-ground/use_parkpos true @@ -147,13 +180,16 @@ - 21 + 31 right + + /sim/gui/dialogs/location-on-ground/use_parkpos + - 22 + 32 /sim/gui/dialogs/location-on-ground/use_parkpos @@ -179,7 +215,10 @@ nasal + reinit mp + + + + + true - \ No newline at end of file + diff --git a/gui/dialogs/rendering.xml b/gui/dialogs/rendering.xml index c524c8edc..419ec3b7a 100644 --- a/gui/dialogs/rendering.xml +++ b/gui/dialogs/rendering.xml @@ -622,16 +622,16 @@ setprop("/sim/rendering/shaders/landmass",qualityLevel); setprop("/sim/rendering/shaders/urban",qualityLevel); setprop("/sim/rendering/shaders/water",qualityLevel); + if (qualityLevel >= 3.0){ + qualityLevel = 3.0; + } + setprop("/sim/rendering/shaders/model",qualityLevel); if (qualityLevel >= 1.0){ qualityLevel = 1.0; } - else { - qualityLevel = 0.0; - } setprop("/sim/rendering/shaders/contrails",qualityLevel); setprop("/sim/rendering/shaders/crop",qualityLevel); setprop("/sim/rendering/shaders/generic",qualityLevel); - setprop("/sim/rendering/shaders/model",qualityLevel); setprop("/sim/rendering/shaders/transition",qualityLevel); }); diff --git a/gui/dialogs/terrasync.xml b/gui/dialogs/terrasync.xml index 29f5fbd1f..2694e4900 100644 --- a/gui/dialogs/terrasync.xml +++ b/gui/dialogs/terrasync.xml @@ -54,6 +54,12 @@ dialog-apply terrasync-enabled + + + /sim/terrasync/scenery-dir + + + @@ -61,40 +67,31 @@ 31 - + scenery-dir left 3 22 400 - true /sim/terrasync/scenery-dir - - - - + + warning_text 4 - 23 + 04 - 0.7 - 0.7 - 0.7 + 1.0 + 0.4 + 0.4 1 - left - + center + @@ -431,20 +428,33 @@ dialog-close - true - diff --git a/gui/dialogs/weather.xml b/gui/dialogs/weather.xml index 9a2eef8e5..5b56ade46 100644 --- a/gui/dialogs/weather.xml +++ b/gui/dialogs/weather.xml @@ -1755,6 +1755,12 @@ dialog-update metar + + + nasal + + diff --git a/gui/menubar.xml b/gui/menubar.xml index 976c9336e..a952ecea4 100644 --- a/gui/menubar.xml +++ b/gui/menubar.xml @@ -36,15 +36,6 @@ dialog-show