1
0
Fork 0

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

This commit is contained in:
Stuart Buchanan 2011-10-13 20:53:10 +01:00
commit 23e27e21ac
15 changed files with 544 additions and 84 deletions

View file

@ -120,6 +120,8 @@ script - execute a PSL script
exit - prompt and quit FlightGear
pause - pause/resume the simulation
load - load properties from an XML file
file: the name of the file to load, relative to the current
directory (defaults to "fgfs.sav")
@ -234,6 +236,9 @@ dialog-apply - copy values from the active dialog box to FlightGear
presets-commit - commit preset values from /sim/presets
open-browser - open the web browser and show given file
path: name of the local file to be opened.
url: URL to be opened (http://..., ftp://...).
The following commands are temporary, and will soon disappear or be
renamed; do NOT rely on them:
@ -280,8 +285,6 @@ old-ap-adjust-dialog - adjust the autopilot settings
old-lat-lon-format-dialog - toggle the lat/lon format in the HUD
old-help-dialog - offer online help
Adding New Commands in C++
--------------------------

161
Effects/flutter.eff Normal file
View file

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/flutter</name>
<inherits-from>Effects/model-default</inherits-from>
<parameters>
<vertex-program-two-side type="bool">true</vertex-program-two-side>
<material>
<color-mode-uniform>1</color-mode-uniform>
<!-- DIFFUSE -->
</material>
<shade-model>smooth</shade-model>
<wind-speed>
<!--<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>
</parameters>
<technique n="9">
<predicate>
<and>
<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>
<material>
<active>
<use>material/active</use>
</active>
<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>
<use>material/color-mode</use>
</color-mode>
</material>
<blend>
<active>
<use>blend/active</use>
</active>
<source>
<use>blend/source</use>
</source>
<destination>
<use>blend/destination</use>
</destination>
</blend>
<shade-model>
<use>shade-model</use>
</shade-model>
<cull-face>
<use>cull-face</use>
</cull-face>
<rendering-hint>
<use>rendering-hint</use>
</rendering-hint>
<texture-unit>
<!-- The texture unit is always active because the shaders expect
that. -->
<unit>0</unit>
<!-- If there is a texture, the type in the derived effect
will be "2d". -->
<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>
<!--
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
-->
</texture-unit>
<texture-unit>
<unit>9</unit>
<type>noise</type>
</texture-unit>
<vertex-program-two-side>
<use>vertex-program-two-side</use>
</vertex-program-two-side>
<program>
<vertex-shader>Shaders/flutter.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>-->
<uniform>
<name>colorMode</name>
<type>int</type>
<value>
<use>material/color-mode-uniform</use>
</value>
</uniform>
<uniform>
<name>WindSpeed</name>
<type>float</type>
<value>
<use>wind-speed</use>
</value>
</uniform>
<uniform>
<name>Offset</name>
<type>float</type>
<value>
<use>offset</use>
</value>
</uniform>
<uniform>
<name>AmpFactor</name>
<type>float</type>
<value>
<use>amplitude-factor</use>
</value>
</uniform>
<uniform>
<name>Noise</name>
<type>sampler-3d</type>
<value type="int">9</value>
</uniform>
</pass>
</technique>
</PropertyList>

79
Shaders/flutter.vert Normal file
View file

@ -0,0 +1,79 @@
// -*-C++-*-
// Shader that uses OpenGL state values to do per-pixel lighting
//
// The only light used is gl_LightSource[0], which is assumed to be
// directional.
//
// Diffuse colors come from the gl_Color, ambient from the material. This is
// equivalent to osg::Material::DIFFUSE.
#define MODE_OFF 0
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
// The ambient term of the lighting equation that doesn't depend on
// the surface normal is passed in gl_{Front,Back}Color. The alpha
// component is set to 1 for front, 0 for back in order to work around
// bugs with gl_FrontFacing in the fragment shader.
varying vec4 diffuse_term;
varying vec3 normal;
varying float fogCoord;
uniform int colorMode;
uniform float osg_SimulationTime;
uniform float WindSpeed, Offset, AmpFactor;
uniform sampler3D Noise;
void main()
{
// map noise vector
vec4 noisevec = texture3D(Noise, gl_Vertex.xyz);
//waving effect
float tsec = osg_SimulationTime;
vec4 pos = gl_Vertex;
vec4 oldpos = gl_Vertex;
float freq = (10 * WindSpeed) + 10;
pos.y = sin((pos.x * 5.0 + tsec * freq )/5.0) * 0.5 ;
pos.y += sin((pos.z * 5.0 + tsec * freq/2)/5.0) * 0.125 ;
pos.y *= pow(pos.x - Offset, 2.0) * AmpFactor;
gl_Position = gl_ModelViewProjectionMatrix * pos;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;
vec4 ambient_color, diffuse_color;
if (colorMode == MODE_DIFFUSE) {
diffuse_color = gl_Color;
ambient_color = gl_FrontMaterial.ambient;
} else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) {
diffuse_color = gl_Color;
ambient_color = gl_Color;
} else {
diffuse_color = gl_FrontMaterial.diffuse;
ambient_color = gl_FrontMaterial.ambient;
}
diffuse_term = diffuse_color * gl_LightSource[0].diffuse;
vec4 ambient_term = ambient_color * gl_LightSource[0].ambient;
// Super hack: if diffuse material alpha is less than 1, assume a
// transparency animation is at work
if (gl_FrontMaterial.diffuse.a < 1.0)
diffuse_term.a = gl_FrontMaterial.diffuse.a;
else
diffuse_term.a = gl_Color.a;
// Another hack for supporting two-sided lighting without using
// gl_FrontFacing in the fragment shader.
gl_FrontColor.rgb = ambient_term.rgb; gl_FrontColor.a = 0.0;
gl_BackColor.rgb = ambient_term.rgb; gl_FrontColor.a = 1.0;
fogCoord = abs(ecPosition.z / ecPosition.w);
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

View file

@ -16,9 +16,31 @@ command interface /autopilot/route-manager/input:
<layout>vbox</layout>
<resizable>true</resizable>
<color>
<red type="float">0.41</red>
<green type="float">0.4</green>
<blue type="float">0.42</blue>
<alpha type="float">1.0</alpha>
<alpha type="float">1.0</alpha>
</color>
<nasal>
<open>
var mapDialog = cmdarg();
var setTransparency = func(updateDialog){
var alpha = (getprop("/gui/map/transparent") or 0);
mapDialog.getNode("color/alpha").setValue(1-alpha*0.3);
mapDialog.getNode("color/red").setValue(0.41-alpha*0.2);
mapDialog.getNode("color/green").setValue(0.4-alpha*0.2);
mapDialog.getNode("color/blue").setValue(0.42-alpha*0.2);
var n = props.Node.new({ "dialog-name": "map" });
if (updateDialog)
{
fgcommand("dialog-close", n);
fgcommand("dialog-show", n);
}
}
setTransparency(0);
</open>
<close>
@ -128,6 +150,19 @@ command interface /autopilot/route-manager/input:
<empty><stretch>true</stretch></empty>
<checkbox>
<label>Magnetic Hdgs</label>
<pref-width>100</pref-width>
<property>/gui/map/magnetic-headings</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
<checkbox>
<label>Center on Acft</label>
<pref-width>100</pref-width>
@ -155,9 +190,9 @@ command interface /autopilot/route-manager/input:
</checkbox>
<checkbox>
<label>Magnetic Hdgs</label>
<label>Transparent</label>
<pref-width>100</pref-width>
<property>/gui/map/magnetic-headings</property>
<property>/gui/map/transparent</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
@ -165,11 +200,16 @@ command interface /autopilot/route-manager/input:
<binding>
<command>property-toggle</command>
</binding>
<binding>
<command>nasal</command>
<script>setTransparency(1);</script>
</binding>
</checkbox>
<empty><stretch>true</stretch></empty>
<button>
<name>close</name>
<legend>Close</legend>
<pref-width>100</pref-width>
<default>true</default>
@ -202,18 +242,19 @@ command interface /autopilot/route-manager/input:
<layout>hbox</layout>
<button>
<legend>-</legend>
<pref-width>22</pref-width>
<pref-height>22</pref-height>
<name>zoomout</name>
<legend>-</legend>
<pref-width>22</pref-width>
<pref-height>22</pref-height>
<binding>
<command>property-adjust</command>
<property>/gui/map/zoom</property>
<min>0</min>
<step>-1</step>
</binding>
</button>
<binding>
<command>property-adjust</command>
<property>/gui/map/zoom</property>
<min>0</min>
<step>-1</step>
</binding>
</button>
<text>
<label>MMM</label>
<format>Zoom %d</format>
@ -222,17 +263,18 @@ command interface /autopilot/route-manager/input:
</text>
<button>
<legend>+</legend>
<pref-width>22</pref-width>
<pref-height>22</pref-height>
<name>zoomin</name>
<legend>+</legend>
<pref-width>22</pref-width>
<pref-height>22</pref-height>
<binding>
<command>property-adjust</command>
<property>/gui/map/zoom</property>
<step>1</step>
<max>12</max>
</binding>
</button>
<binding>
<command>property-adjust</command>
<property>/gui/map/zoom</property>
<step>1</step>
<max>12</max>
</binding>
</button>
</group>
</group>

View file

@ -20,14 +20,40 @@
new : func( dlgRoot ) {
var obj = { parents: [ReplayDialogController] };
obj.dlgRoot = dlgRoot;
obj.initViews(1);
return obj;
},
# Populate the view combo box with a list of the available views
initViews : func(update) {
var combo = me.findElementByName( me.dlgRoot, "view-selector" );
if (update)
combo.removeChildren("value");
var current_view = getprop("/sim/current-view/view-number");
var i = 0;
foreach (var v; view.views) {
var name = "Unnamed view " ~ v.getIndex();
if (v.getNode("name") != nil) {
name = v.getNode("name").getValue();
}
# Pre-populate the combo box selected value
if (i == current_view) {
setprop("/sim/replay/view-name", name);
}
if (update)
combo.getNode("value[" ~ i ~ "]", 1).setValue(name);
i = i + 1;
}
},
open : func {
var replaySlider = me.findElementByName( me.dlgRoot, "replay-time-slider" );
me.maxProp = replaySlider.getChild("max");
me.minProp = replaySlider.getChild("min");
me.maxListenerId = setlistener( "/sim/speed-up", func(n) { me.updateListener(n); }, 1, 1 );
me.speedUpListenerId = setlistener( "/sim/speed-up", func(n) { me.updateListener(n); }, 1, 1 );
me.viewListenerId = setlistener( "/sim/current-view/view-number", func(n) { me.updateListener(n); }, 1, 1 );
if (getprop("/sim/replay/end-time")!=nil)
{
# update max/min range of replay-time slider
@ -45,10 +71,12 @@
SpeedUp = "1/" ~ SpeedUp;
}
setprop("/sim/gui/dialogs/replay/time-factor","" ~ SpeedUp ~ "x");
me.initViews(0);
},
close : func {
#removelistener( me.maxListenerId );
removelistener( me.speedUpListenerId );
removelistener( me.viewListenerId );
},
findElementByName : func(base,name) {
@ -66,6 +94,8 @@
var controller = ReplayDialogController.new( cmdarg() );
controller.open();
if (props.globals.getNode("/rotors",0)!=nil)
setprop("/sim/replay/disable-my-controls",1);
]]></open>
<close><![CDATA[
@ -218,24 +248,7 @@
</button>
<empty><stretch>1</stretch></empty>
<!--
<button>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<color>
<red type="float">0.3</red>
<green type="float">0.3</green>
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<legend></legend>
<keynum>27</keynum>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
-->
<button>
<legend>Hide</legend>
<border>1</border>
@ -378,10 +391,12 @@
<group>
<layout>hbox</layout>
<halign>center</halign>
<stretch>false</stretch>
<halign>fill</halign>
<stretch>true</stretch>
<default-padding>3</default-padding>
<empty><pref-width>26</pref-width></empty>
<button>
<legend>Pause</legend>
<default>true</default>
@ -394,7 +409,7 @@
</color>
<property>/sim/freeze/master</property>
<live>true</live>
<pref-width>47</pref-width>
<pref-width>70</pref-width>
<binding>
<command>property-toggle</command>
<property>/sim/freeze/clock</property>
@ -405,52 +420,68 @@
</binding>
</button>
<empty><pref-width>80</pref-width></empty>
<button>
<legend>End Replay</legend>
<key>Esc</key>
<border>1</border>
<name>mute</name>
<legend>Mute</legend>
<border>2</border>
<pref-width>55</pref-width>
<color>
<red type="float">0.3</red>
<green type="float">0.3</green>
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<!--<pref-width>47</pref-width>-->
<halign>left</halign>
<property>/sim/replay/mute</property>
<live>true</live>
<binding>
<command>property-assign</command>
<property>/sim/replay/disable</property>
<value type="bool">true</value>
</binding>
<binding>
<command>dialog-close</command>
<command>nasal</command>
<script><![CDATA[
var mute = !getprop("/sim/replay/mute");
setprop("/sim/replay/mute",mute);
setprop("/sim/sound/enabled",!mute);
]]></script>
</binding>
</button>
<!-- Future features...
<button>
<legend>My controls!</legend>
<border>1</border>
<combo>
<name>view-selector</name>
<halign>left</halign>
<pref-width>150</pref-width>
<color>
<red>1</red>
<green>0.3</green>
<blue>0.3</blue>
<alpha>0.8</alpha>
<red type="float">0.3</red>
<green type="float">0.3</green>
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<pref-width>80</pref-width>
<color-highlight>
<red type="float">0.6</red>
<green type="float">0.6</green>
<blue type="float">0.6</blue>
<alpha type="float">0.8</alpha>
</color-highlight>
<live>true</live>
<property>/sim/replay/view-name</property>
<binding>
<command>property-assign</command>
<property>/sim/freeze/replay-state</property>
<value type="int">3</value>
<command>dialog-apply</command>
<object-name>view-selector</object-name>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/replay/disable</property>
<value type="bool">true</value>
<command>nasal</command>
<script>
var index = view.indexof(getprop("/sim/replay/view-name"));
setprop("/sim/current-view/view-number", index);
</script>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
</combo>
<empty><pref-width>30</pref-width></empty>
<!-- Future features...
<empty><pref-width>10</pref-width></empty>
<button>
<legend>Save</legend>
<border>1</border>
@ -476,12 +507,76 @@
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<pref-width>40</pref-width>
<pref-width>43</pref-width>
<binding>
<command>nasal</command>
<script>gui.popupTip("Not implemented yet. Comming soon.");</script>
</binding>
</button>
-->
<button>
<legend>My Controls!</legend>
<border>1</border>
<color>
<red>1</red>
<green>0.3</green>
<blue>0.3</blue>
<alpha>0.8</alpha>
</color>
<visible>
<and>
<not><property>/sim/replay/disable-my-controls</property></not>
<or>
<equals>
<property>/sim/flight-model</property>
<value>yasim</value>
</equals>
<!-- Not supported yet...
<equals>
<property>/sim/flight-model</property>
<value>jsb</value>
</equals>
-->
</or>
</and>
</visible>
<pref-width>90</pref-width>
<binding>
<command>property-assign</command>
<property>/sim/freeze/replay-state</property>
<value type="int">3</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/replay/disable</property>
<value type="bool">true</value>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<legend>End Replay</legend>
<key>Esc</key>
<border>1</border>
<pref-width>90</pref-width>
<color>
<red type="float">0.3</red>
<green type="float">0.3</green>
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<binding>
<command>property-assign</command>
<property>/sim/replay/disable</property>
<value type="bool">true</value>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>

View file

@ -7,6 +7,12 @@
<default-padding>8</default-padding>
<x>-5</x>
<y>5</y>
<color>
<red>0.2</red>
<green>0.2</green>
<blue>0.2</blue>
<alpha>0.7</alpha>
</color>
<nasal>
<open>
@ -104,6 +110,12 @@
<legend>Start</legend>
<equal>true</equal>
<pref-width>47</pref-width>
<color>
<red type="float">0.3</red>
<green type="float">0.3</green>
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<binding>
<command>nasal</command>
<script>start()</script>
@ -114,6 +126,12 @@
<legend>Stop</legend>
<default>true</default>
<pref-width>47</pref-width>
<color>
<red type="float">0.3</red>
<green type="float">0.3</green>
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<binding>
<command>nasal</command>
<script>stop()</script>
@ -124,6 +142,12 @@
<legend>Reset</legend>
<key>Delete</key>
<pref-width>47</pref-width>
<color>
<red type="float">0.3</red>
<green type="float">0.3</green>
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<binding>
<command>nasal</command>
<script>reset()</script>
@ -132,6 +156,12 @@
<button>
<legend>Close</legend>
<color>
<red type="float">0.3</red>
<green type="float">0.3</green>
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<key>Esc</key>
<pref-width>47</pref-width>
<binding>

View file

@ -759,7 +759,8 @@
<label>Help (opens in browser)</label>
<name>help-browser</name>
<binding>
<command>old-help-dialog</command>
<command>open-browser</command>
<path>Docs/index.html</path>
</binding>
</item>

View file

@ -1101,7 +1101,7 @@ top down before the key bindings are parsed.
</binding>
</key>
<key n="257">
<!--<key n="257">
<name>F1</name>
<mod-shift>
<desc>Load flight</desc>
@ -1119,7 +1119,7 @@ top down before the key bindings are parsed.
<write-all>false</write-all>
</binding>
</mod-shift>
</key>
</key>-->
<key n="259">
<name>F3</name>

View file

@ -1337,8 +1337,7 @@ Shared parameters for various materials.
</condition>
<effect>Effects/water</effect>
<name>Lagoon</name>
<name>Lake</name>
<texture>Terrain/water-lake.png</texture>
<texture>Terrain/water-lake.png</texture>
<xsize>400</xsize>
<ysize>400</ysize>
<ambient>
@ -1373,6 +1372,7 @@ Shared parameters for various materials.
</equals>
</condition>
<effect>Effects/water-inland</effect>
<name>Lake</name>
<name>Pond</name>
<name>Reservoir</name>
<name>Stream</name>
@ -4777,6 +4777,29 @@ Shared parameters for various materials.
</emissive>
</material>
<material>
<name>UnidirectionalTaperRed</name>
<texture>Symbols/unidirectionalred.dds</texture>
<emissive>
<r>0.92157</r>
<g>0.92157</g>
<b>0.76471</b>
<a>1.0</a>
</emissive>
</material>
<material>
<name>UnidirectionalTaperGreen</name>
<texture>Symbols/unidirectionalgreen.dds</texture>
<emissive>
<r>0.92157</r>
<g>0.92157</g>
<b>0.76471</b>
<a>1.0</a>
</emissive>
</material>
<material>
<name>BidirectionalTaper</name>
<texture>Symbols/bidirectional.dds</texture>

View file

@ -3381,6 +3381,29 @@ Shared parameters for various materials.
<a>1.0</a>
</emissive>
</material>
<material>
<name>UnidirectionalTaperRed</name>
<texture>Symbols/unidirectionalred.png</texture>
<emissive>
<r>0.92157</r>
<g>0.92157</g>
<b>0.76471</b>
<a>1.0</a>
</emissive>
</material>
<material>
<name>UnidirectionalTaperGreen</name>
<texture>Symbols/unidirectionalgreen.png</texture>
<emissive>
<r>0.92157</r>
<g>0.92157</g>
<b>0.76471</b>
<a>1.0</a>
</emissive>
</material>
<material>
<name>BidirectionalTaper</name>

View file

@ -785,6 +785,9 @@ Started September 2000 by David Megginson, david@megginson.com
<default-config type="string">/Aircraft/Generic/flightrecorder/generic-piston-propeller-4.xml</default-config>
</flight-recorder>
<realism>
<dme-fallback-to-loc type="bool">false</dme-fallback-to-loc>
</realism>
</sim>
<!-- mouse mode -->
<devices>