1
0
Fork 0

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

This commit is contained in:
Vivian Meazza 2012-01-21 10:28:56 +00:00
commit 8819b01807
9 changed files with 278 additions and 201 deletions

View file

@ -9,10 +9,12 @@
<!-- DIFFUSE -->
</material>
<shade-model>smooth</shade-model>
<!-- unused ?
<wind-speed>
<!--<use>/environment/Vinson/rel-wind-speed-kts</use>-->
<!- -<use>/environment/Vinson/rel-wind-speed-kts</use>- ->
<use>/environment/config/boundary/entry[0]/wind-speed-kt</use>
</wind-speed>
-->
<offset>0.0</offset>
<amplitude-factor>0.08</amplitude-factor>
<windE>
@ -161,13 +163,13 @@
<use>material/color-mode-uniform</use>
</value>
</uniform>
<uniform>
<!-- uniform> unused?
<name>WindSpeed</name>
<type>float</type>
<value>
<use>wind-speed</use>
</value>
</uniform>
</uniform-->
<uniform>
<name>Offset</name>
<type>float</type>

View file

@ -86,9 +86,9 @@
<windN>
<use>/environment/sea/surface/wind-from-north-fps</use>
</windN>
<wind-from>
<!--wind-from> unused?
<use>/environment/config/boundary/entry[0]/wind-from-heading-deg</use>
</wind-from>
</wind-from-->
<WaveFreq>
<use>/environment/wave/freq</use>
</WaveFreq>
@ -398,13 +398,13 @@
<use>windN</use>
</value>
</uniform>
<uniform>
<!-- uniform> unused?
<name>WindFrom</name>
<type>float</type>
<value>
<use>wind-from</use>
</value>
</uniform>
</uniform-->
<uniform>
<name>WaveFreq</name>
<type>float</type>
@ -765,13 +765,13 @@
<use>windN</use>
</value>
</uniform>
<uniform>
<!--uniform> unused?
<name>WindFrom</name>
<type>float</type>
<value>
<use>wind-from</use>
</value>
</uniform>
</uniform-->
<uniform>
<name>WaveFreq</name>
<type>float</type>

View file

@ -328,4 +328,16 @@
</area>
</terrain>
<sea>
<config>
<wind-filter-time type="double">60.0</wind-filter-time>
</config>
</sea>
<!-- definitions for the scattering skydome shader -->
<ground-visibility-m type="double" userarchive="n">16000.0</ground-visibility-m>
<ground-haze-thickness-m type="double" userarchive="n">2000.0</ground-haze-thickness-m>
<terminator-relative-position-m type="double" userarchive="n">1000000.0</terminator-relative-position-m>
<mean-terrain-elevation-m type="double" userarchive="n">0.0</mean-terrain-elevation-m>
</PropertyList>

View file

@ -196,4 +196,187 @@
<filter-time>1</filter-time>
</filter>
<!-- replace weather-utility.nas -->
<!--
#this utility is a workaround for the fact that a shader uses listeners which cannot
# be used with a tied property
-->
<filter>
<name>EnvironmentInterpolator:wave:wind-from-east-fps</name>
<input>/environment/config/boundary/entry[0]/wind-from-east-fps</input>
<output>/environment/sea/surface/wind-from-east-fps</output>
<type>exponential</type>
<filter-time>/environment/sea/config/wind-filter-time</filter-time>
</filter>
<filter>
<name>EnvironmentInterpolator:wave:wind-from-north-fps</name>
<input>/environment/config/boundary/entry[0]/wind-from-north-fps</input>
<output>/environment/sea/surface/wind-from-north-fps</output>
<type>exponential</type>
<filter-time>/environment/sea/config/wind-filter-time</filter-time>
</filter>
<!--filter> unused?
<name>EnvironmentInterpolator:wave:wind-from-heading-deg</name>
<input>/environment/config/boundary/entry[0]/wind-from-heading-deg</input>
<output>/environment/sea/surface/wind-from-deg</output>
<type>gain</type>
<gain>1</gain>
</filter-->
<!--filter> unused?
<name>EnvironmentInterpolator:wave:wind-speed-kt</name>
<input>/environment/config/boundary/entry[0]/wind-speed-kt</input>
<output>/environment/sea/surface/wind-speed-kt</output>
<type>gain</type>
<gain>1</gain>
</filter-->
<logic>
<name>EnvironmentInterpolator:wave:enabled</name>
<input>/environment/config/enabled</input>
<output>/environment/sea/config/enabled</output>
</logic>
<filter>
<name>EnvironmentInterpolator:model:heading</name>
<input>/orientation/heading-deg</input>
<output>/orientation/model/heading-deg</output>
<type>gain</type>
<gain>1</gain>
</filter>
<filter>
<name>EnvironmentInterpolator:model:pitch</name>
<input>/orientation/pitch-deg</input>
<output>/orientation/model/pitch-deg</output>
<type>gain</type>
<gain>1</gain>
</filter>
<filter>
<name>EnvironmentInterpolator:model:roll</name>
<type>gain</type>
<gain>1</gain>
<input>/orientation/roll-deg</input>
<output>/orientation/model/roll-deg</output>
</filter>
<filter>
<name>EnvironmentInterpolator:wave:amp</name>
<type>gain</type>
<gain>1</gain>
<input>
<expression>
<sum>
<value>1.0</value>
<product>
<value>0.02</value>
<property>/environment/config/boundary/entry[0]/wind-speed-kt</property>
</product>
</sum>
</expression>
</input>
<output>/environment/wave/amp</output>
<min>1.0</min>
<max>2.0</max>
</filter>
<filter>
<name>EnvironmentInterpolator:wave:angle</name>
<type>gain</type>
<gain>1</gain>
<input>
<expression>
<sum>
<value>35.0</value>
<product>
<value>0.2</value>
<property>/environment/config/boundary/entry[0]/wind-speed-kt</property>
</product>
</sum>
</expression>
</input>
<output>/environment/wave/angle</output>
</filter>
<filter>
<name>EnvironmentInterpolator:wave:dangle</name>
<type>gain</type>
<gain>1</gain>
<input>
<expression>
<difference>
<value>20.0</value>
<product>
<value>0.4</value>
<property>/environment/config/boundary/entry[0]/wind-speed-kt</property>
</product>
</difference>
</expression>
</input>
<output>/environment/wave/dangle</output>
</filter>
<filter>
<name>EnvironmentInterpolator:wave:freq</name>
<type>gain</type>
<gain>1</gain>
<input>
<expression>
<sum>
<value>0.01</value>
<product>
<value>0.0008</value>
<property>/environment/config/boundary/entry[0]/wind-speed-kt</property>
</product>
</sum>
</expression>
</input>
<output>/environment/wave/freq</output>
<min>0.01</min>
<max>0.015</max>
</filter>
<filter>
<name>EnvironmentInterpolator:wave:factor</name>
<type>gain</type>
<gain>1</gain>
<input>
<expression>
<difference>
<value>0.0004</value>
<product>
<value>0.00001</value>
<property>/environment/config/boundary/entry[0]/wind-speed-kt</property>
</product>
</difference>
</expression>
</input>
<output>/environment/wave/factor</output>
<min>0.0001</min>
<max>0.0004</max>
</filter>
<filter>
<name>EnvironmentInterpolator:wave:sharp</name>
<type>gain</type>
<gain>1</gain>
<input>
<expression>
<sum>
<value>1.0</value>
<product>
<value>0.02</value>
<property>/environment/config/boundary/entry[0]/wind-speed-kt</property>
</product>
</sum>
</expression>
</input>
<output>/environment/wave/sharp</output>
<min>1.0</min>
<max>2.0</max>
</filter>
</PropertyList>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2012 Torsten Dreyer, Torsten (at) t3r _dot_ de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<!--
Compute local weather related properties
-->
<PropertyList>
<!-- (pi/2 - /sim/time/sun-angle-rad) / 0.017451 * 110000.0 -->
<filter>
<name>LocalWeather:terminator-relative-position</name>
<input>
<expression>
<difference>
<value>1.57079632675</value>
<property>/sim/time/sun-angle-rad</property>
</difference>
</expression>
</input>
<output>/environment/terminator-relative-position-m</output>
<type>gain</type>
<gain>6303363.70409</gain>
</filter>
</PropertyList>

View file

@ -407,4 +407,31 @@
<input>/environment/metar/clouds/layer[0]/alpha</input>
<output>/environment/clouds/layer[0]/alpha</output>
</filter>
<!-- replace weather-utility.nas
# Put the snow line slightly below the station's elevation,
# so the station is completely covered with snow
-->
<filter>
<name>MetarController:snow-level</name>
<type>gain</type>
<gain>1.0</gain>
<input>
<condition>
<property>/environment/metar/valid</property>
<property>/environment/metar/snow-cover</property>
</condition>
<expression>
<sum>
<product>
<property>/environment/metar/station-elevation-ft</property>
<value>0.3048</value>
</product>
<value>-50.0</value>
</sum>
</expression>
</input>
<input>3200</input>
<output>/environment/snow-level-m</output>
<max>3200</max>
</filter>
</PropertyList>

View file

@ -1220,8 +1220,8 @@ var basic_keys = {
{ name: "_", desc: "compose chat message" },
{ name: "F3", desc: "capture screen" },
{ name: "F10", desc: "toggle menubar" },
{ name: "Shift-F1", desc: "load flight" },
{ name: "Shift-F2", desc: "save flight" },
#{ name: "Shift-F1", desc: "load flight" },
#{ name: "Shift-F2", desc: "save flight" },
{ name: "Shift-F10", desc: "cycle through GUI styles" },
],
};

View file

@ -1,190 +0,0 @@
##########
#this utility is a workaround for the fact that a shader uses listeners which cannot
# be used with a tied property
#
# TODO: Make this optional (when shaders disabled etc), or move computation
# away from Nasal.
#does what it says on the tin
var clamp = func(v, min, max) { v < min ? min : v > max ? max : v }
#set global variables
var Amp = 1.0;
var Angle = 35.0;
var DAngle = 20.0;
var Freq = 0.01;
var Factor = 0.0004;
var Sharp = 1.0;
#add control properies for waves
var wave_amp_Node = props.globals.getNode("/environment/wave/amp" , 1);
wave_amp_Node.setDoubleValue(Amp);
var wave_freq_Node = props.globals.getNode("/environment/wave/freq" , 1);
wave_freq_Node.setDoubleValue(Freq);
var wave_sharp_Node = props.globals.getNode("/environment/wave/sharp" , 1);
wave_sharp_Node.setDoubleValue(Sharp);
var wave_angle_Node = props.globals.getNode("/environment/wave/angle" , 1);
wave_angle_Node.setDoubleValue(Angle);
var wave_factor_Node = props.globals.getNode("/environment/wave/factor" , 1);
wave_factor_Node.setDoubleValue(Factor);
var wave_factor_Node = props.globals.getNode("/environment/wave/dangle" , 1);
wave_factor_Node.setDoubleValue(DAngle);
props.globals.initNode("/environment/sea/surface/wind-speed-kt", 0, "DOUBLE");
props.globals.initNode("/environment/sea/surface/wind-from-east-fps", 0, "DOUBLE");
props.globals.initNode("/environment/sea/surface/wind-from-north-fps", 0, "DOUBLE");
props.globals.initNode("/environment/sea/surface/wind-from-deg", 0, "DOUBLE");
props.globals.initNode("/environment/sea/surface/config/enabled", 0, "DOUBLE");
#object rotation values
props.globals.initNode("/orientation/model/heading-deg", 0, "DOUBLE");
props.globals.initNode("/orientation/model/pitch-deg", 0, "DOUBLE");
props.globals.initNode("/orientation/model/roll-deg", 0, "DOUBLE");
var update_waves = func (wind) {
var wind = 0;
var amp = 0;
var angle = 0;
var dangle = 0;
var freq = 0;
var factor = 0;
var sharp = 0;
amp = Amp + 0.02 * wind;
amp = clamp(amp, 1.0, 2.0);
setprop("/environment/wave/amp", amp);
angle = Angle + 0.2 * wind;
setprop("/environment/wave/angle", angle);
dangle = DAngle - 0.4 * wind;
setprop("/environment/wave/dangle", dangle);
freq = Freq + 0.0008 * wind;
freq = clamp(freq, 0.01, 0.015);
setprop("/environment/wave/freq", freq);
factor = Factor - 0.00001 * wind;
factor = clamp(factor, 0.0001, 0.0004);
setprop("/environment/wave/factor", factor);
sharp = Sharp + 0.02 * wind;
sharp = clamp(sharp, 1.0, 2.0);
setprop("/environment/wave/sharp", sharp);
};
var is_initialized = 0;
var initialize = func {
if (is_initialized)
return; # only install listeners once
is_initialized = 1;
var wind_from_east_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-from-east-fps", 1);
wind_from_east_Node.setDoubleValue(0);
var wind_from_north_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-from-north-fps", 1);
wind_from_north_Node.setDoubleValue(0);
var wind_from_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-from-heading-deg", 1);
wind_from_Node.setDoubleValue(0);
var wind_speed_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-speed-kt", 1);
wind_speed_Node.setDoubleValue(0);
var wind_status_Node = props.globals.getNode("/environment/config/enabled", 1);
wind_status_Node.setBoolValue(1);
var ground_vis_Node = props.globals.getNode("/environment/ground-visibility-m", 1);
ground_vis_Node.setDoubleValue(500);
var ground_thick_Node = props.globals.getNode("/environment/ground-haze-thickness-m" , 1);
ground_thick_Node.setDoubleValue(300);
var ground_term_Node = props.globals.getNode("/environment/terminator-relative-position-m" , 1);
ground_term_Node.setDoubleValue(60000);
# ################## listeners ####################
#
# installing a listener to /environment/sea/surface/wind-speed-kt does not make sense,
# since it's currently being written in _every_ update loop anyway).
# setlistener("/environment/sea/surface/wind-speed-kt", func(n) {update_waves(n.getValue())},
# 1,
# 0);# end listener
print("weather util initialized ...");
loop();
}# end init
var loop = func {
var value = getprop("/environment/config/boundary/entry[0]/wind-from-east-fps");
setprop("/environment/sea/surface/wind-from-east-fps", value);
# print("wind-from-east-fps ", getprop("/environment/sea/surface/wind-from-east-fps"));
value = getprop("/environment/config/boundary/entry[0]/wind-from-north-fps");
setprop("/environment/sea/surface/wind-from-north-fps", value);
# print("wind-from-north-fps ", getprop("/environment/sea/surface/wind-from-north-fps"));
value = getprop("/environment/config/boundary/entry[0]/wind-from-heading-deg");
setprop("/environment/sea/surface/wind-from-deg", value);
# print("wind-from-deg ", getprop("/environment/sea/surface/wind-from-deg"));
value = getprop("/environment/config/boundary/entry[0]/wind-speed-kt");
setprop("/environment/sea/surface/wind-speed-kt", value);
# print("wind-speed-kt ", getprop("/environment/sea/surface/wind-speed-kt"));
# Direct call to update wave settings (much more effective than using a listener,
# since it's written in every loop anyway.
update_waves(value);
value = getprop("/environment/config/enabled");
setprop("/environment/sea/config/enabled", value);
# print("wind-speed-kt ", getprop("/environment/config/enabled"));
# orientation fix
#orientation
value = getprop("/orientation/heading-deg") or 0.0;
setprop("/orientation/model/heading-deg", value);
value = getprop("/orientation/pitch-deg") or 0.0;
setprop("/orientation/model/pitch-deg", value);
value = getprop("/orientation/roll-deg") or 0.0;
setprop("/orientation/model/roll-deg", value);
settimer(loop,0);
}
# Fire it up
setlistener("sim/signals/fdm-initialized", initialize);
# end
###
# Adjust snow line to match METAR
#
var snowLineDefault = 3200;
_setlistener("/environment/metar/valid", func {
var snowCover = getprop("/environment/metar/snow-cover");
var snowLine = getprop("/environment/snow-level-m");
# Put the snow line slightly below the station's elevation,
# so the station is completely covered with snow
var stationElev = getprop("/environment/metar/station-elevation-ft") * globals.FT2M - 50;
if (snowCover == 1){
if (stationElev > snowLineDefault) { snowLine = snowLineDefault; }
if ((stationElev <= snowLineDefault) and (snowLine > stationElev)) { snowLine = stationElev; }
}
setprop("/environment/snow-level-m",snowLine);
});
#
###

View file

@ -382,6 +382,10 @@ Started September 2000 by David Megginson, david@megginson.com
<name>Environment Interpolation Rule</name>
<path>Environment/interpolator.xml</path>
</property-rule>
<property-rule>
<name>Local Weather Rules </name>
<path>Environment/local-weather-rules.xml</path>
</property-rule>
</systems>
<instrumentation>
<path>Aircraft/Generic/generic-instrumentation.xml</path>