Merge branch 'master' of gitorious.org:fg/fgdata
28
Aircraft/Generic/Effects/Fuselagereflect.eff
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<PropertyList>
|
||||
|
||||
<name>Fuselagereflect</name>
|
||||
<inherits-from>Effects/reflect</inherits-from>
|
||||
<parameters>
|
||||
<texture n="5">
|
||||
<!-- we use 6 images here instead of a cube cross-->
|
||||
<type>cubemap</type>
|
||||
<images>
|
||||
<positive-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png</positive-x>
|
||||
<negative-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png</negative-x>
|
||||
<positive-y>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png</positive-y>
|
||||
<negative-y>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png</negative-y>
|
||||
<positive-z>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png</positive-z>
|
||||
<negative-z>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png</negative-z>
|
||||
</images>
|
||||
</texture>
|
||||
<rainbowiness type="float">0.01</rainbowiness>
|
||||
<fresneliness>0.1</fresneliness>
|
||||
<refl_correction>0.0</refl_correction>
|
||||
<ambient_correction>0.1</ambient_correction>
|
||||
<reflect_map>0</reflect_map>
|
||||
</parameters>
|
||||
|
||||
</PropertyList>
|
||||
|
|
@ -26,8 +26,57 @@ var forward = func (speed) {
|
|||
}
|
||||
}
|
||||
|
||||
# Set the side step speed of the active walker.
|
||||
# speed - walker speed in m/sec
|
||||
# Returns 1 of there is an active walker and 0 otherwise.
|
||||
var side_step = func (speed) {
|
||||
var cv = view.current.getPath();
|
||||
if (contains(walkers, cv)) {
|
||||
walkers[cv].side_step(speed);
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# The walker class.
|
||||
# ==============================================================================
|
||||
# Class for a moving view.
|
||||
#
|
||||
# CONSTRUCTOR:
|
||||
# walker.new(<view name>, <constraints>);
|
||||
#
|
||||
# view name ... The name of the view : string
|
||||
# constraints ... The movement constraints : constraint hash
|
||||
#
|
||||
# METHODS:
|
||||
# active() : bool
|
||||
# returns true if this walk view is active.
|
||||
#
|
||||
# forward(speed)
|
||||
# Sets the forward speed of this walk view.
|
||||
# speed ... speed in m/sec : double
|
||||
#
|
||||
# side_step(speed)
|
||||
# Sets the side step speed of this walk view.
|
||||
# speed ... speed in m/sec : double
|
||||
#
|
||||
# set_pos(pos)
|
||||
# get_pos() : position
|
||||
#
|
||||
# set_eye_height(h)
|
||||
# get_eye_height() : int (meter)
|
||||
#
|
||||
# set_constraints(constraints)
|
||||
# get_constraints() : contraint hash
|
||||
#
|
||||
# EXAMPLE:
|
||||
# var constraint =
|
||||
# walkview.slopingYAlignedPlane.new([19.1, -0.3, -8.85],
|
||||
# [19.5, 0.3, -8.85]);
|
||||
# var walker = walkview.walker.new("Passenger View", constraint);
|
||||
#
|
||||
var walker = {
|
||||
new : func (view_name, constraints = nil) {
|
||||
var obj = { parents : [walker] };
|
||||
|
@ -40,10 +89,12 @@ var walker = {
|
|||
];
|
||||
obj.heading =
|
||||
obj.view.getNode("config/heading-offset-deg").getValue();
|
||||
obj.speed = 0.0;
|
||||
obj.speed_fwd = 0.0;
|
||||
obj.speed_side = 0.0;
|
||||
obj.id = 0;
|
||||
obj.isactive = 0;
|
||||
obj.eye_height = 1.60;
|
||||
obj.eye_height = 1.60;
|
||||
obj.goal_height = obj.position[2] + obj.eye_height;
|
||||
|
||||
# Register this walker.
|
||||
view.manager.register(view_name, obj);
|
||||
|
@ -56,7 +107,10 @@ var walker = {
|
|||
return me.isactive;
|
||||
},
|
||||
forward : func (speed) {
|
||||
me.speed = speed;
|
||||
me.speed_fwd = speed;
|
||||
},
|
||||
side_step : func (speed) {
|
||||
me.speed_side = speed;
|
||||
},
|
||||
set_pos : func (pos) {
|
||||
me.position[0] = pos[0];
|
||||
|
@ -66,6 +120,12 @@ var walker = {
|
|||
get_pos : func {
|
||||
return me.position;
|
||||
},
|
||||
set_eye_height : func (h) {
|
||||
me.eye_height = h;
|
||||
},
|
||||
get_eye_height : func {
|
||||
return me.eye_height;
|
||||
},
|
||||
set_constraints : func (constraints) {
|
||||
me.constraints = constraints;
|
||||
},
|
||||
|
@ -77,8 +137,9 @@ var walker = {
|
|||
},
|
||||
start : func {
|
||||
me.isactive = 1;
|
||||
me.last_time = getprop("/sim/time/elapsed-sec");
|
||||
me.last_time = getprop("/sim/time/elapsed-sec") - 0.0001;
|
||||
me.update();
|
||||
me.position[2] = me.goal_height;
|
||||
settimer(func { me._loop_(me.id); }, 0.0);
|
||||
},
|
||||
stop : func {
|
||||
|
@ -94,18 +155,31 @@ var walker = {
|
|||
var cur = props.globals.getNode("/sim/current-view");
|
||||
me.heading = cur.getNode("heading-offset-deg").getValue();
|
||||
|
||||
me.position[0] -= me.speed * dt * math.cos(me.heading * RAD);
|
||||
me.position[1] -= me.speed * dt * math.sin(me.heading * RAD);
|
||||
me.position[0] -=
|
||||
me.speed_fwd * dt * math.cos(me.heading * RAD) +
|
||||
me.speed_side * dt * math.sin(me.heading * RAD);
|
||||
me.position[1] -=
|
||||
me.speed_fwd * dt * math.sin(me.heading * RAD) -
|
||||
me.speed_side * dt * math.cos(me.heading * RAD);
|
||||
|
||||
var cur_height = me.position[2];
|
||||
if (me.constraints != nil) {
|
||||
me.position = me.constraints.constrain(me.position);
|
||||
me.position[2] += me.eye_height;
|
||||
cur.getNode("y-offset-m").setValue(me.position[2]);
|
||||
me.goal_height = me.position[2] + me.eye_height;
|
||||
}
|
||||
# Change the view height smoothly
|
||||
if (math.abs(me.goal_height - cur_height) > 2.0 * dt) {
|
||||
me.position[2] =
|
||||
cur_height +
|
||||
2.0 * dt *
|
||||
((me.goal_height > cur_height) ? 1 : -1);
|
||||
} else {
|
||||
me.position[2] = me.goal_height;
|
||||
}
|
||||
|
||||
cur.getNode("z-offset-m").setValue(me.position[0]);
|
||||
cur.getNode("x-offset-m").setValue(me.position[1]);
|
||||
#cur.getNode("y-offset-m").setValue(me.position[2]);
|
||||
cur.getNode("y-offset-m").setValue(me.position[2]);
|
||||
|
||||
me.last_time = t;
|
||||
},
|
||||
|
@ -177,6 +251,43 @@ var slopingYAlignedPlane = {
|
|||
},
|
||||
};
|
||||
|
||||
# Action constraint
|
||||
# Triggers an action when entering or exiting the constraint.
|
||||
# contraint - the area in question.
|
||||
# on_enter - function that is called when the walker enters the area.
|
||||
# on_exit(x, y) - function that is called when the walker leaves the area.
|
||||
# x and y are <0, 0 or >0 depending on in which direction(s)
|
||||
# the walker left the constraint.
|
||||
var actionConstraint = {
|
||||
new : func (constraint, on_enter = nil, on_exit = nil) {
|
||||
var obj = { parents : [actionConstraint] };
|
||||
obj.constraint = constraint;
|
||||
obj.on_enter = on_enter;
|
||||
obj.on_exit = on_exit;
|
||||
obj.inside = 0;
|
||||
return obj;
|
||||
},
|
||||
constrain : func (pos) {
|
||||
var p = me.constraint.constrain(pos);
|
||||
if (p[0] == pos[0] and p[1] == pos[1]) {
|
||||
if (!me.inside) {
|
||||
me.inside = 1;
|
||||
if (me.on_enter != nil) {
|
||||
me.on_enter();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (me.inside) {
|
||||
me.inside -= 1;
|
||||
if (!me.inside and me.on_exit != nil) {
|
||||
me.on_exit(pos[0] - p[0], pos[1] - p[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
};
|
||||
|
||||
###############################################################################
|
||||
# Module implementation below
|
||||
|
||||
|
|
145
Aircraft/Generic/generic-autopilot-helper.xml
Normal file
|
@ -0,0 +1,145 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
These are the autopilot helpers, currently implemented
|
||||
in the c++ code of xmlauto.cxx.
|
||||
These will take over the functionality of the hard
|
||||
coded helpers, once they are removed and this file
|
||||
has been added as an autopilot to preferences.xml
|
||||
-->
|
||||
|
||||
<PropertyList>
|
||||
|
||||
<filter>
|
||||
<name>heading bug error computer/normalizer</name>
|
||||
<debug>false</debug>
|
||||
<type>gain</type>
|
||||
<input>
|
||||
<property>autopilot/settings/heading-bug-deg</property>
|
||||
<offset>
|
||||
<property>orientation/heading-magnetic-deg</property>
|
||||
<scale>-1.0</scale>
|
||||
</offset>
|
||||
</input>
|
||||
<output>autopilot/internal/heading-bug-error-deg</output>
|
||||
<output>autopilot/internal/fdm-heading-bug-error-deg</output>
|
||||
<period>
|
||||
<min>-180</min>
|
||||
<max>180</max>
|
||||
</period>
|
||||
<gain>1.0</gain>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>true heading error computer/normalizer</name>
|
||||
<debug>false</debug>
|
||||
<type>gain</type>
|
||||
<input>
|
||||
<property>autopilot/settings/true-heading-deg</property>
|
||||
<offset>
|
||||
<property>orientation/heading-deg</property>
|
||||
<scale>-1.0</scale>
|
||||
</offset>
|
||||
</input>
|
||||
<output>autopilot/internal/true-heading-error-deg</output>
|
||||
<period>
|
||||
<min>-180</min>
|
||||
<max>180</max>
|
||||
</period>
|
||||
<gain>1.0</gain>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>nav1 heading error computer/normalizer</name>
|
||||
<debug>false</debug>
|
||||
<type>gain</type>
|
||||
<input>
|
||||
<property>instrumentation/nav[0]/radials/target-auto-hdg-deg</property>
|
||||
<offset>
|
||||
<property>orientation/heading-deg</property>
|
||||
<scale>-1.0</scale>
|
||||
</offset>
|
||||
</input>
|
||||
<output>autopilot/internal/nav1-heading-error-deg</output>
|
||||
<period>
|
||||
<min>-180</min>
|
||||
<max>180</max>
|
||||
</period>
|
||||
<gain>1.0</gain>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>nav1 selected course error computer/normalizer</name>
|
||||
<debug>false</debug>
|
||||
<type>gain</type>
|
||||
<input>
|
||||
<property>instrumentation/nav[0]/radials/selected-deg</property>
|
||||
<offset>
|
||||
<property>orientation/heading-magnetic-deg</property>
|
||||
<scale>-1.0</scale>
|
||||
</offset>
|
||||
</input>
|
||||
<output>autopilot/internal/nav1-course-error</output>
|
||||
<period>
|
||||
<min>-180</min>
|
||||
<max>180</max>
|
||||
</period>
|
||||
<gain>1.0</gain>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>vertical speed fpm computer</name>
|
||||
<debug>false</debug>
|
||||
<type>gain</type>
|
||||
<input>velocities/vertical-speed-fps</input>
|
||||
<output>autopilot/internal/vert-speed-fpm</output>
|
||||
<gain>60.0</gain>
|
||||
</filter>
|
||||
|
||||
<predict-simple>
|
||||
<name>speed in 5 seconds predictor</name>
|
||||
<debug>false</debug>
|
||||
<input>velocities/airspeed-kt</input>
|
||||
<output>autopilot/internal/lookahead-5-sec-airspeed-kt</output>
|
||||
<seconds>5.0</seconds>
|
||||
<filter-gain>0.0</filter-gain>
|
||||
</predict-simple>
|
||||
|
||||
<predict-simple>
|
||||
<name>speed in 10 seconds predictor</name>
|
||||
<debug>false</debug>
|
||||
<input>velocities/airspeed-kt</input>
|
||||
<output>autopilot/internal/lookahead-10-sec-airspeed-kt</output>
|
||||
<seconds>10.0</seconds>
|
||||
<filter-gain>0.0</filter-gain>
|
||||
</predict-simple>
|
||||
|
||||
<filter>
|
||||
<name>static port pressure rate computer</name>
|
||||
<debug>false</debug>
|
||||
<type>differential</type>
|
||||
<input>systems/static[0]/pressure-inhg</input>
|
||||
<output>autopilot/internal/pressure-rate</output>
|
||||
<filter-time>1.0</filter-time>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>nav1 track error computer</name>
|
||||
<debug>false</debug>
|
||||
<type>gain</type>
|
||||
<input>
|
||||
<property>instrumentation/nav[0]/radials/target-auto-hdg-deg</property>
|
||||
<offset>
|
||||
<property>orientation/track-deg</property>
|
||||
<scale>-1.0</scale>
|
||||
</offset>
|
||||
</input>
|
||||
<output>autopilot/internal/nav1-track-error-deg</output>
|
||||
<period>
|
||||
<min>-180</min>
|
||||
<max>180</max>
|
||||
</period>
|
||||
<gain>1.0</gain>
|
||||
</filter>
|
||||
|
||||
</PropertyList>
|
||||
|
BIN
Docs/KLSV-10_00.jpg
Normal file
After Width: | Height: | Size: 114 KiB |
BIN
Docs/KLSV-12_00.jpg
Normal file
After Width: | Height: | Size: 110 KiB |
BIN
Docs/KLSV-15_00.jpg
Normal file
After Width: | Height: | Size: 111 KiB |
BIN
Docs/KLSV-17_30.jpg
Normal file
After Width: | Height: | Size: 96 KiB |
BIN
Docs/KLSV-19_00.jpg
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
Docs/KLSV-5_00.jpg
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
Docs/KLSV-7_00.jpg
Normal file
After Width: | Height: | Size: 82 KiB |
|
@ -7,7 +7,7 @@
|
|||
|
||||
<body>
|
||||
|
||||
<h1>Local Weather Package - v0.5</h1>
|
||||
<h1>Local Weather Package - v0.7</h1>
|
||||
|
||||
<h2>1. Introduction</h2>
|
||||
|
||||
|
@ -15,13 +15,13 @@ The aim of a local weather system is to simulate weather phenomena tied to speci
|
|||
|
||||
This is in contrast to the current (v.2.0.0) weather system of Flightgear where weather changes affect the weather everywhere in the simulated world and are (with few exceptions) not tied to specific locations. In such a system, it is impossible to observe e.g. the approach of a rainfront while flying in sunshine.<p>
|
||||
|
||||
The local weather package ultimately aims to provide the functionality to simulate such local phenomena. In version 0.5, the package supplies various cloud placement algorithms, as well as local control over most major weather parameters (visibility, pressure, temperature, rain, snow, thermal lift...) through interpolation routines and event volumes. However, basically all features currently present can and will eventually be improved.<p>
|
||||
The local weather package ultimately aims to provide the functionality to simulate such local phenomena. In version 0.7, the package supplies various cloud placement algorithms, as well as local control over most major weather parameters (visibility, pressure, temperature, rain, snow, thermal lift, turbulence...) through interpolation routines and event volumes. The package contains a fairly detailed algorithm to generate convective clouds and thermals with a realistic distribution. For long-range flights, it automatically provides transitions between different weather patterns like fronts and low and high pressure areas. However, basically all features currently present can and will eventually be improved.<p>
|
||||
|
||||
As of version 0.5, the system does not contain dynamics (development of convective clouds, wind displacement of clouds...). Since wind and dynamics are closely related, any wind parameters can currently <i>not</i> be controlled from the local weather algorithms.<p>
|
||||
As of version 0.7, the system does not contain dynamics (development of convective clouds, wind displacement of clouds...). Since wind and dynamics are closely related, any wind parameters can currently <i>not</i> be controlled from the local weather algorithms.<p>
|
||||
|
||||
<h2>2. Installation</h2>
|
||||
|
||||
The package needs to be unpacked in the Flightgear root directory. It writes content into the <i>Nasal/, gui/, gui/dialogs/, Shaders, Effects/</i>, and <i>Models/Weather/</i> subdirectories. The installation does not overwrite any of the default Flightgear files, but to be accessible from the menu, one must copy <i>gui/menubar.xml.alt</i> to the default <i>menubar.xml</i> or copy the last two lines of the environemnt menu calling <i>local_weather</i> and <i>local_weather_tiles</i> into the default file.<p>
|
||||
The package needs to be unpacked in the Flightgear root directory. It writes content into the <i>Nasal/, gui/, gui/dialogs/, Shaders, Effects/, Docs/</i>, and <i>Models/Weather/</i> subdirectories. The installation does not overwrite any of the default Flightgear files, but to be accessible from the menu, one must copy <i>gui/menubar.xml.alt</i> to the default <i>menubar.xml</i> or copy the last two lines of the environemnt menu calling <i>local_weather</i> and <i>local_weather_tiles</i> into the default file.<p>
|
||||
|
||||
This adds the items <i>Local Weather</i> and <i>Local weather tiles</i> to the <i>Environment</i> menu when Flightgear is up. The central functionality is contained in <i>local_weather.nas</i> which is loaded at startup and identifies itself with a message, but does not start any functions unless called from the GUI.<p>
|
||||
|
||||
|
@ -29,7 +29,7 @@ This adds the items <i>Local Weather</i> and <i>Local weather tiles</i> to the <
|
|||
|
||||
The general rule is that the gui is not hardened against problematic user input, for example it will not reject meaningless input. It is recommended to watch the console, because some level of warnings and errors are passed to the console. Placement calls may sometimes take a significant time to execute especially for large numbers of clouds tied in a complicated way to the terrain. Placing 500 barrier clouds against a small barrier may take a minute to compute.<p>
|
||||
|
||||
The first menu contains the low level cloud placement functions. Currently four options are supported: <i>Place a single cloud</i>, <i>Place a cloud streak</i>, <i>Start the convective system</i>, <i>Create barrier clouds</i> and <i>Place a cloud layer</i>.<p>
|
||||
The first menu contains the low level cloud placement functions. Its purpose is mainly for developing cloud patterns without having to resort to re-type the underlying Nasal code every time. Currently four options are supported: <i>Place a single cloud</i>, <i>Place a cloud streak</i>, <i>Start the convective system</i>, <i>Create barrier clouds</i> and <i>Place a cloud layer</i>.<p>
|
||||
|
||||
<center>
|
||||
<img src="menu1.jpg">
|
||||
|
@ -49,13 +49,13 @@ The pattern can then be randomized in x, y and altitude. Basically, specifying n
|
|||
|
||||
<h3>The convective system</h3>
|
||||
|
||||
The convective system places Cumulus clouds centered on the current position based on the underlying terrain. Currently it models daily variation of convective strength and the latitude variation based on a simple sinusoidal model (i.e. it produces different results when called in the morning than at noon), but it does not take into account seasonal variation (i.e. it assumes the date to be the equinox). This will be significantly improved in the future. The actual placement is chosen based on the type of the underlying terrain, with Cumulus development more likely over city areas than on water. The parameters for this need fine-tuning and are currently rather rough, but they lead for example to pronounced differences between land and sea in coastal regions. The following picture shows the result of a call of the system in the afternoon over TNCM.<p>
|
||||
The convective system places Cumulus clouds centered on the current position based on the underlying terrain. Currently it models daily variation of convective strength and the latitude variation based on a simple sinusoidal model (i.e. it produces different results when called in the morning than at noon), but it does not take into account seasonal variation (i.e. it assumes the date to be the equinox). This will be significantly improved in the future. The actual placement is chosen based on the type of the underlying terrain, with Cumulus development more likely over city areas than on water. Details of the algorithm are described in the appendix. The parameters for this need fine-tuning and are currently rather rough, but they lead for example to pronounced differences between land and sea in coastal regions. The following picture shows the result of a call of the system in the afternoon over TNCM.<p>
|
||||
|
||||
<center>
|
||||
<img src="clouds-cumulus_afternoon.jpg">
|
||||
</center><p>
|
||||
|
||||
Clouds are placed in a constant altitude <i>alt</i> (this is going to be changed in the future) in a tile with given <i>size</i> where the size measures the distance to the tile border, i.e. a size parameter of 15 km corresponds to a 30x30 km region. Clouds are placed with constant density for given terrain type, so be careful with large area placements! <i>strength</i> is an overall multiplicative factor to fine-tune.
|
||||
Unless 'Terrain presampling' is active, clouds are placed in a constant altitude <i>alt</i> in a tile with given <i>size</i> where the size measures the distance to the tile border, i.e. a size parameter of 15 km corresponds to a 30x30 km region. When 'Terrain presampling' is selected, the distribution of clouds in altitude is determined by a more complicated algorithm described in the appendix. Clouds are placed with constant density for given terrain type, so be careful with large area placements! <i>strength</i> is an overall multiplicative factor to fine-tune.
|
||||
|
||||
<h3>The barrier cloud system</h3>
|
||||
|
||||
|
@ -83,31 +83,58 @@ The picture illustrates the result of a layer generation call for Nimbostratus c
|
|||
|
||||
<h3>Tile placement</h3>
|
||||
|
||||
The second menu is used to place complete weather tiles based on low-level calls. Currently it contains several demo tiles indicating what can be done. <p>
|
||||
The second menu is used to place complete weather tiles based on low-level calls. It is intended for the user to automatically create the various weather patterns during flight. <p>
|
||||
|
||||
<center>
|
||||
<img src="menu2.jpg">
|
||||
</center><p>
|
||||
|
||||
The dropdown menu is used to select the type of weather tile to build. In addition, two parameters can be entered. The first is the tile orientation. Some tiles, most notably incoming fronts, have a direction along which the weather changes. The tiles are set up in such a way that fronts come from north, changing orientation rotates the whole tile to the specified direction. As soon as wind is implemented in the local weather system, the tile orientation will essentially also govern the wind direction (clearly, there is a relation between from where a front comes and the wind direction).<p>
|
||||
The dropdown menu is used to select the type of weather tile to build. The menu contains two groups of tiles - the first six are classified by airmass, whereas the last two are scenarios intended for soaring. In addition, two parameters can be entered. The first is the tile orientation. Some tiles, most notably incoming fronts, have a direction along which the weather changes. The tiles are set up in such a way that fronts come from north, changing orientation rotates the whole tile to the specified direction. As soon as wind is implemented in the local weather system, the tile orientation will essentially also govern the wind direction (clearly, there is a relation between from where a front comes and the wind direction). Currently, the functionality of tile orientation is there, but mostly untested and at the moment not particularly useful.<p>
|
||||
|
||||
The second parameter, the altitude offset, is as of now a provisorium. Cloud layer placement calls are specified for absolute altitudes and calibrated at sea level. As a result, layers are placed too low in mountainous terrain. Eventually, the system is to receive a terrain presampling function to determine just where exactly low cloud layers should be placed when a weather tile is set up. Until this is in place, the user must manually specify a suitable altitude offset for all cloud layers.<p>
|
||||
The second parameter, the altitude offset, is to manually adjust the altitude level of clouds in the absence of terrain presampling. Cloud layer placement calls are then specified for absolute altitudes and calibrated at sea level. As a result, layers are placed too low in mountainous terrain, hence the need for an offset. <p>
|
||||
|
||||
The following pictures show the results of tile setups 'Incoming rainfront' and 'Summer rain':<p>
|
||||
The dropdown menu for the tile selection mode controls the long-range behaviour of weather. It specifies according to what rules tiles are automatically generated once the aircraft reaches the border of the original tile. The option 'single tile' creates a single weather tile as specified without automatic generation of further tiles. The option 'repeat tile' creates new tiles of the same type as the originally selected tile. This does not mean that weather will be unchanged during flight, as both parameters like pressure, temperature and visibility as well as the positioning of cloud banks are randomized to some degree. In addition, each tile typically contains 2-5 different cloud scenarios, so five repeated generations of 'low-pressure-border' tiles may never result in the same arrangement of cloud layers. Necertheless, the option will keep weather conditions roughly the same. This is different with the (somewhat optimistically named) 'realistic weather'. This option allows transitions between different airmasses, thus one may select 'low-pressure-core' initially, but as the flight goes on, eventually a region of high pressure and clear skies may be reached. Currently this change between airmasses does not include transitions across fronts. Moreover, it does not cover transitions to arctic or tropical weather conditions - those will be covered in a future release. Note that 'realistic weather' does not work for the two soaring scenarios, 'repeat tile' does not work for any tile which is part of a front.<p>
|
||||
|
||||
The final option, 'METAR', generates weather according to parsed METAR information. This information must be made available in the property tree. Currently this is <b>not</b> done automatically and the METAR system does <b>not</b> work with real-weather-fetch, this needs some work on the Flightgear core.<p>
|
||||
|
||||
Below the menu are four tickboxes. 'Terrain presampling' finds the distribution of altitude in the terrain before placing a cloud layer. As a result, the layers or clouds are automatically placed at the correct altitude above ground in level terrain. In mountain regions, cloud placement is fairly tricky, and the algorithm analyzes quantities like the median altitude to determine what to do. The appendix contains a detailed description of the algorithm. If the box is ticked, the altitude offset specified above is not parsed.<p>
|
||||
|
||||
|
||||
'Worker threads' is an option to distribute the work flow. Usually, the local weather package will compute a task till it is done before starting the next. Thus, creating a new weather tile may lead to a few seconds freeze, before Flightgear continues normally. With 'worker threads' selected, computations will be split across several frames. The advantage is that Flightgear stays responsive during loading and unloading of weather tiles, and in general the flight continues smoothly, albeit with reduced framerate. However, selecting this option does not guarantee that an operation is finished by the time another is beginning - thus there may be situations in which the loading of a new tile blocks unloading of an old one and so on, in essence leading to processes competing for access to the weather array, resulting in an extended period of very low framerates. Dependent on system performance, this may or may not be acceptable to the user. 'asymmetric range' is an experimental performance-improving option (see below). Finally, 'detailed clouds' will change the technique for generating Cumulus clouds from a multilayer model to multiple cloudlets filling a box. This improves the visual appearance of the clouds significantly, albeit at the expense of a (significant) loss of framerate. Rendering multiple tiles of dense Cumulus development with detailed clouds will quite possibly freeze even a powerful system. <p>
|
||||
|
||||
The slider 'Thermal properties' is only relevant for soaring scenarios. It governs the rato of maximum lift to radius of a thermal. A setting close to 'low convection' creates large thermals with relatively small lift and virtually no turbulence, a setting close to 'rough day' creates very narrow, turbulent thermals with large lift. Unless thermals are placed, no other weather tile is affected by the settings.<p>
|
||||
|
||||
The following pictures show the results of tile setups 'Low-pressure-border' and 'High-pressure-border':<p>
|
||||
|
||||
<center>
|
||||
<img src="clouds-incoming-rainfront1.jpg">
|
||||
<img src="carrier-ops08.jpg">
|
||||
</center><p>
|
||||
|
||||
<center>
|
||||
<img src="clouds-summer-rain.jpg">
|
||||
<img src="clouds-lpb01.jpg">
|
||||
</center><p>
|
||||
|
||||
<h2>4. Cloud models</h2>
|
||||
|
||||
The package contains a number of different cloud models, both static ones for Cirrus and Cirrocumulus clouds as well as rotated ones for Altocumulus, Cumulus, Cumulonimbus, Stratus and Nimbostratus cloudlet models. Neither the cloud textures, nor the models nor the transformations are perfected, and any aspect can be improved. Currently the clouds cannot reach the sophistication of the shader-based standard 3-d clouds of Flightgear, but there is no reason in principle why they should not eventually reach that level. The problem is finding a good balance between spending a lot of CPU time to make a single cloud model appear perfect, and the performance degradation that occurs if hundreds of clouds are placed in the sky. The basic aim is to provide realistic appearance for clouds from a standard view position (in cockpit looking forward), to retain acceptable appearance from other positions and to allow large cloud layers.<p>
|
||||
The package contains a number of different cloud models, both static ones for Cirrus and Cirrocumulus clouds as well as rotated ones for Altocumulus, Cirrostratus, Cumulus, Cumulonimbus, Stratus and Nimbostratus cloudlet models. Neither the cloud textures, nor the models nor the transformations are perfected, and any aspect can be improved. Currently the standard clouds cannot quite reach the sophistication of the shader-based standard 3-d clouds of Flightgear, but the detailed Cumulus clouds are on the verge of catching up. <p>
|
||||
|
||||
Currently all clouds which need to be rotated are treated in the Shaders using a view-axis based rotation by two angles. This generally looks okay from a normal flight position, but rapid change of the view axis (looking around), especially straight up or down, causes unrealistic cloud movement. Any static picture of clouds however is (almost) guaranteed to look fine.<p>
|
||||
<center>
|
||||
<img src="clouds-detailed01.jpg">
|
||||
</center><p>
|
||||
|
||||
These are rendered by a different technique: While the default Cumulus models consist of multiple layers rotated around the center of the model, the detailed Cumulus clouds consist of multiple (up to 24) individual cloudlets, rotating each around its own center, randomly distributed into a box. This not only improves the visual appearance, but also leads to a more realistic distribution of cloud sizes and shapes in the sky. In addition, when circling below the cloud (as done when soaring) the effect of the cloudlet rotation is less pronounced. The price to pay is that rendering detailed clouds costs about a factor 4 more performance, so they may not be suitable for all systems.<p>
|
||||
|
||||
More complex clouds are rendered in sandwitched layers of several different textures. An example are Cumulonimbus towers, which use diffuse textures on the bottom, changing to more structured textures in the upper part of the cloud. With up to 2000 cloudlets, skies with multiple thunderstorms may not render with sufficient framerates on every system.<p>
|
||||
|
||||
<center>
|
||||
<img src="clouds-tropical02.jpg">
|
||||
</center><p>
|
||||
|
||||
The general problem is finding a good balance between spending a lot of CPU time to make a single cloud model appear perfect, and the performance degradation that occurs if hundreds of clouds are placed in the sky. The basic aim is to provide realistic appearance for clouds from a standard view position (in cockpit looking forward), to retain acceptable appearance from other positions and to allow large cloud layers.<p>
|
||||
|
||||
|
||||
|
||||
Currently all clouds which need to be rotated are treated in the Shaders using a view-axis based rotation by two angles. This generally looks okay from a normal flight position, but rapid change of the view axis (looking around), especially straight up or down, causes unrealistic cloud movement. Any static picture of clouds however is (almost) guaranteed to look fine. This means that shader effects need to be 'on' in order to see most of the clouds.<p>
|
||||
|
||||
<h2>5. Local weather parameters</h2>
|
||||
|
||||
|
@ -141,19 +168,25 @@ Effect volumes are always specified between a minimum and a maximum altitude, an
|
|||
|
||||
where <i>geometry</i> is a flag (1: circular, 2: elliptical and 3: rectangular), <i>lat</i> and <i>lon</i> are the latitude and longitude, <i>r1</i> and <i>r2</i> are the two size parameters for the elliptic or rectangular shape (for the circular shape, only the first is used), <i>phi</i> is the rotation angle of the shape (not used for circular shape), <i>alt_low</i> and <i>alt_high</i> are the altitude boundaries, <i>vis, rain, snow, turb</i> and <i>lift</i> are weather parameters which are either set to the value they should assume, or to -1 if they are not to be used, or to -2 if a function instead of a parameter is to be used. Since thermal lift can be set to negative values in a sink, a separate flag is provided in this case.<p>
|
||||
|
||||
In version 0.61, thermal lift is implemented by function. There is no easy way to implement any weather parameter by function in an effect volume, as this requires some amount of Nasal coding.
|
||||
|
||||
<h2>6. Property tree structure</h2>
|
||||
|
||||
The internal state of the local weather system is found in the property tree under <i>local-weather/</i>. In this directory, various loop flags are found. They indicate the state of the main monitoring loops - they are set to 1 if a loop is running, setting them to zero terminates the loop.<p>
|
||||
|
||||
The <i>local-weather</i> folder contains various subdirectories. <i>clouds/</i> contains the record of all visible weather phenomena (clouds, precipitation layers, lightning...) in a subdirectory <i>cloud[i]/</i>. The total number of all models placed is accessible as <i>local-weather/clouds/cloud-number</i>. Inside each <i>cloud/</i> subdirectory, there is a string <i>type</i> specifying the type of object and subdirectories <i>position/</i> and <i>orientation</i> which contain the position and spatial orientation of the model inside the scenery. Note that the orientation property is obsolete for clouds which are rotated by the shader.<p>
|
||||
The <i>local-weather</i> folder contains various subdirectories. <i>clouds/</i> contains the record of all visible weather phenomena (clouds, precipitation layers, lightning...) in a subdirectory <i>tile[j]/cloud[i]/</i>. The total number of all models placed is accessible as <i>local-weather/clouds/cloud-number</i>. Inside each <i>cloud/</i> subdirectory, there is a string <i>type</i> specifying the type of object and subdirectories <i>position/</i> and <i>orientation</i> which contain the position and spatial orientation of the model inside the scenery. Note that the orientation property is obsolete for clouds which are rotated by the shader.<p>
|
||||
|
||||
The <i>local-weather/effect-volumes/</i> subfolder contains the management of the effect volumes. It has the total count of specified effect volumes, along with the count of currently active volumes for each property. If volumes are defined, their properties are stored under <i>local-weather/effect-volumes/effect-volume[i]/</i>. In each folder, there are <i>position/</i> and <i>volume/</i> storing the spatial position and extent of the volume, as well as the <i>active-flag</i> which is set to 1 if the airplane is in the volume and the <i>geometry</i> flag which determines if the volume has circular, elliptical or rectangular shape. Finally, the <i>effects/</i> subfolder holds flags determining of a property is to be set when the volume is active and the corresponding values. On entry, the effect volumes also create a subfolder <i>restore/</i> in which the conditions as they were when the volume was entered are saved.<p>
|
||||
|
||||
<i>local-weather/interpolation/</i> holds all properties which are set by the interpolation system, as well as subfolders <i>station[i]/</i> in which the weather station information for the interpolation are found. Basically, here is the state of the weather as it is outside of effect volumes. Since parameters may be set to different values in effect volumes, the folder <i>local-weather/current/</i> contains the weather as the local weather system currently thinks it should be. Currently, weather is actually passed to the Flightgear environment system through several workarounds. In a clean C++ supported version, the parameters should be read from here.<p>
|
||||
|
||||
<i>local-weather/tiles</i> stores the information of the 9 managed weather tiles (the one the airplane is currently in, and the 8 surrounding it). By default each directory contains the tile center coordinates and a flag if it has been generated. Tiles are not generated unless a minimum distance to the tile center has been reached. Once this happens, the tile type is written as a code, and the cloud, interpolation and effect volume information corresponding to the tile is generated. <p>
|
||||
|
||||
<i>local-weather/METAR</i> is used to store the METAR information for the METAR based tile setup. This must include latitude, longitude and altitude of a weather station, temperature, dewpoint, pressure, wind direction and speed, rain, snow and thunderstorm information as well as cloud layer altitude and coverage in oktas. Any properties set here will be executed when 'METAR' is selected as tile selection mode as long as <i>local-weather/METAR/available-flag</i> is set to 1 (this flag is set to zero whenever a tile has been created from METAR info to indicate that the information has been used, so if the user wants to reuse the information, then the flag must be reset).<p>
|
||||
|
||||
<h2>7. Weather tile setup</h2>
|
||||
|
||||
Examples for weather tile setup can be found in <i>Nasal/weather-tiles.nas</i>. Each tile is generated by a sequence of Nasal function calls to first set weather stations, then to draw the cloud layers, and effect volumes. Finally, all necessary loops must be started. It is a bit awkward to have to write in Nasal to customize the system, but I can't think of a reasonable GUI for the task, except marking every placement on a map which exceeds my coding skills a bit. The problem is that there is no real standard solution - every weather tile needs different calls, sometimes a large one generating many clouds, sometimes several smaller ones.<p>
|
||||
Examples for weather tile setup can be found in <i>Nasal/weather-tiles.nas</i>. Each tile is generated by a sequence of Nasal function calls to first set weather stations, then to draw the cloud layers, and effect volumes. It is a bit awkward to have to write in Nasal to customize the system, but I can't think of a reasonable GUI for the task, except marking every placement on a map which exceeds my coding skills a bit. The problem is that there is no real standard solution - every weather tile needs different calls, sometimes a large one generating many clouds, sometimes several smaller ones.<p>
|
||||
|
||||
The first important call sets up the conditions to be interpolated:<p>
|
||||
|
||||
|
@ -165,8 +198,23 @@ If the cloud layer has an orientation, then all placement coordinates should be
|
|||
|
||||
To make your own tile visible, an entry in the menu <i>gui/dialogs/local_weather_tiles.xml</i> needs to be created and the name needs to be added with a tile setup call to the function <i>set_tile</i> in <i>Nasal/local_weather.nas</i>.
|
||||
|
||||
<h2>8. Performance tuning</h2>
|
||||
|
||||
<h2>8. Known issues</h2>
|
||||
With default settings, the local weather package generates a 40x40 km weather tile when the aircraft is closer than 35 km to the tile center and unloads it when the aircraft is more than 37 km away. This means that the system can generate at most 4 tiles at once and clouds are visible for at least 15 km and up to 30 km (the latter number determined by fading in the shaders). However, rendering and managing multiple overcast cloud layers in a region of 80x80 km is a significant drain on performance. For older systems, a few things can be tried:<p>
|
||||
|
||||
* the menu option 'asymmetric range' decreases loading and unloading ranges in a 45 degree sector behind the aircraft. This means that in straight flight, less tiles will be loaded at the same time, as tiles in the rear are unloaded more quickly. The option is currently experimental.<p>
|
||||
|
||||
* a further reduction in the amount of simultaneously generated tiles can be achieved by changing the ranges. These are exposed in the property tree as <i>local-weather/config/distance-to-load-tile-m</i> and <i>local-weather/config/distance-to-remove-tile-m</i>. Note that the removal range <b>must</b> be larger than the loading range - otherwise just generated tiles will be immediately unloaded! Ranges below 20 km will guarantee that only one tile is loaded at a time, but will create empty spots when no tile is loaded. A range above 28 km will guarantee that the aircraft never flies in an empty tile, but empty sky in front will be visible. Finally, ranges above 56 km guarantee that all 9 tiles (a region of 120x120 km) are managed at all times - but will most likely cause a severe drop in framerate for most scenarios.<p>
|
||||
|
||||
* if this does not help, try avoiding scenarios with large cloud count. As a rule, low pressure areas have high cloud count, high pressure areas have a low cloud count. Do not use 'detailed clouds', which tend to generate large cloud counts.<p>
|
||||
|
||||
* a drastic solution is to set the visual ranges lower. Currently, cloud models are set to be visible up to 30 km. Changing the visibility range in the range animation of all cloud model xml wrappers will improve performance accordingly. To achieve a nice fading into the background instead of a sudden disappearance, it is recommended to adjust the visibility range in the shaders accordingly. It would probably be good to expose the visual range as a property, but currently it's not yet done, as passing a property to the shader requires Flightgear CVS and cannot be done in 2.0.0.<p>
|
||||
|
||||
Performance for overcast layers currently is a limiting issue and there are a few ideas around how to improve it - dependent if these work or not, future releases may work better.<p>
|
||||
|
||||
* a different issue is a characteristic small pause every 3 seconds. This is caused by the interpolation loop resetting the weather parameters. Currently, a computationally expensive workaround is needed to do so, causing the problem. Work on a better environment controller is on the way, however until that modification to the core Flightgear code is implemented, the best solution is to set the loop time in <i>Nasal/local-weather.nas</i> to a larger value. <p>
|
||||
|
||||
<h2>9. Known issues</h2>
|
||||
|
||||
* The local weather system does not mix well with the standard weather system. 3d cloud layers can be placed in the absence of effect volumes, but any effect volume causing precipitation will let the layer behave in a strange way. Likewise, 2d cloud layers can be placed, but may or may not lead to strange rendering artefacts. Local weather, as long as interpolation and effect volumes are running, will in general overwrite all other settings - bother real weather METAR and user-specified settings from the menu. The results of mixing standard and local weather settings are unpredictable, and may not lead to the desired results.<p>
|
||||
|
||||
|
@ -174,8 +222,130 @@ To make your own tile visible, an entry in the menu <i>gui/dialogs/local_weather
|
|||
|
||||
* Rain and snow may not start properly. For me, rain is only generated when I switch 'Shader effects' on and off in the menu on startup, otherwise neither moving the menu slider nor entering an effect volume generate rain. This seems to be a bug of some Flightgear versions, not of the local weather system.<p>
|
||||
|
||||
* Especially with multiple overcast layers and weather fronts, loading and unloading weather tiles may take a long time / cause severe drops in framerate. Please refer to performance tuning to solve such problems. In general, overcast layers and tropical weather tiles do require a system on the high end of the performance scale to render properly.<p>
|
||||
|
||||
Thorsten Renk, April 2010
|
||||
* The local weather package is able to occasionally trigger errors like 'Warning:: Picked up error in TriangleIntersect'. These seem to be a problem in the core Flightgear code - the package does nothing but placing normal (rather simple) AC3D models into the scenery.<p>
|
||||
|
||||
* The thermals in the soaring scenarios need a CVS patch to work.<p>
|
||||
|
||||
<h2><a name="appendix_A">Appendix A: An introduction to the algorithms</a></h2>
|
||||
|
||||
This section describes the more complicated cloud placement algorithms in some detail. It is intended for readers who are interested in understanding (and possibly modifying) what creates the weather they get to see.
|
||||
|
||||
<h3>The convective algorithm and the properties of thermals</h3>
|
||||
|
||||
The convective algorithm is used to place Cumulus clouds as well as thermals. Thermals are by default not placed to save CPU time unless a tile designed for soaring is selected, but they can be generated for any weather tile by setting <i>local-weather/tmp/generate-thermal-lift-flag</i> to either 1 (constant-strength thermals) or 2 (detailed thermal model).<p>
|
||||
|
||||
At the core of the convective algorithm is the concept of locally available thermal energy. The source of this energy is solar radiation. The flux of solar energy depends on the angle of incident sunlight with the terrain surface. It is possibly (though computationally very expensive) to compute this quantity, but the algorithm uses a proxy instead. The daily angle of the sun at the equator assuming flat terrain is modelled as <i>0.5 * (1.0-cos(t/24.0*2pi))</i> with t expressed in hours, a function that varies between zero at midnight and 1 at noon. There is a geographical correction to this formula which goes with <i>cos(latitude)</i>, taking care of the fact that the sun does not reach the zenith at higher latitudes. Both the yearly summer/winter variation of the solar position in the sky and the terrain slope are neglected.<p>
|
||||
|
||||
However, the incident energy does not equal the available energy, since some of this energy is reflected back into space, either by high clouds, or by the terrain itself. The reflection by high clouds is not explicitly included in the algorithm - but since in creating a weather tile, one must setup both the high altitude clouds and the convective system, it can easily be included approximately by calling the convective system with a strength that is reduced according to the density of high-altitude clouds. The reflection by the terrain is encoded in the probability <i>p</i> that a given landcover will lead to a thermal. <i>p</i> ranges from 0.35 for rock or concrete surface which heat very well in the sun to 0.01 over water or ice which reflect most of the energy back into space.<p>
|
||||
|
||||
The algorithm now tries to place a number <i>n</i> of clouds in a random position where <i>n</i> is a function of the user-specified strength of development, modified by the daily and geographical factors as described above. However, a cloud is only placed at a position with probability <i>p</i>, so a call to the convective system over city terrain will lead to significantly more clouds than a call with the same strength over water.<p>
|
||||
|
||||
The next task is to determine how the available thermal energy is released in convection across different thermals. There can be for example many weak thermals, or few strong thermals for the same energy. The empirical observation is that the number of thermals and clouds peaks around noon, whereas the strength of thermals peaks in the afternoon. The algorithm thus assigns a strength <i>1.5 * rand() + (2.0 * p))</i> to each cloud, which is again modified by a sinusoidal function with a peak shifted from noon to 15:30.<p>
|
||||
|
||||
Based on this strength parameter <i>s</i>, a cloud model is chosen, and the maximal thermal lift (in ft/s) is calculated as <i>3 + 1 * (s -1)</i> (note that this means that not every cloud is associated with lift). By default, the radius of thermals is assumed to range from 500 to 1000 m. The slider 'thermal properites' in the menu allows to modify the balance between radius and lift from these values. Since the flow profile in a thermal is approximately quadratic, requiring the same flux means that increasing the maximal lift by a factor <i>f</i> leads to a radius reduced by <i>1/f</i>. Moving the thermal properties slider to 'rough day' thus generates narrow thermals with large maximal lift and sink (which are more difficult to fly), moving it to low convection instead generates large thermals with weak lift.<p>
|
||||
|
||||
The following series of pictures, taken over KLSV (Nellis AFB, Las Vegas) illustrates the algorithm at work.<p>
|
||||
|
||||
At 7:00 am, the thermal activity is weak, and there is no lift available in thermals yet.<p>
|
||||
|
||||
<center>
|
||||
<img src="./KLSV-7_00.jpg">
|
||||
</center><p>
|
||||
|
||||
Some activity starts around 10:00 am the average available lift is 0.3 m/s, the more active clouds tend to be above city terrain.
|
||||
|
||||
<center>
|
||||
<img src="KLSV-10_00.jpg">
|
||||
</center><p>
|
||||
|
||||
At 12:00 noon, the maximal cloud number is reached. The average available lift is 1 m/s, in peaks up to 2 m/s.
|
||||
|
||||
<center>
|
||||
<img src="KLSV-12_00.jpg">
|
||||
</center><p>
|
||||
|
||||
The maximum of lift strength is reached close to 15:00 pm. The average lift is now 1.5 m/s, in peaks up to 3 m/s, and the strong convection leads to beginning overdevelopment, some clouds reach beyond the first inversion layer and tower higher up. At this point, the clouds may also overdevelop into a thunderstorm (which is not modelled explicitly by the convective algorithm as it requires somewhat different modelling, but is taken into account in the weather tiles).<p>
|
||||
|
||||
<center>
|
||||
<img src="KLSV-15_00.jpg">
|
||||
</center><p>
|
||||
|
||||
At 17:30 pm, the lift is still strong, 1.5 m/s on average and 2.5 m/s in peaks, but compared with the situation at noon, there are fewer clouds with stronger lift.<p>
|
||||
|
||||
<center>
|
||||
<img src="KLSV-17_30.jpg">
|
||||
</center><p>
|
||||
|
||||
At sunset around 19:00 pm, the number of clouds decreases quickly, but there is still a lot of residual thermal energy (the ground has not cooled down yet), therefore thermal lift of on average 1 m/s is still available even without solar energy input.
|
||||
|
||||
<center>
|
||||
<img src="KLSV-19_00.jpg">
|
||||
</center><p>
|
||||
|
||||
While not accurate in every respect, the model works fairly well to reproduce the actual time dependence of convective clouds and thermal lift during the day.<p>
|
||||
|
||||
<h3>The terrain presampling and cloud altitude determination algorithm</h3>
|
||||
|
||||
While the meaning of a cloud layer altitude is rather obvious in level terrain, this quickly becomes a highly non-trivial question in mountaineous terrain where the elevation of the terrain is more difficult to define. Observation of weather patterns in mountain regions suggests that clouds follow changes in terrain elevation to some degree, but not all cloud types do to the same degree. While convective clouds follow a change in elevation more readily even on small distance scales, layered clouds don't do so. The purpose of the terrain presampling and cloud altitude determination algorithm is to capture this behaviour as closely as possible.<p>
|
||||
|
||||
In nature, what determines the altitude of various clouds are the properties of air layers. In general, clouds become visible at the condensation altitude, i.e. when temperature and dew point merge and the relative humidity of air exceeds 100%. In conditions where there is a lot of vertical air movement (i.e. for Cumulus clouds), the conditions are much more local than in situations with lack of vertical movement (i.e. for layered clouds).<p>
|
||||
|
||||
In the algorithm, various proxies for the structure of air layers and hence the condensation altitude are used. It is assumed that air layers must follow the general slope of the terrain (because there is nowhere else to go), but can (at least to some degree) flow around isolated obstacles. To get the general layout of the terrain, the algorithm first samples the altitude of an 80x80 km square around the 40x40 weather tile to be created. The choice of a larger sampling area reduces the sensitvity of the outcome to purely local terrain features and prevent pronounced transitions from one tile to the next. The result of this sampling is a distribution of probability to find the terrain at a given altitude:<p>
|
||||
|
||||
<center>
|
||||
<img src="terrain1.jpg">
|
||||
</center><p>
|
||||
|
||||
For instance, the terrain around Geneva is mostly flat around 1000 ft (where the peak of the distribution lies) with some mountains up to 4500 ft nearby. Based on such distributions, the algorithm next determines the minimum altitude <i>alt_min</i>, the maximum altitude <i>alt_max</i>, the altitude below which 20% of the terrain are found <i>alt_20</i> and the median altitude below which 50% of the terrain are found <i>alt_med</i>.<p>
|
||||
|
||||
Cumulus clouds are always placed at a constant altitude above <i>alt_20</i>. This is done to ensure gorges and canyons do not provide a minimum in otherwise flat terrain so that clouds appear down in the gorge as opposed to on the rim where they would naturally occur. Basically, layers are assumed not to trace too fine structures in the terrain, so at least 20% of the terrain are required. In the test case of Grand Canyon, the algorithm correctly places the clouds at rim altitude rather than down in the canyon:
|
||||
|
||||
<center>
|
||||
<img src="cloud_altitude_02.jpg">
|
||||
</center><p>
|
||||
|
||||
However, convective clouds are given some freedom to adjust to the terrain. The maximally possible upward shift is given by <i>alt_med - alt_20</i>. This is based on the notion that above <i>alt_med</i>, the terrain is not a significant factor any more because the air can simply flow around any obstacle. However, this maximal shift is not always used - if the cloud is placed far above the terrain in the first place, it would not follow the terrain much. Thus, a factor of <i>1000 ft / altitude above terrain</i>, required to be between 0 and 1, modifies the shift. As a result, a cloud layer placed high above the terrain has no sensitivity to terrain features. The result of this procedure is that clouds show some degree of following terrain elevation, as seen here in Grenoble<p>
|
||||
|
||||
<center>
|
||||
<img src="cloud_altitude_03.jpg">
|
||||
</center><p>
|
||||
|
||||
but they do not follow all terrain features, especially not single isolated peaks as seen here at the example of Mt. Rainier:
|
||||
|
||||
<center>
|
||||
<img src="cloud_altitude_01.jpg">
|
||||
</center><p>
|
||||
|
||||
Finally, layered clouds have essentially no capability to shift with terrain elevation. Moreover, they are caused by large-scale weather processes, hence they do not usually shift upward over even large mountain massives. Currently, the model places them at <i>0.5 * (alt_min + alt_20)</i> base altitude in order to retain, even in mountains, the sensitivity to the flat terrain surrounding the massiv. usually this works well, but may have a problem with gorges in flat terrain. The following picture shows a Nimbostratus layer close to Grenoble:<p>
|
||||
|
||||
<center>
|
||||
<img src="cloud_altitude_04.jpg">
|
||||
</center><p>
|
||||
|
||||
<h3>The offline large scale weather pattern</h3>
|
||||
|
||||
The local weather package generates semi-plausible weather changes even in the absence of METAR information. These weather patterns are encoded in an algorithm governing the rules which weather tiles can have common borders.<p>
|
||||
|
||||
Weather tiles are classified chiefly by air pressure. What is currently in the models are three classes for a low pressure system, four different classes for the system of weather fronts and airmasses spiralling into the low pressure system and three classes for a hugh pressure system. The general rule is that low pressure tiles contain layered clouds, overcast skies and rain whereas the high pressure tiles contain clear skies and few convective clouds. The topology assumed for the weather system is apparent in the following diagram:
|
||||
|
||||
<center>
|
||||
<img src="weather_patterns.jpg">
|
||||
</center><p>
|
||||
|
||||
A transition between classes is possible whenever a class has a common border. However, if a transition actually takes place is probabilistic. Typically, the probability not to make a transition is about 80%. Since changes are only triggered for weather tiles one is actually in, the average distance over which weather patterns persist is 160 km. An exception to this are fronts - weather front tiles trigger changes based on direction rather than probability, so a warmfront will always be a sequence of 4 tiles, a coldfront will always be a small-scale phenomenon crossed within 30 km.
|
||||
|
||||
To avoid unrealistically large changes in pressure when generating a transition and randomly sampling central pressure in tiles from two different pressure classes, a monitoring algorithm limits the pressure difference between tiles to 2 mbar and ensures a slow transition from high pressure to low pressure regions.<p>
|
||||
|
||||
The weather algorithm is currently not able to handle the transition to tropical weather in the Hadley cell close to the equator, although tropical weather exists as a standalone tile and can be used in repetitive mode.<p>
|
||||
|
||||
<h2>Credits</h2>
|
||||
|
||||
The model of a thermal has been developed by Patrice Poly. The shader code used to transform clouds is heavily based on prior work by Stuart Buchanan.<p>
|
||||
|
||||
|
||||
Thorsten Renk, June 2010
|
||||
|
||||
</body>
|
||||
|
||||
|
|
BIN
Docs/carrier-ops08.jpg
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
Docs/cloud_altitude_01.jpg
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
Docs/cloud_altitude_02.jpg
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
Docs/cloud_altitude_03.jpg
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
Docs/cloud_altitude_04.jpg
Normal file
After Width: | Height: | Size: 49 KiB |
BIN
Docs/clouds-detailed01.jpg
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
Docs/clouds-lpb01.jpg
Normal file
After Width: | Height: | Size: 99 KiB |
BIN
Docs/clouds-tropical02.jpg
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
Docs/menu2.jpg
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 19 KiB |
BIN
Docs/terrain1.jpg
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
Docs/weather_patterns.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
|
@ -1,68 +1,58 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PropertyList>
|
||||
<name>Effects/clouds-thin</name>
|
||||
<parameters>
|
||||
<texture n ="0">
|
||||
</texture>
|
||||
</parameters>
|
||||
<technique n="10">
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/shader-effects</property>
|
||||
<less-equal>
|
||||
<value type="float">1.0</value>
|
||||
<shader-language/>
|
||||
</less-equal>
|
||||
</and>
|
||||
</predicate>
|
||||
<pass n="0">
|
||||
<!-- This is apparently not used, so maybe we'll blow it way soon. -->
|
||||
<lighting>true</lighting>
|
||||
<material>
|
||||
<ambient type="vec4d">0.5 0.5 0.5 1.0</ambient>
|
||||
<diffuse type="vec4d">0.5 0.5 0.5 1.0</diffuse>
|
||||
<color-mode>off</color-mode>
|
||||
</material>
|
||||
<alpha-test>
|
||||
<comparison>greater</comparison>
|
||||
<reference type="float">0.01</reference>
|
||||
</alpha-test>
|
||||
<shade-model>smooth</shade-model>
|
||||
<blend>
|
||||
<source>src-alpha</source>
|
||||
<destination>one-minus-src-alpha</destination>
|
||||
</blend>
|
||||
<depth>
|
||||
<write-mask>false</write-mask>
|
||||
</depth>
|
||||
<render-bin>
|
||||
<bin-number>10</bin-number>
|
||||
<bin-name>DepthSortedBin</bin-name>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
<unit>0</unit>
|
||||
<type>
|
||||
<use>texture[0]/type</use>
|
||||
</type>
|
||||
<image>
|
||||
<use>texture[0]/image</use>
|
||||
</image>
|
||||
<filter>
|
||||
<use>texture[0]/filter</use>
|
||||
</filter>
|
||||
<wrap-s>
|
||||
<use>texture[0]/wrap-s</use>
|
||||
</wrap-s>
|
||||
<wrap-t>
|
||||
<use>texture[0]/wrap-t</use>
|
||||
</wrap-t>
|
||||
<!--<wrap-s>clamp</wrap-s>
|
||||
<name>Effects/clouds-thin</name>
|
||||
<parameters>
|
||||
<texture n ="0">
|
||||
</texture>
|
||||
</parameters>
|
||||
<technique n="10">
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/shader-effects</property>
|
||||
<less-equal>
|
||||
<value type="float">1.0</value>
|
||||
<shader-language/>
|
||||
</less-equal>
|
||||
</and>
|
||||
</predicate>
|
||||
<pass n="0">
|
||||
<!-- This is apparently not used, so maybe we'll blow it way soon. -->
|
||||
<lighting>true</lighting>
|
||||
<material>
|
||||
<ambient type="vec4d">0.5 0.5 0.5 1.0</ambient>
|
||||
<diffuse type="vec4d">0.5 0.5 0.5 1.0</diffuse>
|
||||
<color-mode>off</color-mode>
|
||||
</material>
|
||||
<alpha-test>
|
||||
<comparison>greater</comparison>
|
||||
<reference type="float">0.01</reference>
|
||||
</alpha-test>
|
||||
<shade-model>smooth</shade-model>
|
||||
<blend>
|
||||
<source>src-alpha</source>
|
||||
<destination>one-minus-src-alpha</destination>
|
||||
</blend>
|
||||
<depth>
|
||||
<write-mask>false</write-mask>
|
||||
</depth>
|
||||
<render-bin>
|
||||
<bin-number>10</bin-number>
|
||||
<bin-name>DepthSortedBin</bin-name>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
<unit>0</unit>
|
||||
<type><use>texture[0]/type</use></type>
|
||||
<image><use>texture[0]/image</use></image>
|
||||
<filter><use>texture[0]/filter</use></filter>
|
||||
<wrap-s><use>texture[0]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[0]/wrap-t</use></wrap-t>
|
||||
<!--<wrap-s>clamp</wrap-s>
|
||||
<wrap-t>clamp</wrap-t>-->
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/clouds-thin.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/clouds-thin.frag</fragment-shader>
|
||||
<!--<attribute>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/clouds-thin.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/clouds-thin.frag</fragment-shader>
|
||||
<!--<attribute>
|
||||
<name>usrAttr3</name>
|
||||
<index>10</index>
|
||||
</attribute>
|
||||
|
@ -70,13 +60,13 @@
|
|||
<name>usrAttr4</name>
|
||||
<index>11</index>
|
||||
</attribute>-->
|
||||
</program>
|
||||
<uniform>
|
||||
<name>baseTexture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">0</value>
|
||||
</uniform>
|
||||
<vertex-program-two-side>true</vertex-program-two-side>
|
||||
</pass>
|
||||
</technique>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>baseTexture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">0</value>
|
||||
</uniform>
|
||||
<vertex-program-two-side>true</vertex-program-two-side>
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
||||
|
|
64
Effects/clouds-thinlayer.eff
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PropertyList>
|
||||
<name>Effects/clouds-layered</name>
|
||||
<parameters>
|
||||
<texture n ="0">
|
||||
</texture>
|
||||
</parameters>
|
||||
<technique n="10">
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/shader-effects</property>
|
||||
<less-equal>
|
||||
<value type="float">1.0</value>
|
||||
<shader-language/>
|
||||
</less-equal>
|
||||
</and>
|
||||
</predicate>
|
||||
<pass n="0">
|
||||
<!-- This is apparently not used, so maybe we'll blow it way soon. -->
|
||||
<lighting>true</lighting>
|
||||
<material>
|
||||
<ambient type="vec4d">0.5 0.5 0.5 1.0</ambient>
|
||||
<diffuse type="vec4d">0.5 0.5 0.5 1.0</diffuse>
|
||||
<color-mode>off</color-mode>
|
||||
</material>
|
||||
<alpha-test>
|
||||
<comparison>greater</comparison>
|
||||
<reference type="float">0.01</reference>
|
||||
</alpha-test>
|
||||
<shade-model>smooth</shade-model>
|
||||
<blend>
|
||||
<source>src-alpha</source>
|
||||
<destination>one-minus-src-alpha</destination>
|
||||
</blend>
|
||||
<depth>
|
||||
<write-mask>false</write-mask>
|
||||
</depth>
|
||||
<render-bin>
|
||||
<bin-number>10</bin-number>
|
||||
<bin-name>DepthSortedBin</bin-name>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
<unit>0</unit>
|
||||
<type><use>texture[0]/type</use></type>
|
||||
<image><use>texture[0]/image</use></image>
|
||||
<filter><use>texture[0]/filter</use></filter>
|
||||
<wrap-s><use>texture[0]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[0]/wrap-t</use></wrap-t>
|
||||
<!--<wrap-s>clamp</wrap-s>
|
||||
<wrap-t>clamp</wrap-t>-->
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/clouds-thinlayer.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/clouds-thinlayer.frag</fragment-shader>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>baseTexture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">0</value>
|
||||
</uniform>
|
||||
<vertex-program-two-side>true</vertex-program-two-side>
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
|
@ -5,6 +5,7 @@
|
|||
<texture n ="0">
|
||||
<type>white</type>
|
||||
</texture>
|
||||
<vertex-program-two-side type="bool">false</vertex-program-two-side>
|
||||
</parameters>
|
||||
<technique n="10">
|
||||
<predicate>
|
||||
|
@ -60,14 +61,23 @@
|
|||
</internal-format>
|
||||
-->
|
||||
</texture-unit>
|
||||
<vertex-program-two-side>
|
||||
<use>vertex-program-two-side</use>
|
||||
</vertex-program-two-side>
|
||||
<program>
|
||||
<vertex-shader>Shaders/model-default.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/default.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/model-default.frag</fragment-shader>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">0</value></uniform>
|
||||
<name>texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">0</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>twoSideHack</name>
|
||||
<type>bool</type>
|
||||
<value><use>vertex-program-two-side</use></value>
|
||||
</uniform>
|
||||
</pass>
|
||||
</technique>
|
||||
<technique n="11">
|
||||
|
@ -106,6 +116,10 @@
|
|||
<mode>modulate</mode>
|
||||
</environment>
|
||||
</texture-unit>
|
||||
<!-- A two-sided lighting model is set by default near the root
|
||||
of the scene graph. Perhaps that ought to be set in this
|
||||
effect?
|
||||
-->
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
||||
|
|
81
Effects/test.eff
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PropertyList>
|
||||
<name>Effects/test</name>
|
||||
<parameters>
|
||||
<texture n ="0">
|
||||
</texture>
|
||||
</parameters>
|
||||
<technique n="10">
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/shader-effects</property>
|
||||
<less-equal>
|
||||
<value type="float">1.0</value>
|
||||
<shader-language/>
|
||||
</less-equal>
|
||||
</and>
|
||||
</predicate>
|
||||
<pass n="0">
|
||||
<!-- This is apparently not used, so maybe we'll blow it way soon. -->
|
||||
<lighting>true</lighting>
|
||||
<material>
|
||||
<ambient type="vec4d">0.5 0.5 0.5 1.0</ambient>
|
||||
<diffuse type="vec4d">0.5 0.5 0.5 1.0</diffuse>
|
||||
<color-mode>off</color-mode>
|
||||
</material>
|
||||
<alpha-test>
|
||||
<comparison>greater</comparison>
|
||||
<reference type="float">0.01</reference>
|
||||
</alpha-test>
|
||||
<shade-model>smooth</shade-model>
|
||||
<blend>
|
||||
<source>src-alpha</source>
|
||||
<destination>one-minus-src-alpha</destination>
|
||||
</blend>
|
||||
<depth>
|
||||
<write-mask>false</write-mask>
|
||||
</depth>
|
||||
<render-bin>
|
||||
<bin-number>10</bin-number>
|
||||
<bin-name>DepthSortedBin</bin-name>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
<unit>0</unit>
|
||||
<type><use>texture[0]/type</use></type>
|
||||
<image><use>texture[0]/image</use></image>
|
||||
<filter><use>texture[0]/filter</use></filter>
|
||||
<wrap-s><use>texture[0]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[0]/wrap-t</use></wrap-t>
|
||||
<!--<wrap-s>clamp</wrap-s>
|
||||
<wrap-t>clamp</wrap-t>-->
|
||||
</texture-unit>
|
||||
<!--<attribute>
|
||||
<mypars type="vec3">0 0 0</mypars>
|
||||
<value type="int">10</value>
|
||||
</attribute>-->
|
||||
<program>
|
||||
<vertex-shader>Shaders/test.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/test.frag</fragment-shader>
|
||||
<!--<attribute>
|
||||
<name>usrAttr3</name>
|
||||
<index>10</index>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<name>usrAttr4</name>
|
||||
<index>11</index>
|
||||
</attribute>-->
|
||||
</program>
|
||||
<uniform>
|
||||
<name>baseTexture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">0</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>shading</name>
|
||||
<type>float</type>
|
||||
<value type="float">0.5</value>
|
||||
</uniform>
|
||||
<vertex-program-two-side>true</vertex-program-two-side>
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
|
@ -88,19 +88,13 @@
|
|||
</high>
|
||||
</axis>
|
||||
<!-- Buttons on the Yoke -->
|
||||
<button n="0"> <!-- Labled as E -->
|
||||
<desc>Change View</desc>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
v = getprop("/sim/current-view/view-number");
|
||||
v = v + 1;
|
||||
if (v > 4) {
|
||||
v = 0;
|
||||
}
|
||||
setprop("/sim/current-view/view-number", v);
|
||||
</script>
|
||||
</binding>
|
||||
<button n="0">
|
||||
<desc>Cycle View</desc>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>view.stepView(1)</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button n="1"> <!-- Labled as D -->
|
||||
<desc>Toggle parking break</desc>
|
||||
|
@ -217,4 +211,26 @@
|
|||
</binding>
|
||||
</mod-up>
|
||||
</button>
|
||||
<button n="20">
|
||||
<desc>thrust reverse</desc>
|
||||
<repeatable type="bool">false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
props.setAll("/controls/engines/engine", "reverser", 1);
|
||||
props.setAll("/controls/engines/engine", "throttle", 1);
|
||||
gui.popupTip("Thrust reverse on!");
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
props.setAll("/controls/engines/engine", "reverser", 0);
|
||||
props.setAll("/controls/engines/engine", "throttle", 0);
|
||||
gui.popupTip("Thrust reverse off!");
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
</button>
|
||||
</PropertyList>
|
||||
|
|
648
Nasal/weather_tile_management.nas
Normal file
|
@ -0,0 +1,648 @@
|
|||
########################################################
|
||||
# routines to set up, transform and manage weather tiles
|
||||
# Thorsten Renk, April 2010
|
||||
########################################################
|
||||
|
||||
|
||||
###################################
|
||||
# tile management loop
|
||||
###################################
|
||||
|
||||
var tile_management_loop = func {
|
||||
|
||||
var tNode = props.globals.getNode(lw~"tiles", 1).getChildren("tile");
|
||||
var viewpos = geo.aircraft_position(); # using viewpos here triggers massive tile ops for tower view...
|
||||
var code = getprop(lw~"tiles/tile[4]/code");
|
||||
var i = 0;
|
||||
var d_min = 100000.0;
|
||||
var i_min = 0;
|
||||
var distance_to_load = getprop(lw~"config/distance-to-load-tile-m");
|
||||
var distance_to_remove = getprop(lw~"config/distance-to-remove-tile-m");
|
||||
var current_heading = getprop("orientation/heading-deg");
|
||||
var loading_flag = getprop(lw~"tmp/asymmetric-tile-loading-flag");
|
||||
|
||||
foreach (var t; tNode) {
|
||||
|
||||
var tpos = geo.Coord.new();
|
||||
tpos.set_latlon(t.getNode("latitude-deg").getValue(),t.getNode("longitude-deg").getValue(),0.0);
|
||||
var d = viewpos.distance_to(tpos);
|
||||
if (d < d_min) {d_min = d; i_min = i;}
|
||||
var flag = t.getNode("generated-flag").getValue();
|
||||
|
||||
var dir = viewpos.course_to(tpos);
|
||||
var d_load = distance_to_load;
|
||||
var d_remove = distance_to_remove;
|
||||
if (loading_flag == 1)
|
||||
{
|
||||
if ((abs(dir-current_heading) > 135.0) and (abs(dir-current_heading) < 225.0))
|
||||
{
|
||||
d_load = 0.7 * d_load;
|
||||
d_remove = 0.7 * d_remove;
|
||||
}
|
||||
}
|
||||
|
||||
#print(d);
|
||||
if ((d < distance_to_load) and (flag==0)) # the tile needs to be generated, unless it already has been
|
||||
{
|
||||
setprop(lw~"tiles/tile-counter",getprop(lw~"tiles/tile-counter")+1);
|
||||
print("Building tile unique index ",getprop(lw~"tiles/tile-counter"));
|
||||
generate_tile(code, tpos.lat(), tpos.lon(),i);
|
||||
t.getNode("generated-flag").setValue(1);
|
||||
t.getNode("code",1).setValue(getprop(lw~"tiles/code"));
|
||||
t.getNode("tile-index",1).setValue(getprop(lw~"tiles/tile-counter"));
|
||||
}
|
||||
|
||||
if ((d > distance_to_remove) and (flag==1)) # the tile needs to be deleted if it exists
|
||||
{
|
||||
print("Removing tile, unique index ", t.getNode("tile-index").getValue());
|
||||
remove_tile(t.getNode("tile-index").getValue());
|
||||
t.getNode("generated-flag").setValue(0);
|
||||
}
|
||||
i = i + 1;
|
||||
} # end foreach
|
||||
|
||||
#print("Minimum distance to: ",i_min);
|
||||
|
||||
if (i_min != 4) # we've entered a different tile
|
||||
{
|
||||
print("Changing active tile to direction ", i_min);
|
||||
change_active_tile(i_min);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (getprop(lw~"tile-loop-flag") ==1) {settimer(tile_management_loop, 5.0);}
|
||||
|
||||
}
|
||||
|
||||
|
||||
###################################
|
||||
# tile generation call
|
||||
###################################
|
||||
|
||||
var generate_tile = func (code, lat, lon, dir_index) {
|
||||
|
||||
setprop(lw~"tiles/tmp/latitude-deg", lat);
|
||||
setprop(lw~"tiles/tmp/longitude-deg",lon);
|
||||
setprop(lw~"tiles/tmp/code",code);
|
||||
|
||||
# now see if we need to presample the terrain
|
||||
|
||||
if ((getprop(lw~"tmp/presampling-flag") == 1) and (getprop(lw~"tmp/presampling-status") == "idle"))
|
||||
{
|
||||
local_weather.terrain_presampling_start(lat, lon, 1000, 40000, getprop(lw~"tmp/tile-orientation-deg"));
|
||||
return;
|
||||
}
|
||||
|
||||
# now allow for some change in tile orientation
|
||||
|
||||
var alpha = getprop(lw~"tmp/tile-orientation-deg");
|
||||
alpha = alpha + 2.0 * (rand()-0.5) * 10.0;
|
||||
|
||||
# account for the systematic spin of weather systems around a low pressure core dependent on hemisphere
|
||||
if (lat >0.0) {alpha = alpha -3.0;}
|
||||
else {alpha = alpha +3.0;}
|
||||
|
||||
|
||||
setprop(lw~"tmp/tile-orientation-deg",alpha);
|
||||
|
||||
if (getprop(lw~"tmp/tile-management") == "repeat tile")
|
||||
{
|
||||
if (code == "altocumulus_sky"){weather_tiles.set_altocumulus_tile();}
|
||||
else if (code == "broken_layers") {weather_tiles.set_broken_layers_tile();}
|
||||
else if (code == "stratus") {weather_tiles.set_overcast_stratus_tile();}
|
||||
else if (code == "cumulus_sky") {weather_tiles.set_fair_weather_tile();}
|
||||
else if (code == "gliders_sky") {weather_tiles.set_gliders_sky_tile();}
|
||||
else if (code == "blue_thermals") {weather_tiles.set_blue_thermals_tile();}
|
||||
else if (code == "summer_rain") {weather_tiles.set_summer_rain_tile();}
|
||||
else if (code == "high_pressure_core") {weather_tiles.set_high_pressure_core_tile();}
|
||||
else if (code == "high_pressure") {weather_tiles.set_high_pressure_tile();}
|
||||
else if (code == "high_pressure_border") {weather_tiles.set_high_pressure_border_tile();}
|
||||
else if (code == "low_pressure_border") {weather_tiles.set_low_pressure_border_tile();}
|
||||
else if (code == "low_pressure") {weather_tiles.set_low_pressure_tile();}
|
||||
else if (code == "low_pressure_core") {weather_tiles.set_low_pressure_core_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 (getprop(lw~"tmp/tile-management") == "realistic weather")
|
||||
{
|
||||
var rn = rand();
|
||||
|
||||
if (code == "low_pressure_core")
|
||||
{
|
||||
if (rn > 0.2) {weather_tiles.set_low_pressure_core_tile();}
|
||||
else {weather_tiles.set_low_pressure_tile();}
|
||||
}
|
||||
else if (code == "low_pressure")
|
||||
{
|
||||
if (rn > 0.2) {weather_tiles.set_low_pressure_tile();}
|
||||
else if (rn > 0.1) {weather_tiles.set_low_pressure_core_tile();}
|
||||
else {weather_tiles.set_low_pressure_border_tile();}
|
||||
}
|
||||
else if (code == "low_pressure_border")
|
||||
{
|
||||
if (rn > 0.4) {weather_tiles.set_low_pressure_border_tile();}
|
||||
else if (rn > 0.3) {weather_tiles.set_cold_sector_tile();}
|
||||
else if (rn > 0.2) {weather_tiles.set_warm_sector_tile();}
|
||||
else if (rn > 0.1) {weather_tiles.set_low_pressure_tile();}
|
||||
else {weather_tiles.set_high_pressure_border_tile();}
|
||||
}
|
||||
else if (code == "high_pressure_border")
|
||||
{
|
||||
if (rn > 0.4) {weather_tiles.set_high_pressure_border_tile();}
|
||||
else if (rn > 0.3) {weather_tiles.set_cold_sector_tile();}
|
||||
else if (rn > 0.2) {weather_tiles.set_warm_sector_tile();}
|
||||
else if (rn > 0.1) {weather_tiles.set_high_pressure_tile();}
|
||||
else {weather_tiles.set_low_pressure_border_tile();}
|
||||
}
|
||||
else if (code == "high_pressure")
|
||||
{
|
||||
if (rn > 0.2) {weather_tiles.set_high_pressure_tile();}
|
||||
else if (rn > 0.1) {weather_tiles.set_high_pressure_border_tile();}
|
||||
else {weather_tiles.set_high_pressure_core_tile();}
|
||||
}
|
||||
else if (code == "high_pressure_core")
|
||||
{
|
||||
if (rn > 0.2) {weather_tiles.set_high_pressure_core_tile();}
|
||||
else {weather_tiles.set_high_pressure_tile();}
|
||||
}
|
||||
else if (code == "cold_sector")
|
||||
{
|
||||
if (rn > 0.3) {weather_tiles.set_cold_sector_tile();}
|
||||
else if (rn > 0.2)
|
||||
{
|
||||
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
|
||||
{weather_tiles.set_warmfront1_tile();}
|
||||
else if ((dir_index ==3) or (dir_index ==5))
|
||||
{weather_tiles.set_cold_sector_tile();}
|
||||
else if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
|
||||
{weather_tiles.set_coldfront_tile();}
|
||||
}
|
||||
else if (rn > 0.1) {weather_tiles.set_low_pressure_border_tile();}
|
||||
else {weather_tiles.set_high_pressure_border_tile();}
|
||||
}
|
||||
else if (code == "warm_sector")
|
||||
{
|
||||
if (rn > 0.3) {weather_tiles.set_warm_sector_tile();}
|
||||
else if (rn > 0.2)
|
||||
{
|
||||
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
|
||||
{weather_tiles.set_coldfront_tile();}
|
||||
else if ((dir_index ==3) or (dir_index ==5))
|
||||
{weather_tiles.set_warm_sector_tile();}
|
||||
else if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
|
||||
{weather_tiles.set_warmfront4_tile();}
|
||||
}
|
||||
else if (rn > 0.1) {weather_tiles.set_low_pressure_border_tile();}
|
||||
else {weather_tiles.set_high_pressure_border_tile();}
|
||||
}
|
||||
else if (code == "warmfront1")
|
||||
{
|
||||
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
|
||||
{weather_tiles.set_warmfront2_tile();}
|
||||
else if ((dir_index ==3) or (dir_index ==5))
|
||||
{weather_tiles.set_warmfront1_tile();}
|
||||
else if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
|
||||
{weather_tiles.set_cold_sector_tile();}
|
||||
}
|
||||
else if (code == "warmfront2")
|
||||
{
|
||||
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
|
||||
{weather_tiles.set_warmfront3_tile();}
|
||||
if ((dir_index ==3) or (dir_index ==5))
|
||||
{weather_tiles.set_warmfront2_tile();}
|
||||
if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
|
||||
{weather_tiles.set_warmfront1_tile();}
|
||||
}
|
||||
else if (code == "warmfront3")
|
||||
{
|
||||
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
|
||||
{weather_tiles.set_warmfront4_tile();}
|
||||
if ((dir_index ==3) or (dir_index ==5))
|
||||
{weather_tiles.set_warmfront3_tile();}
|
||||
if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
|
||||
{weather_tiles.set_warmfront2_tile();}
|
||||
}
|
||||
else if (code == "warmfront4")
|
||||
{
|
||||
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
|
||||
{weather_tiles.set_warm_sector_tile();}
|
||||
if ((dir_index ==3) or (dir_index ==5))
|
||||
{weather_tiles.set_warmfront4_tile();}
|
||||
if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
|
||||
{weather_tiles.set_warmfront3_tile();}
|
||||
}
|
||||
|
||||
} # end if mode == realistic weather
|
||||
}
|
||||
|
||||
|
||||
###################################
|
||||
# tile removal call
|
||||
###################################
|
||||
|
||||
|
||||
var remove_tile_loop = func (index) {
|
||||
|
||||
var n = 100;
|
||||
|
||||
var flag_mod = 0;
|
||||
|
||||
|
||||
var status = getprop(lw~"tmp/thread-status");
|
||||
|
||||
if ((status == "computing") or (status == "placing")) # the array is blocked
|
||||
{
|
||||
settimer( func {remove_tile_loop(index); },0); # try again next frame
|
||||
return;
|
||||
}
|
||||
else if (status == "idle") # we initialize the loop
|
||||
{
|
||||
mvec = props.globals.getNode("models", 1).getChildren("model");
|
||||
msize = size(mvec);
|
||||
setprop(lw~"tmp/last-reading-pos-mod", msize);
|
||||
setprop(lw~"tmp/thread-status", "removing");
|
||||
}
|
||||
|
||||
var lastpos = getprop(lw~"tmp/last-reading-pos-mod");
|
||||
|
||||
# print("msize: ", msize, "lastpos ", lastpos);
|
||||
|
||||
if (lastpos < (msize-1)) {var istart = lastpos;} else {var istart = (msize-1);}
|
||||
|
||||
if (istart<0) {istart=0;}
|
||||
|
||||
var i_min = istart - n;
|
||||
if (i_min < -1) {i_min =-1;}
|
||||
|
||||
for (var i = istart; i > i_min; i = i- 1)
|
||||
{
|
||||
m = mvec[i];
|
||||
if (m.getNode("legend",1).getValue() == "Cloud")
|
||||
{
|
||||
if (m.getNode("tile-index").getValue() == index)
|
||||
{
|
||||
m.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i<0) {flag_mod = 1;}
|
||||
|
||||
|
||||
if (flag_mod == 0) {setprop(lw~"tmp/last-reading-pos-mod",i); }
|
||||
|
||||
if (flag_mod == 0) # we still have work to do
|
||||
{settimer( func {remove_tile_loop(index); },0);}
|
||||
else
|
||||
{
|
||||
print("Tile deletion loop finished!");
|
||||
setprop(lw~"tmp/thread-status", "idle");
|
||||
setprop(lw~"clouds/placement-index",0);
|
||||
setprop(lw~"clouds/model-placement-index",0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# this is to avoid two tile removal loops starting at the same time
|
||||
|
||||
var waiting_loop = func (index) {
|
||||
|
||||
var status = getprop(lw~"tmp/thread-status");
|
||||
|
||||
if (status == "idle") {remove_tile_loop(index);}
|
||||
|
||||
else {
|
||||
print("Removal of ",index, " waiting for idle thread...");
|
||||
settimer( func {waiting_loop(index); },1.0);
|
||||
}
|
||||
}
|
||||
|
||||
var remove_tile = func (index) {
|
||||
|
||||
var n = size(props.globals.getNode("local-weather/clouds").getChild("tile",index,1).getChildren("cloud"));
|
||||
props.globals.getNode("local-weather/clouds", 1).removeChild("tile",index);
|
||||
setprop(lw~"clouds/cloud-number",getprop(lw~"clouds/cloud-number")-n);
|
||||
|
||||
if (getprop(lw~"tmp/thread-flag") == 1)
|
||||
#{remove_tile_loop(index);}
|
||||
#{waiting_loop(index);}
|
||||
# call the model removal in the next frame, because its initialization takes time
|
||||
# and we do a lot in this frame
|
||||
{settimer( func {waiting_loop(index); },0);}
|
||||
else
|
||||
{
|
||||
var modelNode = props.globals.getNode("models", 1).getChildren("model");
|
||||
foreach (var m; modelNode)
|
||||
{
|
||||
if (m.getNode("legend").getValue() == "Cloud")
|
||||
{
|
||||
if (m.getNode("tile-index").getValue() == index)
|
||||
{
|
||||
m.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var effectNode = props.globals.getNode("local-weather/effect-volumes").getChildren("effect-volume");
|
||||
|
||||
foreach (var e; effectNode)
|
||||
{
|
||||
if (e.getNode("tile-index").getValue() == index)
|
||||
{
|
||||
e.remove();
|
||||
setprop(lw~"effect-volumes/number",getprop(lw~"effect-volumes/number")-1);
|
||||
}
|
||||
}
|
||||
|
||||
# set placement indices to zero to reinitiate search for free positions
|
||||
|
||||
setprop(lw~"clouds/placement-index",0);
|
||||
setprop(lw~"clouds/model-placement-index",0);
|
||||
setprop(lw~"effect-volumes/effect-placement-index",0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
###################################
|
||||
# active tile change and neighbour
|
||||
# recomputation
|
||||
###################################
|
||||
|
||||
var change_active_tile = func (index) {
|
||||
|
||||
var t = props.globals.getNode(lw~"tiles").getChild("tile",index,0);
|
||||
|
||||
var lat = t.getNode("latitude-deg").getValue();
|
||||
var lon = t.getNode("longitude-deg").getValue();
|
||||
var alpha = getprop(lw~"tmp/tile-orientation-deg");
|
||||
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
copy_entry(4,8);
|
||||
copy_entry(3,7);
|
||||
copy_entry(1,5);
|
||||
copy_entry(0,4);
|
||||
create_neighbour(lat,lon,0,alpha);
|
||||
create_neighbour(lat,lon,1,alpha);
|
||||
create_neighbour(lat,lon,2,alpha);
|
||||
create_neighbour(lat,lon,3,alpha);
|
||||
create_neighbour(lat,lon,6,alpha);
|
||||
}
|
||||
else if (index == 1)
|
||||
{
|
||||
copy_entry(3,6);
|
||||
copy_entry(4,7);
|
||||
copy_entry(5,8);
|
||||
copy_entry(0,3);
|
||||
copy_entry(1,4);
|
||||
copy_entry(2,5);
|
||||
create_neighbour(lat,lon,0,alpha);
|
||||
create_neighbour(lat,lon,1,alpha);
|
||||
create_neighbour(lat,lon,2,alpha);
|
||||
}
|
||||
else if (index == 2)
|
||||
{
|
||||
copy_entry(4,6);
|
||||
copy_entry(1,3);
|
||||
copy_entry(2,4);
|
||||
copy_entry(5,7);
|
||||
create_neighbour(lat,lon,0,alpha);
|
||||
create_neighbour(lat,lon,1,alpha);
|
||||
create_neighbour(lat,lon,2,alpha);
|
||||
create_neighbour(lat,lon,5,alpha);
|
||||
create_neighbour(lat,lon,8,alpha);
|
||||
}
|
||||
else if (index == 3)
|
||||
{
|
||||
copy_entry(1,2);
|
||||
copy_entry(4,5);
|
||||
copy_entry(7,8);
|
||||
copy_entry(0,1);
|
||||
copy_entry(3,4);
|
||||
copy_entry(6,7);
|
||||
create_neighbour(lat,lon,0,alpha);
|
||||
create_neighbour(lat,lon,3,alpha);
|
||||
create_neighbour(lat,lon,6,alpha);
|
||||
}
|
||||
else if (index == 5)
|
||||
{
|
||||
copy_entry(1,0);
|
||||
copy_entry(4,3);
|
||||
copy_entry(7,6);
|
||||
copy_entry(2,1);
|
||||
copy_entry(5,4);
|
||||
copy_entry(8,7);
|
||||
create_neighbour(lat,lon,2,alpha);
|
||||
create_neighbour(lat,lon,5,alpha);
|
||||
create_neighbour(lat,lon,8,alpha);
|
||||
}
|
||||
else if (index == 6)
|
||||
{
|
||||
copy_entry(4,2);
|
||||
copy_entry(3,1);
|
||||
copy_entry(6,4);
|
||||
copy_entry(7,5);
|
||||
create_neighbour(lat,lon,0,alpha);
|
||||
create_neighbour(lat,lon,3,alpha);
|
||||
create_neighbour(lat,lon,6,alpha);
|
||||
create_neighbour(lat,lon,7,alpha);
|
||||
create_neighbour(lat,lon,8,alpha);
|
||||
}
|
||||
else if (index == 7)
|
||||
{
|
||||
copy_entry(3,0);
|
||||
copy_entry(4,1);
|
||||
copy_entry(5,2);
|
||||
copy_entry(6,3);
|
||||
copy_entry(7,4);
|
||||
copy_entry(8,5);
|
||||
create_neighbour(lat,lon,6,alpha);
|
||||
create_neighbour(lat,lon,7,alpha);
|
||||
create_neighbour(lat,lon,8,alpha);
|
||||
}
|
||||
else if (index == 8)
|
||||
{
|
||||
copy_entry(4,0);
|
||||
copy_entry(7,3);
|
||||
copy_entry(8,4);
|
||||
copy_entry(5,1);
|
||||
create_neighbour(lat,lon,2,alpha);
|
||||
create_neighbour(lat,lon,5,alpha);
|
||||
create_neighbour(lat,lon,6,alpha);
|
||||
create_neighbour(lat,lon,7,alpha);
|
||||
create_neighbour(lat,lon,8,alpha);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#####################################
|
||||
# copy tile info in neighbour matrix
|
||||
#####################################
|
||||
|
||||
var copy_entry = func (from_index, to_index) {
|
||||
|
||||
var tNode = props.globals.getNode(lw~"tiles");
|
||||
|
||||
var f = tNode.getChild("tile",from_index,0);
|
||||
var t = tNode.getChild("tile",to_index,0);
|
||||
|
||||
t.getNode("latitude-deg").setValue(f.getNode("latitude-deg").getValue());
|
||||
t.getNode("longitude-deg").setValue(f.getNode("longitude-deg").getValue());
|
||||
t.getNode("generated-flag").setValue(f.getNode("generated-flag").getValue());
|
||||
t.getNode("tile-index").setValue(f.getNode("tile-index").getValue());
|
||||
t.getNode("code").setValue(f.getNode("code").getValue());
|
||||
}
|
||||
|
||||
#####################################
|
||||
# create adjacent tile coordinates
|
||||
#####################################
|
||||
|
||||
var create_neighbour = func (blat, blon, index, alpha) {
|
||||
|
||||
var x = 0.0;
|
||||
var y = 0.0;
|
||||
var phi = alpha * math.pi/180.0;
|
||||
|
||||
calc_geo(blat);
|
||||
|
||||
if ((index == 0) or (index == 3) or (index == 6)) {x =-40000.0;}
|
||||
if ((index == 2) or (index == 5) or (index == 8)) {x = 40000.0;}
|
||||
|
||||
if ((index == 0) or (index == 1) or (index == 2)) {y = 40000.0;}
|
||||
if ((index == 6) or (index == 7) or (index == 8)) {y = -40000.0;}
|
||||
|
||||
var t = props.globals.getNode(lw~"tiles").getChild("tile",index,0);
|
||||
|
||||
t.getNode("latitude-deg",1).setValue(blat + get_lat(x,y,phi));
|
||||
t.getNode("longitude-deg",1).setValue(blon + get_lon(x,y,phi));
|
||||
t.getNode("generated-flag",1).setValue(0);
|
||||
t.getNode("tile-index",1).setValue(-1);
|
||||
t.getNode("code",1).setValue("");
|
||||
}
|
||||
|
||||
#####################################
|
||||
# find the 8 adjacent tile coordinates
|
||||
# after the initial setup call
|
||||
#####################################
|
||||
|
||||
var create_neighbours = func (blat, blon, alpha) {
|
||||
|
||||
var x = 0.0;
|
||||
var y = 0.0;
|
||||
var phi = alpha * math.pi/180.0;
|
||||
|
||||
calc_geo(blat);
|
||||
|
||||
x = -40000.0; y = 40000.0;
|
||||
setprop(lw~"tiles/tile[0]/latitude-deg",blat + get_lat(x,y,phi));
|
||||
setprop(lw~"tiles/tile[0]/longitude-deg",blon + get_lon(x,y,phi));
|
||||
setprop(lw~"tiles/tile[0]/generated-flag",0);
|
||||
setprop(lw~"tiles/tile[0]/tile-index",-1);
|
||||
setprop(lw~"tiles/tile[0]/code","");
|
||||
|
||||
x = 0.0; y = 40000.0;
|
||||
setprop(lw~"tiles/tile[1]/latitude-deg",blat + get_lat(x,y,phi));
|
||||
setprop(lw~"tiles/tile[1]/longitude-deg",blon + get_lon(x,y,phi));
|
||||
setprop(lw~"tiles/tile[1]/generated-flag",0);
|
||||
setprop(lw~"tiles/tile[1]/tile-index",-1);
|
||||
setprop(lw~"tiles/tile[1]/code","");
|
||||
|
||||
x = 40000.0; y = 40000.0;
|
||||
setprop(lw~"tiles/tile[2]/latitude-deg",blat + get_lat(x,y,phi));
|
||||
setprop(lw~"tiles/tile[2]/longitude-deg",blon + get_lon(x,y,phi));
|
||||
setprop(lw~"tiles/tile[2]/generated-flag",0);
|
||||
setprop(lw~"tiles/tile[2]/tile-index",-1);
|
||||
setprop(lw~"tiles/tile[2]/code","");
|
||||
|
||||
x = -40000.0; y = 0.0;
|
||||
setprop(lw~"tiles/tile[3]/latitude-deg",blat + get_lat(x,y,phi));
|
||||
setprop(lw~"tiles/tile[3]/longitude-deg",blon + get_lon(x,y,phi));
|
||||
setprop(lw~"tiles/tile[3]/generated-flag",0);
|
||||
setprop(lw~"tiles/tile[3]/tile-index",-1);
|
||||
setprop(lw~"tiles/tile[3]/code","");
|
||||
|
||||
# this is the current tile
|
||||
x = 0.0; y = 0.0;
|
||||
setprop(lw~"tiles/tile[4]/latitude-deg",blat + get_lat(x,y,phi));
|
||||
setprop(lw~"tiles/tile[4]/longitude-deg",blon + get_lon(x,y,phi));
|
||||
setprop(lw~"tiles/tile[4]/generated-flag",1);
|
||||
setprop(lw~"tiles/tile[4]/tile-index",1);
|
||||
setprop(lw~"tiles/tile[4]/code","");
|
||||
|
||||
|
||||
x = 40000.0; y = 0.0;
|
||||
setprop(lw~"tiles/tile[5]/latitude-deg",blat + get_lat(x,y,phi));
|
||||
setprop(lw~"tiles/tile[5]/longitude-deg",blon + get_lon(x,y,phi));
|
||||
setprop(lw~"tiles/tile[5]/generated-flag",0);
|
||||
setprop(lw~"tiles/tile[5]/tile-index",-1);
|
||||
setprop(lw~"tiles/tile[5]/code","");
|
||||
|
||||
x = -40000.0; y = -40000.0;
|
||||
setprop(lw~"tiles/tile[6]/latitude-deg",blat + get_lat(x,y,phi));
|
||||
setprop(lw~"tiles/tile[6]/longitude-deg",blon + get_lon(x,y,phi));
|
||||
setprop(lw~"tiles/tile[6]/generated-flag",0);
|
||||
setprop(lw~"tiles/tile[6]/tile-index",-1);
|
||||
setprop(lw~"tiles/tile[6]/code","");
|
||||
|
||||
x = 0.0; y = -40000.0;
|
||||
setprop(lw~"tiles/tile[7]/latitude-deg",blat + get_lat(x,y,phi));
|
||||
setprop(lw~"tiles/tile[7]/longitude-deg",blon + get_lon(x,y,phi));
|
||||
setprop(lw~"tiles/tile[7]/generated-flag",0);
|
||||
setprop(lw~"tiles/tile[7]/tile-index",-1);
|
||||
setprop(lw~"tiles/tile[7]/code","");
|
||||
|
||||
x = 40000.0; y = -40000.0;
|
||||
setprop(lw~"tiles/tile[8]/latitude-deg",blat + get_lat(x,y,phi));
|
||||
setprop(lw~"tiles/tile[8]/longitude-deg",blon + get_lon(x,y,phi));
|
||||
setprop(lw~"tiles/tile[8]/generated-flag",0);
|
||||
setprop(lw~"tiles/tile[8]/tile-index",-1);
|
||||
setprop(lw~"tiles/tile[8]/code","");
|
||||
}
|
||||
|
||||
###################
|
||||
# global variables
|
||||
###################
|
||||
|
||||
# these already exist in different namespace, but for ease of typing we define them here as well
|
||||
|
||||
var lat_to_m = 110952.0; # latitude degrees to meters
|
||||
var m_to_lat = 9.01290648208234e-06; # meters to latitude degrees
|
||||
var ft_to_m = 0.30480;
|
||||
var m_to_ft = 1.0/ft_to_m;
|
||||
var inhg_to_hp = 33.76389;
|
||||
var hp_to_inhg = 1.0/inhg_to_hp;
|
||||
var lon_to_m = 0.0; #local_weather.lon_to_m;
|
||||
var m_to_lon = 0.0; # local_weather.m_to_lon;
|
||||
var lw = "/local-weather/";
|
||||
|
||||
# storage array for model vector
|
||||
|
||||
var mvec = [];
|
||||
var msize = 0;
|
||||
|
||||
###################
|
||||
# helper functions
|
||||
###################
|
||||
|
||||
var calc_geo = func(clat) {
|
||||
|
||||
lon_to_m = math.cos(clat*math.pi/180.0) * lat_to_m;
|
||||
m_to_lon = 1.0/lon_to_m;
|
||||
}
|
||||
|
||||
var get_lat = func (x,y,phi) {
|
||||
|
||||
return (y * math.cos(phi) - x * math.sin(phi)) * m_to_lat;
|
||||
}
|
||||
|
||||
var get_lon = func (x,y,phi) {
|
||||
|
||||
return (x * math.cos(phi) + y * math.sin(phi)) * m_to_lon;
|
||||
}
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
varying float fogFactor;
|
||||
|
||||
float shade = 0.2;
|
||||
float cloud_height = 3000.0;
|
||||
float shade = 0.4;
|
||||
float cloud_height = 1000.0;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -23,13 +23,15 @@ void main(void)
|
|||
// Do the matrix multiplication by [ u r w pos]. Assume no
|
||||
// scaling in the homogeneous component of pos.
|
||||
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
gl_Position.xyz = gl_Vertex.x * u;
|
||||
gl_Position.xyz = gl_Vertex.x * u ;
|
||||
gl_Position.xyz += gl_Vertex.y * r * 1.0;
|
||||
gl_Position.xyz += gl_Vertex.z * w * 0.4;
|
||||
gl_Position.xyz += gl_Vertex.z * w * 1.0;//0.4;
|
||||
//gl_Position.xyz += gl_Vertex.y * r * wScale;
|
||||
//gl_Position.xyz += gl_Vertex.z * w * hScale;
|
||||
gl_Position.xyz += gl_Color.xyz;
|
||||
|
||||
gl_Position.z = gl_Position.z * 0.4;
|
||||
|
||||
// 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),
|
||||
|
@ -56,6 +58,6 @@ void main(void)
|
|||
gl_BackColor = gl_FrontColor;
|
||||
|
||||
// Fog doesn't affect clouds as much as other objects.
|
||||
fogFactor = exp( -gl_Fog.density * fogCoord * 0.2);
|
||||
fogFactor = exp( -gl_Fog.density * fogCoord * 0.5);
|
||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
varying float fogFactor;
|
||||
|
||||
float shade = 0.5;
|
||||
float shade = 0.6;
|
||||
float cloud_height = 1000.0;
|
||||
|
||||
void main(void)
|
||||
|
|
11
Shaders/clouds-thinlayer.frag
Normal file
|
@ -0,0 +1,11 @@
|
|||
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);
|
||||
}
|
||||
|
63
Shaders/clouds-thinlayer.vert
Normal file
|
@ -0,0 +1,63 @@
|
|||
// -*-C++-*-
|
||||
#version 120
|
||||
|
||||
varying float fogFactor;
|
||||
|
||||
float shade = 0.7;
|
||||
float cloud_height = 1000.0;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
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);
|
||||
|
||||
// Find a rotation matrix that rotates 1,0,0 into u. u, r and w are
|
||||
// the columns of that matrix.
|
||||
vec3 absu = abs(u);
|
||||
vec3 r = normalize(vec3(-u.y, u.x, 0));
|
||||
vec3 w = cross(u, r);
|
||||
|
||||
// Do the matrix multiplication by [ u r w pos]. Assume no
|
||||
// scaling in the homogeneous component of pos.
|
||||
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
gl_Position.xyz = gl_Vertex.x * u ;
|
||||
gl_Position.xyz += gl_Vertex.y * r * 1.0;
|
||||
gl_Position.xyz += gl_Vertex.z * w * 1.0;//0.4;
|
||||
//gl_Position.xyz += gl_Vertex.y * r * wScale;
|
||||
//gl_Position.xyz += gl_Vertex.z * w * hScale;
|
||||
gl_Position.xyz += gl_Color.xyz;
|
||||
|
||||
gl_Position.z = gl_Position.z * 0.2;
|
||||
|
||||
// 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);
|
||||
|
||||
// Final position of the sprite
|
||||
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, 300.0, fogCoord), 1 - smoothstep(25000.0, 30000.0, fogCoord));
|
||||
gl_BackColor = gl_FrontColor;
|
||||
|
||||
// Fog doesn't affect clouds as much as other objects.
|
||||
fogFactor = exp( -gl_Fog.density * fogCoord * 0.2);
|
||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
}
|
46
Shaders/model-default.frag
Normal file
|
@ -0,0 +1,46 @@
|
|||
// -*-C++-*-
|
||||
|
||||
varying vec4 diffuse, constantColor;
|
||||
varying vec3 normal, lightDir, halfVector;
|
||||
varying float fogCoord, alpha;
|
||||
|
||||
uniform bool twoSideHack;
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
float luminance(vec3 color)
|
||||
{
|
||||
return dot(vec3(0.212671, 0.715160, 0.072169), color);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 n, halfV;
|
||||
float NdotL, NdotHV, fogFactor;
|
||||
vec4 color = constantColor;
|
||||
vec4 texel;
|
||||
vec4 fragColor;
|
||||
vec4 specular = vec4(0.0);
|
||||
n = normalize(normal);
|
||||
if (twoSideHack && gl_Color.a == 0.0)
|
||||
n = -n;
|
||||
NdotL = max(dot(n, lightDir), 0.0);
|
||||
if (NdotL > 0.0) {
|
||||
color += diffuse * NdotL;
|
||||
halfV = normalize(halfVector);
|
||||
NdotHV = max(dot(n, halfV), 0.0);
|
||||
if (gl_FrontMaterial.shininess > 0.0)
|
||||
specular.rgb = (gl_FrontMaterial.specular.rgb
|
||||
* gl_LightSource[0].specular.rgb
|
||||
* pow(NdotHV, gl_FrontMaterial.shininess));
|
||||
}
|
||||
color.a = alpha;
|
||||
// This shouldn't be necessary, but our lighting becomes very
|
||||
// saturated. Clamping the color before modulating by the texture
|
||||
// is closer to what the OpenGL fixed function pipeline does.
|
||||
color = clamp(color, 0.0, 1.0);
|
||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
fragColor = color * texel + specular;
|
||||
fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||
gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||
}
|
|
@ -12,6 +12,8 @@ varying vec4 diffuse, constantColor;
|
|||
varying vec3 normal, lightDir, halfVector;
|
||||
varying float alpha, fogCoord;
|
||||
|
||||
uniform bool twoSideHack;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
@ -28,6 +30,12 @@ void main()
|
|||
alpha = gl_FrontMaterial.diffuse.a;
|
||||
else
|
||||
alpha = gl_Color.a;
|
||||
// Another hack for supporting two-sided lighting without using
|
||||
// gl_FrontFacing in the fragment shader.
|
||||
if (twoSideHack) {
|
||||
gl_FrontColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
gl_BackColor = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
constantColor = gl_FrontLightModelProduct.sceneColor
|
||||
+ gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
|
||||
fogCoord = abs(ecPosition3.z);
|
||||
|
|
|
@ -1,120 +1,118 @@
|
|||
// -*- mode: C; -*-
|
||||
// Licence: GPL v2
|
||||
// Author: Vivian Meazza.
|
||||
|
||||
#version 120
|
||||
|
||||
varying vec4 rawpos;
|
||||
varying vec4 ecPosition;
|
||||
varying vec3 VNormal;
|
||||
varying vec3 Normal;
|
||||
varying vec4 constantColor;
|
||||
varying vec3 vViewVec;
|
||||
varying vec3 reflVec;
|
||||
|
||||
varying vec4 Diffuse;
|
||||
varying vec3 lightDir, halfVector;
|
||||
varying float alpha, fogCoord;
|
||||
|
||||
uniform samplerCube Environment;
|
||||
uniform sampler2D Rainbow;
|
||||
uniform sampler2D BaseTex;
|
||||
uniform sampler2D Fresnel;
|
||||
uniform sampler2D Map;
|
||||
uniform sampler3D Noise;
|
||||
|
||||
uniform float refl_correction;
|
||||
uniform float rainbowiness;
|
||||
uniform float fresneliness;
|
||||
uniform float noisiness;
|
||||
uniform float ambient_correction;
|
||||
uniform float reflect_map;
|
||||
|
||||
void main (void)
|
||||
{
|
||||
if (!gl_FrontFacing) discard;
|
||||
|
||||
vec3 n, halfV;
|
||||
float NdotL, NdotHV;
|
||||
vec4 color = constantColor;
|
||||
vec4 specular = vec4(0.0);
|
||||
n = VNormal;
|
||||
NdotL = max(0.0, dot(n, lightDir));
|
||||
|
||||
// calculate the specular light
|
||||
if (NdotL > 0.0) {
|
||||
color += Diffuse * NdotL;
|
||||
halfV = normalize(halfVector);
|
||||
NdotHV = max(dot(n, halfV), 0.0);
|
||||
if (gl_FrontMaterial.shininess > 0.0)
|
||||
specular.rgb = (gl_FrontMaterial.specular.rgb
|
||||
* gl_LightSource[0].specular.rgb
|
||||
* pow(NdotHV, gl_FrontMaterial.shininess));
|
||||
}
|
||||
|
||||
color.a = alpha;
|
||||
color = clamp(color, 0.0, 1.0);
|
||||
vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st);
|
||||
vec4 texelcolor = color * texel + specular;
|
||||
|
||||
// calculate the fog factor
|
||||
float fogCoord = ecPosition.z;
|
||||
const float LOG2 = 1.442695;
|
||||
float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
|
||||
if(gl_Fog.density == 1.0)
|
||||
fogFactor=1.0;
|
||||
|
||||
vec3 normal = normalize(VNormal);
|
||||
vec3 viewVec = normalize(vViewVec);
|
||||
|
||||
// Map a rainbowish color
|
||||
float v = dot(viewVec, normal);
|
||||
vec4 rainbow = texture2D(Rainbow, vec2(v, 0.0));
|
||||
|
||||
// Map a fresnel effect
|
||||
vec4 fresnel = texture2D(Fresnel, vec2(v, 0.0));
|
||||
|
||||
// map the refection of the environment
|
||||
vec4 reflection = textureCube(Environment, reflVec);
|
||||
|
||||
// set the user shininess offse
|
||||
float transparency_offset = clamp(refl_correction, -1.0, 1.0);
|
||||
float reflFactor = 0.0;
|
||||
|
||||
if(reflect_map > 0){
|
||||
// map the shininess of the object with user input
|
||||
vec4 map = texture2D(Map, gl_TexCoord[0].st);
|
||||
//float pam = (map.a * -2) + 1; //reverse map
|
||||
reflFactor = map.a + transparency_offset;
|
||||
} else {
|
||||
// set the reflectivity proportional to shininess with user
|
||||
// input
|
||||
reflFactor = (gl_FrontMaterial.shininess / 128) + transparency_offset;
|
||||
}
|
||||
|
||||
reflFactor = clamp(reflFactor, 0.0, 1.0);
|
||||
|
||||
// set ambient adjustment to remove bluiness with user input
|
||||
float ambient_offset = clamp(ambient_correction, -1.0, 1.0);
|
||||
vec4 ambient_Correction = vec4(gl_LightSource[0].ambient.rg, gl_LightSource[0].ambient.b * 0.6, 0.5) * ambient_offset ;
|
||||
ambient_Correction = clamp(ambient_Correction, -1.0, 1.0);
|
||||
|
||||
// map noise vectore
|
||||
vec4 noisevec = texture3D(Noise, rawpos.xyz);
|
||||
|
||||
// add fringing fresnel and rainbow effects and modulate by reflection
|
||||
vec4 reflcolor = mix(reflection, rainbow, rainbowiness * v);
|
||||
vec4 reflfrescolor = mix(reflcolor, fresnel, fresneliness * v);
|
||||
vec4 noisecolor = mix(reflfrescolor, noisevec, noisiness);
|
||||
vec4 raincolor = vec4(noisecolor.rgb, 1.0) * reflFactor;
|
||||
|
||||
vec4 mixedcolor = mix(texel, raincolor, reflFactor);
|
||||
|
||||
// the final reflection
|
||||
vec4 reflColor = color * mixedcolor + specular + ambient_Correction ;
|
||||
reflColor = clamp(reflColor, 0.0, 1.0);
|
||||
|
||||
gl_FragColor = mix(gl_Fog.color, reflColor, fogFactor);
|
||||
}
|
||||
// -*- mode: C; -*-
|
||||
// Licence: GPL v2
|
||||
// Author: Vivian Meazza.
|
||||
|
||||
#version 120
|
||||
|
||||
varying vec4 rawpos;
|
||||
varying vec4 ecPosition;
|
||||
varying vec3 VNormal;
|
||||
varying vec3 Normal;
|
||||
varying vec4 constantColor;
|
||||
varying vec3 vViewVec;
|
||||
varying vec3 reflVec;
|
||||
|
||||
varying vec4 Diffuse;
|
||||
varying vec3 lightDir, halfVector;
|
||||
varying float alpha, fogCoord;
|
||||
|
||||
uniform samplerCube Environment;
|
||||
uniform sampler2D Rainbow;
|
||||
uniform sampler2D BaseTex;
|
||||
uniform sampler2D Fresnel;
|
||||
uniform sampler2D Map;
|
||||
uniform sampler3D Noise;
|
||||
|
||||
uniform float refl_correction;
|
||||
uniform float rainbowiness;
|
||||
uniform float fresneliness;
|
||||
uniform float noisiness;
|
||||
uniform float ambient_correction;
|
||||
uniform float reflect_map;
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec3 n, halfV;
|
||||
float NdotL, NdotHV;
|
||||
vec4 color = constantColor;
|
||||
vec4 specular = vec4(0.0);
|
||||
n = VNormal;
|
||||
NdotL = max(0.0, dot(n, lightDir));
|
||||
|
||||
// calculate the specular light
|
||||
if (NdotL > 0.0) {
|
||||
color += Diffuse * NdotL;
|
||||
halfV = normalize(halfVector);
|
||||
NdotHV = max(dot(n, halfV), 0.0);
|
||||
if (gl_FrontMaterial.shininess > 0.0)
|
||||
specular.rgb = (gl_FrontMaterial.specular.rgb
|
||||
* gl_LightSource[0].specular.rgb
|
||||
* pow(NdotHV, gl_FrontMaterial.shininess));
|
||||
}
|
||||
|
||||
color.a = alpha;
|
||||
color = clamp(color, 0.0, 1.0);
|
||||
vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st);
|
||||
vec4 texelcolor = color * texel + specular;
|
||||
|
||||
// calculate the fog factor
|
||||
float fogCoord = ecPosition.z;
|
||||
const float LOG2 = 1.442695;
|
||||
float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
|
||||
if(gl_Fog.density == 1.0)
|
||||
fogFactor=1.0;
|
||||
|
||||
vec3 normal = normalize(VNormal);
|
||||
vec3 viewVec = normalize(vViewVec);
|
||||
|
||||
// Map a rainbowish color
|
||||
float v = dot(viewVec, normal);
|
||||
vec4 rainbow = texture2D(Rainbow, vec2(v, 0.0));
|
||||
|
||||
// Map a fresnel effect
|
||||
vec4 fresnel = texture2D(Fresnel, vec2(v, 0.0));
|
||||
|
||||
// map the refection of the environment
|
||||
vec4 reflection = textureCube(Environment, reflVec);
|
||||
|
||||
// set the user shininess offse
|
||||
float transparency_offset = clamp(refl_correction, -1.0, 1.0);
|
||||
float reflFactor = 0.0;
|
||||
|
||||
if(reflect_map > 0){
|
||||
// map the shininess of the object with user input
|
||||
vec4 map = texture2D(Map, gl_TexCoord[0].st);
|
||||
//float pam = (map.a * -2) + 1; //reverse map
|
||||
reflFactor = map.a + transparency_offset;
|
||||
} else {
|
||||
// set the reflectivity proportional to shininess with user
|
||||
// input
|
||||
reflFactor = (gl_FrontMaterial.shininess / 128) + transparency_offset;
|
||||
}
|
||||
|
||||
reflFactor = clamp(reflFactor, 0.0, 1.0);
|
||||
|
||||
// set ambient adjustment to remove bluiness with user input
|
||||
float ambient_offset = clamp(ambient_correction, -1.0, 1.0);
|
||||
vec4 ambient_Correction = vec4(gl_LightSource[0].ambient.rg, gl_LightSource[0].ambient.b * 0.6, 0.5) * ambient_offset ;
|
||||
ambient_Correction = clamp(ambient_Correction, -1.0, 1.0);
|
||||
|
||||
// map noise vectore
|
||||
vec4 noisevec = texture3D(Noise, rawpos.xyz);
|
||||
|
||||
// add fringing fresnel and rainbow effects and modulate by reflection
|
||||
vec4 reflcolor = mix(reflection, rainbow, rainbowiness * v);
|
||||
vec4 reflfrescolor = mix(reflcolor, fresnel, fresneliness * v);
|
||||
vec4 noisecolor = mix(reflfrescolor, noisevec, noisiness);
|
||||
vec4 raincolor = vec4(noisecolor.rgb, 1.0) * reflFactor;
|
||||
|
||||
vec4 mixedcolor = mix(texel, raincolor, reflFactor);
|
||||
|
||||
// the final reflection
|
||||
vec4 reflColor = color * mixedcolor + specular + ambient_Correction ;
|
||||
reflColor = clamp(reflColor, 0.0, 1.0);
|
||||
|
||||
gl_FragColor = mix(gl_Fog.color, reflColor, fogFactor);
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ void main()
|
|||
vec4 specular = vec4(0.0);
|
||||
|
||||
n = normalize(normal);
|
||||
if (!gl_FrontFacing)
|
||||
n = -n;
|
||||
NdotL = max(dot(n, lightDir), 0.0);
|
||||
if (NdotL > 0.0) {
|
||||
color += diffuse * NdotL;
|
||||
|
|
11
Shaders/test.frag
Normal file
|
@ -0,0 +1,11 @@
|
|||
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);
|
||||
}
|
||||
|
91
Shaders/test.vert
Normal file
|
@ -0,0 +1,91 @@
|
|||
// -*-C++-*-
|
||||
#version 120
|
||||
|
||||
varying float fogFactor;
|
||||
|
||||
//attribute vec3 usrAttr3;
|
||||
//attribute vec3 usrAttr4;
|
||||
|
||||
//float textureIndexX = usrAttr3.r;
|
||||
//float textureIndexY = usrAttr3.g;
|
||||
//float wScale = usrAttr3.b;
|
||||
//float hScale = usrAttr4.r;
|
||||
//float shade = usrAttr4.g;
|
||||
//float cloud_height = usrAttr4.b;
|
||||
|
||||
//float shade = usrAttr3.r;
|
||||
//float cloud_height = usrAttr3.g;
|
||||
//float scale = usrAttr3.b;
|
||||
|
||||
float shading;
|
||||
|
||||
float shade = 0.3;
|
||||
float cloud_height = 1000.0;
|
||||
float scale = 0.5;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//shade = 0.1 * shade;
|
||||
//scale = 0.1 * scale;
|
||||
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
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 view = normalize(ep.xyz - l.xyz);
|
||||
|
||||
vec4 posh = gl_ModelViewMatrixInverse * normalize(vec4(gl_Vertex.x,gl_Vertex.y,gl_Vertex.z,1.0));
|
||||
vec3 pos = normalize(ep.xyz - posh.xyz);
|
||||
|
||||
mat4 sprime = mat4(1.0,0.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0);
|
||||
mat4 scale = gl_ModelViewMatrix * sprime * gl_ModelViewMatrixInverse;
|
||||
|
||||
float dist = sqrt(gl_Vertex.x * gl_Vertex.x + gl_Vertex.y * gl_Vertex.y + gl_Vertex.z * gl_Vertex.z);
|
||||
//vec3 u = normalize(smoothstep(500.0, 1500.0, dist) * pos + (1.0 - smoothstep(500.0, 1500.0, dist)) * view);
|
||||
//vec3 u = normalize(mix(pos, view, smoothstep(500.0,1500.0,dist)));
|
||||
vec3 u = view;
|
||||
|
||||
// Find a rotation matrix that rotates 1,0,0 into u. u, r and w are
|
||||
// the columns of that matrix.
|
||||
vec3 absu = abs(u);
|
||||
vec3 r = normalize(vec3(-u.y, u.x, 0));
|
||||
vec3 w = cross(u, r);
|
||||
|
||||
// Do the matrix multiplication by [ u r w pos]. Assume no
|
||||
// scaling in the homogeneous component of pos.
|
||||
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
gl_Position.xyz = gl_Vertex.x * u;
|
||||
gl_Position.xyz += gl_Vertex.y * r * 1.0;
|
||||
gl_Position.xyz += gl_Vertex.z * w * scale;
|
||||
//gl_Position.xyz += gl_Vertex.y * r * wScale;
|
||||
//gl_Position.xyz += gl_Vertex.z * w * hScale;
|
||||
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);
|
||||
|
||||
// Final position of the sprite
|
||||
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(10.0, 100.0, fogCoord), 1 - smoothstep(15000.0, 20000.0, fogCoord));
|
||||
gl_BackColor = gl_FrontColor;
|
||||
|
||||
// Fog doesn't affect clouds as much as other objects.
|
||||
fogFactor = exp( -gl_Fog.density * fogCoord * 0.2);
|
||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
}
|
BIN
Sounds/R-1535Slow.wav
Normal file
BIN
Sounds/blade_vortex.wav
Normal file
BIN
Sounds/rotor_stall.wav
Normal file
BIN
Sounds/starter_loop.wav
Normal file
BIN
Sounds/starter_start.wav
Normal file
BIN
Sounds/starter_stop.wav
Normal file
|
@ -74,9 +74,12 @@
|
|||
<value>Cirrus</value>
|
||||
<value>Cumulus</value>
|
||||
<value>Cumulonimbus</value>
|
||||
<value>Fog (thin)</value>
|
||||
<value>Fog (thick)</value>
|
||||
<value>Nimbus</value>
|
||||
<value>Stratus</value>
|
||||
<value>Stratus (structured)</value>
|
||||
<value>Stratus (thin)</value>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
|
@ -236,11 +239,15 @@
|
|||
<value>Altocumulus</value>
|
||||
<value>Cirrus</value>
|
||||
<value>Cumulus</value>
|
||||
<value>Cumulus (cloudlet)</value>
|
||||
<value>Cumulonimbus</value>
|
||||
<value>Cumulonimbus (rain)</value>
|
||||
<value>Fog (thin)</value>
|
||||
<value>Fog (thick)</value>
|
||||
<value>Nimbus</value>
|
||||
<value>Stratus</value>
|
||||
<value>Stratus (structured)</value>
|
||||
<value>Stratus (thin)</value>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
|
@ -647,10 +654,14 @@
|
|||
<value>Altocumulus</value>
|
||||
<value>Cirrus</value>
|
||||
<value>Cumulus</value>
|
||||
<value>Cumulus (cloudlet)</value>
|
||||
<value>Cumulonimbus</value>
|
||||
<value>Fog (thin)</value>
|
||||
<value>Fog (thick)</value>
|
||||
<value>Nimbus</value>
|
||||
<value>Stratus</value>
|
||||
<value>Stratus (structured)</value>
|
||||
<value>Stratus (thin)</value>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<name>local_weather_tiles</name>
|
||||
<width>300</width>
|
||||
<height>300</height>
|
||||
<height>330</height>
|
||||
<modal>false</modal>
|
||||
|
||||
|
||||
|
@ -19,19 +19,35 @@
|
|||
|
||||
<combo>
|
||||
<x>10</x>
|
||||
<y>220</y>
|
||||
<y>270</y>
|
||||
<width>280</width>
|
||||
<height>25</height>
|
||||
<live>true</live>
|
||||
<property>/local-weather/tmp/tile-type</property>
|
||||
<value>Altocumulus sky</value>
|
||||
<value>Broken layers</value>
|
||||
<value>Cirrus sky</value>
|
||||
<value>Fair weather</value>
|
||||
<value>High-pressure-core</value>
|
||||
<value>High-pressure</value>
|
||||
<value>High-pressure-border</value>
|
||||
<value>Low-pressure-border</value>
|
||||
<value>Low-pressure</value>
|
||||
<value>Low-pressure-core</value>
|
||||
<value>Cold-sector</value>
|
||||
<value>Coldfront</value>
|
||||
<value>Warmfront-1</value>
|
||||
<value>Warmfront-2</value>
|
||||
<value>Warmfront-3</value>
|
||||
<value>Warmfront-4</value>
|
||||
<value>Tropical</value>
|
||||
<value>---</value>
|
||||
<!--<value>Altocumulus sky</value>-->
|
||||
<!--<value>Broken layers</value>-->
|
||||
<!--<value>Cirrus sky</value>-->
|
||||
<!--<value>Fair weather</value>-->
|
||||
<value>Glider's sky</value>
|
||||
<value>Incoming rainfront</value>
|
||||
<value>Overcast stratus sky</value>
|
||||
<value>Summer rain</value>
|
||||
<value>Blue thermals</value>
|
||||
<!--<value>Incoming rainfront</value>-->
|
||||
<!--<value>8/8 stratus sky</value>-->
|
||||
<value>Test tile</value>
|
||||
<!--<value>Summer rain</value>-->
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
|
@ -39,32 +55,133 @@
|
|||
|
||||
<text>
|
||||
<x>10</x>
|
||||
<y>170</y>
|
||||
<y>220</y>
|
||||
<label>orientation (deg)</label>
|
||||
</text>
|
||||
|
||||
<input>
|
||||
<x>120</x>
|
||||
<y>170</y>
|
||||
<width>50</width>
|
||||
<x>115</x>
|
||||
<y>220</y>
|
||||
<width>40</width>
|
||||
<height>25</height>
|
||||
<property>/local-weather/tmp/tile-orientation-deg</property>
|
||||
</input>
|
||||
|
||||
<text>
|
||||
<x>170</x>
|
||||
<y>170</y>
|
||||
<x>155</x>
|
||||
<y>220</y>
|
||||
<label>alt. offset (ft)</label>
|
||||
</text>
|
||||
|
||||
<input>
|
||||
<x>250</x>
|
||||
<y>170</y>
|
||||
<width>40</width>
|
||||
<x>240</x>
|
||||
<y>220</y>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
<property>/local-weather/tmp/tile-alt-offset-ft</property>
|
||||
</input>
|
||||
|
||||
<text>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<label>tile selection mode</label>
|
||||
</text>
|
||||
|
||||
<combo>
|
||||
<x>150</x>
|
||||
<y>180</y>
|
||||
<width>140</width>
|
||||
<height>25</height>
|
||||
<live>true</live>
|
||||
<property>/local-weather/tmp/tile-management</property>
|
||||
<value>single tile</value>
|
||||
<value>repeat tile</value>
|
||||
<value>realistic weather</value>
|
||||
<value>METAR</value>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</combo>
|
||||
|
||||
<checkbox>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>15</width>
|
||||
<height>15</height>
|
||||
<label>Terrain presampling</label>
|
||||
<property>/local-weather/tmp/presampling-flag</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<checkbox>
|
||||
<x>150</x>
|
||||
<y>140</y>
|
||||
<width>15</width>
|
||||
<height>15</height>
|
||||
<label>Worker threads</label>
|
||||
<property>/local-weather/tmp/thread-flag</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<checkbox>
|
||||
<x>10</x>
|
||||
<y>110</y>
|
||||
<width>15</width>
|
||||
<height>15</height>
|
||||
<label>asymmetric range</label>
|
||||
<property>/local-weather/tmp/asymmetric-tile-loading-flag</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<checkbox>
|
||||
<x>150</x>
|
||||
<y>110</y>
|
||||
<width>15</width>
|
||||
<height>15</height>
|
||||
<label>detailed clouds</label>
|
||||
<property>/local-weather/config/detailed-clouds-flag</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<text>
|
||||
<x>10</x>
|
||||
<y>75</y>
|
||||
<label>Thermal properties:</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<label>rough day</label>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<x>80</x>
|
||||
<y>50</y>
|
||||
<width>90</width>
|
||||
<height>20</height>
|
||||
<min>0.3</min>
|
||||
<max>1.5</max>
|
||||
<property>/local-weather/config/thermal-properties</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</slider>
|
||||
|
||||
<text>
|
||||
<x>180</x>
|
||||
<y>50</y>
|
||||
<label>low convection</label>
|
||||
</text>
|
||||
|
||||
<group>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
|
|
654
gui/menubar.xml.alt
Normal file
|
@ -0,0 +1,654 @@
|
|||
<PropertyList>
|
||||
|
||||
<menu>
|
||||
<label>File</label>
|
||||
|
||||
<item>
|
||||
<label>Load</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>gui.load_flight()</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Save</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>gui.save_flight()</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Reset</label>
|
||||
<binding>
|
||||
<command>reset</command>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>High-Res Snapshot</label>
|
||||
<enabled>false</enabled>
|
||||
<binding>
|
||||
<command>hires-screen-capture</command>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Snapshot</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
var success = fgcommand("screen-capture");
|
||||
var path = getprop("/sim/paths/screenshot-last");
|
||||
if (success)
|
||||
gui.popupTip("Screenshot written to '" ~ path ~ "'");
|
||||
else
|
||||
gui.popupTip("Error writing screenshot '" ~ path ~ "'");
|
||||
</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Print Screen</label>
|
||||
<binding>
|
||||
<command>old-print-dialog</command>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Sound Configuration</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>sound-dialog</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Browse Internal Properties</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>gui.property_browser()</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Logging</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>logging</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Quit</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>exit</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu>
|
||||
<label>View</label>
|
||||
|
||||
<item>
|
||||
<label>Display Options</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>display</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Rendering Options</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>rendering</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>View Options</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>view</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Cockpit View Options</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>cockpit-view</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Adjust View Position</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>pilot_offset</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Adjust HUD Properties</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>hud</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Instant Replay</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>replay</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Adjust LOD Ranges</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>static-lod</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu>
|
||||
<label>Location</label>
|
||||
|
||||
<item>
|
||||
<label>Position Aircraft (on ground)</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>location-on-ground</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Position Aircraft (in air)</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>location-in-air</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Select Airport from List</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>airports</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Random Attitude</label>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>/sim/presets/trim</property>
|
||||
<value>false</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>property-randomize</command>
|
||||
<property>/orientation/pitch-deg</property>
|
||||
<min>0</min>
|
||||
<max>360</max>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>property-randomize</command>
|
||||
<property>/orientation/roll-deg</property>
|
||||
<min>0</min>
|
||||
<max>360</max>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>property-randomize</command>
|
||||
<property>/orientation/heading-deg</property>
|
||||
<min>0</min>
|
||||
<max>360</max>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Tower position</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>location-of-tower</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
</menu>
|
||||
|
||||
<menu>
|
||||
<label>Autopilot</label>
|
||||
<name>autopilot</name>
|
||||
|
||||
<item>
|
||||
<label>Autopilot Settings</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>autopilot</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Route Manager</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>route-manager</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Pop Waypoint</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>setprop("/autopilot/route-manager/input", "@pop")</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Clear Route</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>setprop("/autopilot/route-manager/input", "@clear")</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Set Lat/Lon Format</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
var f = getprop(var d = "/sim/lon-lat-format") + 1;
|
||||
setprop(d, f < 0 ? 0 : f > 2 ? 0 : f);
|
||||
</script>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu>
|
||||
<label>Environment</label>
|
||||
|
||||
<item>
|
||||
<label>Weather Scenario</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>weather_scenario</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Weather Conditions</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>weather</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Clouds</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>clouds</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Time Settings</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>timeofday</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Rain/Snow Settings</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>rainsnow</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Wildfire Settings</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>wildfire.dialog.show()</script>
|
||||
</binding>
|
||||
</item>
|
||||
<item>
|
||||
<label>Local Weather</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>local_weather</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
<item>
|
||||
<label>Local Weather Tiles</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>local_weather_tiles</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu>
|
||||
<label>Equipment</label>
|
||||
|
||||
<item>
|
||||
<label>Fuel and Payload</label>
|
||||
<name>fuel-and-payload</name>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>gui.showWeightDialog()</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Radio Settings</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>radios</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>GPS Settings</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>gps</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Instrument Settings</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>instruments</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Stopwatch</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>stopwatch-dialog</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Random Failures</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>random-failures</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>System Failures</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>system-failures</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Instrument Failures</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>instrument-failures</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu>
|
||||
<label>ATC/AI</label>
|
||||
|
||||
<item>
|
||||
<label>Frequencies</label>
|
||||
<binding>
|
||||
<command>ATC-freq-search</command>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Options</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>atc-ai</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Tanker</label>
|
||||
<name>tanker</name>
|
||||
<enabled>false</enabled>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>tanker</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu>
|
||||
<label>Network</label>
|
||||
<name>multiplayer</name>
|
||||
|
||||
<item>
|
||||
<label>Chat</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>chat-full</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Chat Menu</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>chat-menu</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Pilot List</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>multiplayer.dialog.show()</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>MPCarrier selection</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
if (contains(globals, "MPCarriers")) {
|
||||
MPCarriers.carrier_dialog.show();
|
||||
} else {
|
||||
gui.popupTip("No MPCarriers around at the moment.");
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu>
|
||||
<label>Debug</label>
|
||||
|
||||
<item>
|
||||
<label>Reload GUI</label>
|
||||
<binding>
|
||||
<command>reinit</command>
|
||||
<subsystem>gui</subsystem>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Reload Input</label>
|
||||
<binding>
|
||||
<command>reinit</command>
|
||||
<subsystem>input</subsystem>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Reload Panel</label>
|
||||
<binding>
|
||||
<command>panel-load</command>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Reload Autopilot</label>
|
||||
<binding>
|
||||
<command>reinit</command>
|
||||
<subsystem>xml-autopilot</subsystem>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Reload Network</label>
|
||||
<binding>
|
||||
<command>reinit</command>
|
||||
<subsystem>io</subsystem>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Nasal Console</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>nasal-console</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Development Keys</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>gui.showHelpDialog("/sim/help/debug")</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Configure Development Extensions</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>devel-extensions</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Display Tutorial Marker</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>tutorial.dialog()</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Dump Scene Graph</label>
|
||||
<binding>
|
||||
<command>dump-scenegraph</command>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Print Statistics</label>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>/sim/rendering/print-statistics</property>
|
||||
<value>true</value>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Cycle On-Screen Statistics</label>
|
||||
<binding>
|
||||
<command>property-adjust</command>
|
||||
<property>/sim/rendering/on-screen-statistics</property>
|
||||
<step type="int">1</step>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu>
|
||||
<label>Help</label>
|
||||
|
||||
<item>
|
||||
<label>Help</label>
|
||||
<binding>
|
||||
<command>old-help-dialog</command>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Joystick Information</label>
|
||||
<name>joystick-info</name>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>joystick-info</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Basic Keys</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>gui.showHelpDialog("/sim/help/basic")</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Common Aircraft Keys</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>gui.showHelpDialog("/sim/help/common")</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Aircraft Help</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>gui.showHelpDialog("/sim/help")</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Toggle Glide Slope Tunnel</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
var p = "/sim/rendering/glide-slope-tunnel";
|
||||
setprop(p, var i = !getprop(p));
|
||||
gui.popupTip("Glide slope tunnel " ~ (i ? "enabled" : "disabled"));
|
||||
</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Start Tutorial</label>
|
||||
<name>tutorial-start</name>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>tutorial</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>End Tutorial</label>
|
||||
<name>tutorial-stop</name>
|
||||
<enabled>false</enabled>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>tutorial.stopTutorial()</script>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
</PropertyList>
|
|
@ -269,6 +269,12 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<autopilot>
|
||||
<path>Aircraft/Generic/generic-autopilot.xml</path>
|
||||
</autopilot>
|
||||
<!--
|
||||
to be enabled when the hard coded helpers are gone
|
||||
<autopilot>
|
||||
<path>Aircraft/Generic/generic-autopilot-helper.xml</path>
|
||||
</autopilot>
|
||||
-->
|
||||
</systems>
|
||||
<instrumentation>
|
||||
<path>Aircraft/Generic/generic-instrumentation.xml</path>
|
||||
|
|