Merge branch 'master' of git://gitorious.org/fg/fgdata
This commit is contained in:
commit
bd02256f1f
6 changed files with 79 additions and 52 deletions
|
@ -289,8 +289,10 @@
|
||||||
|
|
||||||
|
|
||||||
<program>
|
<program>
|
||||||
<vertex-shader>Shaders/reflect.vert</vertex-shader>
|
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||||
<fragment-shader>Shaders/reflect.frag</fragment-shader>
|
<vertex-shader n="1">Shaders/reflect.vert</vertex-shader>
|
||||||
|
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||||
|
<fragment-shader n="1">Shaders/reflect.frag</fragment-shader>
|
||||||
<attribute>
|
<attribute>
|
||||||
<name>tangent</name>
|
<name>tangent</name>
|
||||||
<index>6</index>
|
<index>6</index>
|
||||||
|
|
|
@ -437,12 +437,14 @@ var model = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
_setlistener("/sim/signals/nasal-dir-initialized", func {
|
var mp_mode_changed = func(n) {
|
||||||
|
var is_online = n.getBoolValue();
|
||||||
|
foreach (var menuitem;["mp-chat","mp-chat-menu","mp-list","mp-carrier"])
|
||||||
|
{
|
||||||
|
gui.menuEnable(menuitem, is_online);
|
||||||
|
}
|
||||||
|
|
||||||
model.init();
|
if (is_online) {
|
||||||
|
|
||||||
setlistener("/sim/multiplay/online", func(n) {
|
|
||||||
if (n.getBoolValue()) {
|
|
||||||
if (getprop("/sim/multiplay/write-message-log")) {
|
if (getprop("/sim/multiplay/write-message-log")) {
|
||||||
var ac = getprop("/sim/aircraft");
|
var ac = getprop("/sim/aircraft");
|
||||||
var cs = getprop("/sim/multiplay/callsign");
|
var cs = getprop("/sim/multiplay/callsign");
|
||||||
|
@ -468,7 +470,18 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
|
||||||
}
|
}
|
||||||
check_messages(msg_loop_id += 1);
|
check_messages(msg_loop_id += 1);
|
||||||
}
|
}
|
||||||
}, 1, 0);
|
else
|
||||||
|
{
|
||||||
|
# stop message loop
|
||||||
|
msg_loop_id += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_setlistener("/sim/signals/nasal-dir-initialized", func {
|
||||||
|
|
||||||
|
model.init();
|
||||||
|
|
||||||
|
setlistener("/sim/multiplay/online", mp_mode_changed, 1, 0);
|
||||||
|
|
||||||
# Call-back to ensure we see our own messages.
|
# Call-back to ensure we see our own messages.
|
||||||
setlistener("/sim/multiplay/chat", chat_listener);
|
setlistener("/sim/multiplay/chat", chat_listener);
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
# be used with a tied property
|
# be used with a tied property
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# TODO: Make this optional (when shaders disabled etc), or move computation
|
||||||
|
# away from Nasal.
|
||||||
|
|
||||||
#does what it says on the tin
|
#does what it says on the tin
|
||||||
var clamp = func(v, min, max) { v < min ? min : v > max ? max : v }
|
var clamp = func(v, min, max) { v < min ? min : v > max ? max : v }
|
||||||
|
|
||||||
|
@ -44,7 +47,44 @@ props.globals.initNode("/orientation/model/pitch-deg", 0, "DOUBLE");
|
||||||
props.globals.initNode("/orientation/model/roll-deg", 0, "DOUBLE");
|
props.globals.initNode("/orientation/model/roll-deg", 0, "DOUBLE");
|
||||||
|
|
||||||
|
|
||||||
|
var update_waves = func (wind) {
|
||||||
|
var wind = 0;
|
||||||
|
var amp = 0;
|
||||||
|
var angle = 0;
|
||||||
|
var dangle = 0;
|
||||||
|
var freq = 0;
|
||||||
|
var factor = 0;
|
||||||
|
var sharp = 0;
|
||||||
|
|
||||||
|
amp = Amp + 0.02 * wind;
|
||||||
|
amp = clamp(amp, 1.0, 2.0);
|
||||||
|
|
||||||
|
setprop("/environment/wave/amp", amp);
|
||||||
|
|
||||||
|
angle = Angle + 0.2 * wind;
|
||||||
|
setprop("/environment/wave/angle", angle);
|
||||||
|
|
||||||
|
dangle = DAngle - 0.4 * wind;
|
||||||
|
setprop("/environment/wave/dangle", dangle);
|
||||||
|
|
||||||
|
freq = Freq + 0.0008 * wind;
|
||||||
|
freq = clamp(freq, 0.01, 0.015);
|
||||||
|
setprop("/environment/wave/freq", freq);
|
||||||
|
|
||||||
|
factor = Factor - 0.00001 * wind;
|
||||||
|
factor = clamp(factor, 0.0001, 0.0004);
|
||||||
|
setprop("/environment/wave/factor", factor);
|
||||||
|
|
||||||
|
sharp = Sharp + 0.02 * wind;
|
||||||
|
sharp = clamp(sharp, 1.0, 2.0);
|
||||||
|
setprop("/environment/wave/sharp", sharp);
|
||||||
|
};
|
||||||
|
|
||||||
|
var is_initialized = 0;
|
||||||
var initialize = func {
|
var initialize = func {
|
||||||
|
if (is_initialized)
|
||||||
|
return; # only install listeners once
|
||||||
|
is_initialized = 1;
|
||||||
|
|
||||||
var wind_from_east_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-from-east-fps", 1);
|
var wind_from_east_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-from-east-fps", 1);
|
||||||
wind_from_east_Node.setDoubleValue(0);
|
wind_from_east_Node.setDoubleValue(0);
|
||||||
|
@ -72,48 +112,14 @@ var initialize = func {
|
||||||
|
|
||||||
# ################## listeners ####################
|
# ################## listeners ####################
|
||||||
#
|
#
|
||||||
setlistener("/environment/sea/surface/wind-speed-kt", func (n) {
|
# installing a listener to /environment/sea/surface/wind-speed-kt does not make sense,
|
||||||
var wind = 0;
|
# since it's currently being written in _every_ update loop anyway).
|
||||||
var amp = 0;
|
# setlistener("/environment/sea/surface/wind-speed-kt", func(n) {update_waves(n.getValue())},
|
||||||
var angle = 0;
|
# 1,
|
||||||
var dangle = 0;
|
# 0);# end listener
|
||||||
var freq = 0;
|
|
||||||
var factor = 0;
|
|
||||||
var sharp = 0;
|
|
||||||
|
|
||||||
wind = n.getValue();
|
|
||||||
|
|
||||||
amp = Amp + 0.02 * wind;
|
|
||||||
amp = clamp(amp, 1.0, 2.0);
|
|
||||||
|
|
||||||
setprop("/environment/wave/amp", amp);
|
|
||||||
|
|
||||||
angle = Angle + 0.2 * wind;
|
|
||||||
setprop("/environment/wave/angle", angle);
|
|
||||||
|
|
||||||
dangle = DAngle - 0.4 * wind;
|
|
||||||
setprop("/environment/wave/dangle", dangle);
|
|
||||||
|
|
||||||
freq = Freq + 0.0008 * wind;
|
|
||||||
freq = clamp(freq, 0.01, 0.015);
|
|
||||||
setprop("/environment/wave/freq", freq);
|
|
||||||
|
|
||||||
factor = Factor - 0.00001 * wind;
|
|
||||||
factor = clamp(factor, 0.0001, 0.0004);
|
|
||||||
setprop("/environment/wave/factor", factor);
|
|
||||||
|
|
||||||
sharp = Sharp + 0.02 * wind;
|
|
||||||
sharp = clamp(sharp, 1.0, 2.0);
|
|
||||||
setprop("/environment/wave/sharp", sharp);
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
1,
|
|
||||||
0);# end listener
|
|
||||||
|
|
||||||
print("weather util initialized ...");
|
print("weather util initialized ...");
|
||||||
loop();
|
loop();
|
||||||
|
|
||||||
}# end init
|
}# end init
|
||||||
|
|
||||||
var loop = func {
|
var loop = func {
|
||||||
|
@ -132,6 +138,9 @@ var loop = func {
|
||||||
value = getprop("/environment/config/boundary/entry[0]/wind-speed-kt");
|
value = getprop("/environment/config/boundary/entry[0]/wind-speed-kt");
|
||||||
setprop("/environment/sea/surface/wind-speed-kt", value);
|
setprop("/environment/sea/surface/wind-speed-kt", value);
|
||||||
# print("wind-speed-kt ", getprop("/environment/sea/surface/wind-speed-kt"));
|
# print("wind-speed-kt ", getprop("/environment/sea/surface/wind-speed-kt"));
|
||||||
|
# Direct call to update wave settings (much more effective than using a listener,
|
||||||
|
# since it's written in every loop anyway.
|
||||||
|
update_waves(value);
|
||||||
|
|
||||||
value = getprop("/environment/config/enabled");
|
value = getprop("/environment/config/enabled");
|
||||||
setprop("/environment/sea/config/enabled", value);
|
setprop("/environment/sea/config/enabled", value);
|
||||||
|
|
|
@ -1759,7 +1759,7 @@
|
||||||
Fix for #567 -->
|
Fix for #567 -->
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>local_weather.clear_all()</script>
|
<script>if (getprop("/nasal/local_weather/loaded",0)) local_weather.clear_all()</script>
|
||||||
</binding>
|
</binding>
|
||||||
</combo>
|
</combo>
|
||||||
|
|
||||||
|
|
|
@ -570,7 +570,7 @@
|
||||||
if (contains(globals, "MPCarriers")) {
|
if (contains(globals, "MPCarriers")) {
|
||||||
MPCarriers.carrier_dialog.show();
|
MPCarriers.carrier_dialog.show();
|
||||||
} else {
|
} else {
|
||||||
gui.popupTip("No MPCarriers around at the moment.");
|
gui.popupTip("Found no MPCarriers for activated carrier AI scenarios within range.", 5.0);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</binding>
|
</binding>
|
||||||
|
|
|
@ -710,6 +710,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
||||||
|
|
||||||
<atc>
|
<atc>
|
||||||
<enabled type="bool">true</enabled>
|
<enabled type="bool">true</enabled>
|
||||||
|
<runway type="string" preserve="y"/>
|
||||||
</atc>
|
</atc>
|
||||||
|
|
||||||
<ai-traffic>
|
<ai-traffic>
|
||||||
|
@ -739,7 +740,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
||||||
<!-- <scenario>vinson_demo</scenario> -->
|
<!-- <scenario>vinson_demo</scenario> -->
|
||||||
</ai>
|
</ai>
|
||||||
|
|
||||||
<multiplay>
|
<multiplay preserve="y">
|
||||||
<chat type="string" preserve="y">Hello</chat>
|
<chat type="string" preserve="y">Hello</chat>
|
||||||
<transmission-freq-hz type="string">118500000</transmission-freq-hz>
|
<transmission-freq-hz type="string">118500000</transmission-freq-hz>
|
||||||
<chat-display type="bool"
|
<chat-display type="bool"
|
||||||
|
@ -748,6 +749,8 @@ Started September 2000 by David Megginson, david@megginson.com
|
||||||
<write-message-log type="bool">false</write-message-log>
|
<write-message-log type="bool">false</write-message-log>
|
||||||
<freeze-on-replay type="bool">true</freeze-on-replay>
|
<freeze-on-replay type="bool">true</freeze-on-replay>
|
||||||
<default-model type="string">Models/Geometry/glider.ac</default-model>
|
<default-model type="string">Models/Geometry/glider.ac</default-model>
|
||||||
|
<callsign type="string" userarchive="y">callsign</callsign>
|
||||||
|
<selected-server type="string" userarchive="y"/>
|
||||||
</multiplay>
|
</multiplay>
|
||||||
|
|
||||||
<user>
|
<user>
|
||||||
|
|
Loading…
Reference in a new issue