1
0
Fork 0

Merge branch 'master' of git://gitorious.org/fg/fgdata

This commit is contained in:
git@gitorious.org:~gijs/fg/gijss-fgdata.git 2010-08-17 13:28:09 +02:00
commit c1d421dbfe
143 changed files with 10703 additions and 5844 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 840 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View 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>

View file

@ -0,0 +1,194 @@
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1 amb 1 1 1 emis 0 0 0 spec 1 1 1 shi 100 trans 0.482
OBJECT world
kids 10
OBJECT poly
name "rect1"
loc -0.242457 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect2"
loc -0.188577 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect3"
loc -0.134698 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect4"
loc -0.0808192 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect5"
loc -0.0269392 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect6"
loc 0.0269398 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect7"
loc 0.0808188 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect8"
loc 0.134698 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect9"
loc 0.188578 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect10"
loc 0.242457 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View file

@ -0,0 +1,384 @@
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1 amb 1 1 1 emis 0 0 0 spec 1 1 1 shi 100 trans 0.482
OBJECT world
kids 20
OBJECT poly
name "rect1"
loc -0.51799 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect2"
loc -0.46411 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect3"
loc -0.410231 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect4"
loc -0.356352 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect5"
loc -0.302472 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect6"
loc -0.248593 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect7"
loc -0.194714 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect8"
loc -0.140835 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect9"
loc -0.086955 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect10"
loc -0.0330757 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect11"
loc 0.0208036 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect12"
loc 0.0746829 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect13"
loc 0.125599 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect14"
loc 0.176515 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect15"
loc 0.227431 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect16"
loc 0.278347 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect17"
loc 0.329263 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect18"
loc 0.380179 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect19"
loc 0.431095 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 25.062 -25
0 25.062 25
0 -24.938 25
0 -24.938 -25
numsurf 1
SURF 0x0
mat 0
refs 4
0 -0.046875 1.04687
1 1.04687 1.04687
2 1.04687 -0.0468746
3 -0.046875 -0.0468746
kids 0
OBJECT poly
name "rect20"
loc 0.48201 -0.06195 -1.19202e-006
texture "contrail.png"
crease 45.000000
numvert 4
0 -24.938 -25
0 -24.938 25
0 25.062 25
0 25.062 -25
numsurf 1
SURF 0x0
mat 0
refs 4
3 -0.046875 1.04687
2 1.04687 1.04687
1 1.04687 -0.0468746
0 -0.046875 -0.0468746
kids 0

View file

@ -11,7 +11,9 @@
# Global API. Automatically selects the right walker for the current view.
# NOTE: Coordinates are always 3 component lists: [x, y, z].
# NOTE: Coordinates are always 3 component lists: [x, y, z] in meters.
# The coordinate system is the same as the main 3d model one.
# X - back, Y - right and Z - up.
# Set the forward speed of the active walker.
# speed - walker speed in m/sec
@ -26,13 +28,85 @@ 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;
}
}
# Get the currently active walker.
# Returns the active walker object or nil otherwise.
var active_walker = func {
var cv = view.current.getPath();
if (contains(walkers, cv)) {
return walkers[cv];
} else {
return nil;
}
}
###############################################################################
# The walker class.
# ==============================================================================
# Class for a moving view.
#
# CONSTRUCTOR:
# walker.new(<view name>, <constraints>, <managers>);
#
# view name ... The name of the view : string
# constraints ... The movement constraints : constraint hash
# Determines where the view can go.
# managers ... Optional list of custom managers. A manager is a
# a hash that contains an update function of the type
# func(walker instance). The update function
# of each manager will be called as the last part of
# each walker update. Intended for controlling a
# a 3d model or similar.
#
# 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() : constraint 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);
#
# NOTES:
# Currently there can only be one view manager per view so the
# walk view should not have any other view manager.
#
var walker = {
new : func (view_name, constraints = nil) {
new : func (view_name, constraints = nil, managers = nil) {
var obj = { parents : [walker] };
obj.view = view.views[view.indexof(view_name)];
obj.constraints = constraints;
obj.managers = managers;
obj.position = [
obj.view.getNode("config/z-offset-m").getValue(),
obj.view.getNode("config/x-offset-m").getValue(),
@ -40,10 +114,11 @@ var walker = {
];
obj.heading =
obj.view.getNode("config/heading-offset-deg").getValue();
obj.speed = 0.0;
obj.id = 0;
obj.speed_fwd = 0.0;
obj.speed_side = 0.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 +131,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];
@ -64,7 +142,13 @@ var walker = {
me.position[2] = pos[2];
},
get_pos : func {
return me.position;
return [me.position[0], me.position[1], me.position[2]];
},
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,15 +161,14 @@ 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();
settimer(func { me._loop_(me.id); }, 0.0);
me.position[2] = me.goal_height;
},
stop : func {
me.isactive = 0;
me.id += 1;
},
# Internals.
# The update function is called by the view manager when the view is active.
update : func {
var t = getprop("/sim/time/elapsed-sec");
var dt = t - me.last_time;
@ -94,32 +177,49 @@ 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 * TO_RAD) +
me.speed_side * dt * math.sin(me.heading * TO_RAD);
me.position[1] -=
me.speed_fwd * dt * math.sin(me.heading * TO_RAD) -
me.speed_side * dt * math.cos(me.heading * TO_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]);
if (me.managers != nil) {
foreach(var m; me.managers) {
m.update(me);
}
}
me.last_time = t;
return 0.0;
},
_loop_ : func (id) {
if (me.id != id) return;
me.update();
settimer(func { me._loop_(id); }, 0.0);
}
};
###############################################################################
# Constraint classes.
# Constraint classes. Determines where the view can walk.
# Assumes that the constraints are convex.
# The union of two constraints.
# c1, c2 - the constraints : constraint
# NOTE: Assumes that the constraints are convex.
var unionConstraint = {
new : func (c1, c2) {
var obj = { parents : [unionConstraint] };
@ -145,6 +245,7 @@ var unionConstraint = {
};
# Build a unionConstraint hierarchy from a list of constraints.
# cs - list of constraints : [constraint]
var makeUnionConstraint = func (cs) {
if (size(cs) < 2) return cs[0];
@ -156,8 +257,8 @@ var makeUnionConstraint = func (cs) {
}
# Mostly aligned plane sloping along the X axis.
# minp - the X,Y minimum point
# maxp - the X,Y maximum point
# minp - the X,Y minimum point : position (meter)
# maxp - the X,Y maximum point : position (meter)
var slopingYAlignedPlane = {
new : func (minp, maxp) {
var obj = { parents : [slopingYAlignedPlane] };
@ -177,11 +278,86 @@ var slopingYAlignedPlane = {
},
};
# Action constraint
# Triggers an action when entering or exiting the constraint.
# constraint - the area in question : constraint
# 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;
}
};
###############################################################################
# Manager classes.
# JSBSim pointmass manager.
# Moves a pointmass representing the crew member together with the view.
# CONSTRUCTOR:
# JSBSimPointmass.new(<pointmass index>);
#
# pointmass index ... The index of the pointmass : int
# offsets ... [x, y ,z] position in meter of the origin of the
# JSBSim structural frame in the 3d model frame.
#
# NOTE: Only supports aligned frames (yet).
#
var JSBSimPointmass = {
new : func (index, offsets = nil) {
var base = props.globals.getNode("fdm/jsbsim/inertia");
var prefix = "pointmass-location-";
var postfix = "-inches[" ~ index ~"]";
var obj = { parents : [JSBSimPointmass] };
obj.pos_ft =
[
base.getNode(prefix ~ "X" ~ postfix),
base.getNode(prefix ~ "Y" ~ postfix),
base.getNode(prefix ~ "Z" ~ postfix)
];
obj.offset = (offsets == nil) ? [0.0, 0.0, 0.0] : offsets;
return obj;
},
update : func (walker) {
var pos = walker.get_pos();
pos[2] += walker.get_eye_height()/2;
forindex (var i; pos) {
me.pos_ft[i].setValue((pos[i] - me.offset[i])*M2FT*12);
}
}
};
###############################################################################
# Module implementation below
var RAD = math.pi/180;
var DEG = 180/math.pi;
var TO_RAD = math.pi/180;
var TO_DEG = 180/math.pi;
var walkers = {};

View 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>derivative</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>

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -1,54 +0,0 @@
<?xml version="1.0"?>
<PropertyList>
<path>Turn.ac</path>
<animation>
<type>material</type>
<object-name>Face</object-name>
<object-name>PtrTip</object-name>
<object-name>BallEnclosure</object-name>
<emission>
<red>1.0</red>
<green>0.2</green>
<blue>0.0</blue>
<factor-prop>sim/model//material/instruments/factor</factor-prop>
</emission>
</animation>
<animation>
<type>rotate</type>
<object-name>PtrCtr</object-name>
<object-name>PtrTip</object-name>
<property>instrumentation/turn-indicator/indicated-turn-rate</property>
<factor>20.0</factor>
<axis>
<x>-1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>Ball</object-name>
<property>instrumentation/slip-skid-ball/indicated-slip-skid</property>
<factor>21</factor>
<min-deg>-19</min-deg>
<max-deg>19</max-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0.05</z-m>
</center>
<axis>
<x>-1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
</PropertyList>

View file

@ -4,10 +4,10 @@
<path>c172p.ac</path>
<offsets>
<pitch-deg>-3.0</pitch-deg>
<pitch-deg>-3.0</pitch-deg>
<z-m> -0.065 </z-m>
</offsets>
<!-- Normal shader effect. Separate effects required for each normal map texture -->
<effect>
@ -18,12 +18,12 @@
<object-name>leftaileron</object-name>
</effect>
<effect>
<inherits-from>Aircraft/c172p/Models/Effects/bumpspec-fuselage</inherits-from>
<object-name>fuselage_1</object-name>
</effect>
<effect>
<inherits-from>Aircraft/c172p/Models/Effects/bumpspec-tail</inherits-from>
<object-name>vstab</object-name>
@ -144,7 +144,7 @@
<model>
<name>Turn</name>
<path>Aircraft/c172p/Instruments/Turn/Turn.xml</path>
<path>Aircraft/Instruments-3d/tc/tc.xml</path>
<offsets>
<x-m>-0.368</x-m>
<y-m>-0.311</y-m>
@ -352,7 +352,7 @@
<z-m>-0.65</z-m>
</offsets>
</model>
<model>
<name>CoPilotPedals</name>
<path>Aircraft/c172p/Models/Pedals/pedals.xml</path>
@ -362,7 +362,7 @@
<z-m>-0.65</z-m>
</offsets>
</model>
<text>
<name>Registration</name>
<type type="string">text-value</type>
@ -384,11 +384,11 @@
<x-m>-0.34</x-m>
<y-m>0.25</y-m>
<z-m>0.01</z-m>
</offsets>
</offsets>
</text>
<!-- Labels activated by hotspots -->
<!-- Labels activated by hotspots -->
<text>
<name>LabelASI</name>
<type type="string">literal</type>
@ -409,7 +409,7 @@
<x-m>-0.34</x-m>
<y-m>-0.311</y-m>
<z-m>0.068</z-m>
</offsets>
</offsets>
</text>
<text>
@ -432,7 +432,7 @@
<x-m>-0.34</x-m>
<y-m>-0.222</y-m>
<z-m>0.069</z-m>
</offsets>
</offsets>
</text>
<text>
@ -455,7 +455,7 @@
<x-m>-0.3</x-m>
<y-m>0.00</y-m>
<z-m>0.18</z-m>
</offsets>
</offsets>
</text>
<text>
@ -478,7 +478,7 @@
<x-m>-0.34</x-m>
<y-m>-0.133</y-m>
<z-m>0.069</z-m>
</offsets>
</offsets>
</text>
<text>
@ -501,7 +501,7 @@
<x-m>-0.34</x-m>
<y-m>-0.410</y-m>
<z-m>-0.171</z-m>
</offsets>
</offsets>
</text>
<text>
@ -524,7 +524,7 @@
<x-m>-0.34</x-m>
<y-m>0.116</y-m>
<z-m>-0.085</z-m>
</offsets>
</offsets>
</text>
<text>
@ -547,7 +547,7 @@
<x-m>-0.34</x-m>
<y-m>0.116</y-m>
<z-m>-0.142</z-m>
</offsets>
</offsets>
</text>
<text>
@ -570,7 +570,7 @@
<x-m>-0.34</x-m>
<y-m>-0.311</y-m>
<z-m>-0.037</z-m>
</offsets>
</offsets>
</text>
<text>
@ -593,7 +593,7 @@
<x-m>-0.34</x-m>
<y-m>-0.131</y-m>
<z-m>-0.036</z-m>
</offsets>
</offsets>
</text>
<text>
@ -616,7 +616,7 @@
<x-m>-0.34</x-m>
<y-m>-0.311</y-m>
<z-m>-0.142</z-m>
</offsets>
</offsets>
</text>
<text>
@ -639,7 +639,7 @@
<x-m>-0.34</x-m>
<y-m>-0.222</y-m>
<z-m>-0.036</z-m>
</offsets>
</offsets>
</text>
<text>
@ -662,7 +662,7 @@
<x-m>-0.34</x-m>
<y-m>-0.041</y-m>
<z-m>0.069</z-m>
</offsets>
</offsets>
</text>
<text>
@ -685,7 +685,7 @@
<x-m>-0.34</x-m>
<y-m>-0.041</y-m>
<z-m>-0.036</z-m>
</offsets>
</offsets>
</text>
<text>
@ -708,7 +708,7 @@
<x-m>-0.34</x-m>
<y-m>-0.041</y-m>
<z-m>-0.141</z-m>
</offsets>
</offsets>
</text>
<text>
@ -731,7 +731,7 @@
<x-m>-0.34</x-m>
<y-m>0.113</y-m>
<z-m>0.025</z-m>
</offsets>
</offsets>
</text>
<text>
@ -754,7 +754,7 @@
<x-m>-0.34</x-m>
<y-m>0.113</y-m>
<z-m>-0.02</z-m>
</offsets>
</offsets>
</text>
<text>
@ -777,7 +777,7 @@
<x-m>-0.34</x-m>
<y-m>0.113</y-m>
<z-m>0.100</z-m>
</offsets>
</offsets>
</text>
<text>
@ -800,7 +800,7 @@
<x-m>-0.34</x-m>
<y-m>0.113</y-m>
<z-m>0.061</z-m>
</offsets>
</offsets>
</text>
<text>
@ -823,7 +823,7 @@
<x-m>-0.34</x-m>
<y-m>-0.389</y-m>
<z-m>0.049</z-m>
</offsets>
</offsets>
</text>
<text>
@ -846,7 +846,7 @@
<x-m>-0.34</x-m>
<y-m>-0.432</y-m>
<z-m>0.0228</z-m>
</offsets>
</offsets>
</text>
<text>
@ -869,7 +869,7 @@
<x-m>-0.34</x-m>
<y-m>-0.405</y-m>
<z-m>-0.013</z-m>
</offsets>
</offsets>
</text>
<text>
@ -892,7 +892,7 @@
<x-m>-0.34</x-m>
<y-m>-0.405</y-m>
<z-m>-0.060</z-m>
</offsets>
</offsets>
</text>
<text>
@ -915,7 +915,7 @@
<x-m>-0.34</x-m>
<y-m>-0.414</y-m>
<z-m>-0.250</z-m>
</offsets>
</offsets>
</text>
<text>
@ -938,7 +938,7 @@
<x-m>-0.34</x-m>
<y-m>-0.035</y-m>
<z-m>-0.273</z-m>
</offsets>
</offsets>
</text>
<text>
@ -961,7 +961,7 @@
<x-m>-0.34</x-m>
<y-m>0.19</y-m>
<z-m>-0.25</z-m>
</offsets>
</offsets>
</text>
<text>
@ -984,7 +984,7 @@
<x-m>-0.34</x-m>
<y-m>-0.20</y-m>
<z-m>-0.29</z-m>
</offsets>
</offsets>
</text>
<text>
@ -1007,7 +1007,7 @@
<x-m>-0.34</x-m>
<y-m>-0.08</y-m>
<z-m>-0.19</z-m>
</offsets>
</offsets>
</text>
<text>
@ -1030,7 +1030,7 @@
<x-m>-0.34</x-m>
<y-m>-0.02</y-m>
<z-m>-0.18</z-m>
</offsets>
</offsets>
</text>
<text>
@ -1053,7 +1053,7 @@
<x-m>-0.34</x-m>
<y-m> 0.07</y-m>
<z-m>-0.18</z-m>
</offsets>
</offsets>
</text>
<text>
@ -1076,7 +1076,7 @@
<x-m>-0.24</x-m>
<y-m>-0.10</y-m>
<z-m>-0.38</z-m>
</offsets>
</offsets>
</text>
<animation>
@ -1117,7 +1117,7 @@
<blue>0.0</blue>
</emission>
</animation>
<animation>
<type>select</type>
<object-name>LabelASI</object-name>
@ -1271,7 +1271,7 @@
</animation>
<!--door animation-->
<animation>
<animation>
<type>rotate</type>
<object-name>rightdoor</object-name>
<object-name>rightwindow</object-name>
@ -1304,7 +1304,7 @@
<z2-m>-0.117</z2-m>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>doorhandleint_right</object-name>
@ -1334,7 +1334,7 @@
<z>0.0</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>leftdoor</object-name>
@ -1396,13 +1396,13 @@
<z>0.0</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>baggagedoor</object-name>
<object-name>baggagedoor.002</object-name>
<object-name>baggagedoorhandle</object-name>
<object-name>baggagedoorhandle</object-name>
<property>/sim/model/door-positions/baggageDoor/position-norm</property>
<factor>-90</factor>
<axis>
@ -1513,7 +1513,7 @@
<z>0.0</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>ParkingBrake</object-name>
@ -1557,7 +1557,7 @@
<z>0.0</z>
</axis>
</animation>
<animation>
<type>pick</type>
<object-name>CarbHeatGroup</object-name>
@ -1583,7 +1583,7 @@
<z>0.0</z>
</axis>
</animation>
<animation>
<type>pick</type>
<object-name>Throttle</object-name>
@ -1628,7 +1628,7 @@
<z>0.0</z>
</axis>
</animation>
<animation>
<type>pick</type>
<object-name>Mixture</object-name>
@ -1660,7 +1660,7 @@
<wrap>0</wrap>
</binding>
</action>
</animation>
</animation>
<!-- Elevator Trim -->
<animation>
@ -1710,7 +1710,7 @@
</binding>
</action>
</animation>
<animation>
<type>rotate</type>
<object-name>ElevatorTrimPos</object-name>
@ -1727,7 +1727,7 @@
<z-m>-0.48</z-m>
</center>
</animation>
<animation>
<type>rotate</type>
@ -1745,7 +1745,7 @@
<z-m>-0.221</z-m>
</center>
</animation>
<animation>
<type>rotate</type>
<object-name>LandingLightSwitch</object-name>
@ -1964,7 +1964,7 @@
</axis>
</animation>
<animation>
<type>rotate</type>
@ -2104,7 +2104,7 @@
<x2-m>5.088</x2-m>
<y2-m>0.813</y2-m>
<z2-m>-0.457</z2-m>
</axis>
</axis>
</animation>
<!--<animation>
@ -2140,7 +2140,7 @@
<z2-m>1.007</z2-m>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>fairing1</object-name>
@ -2160,7 +2160,7 @@
<z2-m>-1.172</z2-m>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>fairing1</object-name>
@ -2176,7 +2176,7 @@
<z>1.0</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>TopLink</object-name>
@ -2248,7 +2248,7 @@
<z>0.0</z>
</axis>
</animation>
<!--Lights-->
<!--landinglight-->
<animation>
@ -2269,9 +2269,9 @@
</not>
</condition>
</animation>
<animation>
<type>noshadow</type>
<object-name>landinglight</object-name>
@ -2307,7 +2307,7 @@
<property>/sim/model/c172p/lighting/strobes/state</property>
</condition>
</animation>
<animation>
<type>range</type>
<min-m>0</min-m>
@ -2326,7 +2326,7 @@
<object-name>strobe2</object-name>
</animation>
<animation>
<type>alpha-test</type>
<object-name>Plane.014XGroup</object-name>
@ -2411,7 +2411,7 @@
<condition>
<property>/sim/model/c172p/lighting/beacon-top/state</property>
</condition>
</animation>
</animation>
<animation>
<type>range</type>
@ -2425,7 +2425,7 @@
<light-far>10</light-far>
</BeaconOffXparams>
<animation>
<type>alpha-test</type>
<object-name>BeaconOffX</object-name>
@ -2475,7 +2475,7 @@
<property>sim/model/c172p/fairing1</property>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>fairing2</object-name>
@ -2483,7 +2483,7 @@
<property>sim/model/c172p/fairing2</property>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>fairing3</object-name>
@ -2491,7 +2491,7 @@
<property>sim/model/c172p/fairing3</property>
</condition>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2501,7 +2501,7 @@
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2510,7 +2510,7 @@
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2519,7 +2519,7 @@
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2528,7 +2528,7 @@
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2537,7 +2537,7 @@
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2549,7 +2549,7 @@
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2558,7 +2558,7 @@
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2567,7 +2567,7 @@
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2576,7 +2576,7 @@
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2585,7 +2585,7 @@
<texture-prop>texture</texture-prop>
<texture>wing.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->
@ -2603,7 +2603,7 @@
<texture-prop>texture</texture-prop>
<texture>wing.png</texture>
</animation>
<animation>
<type>material</type>
<!--global type="bool">true</global-->

BIN
Docs/KLSV-10_00.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

BIN
Docs/KLSV-12_00.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
Docs/KLSV-15_00.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
Docs/KLSV-17_30.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

BIN
Docs/KLSV-19_00.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
Docs/KLSV-5_00.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
Docs/KLSV-7_00.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Binary file not shown.

View file

@ -7,7 +7,7 @@
<body>
<h1>Local Weather Package - v0.5</h1>
<h1>Local Weather Package - v0.8</h1>
<h2>1. Introduction</h2>
@ -15,21 +15,22 @@ 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.8, the package supplies various cloud placement algorithms, as well as local control over most major weather parameters (wind, visibility, pressure, temperature, rain, snow, thermal lift, turbulence...) through interpolation routines and event volumes. The dynamics of the different systems is tied together - clouds and weather effects drift in the specified wind field. The package also contains a fairly detailed algorithm to generate convective clouds and thermals with a realistic distribution. Unfortunately, as of v0.8, there is no interaction yet between the windfield and the cloud-generating algorithms, i.e. while the placement algorithms create a realistic configuration of thermals and convective clouds, the wind will simply move this configuration, not create, destroy or move clouds in altitude dynamically (which would be realistic). <p>
For long-range flights, the system 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>
<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>
This adds the items <i>Local Weather</i> and <i>Local weather tiles</i> to the <i>Environment</i> menu when Flightgear is up. Most of the basic 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>
<h2>3. Functionality</h2>
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 general rule is that the gui is not hardened against problematic user input, for example it will not reject meaningless input like negative windspeeds or unphysical windshear. 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. During this time, a reduced framerate is to be expected<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 five 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 +50,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 +84,75 @@ 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 are classified by airmass, whereas the last two are scenarios intended for soaring. <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>
Below are entries for three parameters. The first two are the simplified version of wind direction and speed for the user who is not interested in specifying many different wind interpolation points.
The third 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. The offset may at present also be useful for dynamical weather, as convective clouds with terrain presampling follow terrain altitude, which looks strange when the clouds are allowed to drift in the wind without altitude correction. <p>
The following pictures show the results of tile setups 'Incoming rainfront' and 'Summer rain':<p>
The dropdown menu for the wind contains various models for how the windfield is specified which require a different amount of user-specified input. The options are described further down when the windfield modelling is described in more detail.<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 five 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 option 'dynamical weather' ties all clouds and weather effects to the windfield. If that option is not chosen, the wind is still generated according to the chosen model, but only felt by the aircraft. This makes e.g. soaring unrealistic, as the aircraft continuously drifts out of a static thermal below a static cap cloud. When 'dynamical weather' is selected, aircraft, cloud and thermal are all displaced by the wind.<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 button 'Show winds' brings up the detailed wind menu which is needed for the wind models 'aloft interpolated' and 'aloft waypoints':<p>
<center>
<img src="clouds-incoming-rainfront1.jpg">
<img src="menu3.jpg">
</center><p>
For 'aloft interpolated', the menu is used by inserting wind direction and speed for all given altitudes. After 'Okay', the specified values are used. For 'aloft waypoints', the same info must be supplied for a series of waypoints. First, the latitude and longitude has to be inserted, afterwards the aloft winds for that point below. The button 'Set waypoint' commits the windfield as specified in the menu for this position into memory. For orientation, the number of points inserted is counted on the lower right. 'Clear Waypoints' removes all information entered so far. Note that 'Okay' does not commit the data for a waypoint. <p>
In principle, the waypoint information inserted so far can be seen using the property browser. It is stored under <i>/local-weather/interpolation/wind[n]/</i>.<p>
The following pictures show the results of tile setups 'Low-pressure-border' and 'High-pressure-border':<p>
<center>
<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 +186,50 @@ 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>
<h2>6. Property tree structure</h2>
In version 0.8, 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. Wind models and dynamical weather</h2>
In reality, the wind is a vector field changing in space and time, subject to physical boundary conditions such as a continuity equation (there are no sources or sinks of air - air flowing out of a volume element must be balanced by air flowing into the volume element). This vector field has two horizontal and one vertical component. <p>
It is quite clear that the wind model within local weather has to be an approximation to the real situation. First, the windfield is assumed to always have horizontal components only - vertical air movement is simulated on top of the wind field by ridge lift generated from the Flightgear core and by thermals and turbulence as effect volumes. <p>
In the horizontal windfield, aloft and bounday layers need to be distinguished. The aloft wind layers are high enough so that they do not interact with the terrain (and hence can be specified as a function of altitude above sea level), the low region where the aloft winds experience friction by interaction with the terrain and are slowed down constitutes the boundary layer. The boundary layer hence needs to be defined as a function of altitude above ground - it shifts as the elevation shifts. The size of the boundary layer, as well as its capacity to slow down aloft winds, depends on the roughness of the terrain. Over the open sea, the boundary layer is typically as small as 150 ft, while over rough terrain it can extend up to several hundred ft.<p>
When the option 'dynamical weather' is active, clouds and effect volumes move with the wind. Due to performance reasons, only clouds in the field of view are processed in each frame. As an efficient way to do this, a quadtree structure is used. However, this has the side effect that all clouds inside a tile need to be moved with the same windspeed (otherwise they would over time drift out of the position where the quadtree expects to find them). Since thermals and their cap clouds should not drift apart, also weather effects are moved with the same windspeed inside each tile. In the following, this is referred to as 'tile wind speed'. The tile wind speed always corresponds to the lowest aloft layer windspeed. The reason why this is considered acceptable is that at the same altitude for different positions inside a tile, the correct windspeed is at most a few kt different from the tile windspeed, and this is impossible to see visually. At high altitudes, the true wind is very different from the speed at which clouds are moved, but without reference and from fast-moving planes, the error is again very hard to see. However, with e.g. a hot air balloon, the fact that at high altitudes clouds are not moved with the high-altitude windspeed would be quite apparent.<p>
Dependent on how detailed the wind field should be specified, what the pilot aims to do and how much user control is desired, there are several options to model the wind.
<ul>
<li> <b>constant</b> sets the aloft wind to the same speed and direction as specified in the weather tile menu everywhere - at every spatial position and at every altitude. This is for the casual pilot who just wants some simple wind setting, or when it is mandatory that clouds, plane and weather effects all move with the same speed, such as for lighter-than-air aviation. Note that the wind set in the menu is not the wind seen on the runway, as the option sets the aloft wind, from which the boundary layer wind is computed using terrain information.<p>
<li> <b>constant in tile</b> keeps the wind equal to the tile windspeed, but allows to change randomly direction and strength a bit between tiles, so that the wind at the destination will not be equal to the wind at takeoff, but such that still the same wind is felt by aircraft, clouds and weather effects. The drawback of this option is that the wind changes discontinuously as a tile boundary is crossed (felt as a sudden gust) and that aloft winds do not change in altitude This model is suitable e.g. for gliders, when it is important that glider, thermal and cap cloud move with the same speed, high altitudes are out of reach anyway and a little variation in the wind is okay.<p>
<li> <b>aloft interoplated</b> requires the wind menu. Here, the wind is kept constant as a function of position, but is allowed to vary in altitude according to the information provided by the user for the different pressure altitudes. A linear interpolation in altitude is used. The option essentially provides the functionality of the default Flightgear weather conditions menu.<p>
<li> <b>aloft waypoints</b> finally allows to interpolate the windfield in altitude and in position according to the grid of interpolation points (or 'waypoints') entered by the user in the wind menu. The correct tile windspeed and direction is computed by the same interpolation. A linear interpolation in altitude and an inverse distance weighting for the interpolation in position are used. This is a suitable option for e.g. airliner operation when high altitude wind maps are available.<p>
</ul>
In all cases, the boundary layer is computed separately. Since the boundary layer effect depends on terrain, there is no direct way to set the wind as experienced on the runway (but of course changing the lowest aloft layer will lead to the desired result).
<h2>7. 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/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 and subfolders <i>wind[i]</i> where wind information in the case of 'aloft interpolated' or 'aloft waypoints' is stored. 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>
<h2>7. Weather tile setup</h2>
<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>
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>
<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>8. 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. 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,17 +241,176 @@ 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>9. 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 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>
<ul>
* Some cloud textures have artefacts, rain textures have too sharp boundaries and in general some things could look better. Please don't complain, but rather get me good photographs of the sky, cloud texture files or create better AC3D cloud models. I will eventually improve texture quality, but it's not high up in the to-do list, and the cloud model files are openly accessible for anyone with an editor.<p>
<li> 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>
* 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>
<li> 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>
<li> 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>
<li> 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.
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>
<li> a different issue is a characteristic small pause every second. 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>
<li> dynamical weather uses a lot of performance. If framerate is low and you don't need it, don't use it! From fast planes, cloud drift is almost impossible to see against the relative motion of cloud and airplane anyway.<p>
</ul>
<h2>10. Known issues</h2>
<ul>
<li> 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>
<li> Some cloud textures have artefacts, rain textures have too sharp boundaries and in general some things could look better. Please don't complain, but rather get me good photographs of the sky, cloud texture files or create better AC3D cloud models. I will eventually improve texture quality, but it's not high up in the to-do list, and the cloud model files are openly accessible for anyone with an editor.<p>
<li> 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>
<li> 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>
<li> 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>
<li> For dynamical weather, clouds sometimes appear to 'jump' to a position. The reason is that the control loop of cloud drift accepts for performance reasons only a limited number of clouds. If there are more in the field of view, the most distant clouds are not processed. As nearby clouds drift out of the visual field, more distant clouds move into the loop, at which point their position is suddenly updated, resulting in a jump. Short of committing potentially vast computational resources (if there is a large number of clouds in the visual field), there is no easy fix to the problem.<p>
<li> To smooth out changes in wind settings, rather than producing a sudden gust, the wind is changed over about 1 second. In sharp wind gradients, this produces a series of ripples like turbulence. This is actually a realistic behaviour in this situation and hence left as it is. Some systems seem to take an unreasonable effort to reinit the environment (as must be done to set wind) - here the function call <i>setWindSmoothly()</i> in <i>local_weather.nas</i> should perhaps be replace by <i>setWind</i> to ease the load.
<li> The thermals in the soaring scenarios need GIT to work.<p>
</ul>
<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>
<h3>The boundary layer computation</h3>
The boundary layer is only dynamically computed when 'terrain presampling' is active (otherwise the weather system has no information of the terrain and a schematic reduction of aloft winds by 2/3 is used instead). The assumption is that the boundary layer at median altitude has a thickness of 150 ft. Below the median altitude, the boundary layer is assumed to grow with 1/3 of the altitude difference, but to no more than 3000 ft while above it is assumed to shrink with 10% of the altitude difference, but to no more than 50 ft. <p>
The boundary layer effectiveness, i.e. the amount of windspeed reduction at the layer bottom is assumed to vary logarithmically with thickness - thicker layers are more effective, but not dramatically so. Over open water, the layer thickness is hence about 150 ft with a maximal reduction of 10%, in deep valleys the reduction factor can be as large as 70%. The interpolation of wind reduction inside the boundary layer is done linearly.<p>
Realistically, the boundary layer should also depend on terrain coverage. Due to the need for performance to sample terrain coverage in the vicinity of the aircraft frequently, this is currently not implemented.<p>
Thorsten Renk, April 2010
<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>

View file

@ -23,6 +23,10 @@
adequate for smoke effects, etc., for bullets, bombs, droptanks this is probably
best left at "False". Since the effects of wind on various ballistic objects is
uncertain, there is no plan to change this situation.
4. Submodels can be ensted to any depth, thus a submodel on expiry or impact etc,
can launch a child submodel, which in turn can launch a submodel. and so on. This
is the basis for Persistent Contrails, but any use is possible.
The initial conditions (IC) define the object's starting point (relative
to the user aircraft's "reported position"), and its initial speed and
@ -39,14 +43,15 @@
<delay> Time, in seconds, between repeated releases.
<count> Number of submodels available for multiple release.
-1 defines an unlimited number.
<slaved> Not used yet.
<slaved> If true, the submodel is slaved to the parent model.
<x-offset> Submodel's initial fore/aft position (in feet), relative to user aircraft. Fore is positive.
<y-offset> Submodel's initial left/right position (in feet), relative to user aircraft. Right is positive.
<z-offset> Submodel's initial up/down position (in feet), relative to user aircraft. Up is positive.
<yaw-offset> Submodel's initial azimuth, in degrees, relative to user
aircraft'snose. Right is positive.
<pitch-offset> Submodel's initial elevation, in degrees, relative to user aircraft's pitch. Up is positive.
<life> Life span in seconds. Default is 900.0.
<life> Life span in seconds.
Default is 900.0.
<buoyancy> In ft/sec/sec. Works opposite acceleration of gravity.
For example, if set to 32 the submodel will feel no
gravity. If greater than 32 the object will rise.
@ -58,10 +63,20 @@
<weight> The weight of the submodel (lbs). NOT set to 0 on submodel release. You may wish to set this value to 0 by means of key bindings or Nasal script.
Defaults to 0.25.
<contents> The path to the contents of a submodel. The contents must be in lbs. Intended for use with drop tanks. The property value will be set to 0 on release of the submodel: do not also set to 0 elsewhere e.g. in key bindings. Defaults to 0.
<random> Varies CD by +- 5%.
<random> Varies CD by +- 10%, initial azimuth by +- 10 degs, and life by <randomness>
<randomness> If <random> is true, <randomness> is applied to <life>. 0 > Value < 1 are valid.
Defaults to 0.5.
<no-roll> If true the submodel does not roll.
<impact> If true, the impact location (lat/lon) on the terrain is calculated. The Material (e.g Grass)of the terrain, load resistance, impact velocity and energy are returned. Altitude agl is calculated.
<impact-reports> Defines a report node. When an impact happens, then the path of the submodel will be written to this node. An attached listener function can evaluate the impact properties. If unset, reports go to /ai/models/model-impact.
<impact> If true, the impact location (lat/lon) on the terrain is calculated. The Material
(e.g Grass)of the terrain, load resistance, and impact velocity. Altitude agl is calculated.
<collision> If true, collisions with other objects is tested. If a collision is detected then
the position data are written to the "Report Node".
<fuze-range> Used in detecting collisions. The distance in feet between an object and a submodel
at which a collision is deemed to have occurred.
<expiry> If true, the current position of the submodel is written to the "Report Node" when the submodel life expires.
<impact-reports> Defines a "Report Node". When an impact happens, then the path of the submodel will be written to this node.
An attached listener function can evaluate the impact properties. If unset,
reports go to /ai/models/model-impact.
***** experimental ****
<external-force> If true the submodel is subjected to an external force<force-path> A string describing the property where the magnitude, azimuth and elevation of the external force is to be found. The following child properties are instantiated:

BIN
Docs/carrier-ops08.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
Docs/cloud_altitude_01.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
Docs/cloud_altitude_02.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
Docs/cloud_altitude_03.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
Docs/cloud_altitude_04.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
Docs/clouds-detailed01.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
Docs/clouds-lpb01.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

BIN
Docs/clouds-tropical02.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 25 KiB

BIN
Docs/menu3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
Docs/terrain1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
Docs/weather_patterns.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View file

@ -36,7 +36,7 @@
<write-mask>false</write-mask>
</depth>
<render-bin>
<bin-number>10</bin-number>
<bin-number>9</bin-number>
<bin-name>DepthSortedBin</bin-name>
</render-bin>
<texture-unit>

View file

@ -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>

View 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>

View file

@ -11,7 +11,7 @@
<internal-format>normalized</internal-format>
</texture>
<texture n="3">
<image>Textures/Terrain/cropcolors.png</image>
<image>Textures/Terrain/crop-colors.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>mirror</wrap-s>
<internal-format>normalized</internal-format>

103
Effects/cropgrass.eff Normal file
View file

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/cropgrass</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<texture n="2">
<image>Textures/Terrain/cropgrass.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="3">
<image>Textures/Terrain/cropgrass-colors.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>mirror</wrap-s>
<internal-format>normalized</internal-format>
</texture>
</parameters>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/crop-shader</property>
<property>/sim/rendering/shader-effects</property>
<or>
<less-equal>
<value type="float">2.0</value>
<glversion/>
</less-equal>
<and>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<!-- Use material values that are either inherited from the
terrain-default effect or supplied by an effect derived
from this one e.g., one created in the materials library. -->
<material>
<ambient><use>material/ambient</use></ambient>
<diffuse><use>material/diffuse</use></diffuse>
<specular><use>material/specular</use></specular>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<blend><use>transparent</use></blend>
<alpha-test><use>transparent</use></alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number><use>render-bin/bin-number</use></bin-number>
<bin-name><use>render-bin/bin-name</use></bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<type>noise</type>
</texture-unit>
<texture-unit>
<unit>1</unit>
<image><use>texture[2]/image</use></image>
<filter><use>texture[2]/filter</use></filter>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[2]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<type>1d</type>
<image><use>texture[3]/image</use></image>
<filter><use>texture[3]/filter</use></filter>
<wrap-s><use>texture[3]/wrap-s</use></wrap-s>
<internal-format>
<use>texture[3]/internal-format</use>
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/crop.vert</vertex-shader>
<fragment-shader>Shaders/crop.frag</fragment-shader>
</program>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>SampleTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>ColorsTex</name>
<type>sampler-1d</type>
<value type="int">2</value>
</uniform>
</pass>
</technique>
</PropertyList>

View file

@ -43,6 +43,59 @@
<extension-supported>GL_EXT_geometry_shader4</extension-supported>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<material>
<ambient><use>material/ambient</use></ambient>
<diffuse><use>material/diffuse</use></diffuse>
<specular><use>material/specular</use></specular>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<alpha-test><use>transparent</use></alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number>-1</bin-number>
<bin-name>RenderBin</bin-name>
</render-bin>
<texture-unit>
<unit>1</unit>
<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>
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/landmass-g.vert</vertex-shader>
<geometry-shader>Shaders/landmass.geom</geometry-shader>
<fragment-shader>Shaders/terrain-nocolor.frag</fragment-shader>
<geometry-vertices-out type="int">18</geometry-vertices-out>
<geometry-input-type>triangles</geometry-input-type>
<geometry-output-type>triangle-strip</geometry-output-type>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>binormal</name>
<index>7</index>
</attribute>
</program>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>canopy_height</name>
<type>float</type>
<value><use>canopy-height</use></value>
</uniform>
<color-mask type="vec4d">0 0 0 0</color-mask>
</pass>
<pass>
<lighting>true</lighting>
<material>
@ -134,6 +187,10 @@
<type>float</type>
<value><use>quality-level</use></value>
</uniform>
<depth>
<function>lequal</function>
<write-mask type="bool">false</write-mask>
</depth>
</pass>
</technique>
<technique n="9">

View file

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/material-off</name>
<name>Effects/material-diffuse</name>
<inherits-from>Effects/model-default</inherits-from>
<technique n="10">
<pass>
<program>
<vertex-shader n="0">Shaders/mode-diffuse.vert</vertex-shader>
<vertex-shader n="1">Shaders/mat-anim.vert</vertex-shader>
<fragment-shader n="0">Shaders/mat-anim.frag</fragment-shader>
<vertex-shader>Shaders/default.vert</vertex-shader>
<fragment-shader>Shaders/default.frag</fragment-shader>
</program>
<uniform>
<name>colorMode</name>
<type>int</type>
<value>1</value> <!-- DIFFUSE -->
</uniform>
</pass>
</technique>
</PropertyList>

View file

@ -4,11 +4,11 @@
<inherits-from>Effects/model-default</inherits-from>
<technique n="10">
<pass>
<program>
<vertex-shader n="0">Shaders/mode-off.vert</vertex-shader>
<vertex-shader n="1">Shaders/mat-anim.vert</vertex-shader>
<fragment-shader n="0">Shaders/mat-anim.frag</fragment-shader>
</program>
<uniform>
<name>colorMode</name>
<type>int</type>
<value>0</value> <!-- OFF -->
</uniform>
</pass>
</technique>
</PropertyList>

View file

@ -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>
<vertex-shader>Shaders/default.vert</vertex-shader>
<fragment-shader>Shaders/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>colorMode</name>
<type>int</type>
<value>1</value> <!-- DIFFUSE -->
</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>

View file

@ -57,6 +57,44 @@
</or>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<material>
<ambient><use>material/ambient</use></ambient>
<diffuse><use>material/diffuse</use></diffuse>
<specular><use>material/specular</use></specular>
<emissive><use>material/emissive</use></emissive>
<shininess><use>material/shininess</use></shininess>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<alpha-test><use>transparent</use></alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number>-1</bin-number>
<bin-name>RenderBin</bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<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>
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/default.vert</vertex-shader>
<fragment-shader>Shaders/terrain-nocolor.frag</fragment-shader>
</program>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<color-mask type="vec4d">0 0 0 0</color-mask>
</pass>
<pass>
<lighting>true</lighting>
<material>
@ -87,12 +125,22 @@
</texture-unit>
<program>
<vertex-shader>Shaders/default.vert</vertex-shader>
<fragment-shader>Shaders/terrain-default.frag</fragment-shader>
<fragment-shader>Shaders/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>colorMode</name>
<type>int</type>
<value>2</value> <!-- AMBIENT_AND_DIFFUSE -->
</uniform>
<depth>
<function>lequal</function>
<write-mask type="bool">false</write-mask>
</depth>
</pass>
</technique>
<technique n="11">

81
Effects/test.eff Normal file
View 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>

42
Input/Joysticks/CH/fighterstick-usb.xml Executable file → Normal file
View file

@ -19,10 +19,10 @@
************************************************************************
-->
<PropertyList>
<name>CH FIGHTERSTICK USB </name>
<name>CH PRODUCTS CH FIGHTERSTICK USB </name>
<axis n="0">
<desc>Aileron</desc>
<binding>
@ -33,7 +33,7 @@
<factor type="double">1.0</factor>
</binding>
</axis>
<axis n="1">
<desc>Elevator</desc>
<binding>
@ -44,7 +44,7 @@
<factor type="double">-1.0</factor>
</binding>
</axis>
<axis n="2">
<desc>Throttle</desc>
<binding>
@ -52,7 +52,7 @@
<script>controls.throttleAxis()</script>
</binding>
</axis>
<axis>
<desc>Rudder Trim</desc>
<number>
@ -74,7 +74,7 @@
</binding>
</high>
</axis>
<axis>
<desc>Elevator Trim</desc>
<number>
@ -96,7 +96,7 @@
</binding>
</high>
</axis>
<button n="0">
<name>trigger</name>
<desc>Trigger</desc>
@ -135,7 +135,7 @@
<script>controls.applyParkingBrake(1)</script>
</binding>
</button>
<button n="3">
<desc>Reset view</desc>
<repeatable>false</repeatable>
@ -149,10 +149,10 @@
</script>
</binding>
</button>
<button n="4">
<desc>Flaps Up</desc>
<repeatable>false</repeatable>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>controls.flapsDown(-1)</script>
@ -164,10 +164,10 @@
</binding>
</mod-up>
</button>
<button n="6">
<desc>Flaps Down</desc>
<repeatable>false</repeatable>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>controls.flapsDown(1)</script>
@ -179,7 +179,7 @@
</binding>
</mod-up>
</button>
<button n="8">
<desc>View Decrease</desc>
<repeatable>true</repeatable>
@ -188,7 +188,7 @@
<script>view.decrease(0.75)</script>
</binding>
</button>
<button n="9">
<desc>View Cycle Forwards</desc>
<repeatable>false</repeatable>
@ -197,7 +197,7 @@
<script>view.stepView(1)</script>
</binding>
</button>
<button n="10">
<desc>View Increase</desc>
<repeatable>true</repeatable>
@ -206,7 +206,7 @@
<script>view.increase(0.75)</script>
</binding>
</button>
<button n="11">
<desc>View Cycle Backwards</desc>
<repeatable>false</repeatable>
@ -215,7 +215,7 @@
<script>view.stepView(-1)</script>
</binding>
</button>
<button n="12">
<desc>View Up</desc>
<repeatable>false</repeatable>
@ -225,7 +225,7 @@
<step>20.0</step>
</binding>
</button>
<button n="13">
<desc>View Right</desc>
<repeatable>false</repeatable>
@ -235,7 +235,7 @@
<step>-30.0</step>
</binding>
</button>
<button n="14">
<desc>View Down</desc>
<repeatable>false</repeatable>
@ -245,7 +245,7 @@
<step>-20.0</step>
</binding>
</button>
<button n="15">
<desc>View Left</desc>
<repeatable>false</repeatable>
@ -255,5 +255,5 @@
<step>30.0</step>
</binding>
</button>
</PropertyList>

View file

@ -57,7 +57,7 @@
<desc>Propeller</desc>
<number>
<unix>4</unix>
<mac>3</mac>
<mac>4</mac>
<windows>3</windows>
</number>
<binding>
@ -125,17 +125,11 @@
</axis>
<button n="0">
<desc>Fire Starter on Selected Engine(s)</desc>
<desc>Reset View</desc>
<binding>
<command>nasal</command>
<script>controls.startEngine()</script>
<script>view.resetView()</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>props.setAll("/controls/engines/engine", "starter", 0)</script>
</binding>
</mod-up>
</button>
<button n="1">
@ -148,16 +142,6 @@
</button>
<button n="2">
<desc>Rudder Trim Right</desc>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/flight/rudder-trim</property>
<step>0.001</step>
</binding>
</button>
<button n="3">
<desc>Rudder Trim Left</desc>
<repeatable>true</repeatable>
<binding>
@ -167,6 +151,16 @@
</binding>
</button>
<button n="3">
<desc>Rudder Trim Right</desc>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/flight/rudder-trim</property>
<step>0.001</step>
</binding>
</button>
<button n="4">
<desc>Gear up</desc>
<repeatable>false</repeatable>

View file

@ -30,6 +30,7 @@ $Id$
<name>Logitech Extreme 3D Pro</name>
<name>Logitech Extreme 3D Pro USB</name>
<name>Logitech Extreme 3D Pro USB</name>
<name>Logitech Extreme 3D</name>
<axis n="0">
<desc>Aileron</desc>
@ -55,6 +56,7 @@ $Id$
<number>
<unix>2</unix>
<windows>3</windows>
<mac>2</mac>
</number>
<binding>
<command>property-scale</command>
@ -68,6 +70,7 @@ $Id$
<number>
<unix>3</unix>
<windows>2</windows>
<mac>3</mac>
</number>
<binding>
<command>nasal</command>
@ -80,6 +83,7 @@ $Id$
<number>
<unix>4</unix>
<windows>6</windows>
<mac>4</mac>
</number>
<low>
<repeatable>true</repeatable>
@ -104,6 +108,7 @@ $Id$
<number>
<unix>5</unix>
<windows>7</windows>
<mac>5</mac>
</number>
<low>
<repeatable>true</repeatable>

View file

@ -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>

View file

@ -27,6 +27,7 @@
READ ALLOW $FG_ROOT/*
READ ALLOW $FG_HOME/*
READ ALLOW $FG_AIRCRAFT/*
WRITE ALLOW /tmp/*.xml
WRITE ALLOW $FG_HOME/*.sav

View file

@ -606,7 +606,7 @@ var overlay_update = {
return m;
},
add: func(path, prop, callback = nil) {
var path = string.normpath(getprop("/sim/fg-root") ~ '/' ~ path) ~ '/';
var path = path ~ '/';
me.data[path] = [me.root.initNode(prop, ""), "",
typeof(callback) == "func" ? callback : func nil];
return me;

500
Nasal/compat_layer.nas Normal file
View file

@ -0,0 +1,500 @@
########################################################
# compatibility layer for local weather package
# Thorsten Renk, July 2010
########################################################
# function purpose
#
# setVisibility to set the visibility to a given value
# setRain to set rain to a given value
# setSnow to set snow to a given value
# setTurbulence to set turbulence to a given value
# setTemperature to set temperature to a given value
# setPressure to set pressure to a given value
# setDewpoint to set the dewpoint to a given value
# setWind to set wind
# setWindSmoothly to set the wind gradually across a second
# smooth_wind_loop helper function for setWindSmoothly
# create_cloud to place a single cloud into the scenery
# create_cloud_array to place clouds from storage arrays into the scenery
# move_cloud to move the cloud position
# remove_clouds to remove clouds by tile index
# waiting_loop to ensure tile removal calls do not overlap
# remove_tile_loop to remove a fixed number of clouds per frame
# get_elevation to get the terrain elevation at given coordinates
# get_elevation_vector to get terrain elevation at given coordinate vector
####################################
# set visibility to given value
####################################
var setVisibility = func (vis) {
# this is a rather dirty workaround till a better solution becomes available
# essentially we update all entries in config and reinit environment
var entries_aloft = props.globals.getNode("environment/config/aloft", 1).getChildren("entry");
foreach (var e; entries_aloft) {
e.getNode("visibility-m",1).setValue(vis);
}
var entries_boundary = props.globals.getNode("environment/config/boundary", 1).getChildren("entry");
foreach (var e; entries_boundary) {
e.getNode("visibility-m",1).setValue(vis);
}
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
####################################
# set rain to given value
####################################
var setRain = func (rain) {
# setting the lowest cloud layer to 30.000 ft is a workaround
# as rain is only created below that layer in default
setprop("environment/clouds/layer[0]/elevation-ft", 30000.0);
setprop("environment/metar/rain-norm",rain);
}
####################################
# set snow to given value
####################################
var setSnow = func (snow) {
# setting the lowest cloud layer to 30.000 ft is a workaround
# as snow is only created below that layer in default
setprop("environment/clouds/layer[0]/elevation-ft", 30000.0);
setprop("environment/metar/snow-norm",snow);
}
####################################
# set turbulence to given value
####################################
var setTurbulence = func (turbulence) {
# this is a rather dirty workaround till a better solution becomes available
# essentially we update all entries in config and reinit environment
var entries_aloft = props.globals.getNode("environment/config/aloft", 1).getChildren("entry");
foreach (var e; entries_aloft) {
e.getNode("turbulence/magnitude-norm",1).setValue(turbulence);
}
# turbulence is slightly reduced in boundary layers
var entries_boundary = props.globals.getNode("environment/config/boundary", 1).getChildren("entry");
var i = 1;
foreach (var e; entries_boundary) {
e.getNode("turbulence/magnitude-norm",1).setValue(turbulence * 0.25*i);
i = i + 1;
}
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
####################################
# set temperature to given value
####################################
var setTemperature = func (T) {
# this is a rather dirty workaround till a better solution becomes available
# essentially we update the entry in config and reinit environment
setprop(ec~"boundary/entry[0]/temperature-degc",T);
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
####################################
# set pressure to given value
####################################
var setPressure = func (p) {
# this is a rather dirty workaround till a better solution becomes available
# essentially we update the entry in config and reinit environment
setprop(ec~"boundary/entry[0]/pressure-sea-level-inhg",p);
setprop(ec~"aloft/entry[0]/pressure-sea-level-inhg",p);
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
####################################
# set dewpoint to given value
####################################
var setDewpoint = func (D) {
# this is a rather dirty workaround till a better solution becomes available
# essentially we update the entry in config and reinit environment
setprop(ec~"boundary/entry[0]/dewpoint-degc",D);
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
###########################################################
# set wind to given direction and speed
###########################################################
var setWind = func (dir, speed) {
# this is a rather dirty workaround till a better solution becomes available
# essentially we update all entries in config and reinit environment
var entries_aloft = props.globals.getNode("environment/config/aloft", 1).getChildren("entry");
foreach (var e; entries_aloft) {
e.getNode("wind-from-heading-deg",1).setValue(dir);
e.getNode("wind-speed-kt",1).setValue(speed);
}
var entries_boundary = props.globals.getNode("environment/config/boundary", 1).getChildren("entry");
foreach (var e; entries_boundary) {
e.getNode("wind-from-heading-deg",1).setValue(dir);
e.getNode("wind-speed-kt",1).setValue(speed);
}
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
###########################################################
# set wind smoothly to given direction and speed
# interpolating across several frames
###########################################################
var setWindSmoothly = func (dir, speed) {
var entries_aloft = props.globals.getNode("environment/config/aloft", 1).getChildren("entry");
var dir_old = entries_aloft[0].getNode("wind-from-heading-deg",1).getValue();
var speed_old = entries_aloft[0].getNode("wind-speed-kt",1).getValue();
var dir = dir * math.pi/180.0;
var dir_old = dir_old * math.pi/180.0;
var vx = speed * math.sin(dir);
var vx_old = speed_old * math.sin(dir_old);
var vy = speed * math.cos(dir);
var vy_old = speed_old * math.cos(dir_old);
smooth_wind_loop(vx,vy,vx_old, vy_old, 4, 4);
}
var smooth_wind_loop = func (vx, vy, vx_old, vy_old, counter, count_max) {
var time_delay = 0.9/count_max;
if (counter == 0) {return;}
var f = (counter -1)/count_max;
var vx_set = f * vx_old + (1-f) * vx;
var vy_set = f * vy_old + (1-f) * vy;
var speed_set = math.sqrt(vx_set * vx_set + vy_set * vy_set);
var dir_set = math.atan2(vx_set,vy_set) * 180.0/math.pi;
setWind(dir_set,speed_set);
settimer( func {smooth_wind_loop(vx,vy,vx_old,vy_old,counter-1, count_max); },time_delay);
}
###########################################################
# place a single cloud
###########################################################
var create_cloud = func(path, lat, long, alt, heading) {
var tile_counter = getprop(lw~"tiles/tile-counter");
var n = props.globals.getNode("local-weather/clouds", 1);
var c = n.getChild("tile",tile_counter,1);
var cloud_number = n.getNode("placement-index").getValue();
for (var i = cloud_number; 1; i += 1)
if (c.getChild("cloud", i, 0) == nil)
break;
cl = c.getChild("cloud", i, 1);
n.getNode("placement-index").setValue(i);
var model_number = n.getNode("model-placement-index").getValue();
var m = props.globals.getNode("models", 1);
for (var i = model_number; 1; i += 1)
if (m.getChild("model", i, 0) == nil)
break;
model = m.getChild("model", i, 1);
n.getNode("model-placement-index").setValue(i);
var latN = cl.getNode("position/latitude-deg", 1); latN.setValue(lat);
var lonN = cl.getNode("position/longitude-deg", 1); lonN.setValue(long);
var altN = cl.getNode("position/altitude-ft", 1); altN.setValue(alt);
var hdgN = cl.getNode("orientation/true-heading-deg", 1); hdgN.setValue(heading);
#var pitchN = cl.getNode("orientation/pitch-deg", 1); pitchN.setValue(0.0);
#var rollN = cl.getNode("orientation/roll-deg", 1);rollN.setValue(0.0);
cl.getNode("tile-index",1).setValue(tile_counter);
model.getNode("path", 1).setValue(path);
model.getNode("latitude-deg-prop", 1).setValue(latN.getPath());
model.getNode("longitude-deg-prop", 1).setValue(lonN.getPath());
model.getNode("elevation-ft-prop", 1).setValue(altN.getPath());
model.getNode("heading-deg-prop", 1).setValue(hdgN.getPath());
#model.getNode("pitch-deg-prop", 1).setValue(pitchN.getPath());
#model.getNode("roll-deg-prop", 1).setValue(rollN.getPath());
model.getNode("tile-index",1).setValue(tile_counter);
model.getNode("load", 1).remove();
n.getNode("cloud-number").setValue(n.getNode("cloud-number").getValue()+1);
# sort the model nodes into a vector
append(weather_tile_management.modelArrays[tile_counter-1],model);
# if weather dynamics is on, also create a timestamp property and sort into quadtree
if (getprop(lw~"config/dynamics-flag") == 1)
{
cl.getNode("timestamp-sec",1).setValue(weather_dynamics.time_lw);
var blat = getprop(lw~"tiles/tmp/latitude-deg");
var blon = getprop(lw~"tiles/tmp/longitude-deg");
var alpha = getprop(lw~"tmp/tile-orientation-deg");
#weather_dynamics.sort_into_quadtree(blat, blon, alpha, lat, long, weather_dynamics.cloudQuadtree, cl);
weather_dynamics.sort_into_quadtree(blat, blon, alpha, lat, long, weather_dynamics.cloudQuadtrees[tile_counter-1], cl);
}
}
###########################################################
# place a cloud layer from arrays, split across frames
###########################################################
var create_cloud_array = func (i, clouds_path, clouds_lat, clouds_lon, clouds_alt, clouds_orientation) {
if (getprop(lw~"tmp/thread-status") != "placing") {return;}
if (getprop(lw~"tmp/convective-status") != "idle") {return;}
if ((i < 0) or (i==0))
{
print("Cloud placement from array finished!");
setprop(lw~"tmp/thread-status", "idle");
return;
}
var k_max = 30;
var s = size(clouds_path);
if (s < k_max) {k_max = s;}
for (var k = 0; k < k_max; k = k+1)
{
#print(s, " ", k, " ", s-k-1, " ", clouds_path[s-k-1]);
#create_cloud(clouds_type[s-k-1], clouds_path[s-k-1], clouds_lat[s-k-1], clouds_lon[s-k-1], clouds_alt[s-k-1], 0.0, 0);
create_cloud(clouds_path[s-k-1], clouds_lat[s-k-1], clouds_lon[s-k-1], clouds_alt[s-k-1], clouds_orientation[s-k-1]);
}
setsize(clouds_path,s-k_max);
setsize(clouds_lat,s-k_max);
setsize(clouds_lon,s-k_max);
setsize(clouds_alt,s-k_max);
setsize(clouds_orientation,s-k_max);
settimer( func {create_cloud_array(i - k, clouds_path, clouds_lat, clouds_lon, clouds_alt, clouds_orientation ) }, 0 );
};
####################################################
# move a cloud
####################################################
var move_cloud = func (c, tile_index) {
# get the old spacetime position of the cloud
var lat_old = c.getNode("position/latitude-deg").getValue();
var lon_old = c.getNode("position/longitude-deg").getValue();
var alt = c.getNode("position/altitude-ft").getValue();
var timestamp = c.getNode("timestamp-sec").getValue();
# get windfield and time since last update
var windfield = weather_dynamics.get_windfield(tile_index);
var dt = weather_dynamics.time_lw - timestamp;
#print(dt * windfield[1]);
# update the spacetime position of the cloud
c.getNode("position/latitude-deg",1).setValue(lat_old + windfield[1] * dt * local_weather.m_to_lat);
c.getNode("position/longitude-deg",1).setValue(lon_old + windfield[0] * dt * local_weather.m_to_lon);
c.getNode("timestamp-sec",1).setValue(weather_dynamics.time_lw);
}
####################################################
# remove clouds by tile index
####################################################
var remove_clouds = 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)
{settimer( func {waiting_loop(index); },0);}
else
{
var modelNode = props.globals.getNode("models", 1).getChildren("model");
foreach (var m; modelNode)
{
if (m.getNode("tile-index",1).getValue() == index) {m.remove();}
}
}
}
# 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_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 = weather_tile_management.modelArrays[index-1];
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");
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];
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);
setsize(weather_tile_management.modelArrays[index-1],0);
}
}
###########################################################
# get terrain elevation
###########################################################
var get_elevation = func (lat, lon) {
var info = geodinfo(lat, lon);
if (info != nil) {var elevation = info[0] * local_weather.m_to_ft;}
else {var elevation = -1.0;}
return elevation;
}
###########################################################
# get terrain elevation vector
###########################################################
var get_elevation_array = func (lat, lon) {
var elevation = [];
var n = size(lat);
for(var i = 0; i < n; i=i+1)
{
append(elevation, get_elevation(lat[i], lon[i]));
}
return elevation;
}
############################################################
# global variables
############################################################
# some common abbreviations
var lw = "/local-weather/";
var ec = "/environment/config/";
# storage arrays for model vector
var mvec = [];
var msize = 0;

39
Nasal/contrail.nas Normal file
View file

@ -0,0 +1,39 @@
#########
# contrail calculator. Based on an approxmation to the "Appleman Chart"
# y = -0.077x2 + 2.7188x - 64.36
#
########
updateContrail = func{
var pressure_Node = props.globals.getNode("environment/pressure-inhg");
var temperature_Node = props.globals.getNode("environment/temperature-degc");
var contrail_Node = props.globals.getNode("environment/contrail");
var contrail_temp_Node = props.globals.getNode("environment/contrail-temperature-degc");
var x = pressure_Node.getValue();
var y = temperature_Node.getValue();
var con_temp = -0.077 * x * x + 2.7188 * x - 64.36;
contrail_temp_Node.setValue(con_temp);
if (y < con_temp and y < -40){
contrail_Node.setValue(1);
} else {
contrail_Node.setValue(0);
}
settimer(updateContrail,30)
}
### Contrail
print ("init contrail");
_setlistener("/sim/signals/nasal-dir-initialized", func {
props.globals.initNode("environment/pressure-inhg", 1, "DOUBLE");
props.globals.initNode("environment/temperature-degc", 1, "DOUBLE");
props.globals.initNode("environment/contrail", 1, "BOOL");
props.globals.initNode("environment/contrail-temperature-degc", 1, "DOUBLE");
var static_contrail_node = props.globals.getNode("sim/ai/aircraft/contrail", 1);
var time_node = props.globals.getNode("sim/time/elapsed-sec", 1);
updateContrail();
});

View file

@ -287,7 +287,7 @@ var Dialog = {
me.close();
me.prop.removeChildren();
io.read_properties(getprop("/sim/fg-root") ~ "/" ~ me.path, me.prop);
io.read_properties(me.path, me.prop);
var n = me.prop.getNode("name");
if (n == nil)
@ -372,8 +372,10 @@ var OverlaySelector = {
var m = Dialog.new(data.getNode("dialog", 1), "gui/dialogs/overlay-select.xml", name);
m.parents = [OverlaySelector, Dialog];
m.dir = string.normpath(getprop("/sim/fg-root") ~ '/' ~ dir) ~ '/';
# resolve the path in FG_ROOT, and --fg-aircraft dir, etc
m.dir = resolvepath(dir) ~ "/";
var relpath = func(p) substr(p, p[0] == `/`);
m.nameprop = relpath(nameprop);
m.sortprop = relpath(sortprop or nameprop);

View file

@ -235,11 +235,26 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
var pattern = f[2];
foreach (var p; subvec(f, 3))
pattern ~= " " ~ p;
if (substr(pattern, 0, 9) == "$FG_ROOT/")
pattern = root ~ "/" ~ substr(pattern, 9);
elsif (substr(pattern, 0, 9) == "$FG_HOME/")
pattern = home ~ "/" ~ substr(pattern, 9);
append(f[0] == "READ" ? read_rules : write_rules, [pattern, f[1] == "ALLOW"]);
var rules = f[0] == "READ" ? read_rules : write_rules;
var allow = (f[1] == "ALLOW");
if (substr(pattern, 0, 13) == "$FG_AIRCRAFT/") {
var p = substr(pattern, 13);
var sim = props.globals.getNode("/sim");
foreach (var c; sim.getChildren("fg-aircraft")) {
pattern = c.getValue() ~ "/" ~ p;
append(rules, [pattern, allow]);
printlog("info", "IORules: appending ", pattern);
}
} else {
if (substr(pattern, 0, 9) == "$FG_ROOT/")
pattern = root ~ "/" ~ substr(pattern, 9);
elsif (substr(pattern, 0, 9) == "$FG_HOME/")
pattern = home ~ "/" ~ substr(pattern, 9);
append(rules, [pattern, allow]);
printlog("info", "IORules: appending ", pattern);
}
}
close(file);
return path;

File diff suppressed because it is too large Load diff

View file

@ -1,15 +1,15 @@
###############################################################################
## $Id$
##
## A message based information broadcast for the multiplayer network.
##
## Copyright (C) 2008 - 2009 Anders Gidenstam (anders(at)gidenstam.org)
## Copyright (C) 2008 - 2010 Anders Gidenstam (anders(at)gidenstam.org)
## This file is licensed under the GPL license version 2 or later.
##
###############################################################################
###############################################################################
# Broadcast primitive using a MP enabled string property.
# Broadcasts from users in multiplayer.ignore are ignored.
#
# BroadcastChannel.new(mpp_path, process)
# Create a new broadcast primitive. Any MP user with the same
@ -101,7 +101,9 @@ BroadcastChannel.update = func {
props.globals.getNode("/ai/models").getChildren("multiplayer");
foreach (var pilot; mpplayers) {
if ((pilot.getChild("valid") != nil) and
pilot.getChild("valid").getValue()) {
pilot.getChild("valid").getValue() and
!contains(multiplayer.ignore,
pilot.getChild("callsign").getValue())) {
if ((me.peers[pilot.getIndex()] == nil) and
me.accept_predicate(pilot)) {
me.peers[pilot.getIndex()] =
@ -110,8 +112,10 @@ BroadcastChannel.update = func {
MessageChannel.new_message_handler(process_msg, pilot));
}
} else {
delete(me.peers, pilot.getIndex());
me.on_disconnect(pilot);
if (contains(me.peers, pilot.getIndex())) {
delete(me.peers, pilot.getIndex());
me.on_disconnect(pilot);
}
}
}
me.last_time = t;

View file

@ -468,7 +468,7 @@ var dialog = func {
#
var load = func(file, index = 0) {
props.globals.getNode("/sim/tutorials", 1).removeChild("tutorial", index);
io.read_properties(getprop("/sim/fg-root") ~ "/" ~ file, "/sim/tutorials/tutorial[" ~ index ~ "]/");
io.read_properties(file, "/sim/tutorials/tutorial[" ~ index ~ "]/");
}

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more