1
0
Fork 0

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

This commit is contained in:
Dave Perry 2011-02-18 16:46:05 -07:00
commit af39c395b6
12 changed files with 126 additions and 123 deletions

View file

@ -12,13 +12,13 @@
-->
<piston_engine name="IO320">
<minmp unit="INHG"> 6.5 </minmp> <!-- Deprecated -->
<minmp unit="INHG"> 8.3 </minmp> <!-- Deprecated -->
<maxmp unit="INHG"> 28.5 </maxmp>
<displacement unit="IN3"> 320.0 </displacement>
<maxhp> 160.0 </maxhp>
<!-- bsfc> 0.37 </bsfc -->
<cycles> 4.0 </cycles>
<idlerpm> 550.0 </idlerpm>
<idlerpm> 600.0 </idlerpm>
<maxrpm> 2700.0 </maxrpm>
<maxthrottle> 1.0 </maxthrottle>
<minthrottle> 0.1 </minthrottle>

View file

@ -1,12 +0,0 @@
<?xml version="1.0"?>
<initialize name="reset00">
<ubody unit="FT/SEC"> 3.76751 </ubody>
<vbody unit="FT/SEC"> 149.591 </vbody>
<wbody unit="FT/SEC"> -216.892 </wbody>
<phi unit="DEG"> -1.56812 </phi>
<theta unit="DEG"> -0.24805 </theta>
<psi unit="DEG"> 3.50617 </psi>
<longitude unit="DEG"> 0 </longitude>
<latitude unit="DEG"> 0 </latitude>
<altitude unit="FT"> 1170.89 </altitude>
</initialize>

View file

@ -776,16 +776,20 @@ var autotrim = {
# (see Hawker Seahawk for an example).
#
# SYNOPSIS:
# aircraft.tyresmoke.new(<gear index>)
# <gear index> - the index of the gear to which the tyre smoke is attached
# aircraft.tyresmoke.new(gear index [, auto = 0])
# gear index - the index of the gear to which the tyre smoke is attached
# auto - enable automatic update (recommended). defaults to 0 for backward compatibility.
# aircraft.tyresmoke.del()
# destructor.
# aircraft.tyresmoke.update()
# Runs the update. Not required if automatic updates are enabled.
#
# EXAMPLE:
# var tyresmoke_0 = aircraft.tyresmoke.new(0);
# tyresmoke_0.update();
#
var tyresmoke = {
new: func(number) {
new: func(number, auto = 0) {
var m = { parents: [tyresmoke] };
me.vertical_speed = props.globals.initNode("velocities/vertical-speed-fps");
me.speed = props.globals.initNode("velocities/groundspeed-kt");
@ -798,6 +802,8 @@ var tyresmoke = {
m.sprayspeed = gear.initNode("sprayspeed-ms");
m.spray = gear.initNode("spray", 0, "BOOL");
m.spraydensity = gear.initNode("spray-density", 0, "DOUBLE");
m.auto = auto;
m.listener = nil;
if (getprop("sim/flight-model") == "jsb") {
var wheel_speed = "fdm/jsbsim/gear/unit[" ~ number ~ "]/wheel-speed-fps";
@ -809,8 +815,16 @@ var tyresmoke = {
}
m.lp = lowpass.new(2);
auto and m.update();
return m;
},
del: func {
if (me.listener != nil) {
removelistener(me.listener);
me.listener = nil;
}
me.auto = 0;
},
update: func {
var rollspeed = me.get_rollspeed();
var vert_speed = me.vertical_speed.getValue();
@ -829,23 +843,67 @@ var tyresmoke = {
me.tyresmoke.setValue(1);
me.spray.setValue(0);
me.spraydensity.setValue(0);
} elsif (wow and groundspeed > 5 and rain >= 0.20) {
me.tyresmoke.setValue(0);
me.spray.setValue(1);
me.sprayspeed.setValue(rollspeed * 6);
me.spraydensity.setValue(rain * groundspeed);
} else {
me.tyresmoke.setValue(0);
me.spray.setValue(0);
me.sprayspeed.setValue(0);
me.spraydensity.setValue(0);
}
if (me.auto) {
if (wow) {
settimer(func me.update(), 0);
if (me.listener != nil) {
removelistener(me.listener);
me.listener = nil;
}
} elsif (me.listener == nil) {
me.listener = setlistener(me.wow, func me._wowchanged_(), 0, 0);
}
}
},
_wowchanged_: func() {
if (me.wow.getValue()) {
me.lp.set(0);
me.update();
}
},
};
# tyresmoke_system
# =============================================================================
# Helper class to contain the tyresmoke objects for all the gears.
# Will update automatically, nothing else needs to be done by the caller.
#
# SYNOPSIS:
# aircraft.tyresmoke_system.new(<gear index 1>, <gear index 2>, ...)
# <gear index> - the index of the gear to which the tyre smoke is attached
# aircraft.tyresmoke_system.del()
# destructor
# EXAMPLE:
# var tyresmoke_system = aircraft.tyresmoke_system.new(0, 1, 2, 3, 4);
var tyresmoke_system = {
new: func {
var m = { parents: [tyresmoke_system] };
# preset array to proper size
m.gears = [];
setsize(m.gears, size(arg));
for(var i = size(arg) - 1; i >= 0; i -= 1) {
m.gears[i] = tyresmoke.new(arg[i], 1);
}
return m;
},
del: func {
foreach(var gear; me.gears) {
gear.del();
}
}
};
# rain
# =============================================================================

View file

@ -1,8 +1,6 @@
# Properties under /consumables/fuel/tank[n]:
# + level-gal_us - Current fuel load. Can be set by user code.
# + level-lbs - OUTPUT ONLY property, do not try to set
# + level-lbs - Current fuel load. Can be set by user code.
# + selected - boolean indicating tank selection.
# + density-ppg - Fuel density, in lbs/gallon.
# + capacity-gal_us - Tank capacity
#
# Properties under /engines/engine[n]:
@ -42,11 +40,10 @@ var update = func {
} else {
var fuel_per_tank = consumed_fuel / size(selected_tanks);
foreach (var t; selected_tanks) {
var ppg = t.getNode("density-ppg").getValue();
var lbs = t.getNode("level-gal_us").getValue() * ppg;
var lbs = t.getNode("level-lbs").getValue();
lbs = lbs - fuel_per_tank;
if (lbs < 0) {
lbs = 0;
t.getNode("level-lbs").setDoubleValue(lbs);
if( t.getNode("empty").getBoolValue() ) {
# Kill the engines if we're told to, otherwise simply
# deselect the tank.
if (t.getNode("kill-when-empty", 1).getBoolValue())
@ -54,27 +51,9 @@ var update = func {
else
t.getNode("selected").setBoolValue(0);
}
var gals = lbs / ppg;
t.getNode("level-gal_us").setDoubleValue(gals);
t.getNode("level-lbs").setDoubleValue(lbs);
}
}
# Total fuel properties
var lbs = 0;
var gals = 0;
var cap = 0;
foreach (var t; tanks) {
lbs += t.getNode("level-lbs").getValue();
gals += t.getNode("level-gal_us").getValue();
cap += t.getNode("capacity-gal_us").getValue();
}
total_lbs.setDoubleValue(lbs);
total_gals.setDoubleValue(gals);
total_norm.setDoubleValue(gals / cap);
foreach (var e; engines)
e.getNode("out-of-fuel").setBoolValue(out_of_fuel);
}
@ -85,22 +64,13 @@ var loop = func {
settimer(loop, UPDATE_PERIOD);
}
var tanks = [];
var engines = [];
var fuel_freeze = nil;
var total_gals = nil;
var total_lbs = nil;
var total_norm = nil;
_setlistener("/sim/signals/fdm-initialized", func {
setlistener("/sim/freeze/fuel", func(n) { fuel_freeze = n.getBoolValue() }, 1);
total_gals = props.globals.getNode("/consumables/fuel/total-fuel-gals", 1);
total_lbs = props.globals.getNode("/consumables/fuel/total-fuel-lbs", 1);
total_norm = props.globals.getNode("/consumables/fuel/total-fuel-norm", 1);
engines = props.globals.getNode("engines", 1).getChildren("engine");
foreach (var e; engines) {
e.getNode("fuel-consumed-lbs", 1).setDoubleValue(0);
@ -112,10 +82,6 @@ _setlistener("/sim/signals/fdm-initialized", func {
continue; # skip native_fdm.cxx generated zombie tanks
append(tanks, t);
t.initNode("level-gal_us", 0.0);
t.initNode("level-lbs", 0.0);
t.initNode("capacity-gal_us", 0.01); # not zero (div/zero issue)
t.initNode("density-ppg", 6.0); # gasoline
t.initNode("selected", 1, "BOOL");
}

View file

@ -2,11 +2,11 @@
// Licence: GPL v2
// Author: Frederic Bouvier
varying vec4 ecPosition;
varying float fogCoord;
varying vec3 VNormal;
varying vec3 VTangent;
varying vec3 VBinormal;
varying vec4 constantColor;
uniform sampler2D tex_color;
uniform sampler2D tex_normal;
@ -29,7 +29,7 @@ void main (void)
vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP;
vec4 Specular = gl_LightSource[0].specular * pf;
vec4 color = constantColor + Diffuse * gl_FrontMaterial.diffuse;
vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse;
color *= texture2D(tex_color, gl_TexCoord[0].xy);
color += Specular * gl_FrontMaterial.specular * ns.a;
@ -37,7 +37,6 @@ void main (void)
float fogFactor;
float fogCoord = ecPosition.z;
const float LOG2 = 1.442695;
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
fogFactor = clamp(fogFactor, 0.0, 1.0);

View file

@ -2,23 +2,24 @@
// Licence: GPL v2
// Author: Frederic Bouvier
varying vec4 ecPosition;
varying float fogCoord;
varying vec3 VNormal;
varying vec3 VTangent;
varying vec3 VBinormal;
varying vec4 constantColor;
attribute vec3 tangent;
attribute vec3 binormal;
void main (void)
{
ecPosition = gl_ModelViewMatrix * gl_Vertex;
vec4 pos = gl_ModelViewMatrix * gl_Vertex;
fogCoord = pos.z / pos.w;
VNormal = normalize(gl_NormalMatrix * gl_Normal);
VTangent = normalize(gl_NormalMatrix * tangent);
VBinormal = normalize(gl_NormalMatrix * binormal);
constantColor = gl_FrontLightModelProduct.sceneColor + gl_LightSource[0].ambient * gl_FrontMaterial.ambient;
gl_FrontColor = constantColor;
gl_FrontColor = gl_FrontLightModelProduct.sceneColor + gl_LightSource[0].ambient * gl_FrontMaterial.ambient;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}

View file

@ -14,7 +14,7 @@ float luminance(vec3 color)
void main()
{
vec3 n, halfV;
vec3 n;
float NdotL, NdotHV, fogFactor;
vec4 color = gl_Color;
vec3 lightDir = gl_LightSource[0].position.xyz;
@ -22,16 +22,16 @@ void main()
vec4 texel;
vec4 fragColor;
vec4 specular = vec4(0.0);
n = normalize(normal);
// If gl_Color.a == 0, this is a back-facing polygon and the
// normal should be reversed.
n = (2.0 * gl_Color.a - 1.0) * normal;
n = normalize(n);
n = (2.0 * gl_Color.a - 1.0) * n;
NdotL = max(dot(n, lightDir), 0.0);
NdotL = dot(n, lightDir);
if (NdotL > 0.0) {
color += diffuse_term * NdotL;
halfV = halfVector;
NdotHV = max(dot(n, halfV), 0.0);
NdotHV = max(dot(n, halfVector), 0.0);
if (gl_FrontMaterial.shininess > 0.0)
specular.rgb = (gl_FrontMaterial.specular.rgb
* gl_LightSource[0].specular.rgb

View file

@ -22,11 +22,11 @@ void main()
vec4 texel;
vec4 fragColor;
vec4 specular = vec4(0.0);
n = normalize(normal);
// If gl_Color.a == 0, this is a back-facing polygon and the
// normal should be reversed.
n = (2.0 * gl_Color.a - 1.0) * n;
NdotL = max(dot(n, lightDir), 0.0);
n = (2.0 * gl_Color.a - 1.0) * normal;
n = normalize(n);
NdotL = dot(n, lightDir);
if (NdotL > 0.0) {
color += diffuse_term * NdotL;
halfV = normalize(halfVector);

View file

@ -4,19 +4,17 @@
#version 120
varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 rawpos;
varying vec3 VNormal;
varying vec3 VTangent;
varying vec3 VBinormal;
varying vec3 Normal;
varying vec4 constantColor;
varying vec3 vViewVec;
varying vec3 reflVec;
varying vec4 Diffuse;
varying vec3 lightDir, halfVector;
varying float alpha, fogCoord;
varying float alpha;
varying float fogCoord;
uniform samplerCube Environment;
uniform sampler2D Rainbow;
@ -37,7 +35,12 @@ void main (void)
{
vec3 halfV;
float NdotL, NdotHV;
vec4 color = constantColor;
vec3 lightDir = gl_LightSource[0].position.xyz;
vec3 halfVector = gl_LightSource[0].halfVector.xyz;
vec4 color = gl_Color;
vec4 specular = vec4(0.0);
vec4 ns = texture2D(NormalTex, gl_TexCoord[0].st);
vec3 n = ns.rgb * 2.0 - 1.0;
@ -61,7 +64,6 @@ void main (void)
vec4 texelcolor = color * texel + specular;
// calculate the fog factor
float fogCoord = ecPosition.z;
const float LOG2 = 1.442695;
float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
fogFactor = clamp(fogFactor, 0.0, 1.0);

View file

@ -2,19 +2,17 @@
// Licence: GPL v2
// Author: Vivian Meazza.
varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 rawpos;
varying float fogCoord;
varying vec3 VNormal;
varying vec3 VTangent;
varying vec3 VBinormal;
varying vec3 Normal;
varying vec4 constantColor;
varying vec3 vViewVec;
varying vec3 reflVec;
varying vec4 Diffuse;
varying vec3 normal, lightDir, halfVector;
varying float alpha, fogCoord;
varying float alpha;
uniform mat4 osg_ViewMatrixInverse;
@ -23,23 +21,23 @@ attribute vec3 binormal;
void main(void)
{
rawpos = gl_Vertex;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
vec3 ecPosition3 = vec3(gl_ModelViewMatrix * gl_Vertex) / ecPosition.w;
rawpos = gl_Vertex.xyz / gl_Vertex.w;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition.xyz = ecPosition.xyz / ecPosition.w;
fogCoord = ecPosition.z;
vec3 t = normalize(cross(gl_Normal, vec3(1.0,0.0,0.0)));
vec3 b = normalize(cross(gl_Normal,t));
vec3 n = normalize(gl_Normal);
vec3 t = cross(gl_Normal, vec3(1.0,0.0,0.0));
vec3 b = cross(n,t);
VNormal = normalize(gl_NormalMatrix * gl_Normal);
VTangent = normalize(gl_NormalMatrix * tangent);
VBinormal = normalize(gl_NormalMatrix * binormal);
VTangent = normalize(gl_NormalMatrix * tangent);
VBinormal = normalize(gl_NormalMatrix * binormal);
Normal = normalize(gl_Normal);
lightDir = normalize(vec3(gl_LightSource[0].position));
halfVector = normalize(gl_LightSource[0].halfVector.xyz);
Diffuse = gl_Color * gl_LightSource[0].diffuse;
//Diffuse= gl_Color.rgb * max(0.0, dot(normalize(VNormal), gl_LightSource[0].position.xyz));
// Super hack: if diffuse material alpha is less than 1, assume a
// transparency animation is at work
if (gl_FrontMaterial.diffuse.a < 1.0)
@ -47,8 +45,6 @@ void main(void)
else
alpha = gl_Color.a;
fogCoord = abs(ecPosition3.z);
// Vertex in eye coordinates
vec3 vertVec = ecPosition.xyz;
@ -60,10 +56,8 @@ void main(void)
vec4 reflect_eye = vec4(reflect(vertVec, VNormal), 0.0);
reflVec = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz;
gl_FrontColor = gl_Color;
constantColor = gl_FrontMaterial.emission
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_FrontColor = gl_FrontMaterial.emission + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}
}

View file

@ -4,17 +4,15 @@
#version 120
varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 rawpos;
varying vec3 VNormal;
varying vec3 Normal;
varying vec4 constantColor;
varying vec3 vViewVec;
varying vec3 reflVec;
varying vec4 Diffuse;
varying vec3 lightDir, halfVector;
varying float alpha, fogCoord;
varying float alpha;
varying float fogCoord;
uniform samplerCube Environment;
uniform sampler2D Rainbow;
@ -36,8 +34,11 @@ void main (void)
float NdotL, NdotHV;
vec4 color = constantColor;
vec4 specular = vec4(0.0);
n = VNormal;
NdotL = max(0.0, dot(n, lightDir));
n = normalize(VNormal);
vec3 lightDir = gl_LightSource[0].position.xyz;
vec3 halfVector = gl_LightSource[0].halfVector.xyz;
NdotL = dot(n, lightDir);
// calculate the specular light
if (NdotL > 0.0) {
@ -56,7 +57,6 @@ void main (void)
vec4 texelcolor = color * texel + specular;
// calculate the fog factor
float fogCoord = ecPosition.z;
const float LOG2 = 1.442695;
float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
fogFactor = clamp(fogFactor, 0.0, 1.0);

View file

@ -2,17 +2,15 @@
// Licence: GPL v2
// Author: Vivian Meazza.
varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 rawpos;
varying vec3 VNormal;
varying vec3 Normal;
varying vec4 constantColor;
varying vec3 vViewVec;
varying vec3 reflVec;
varying vec4 Diffuse;
varying vec3 normal, lightDir, halfVector;
varying float alpha, fogCoord;
varying float alpha;
varying float fogCoord;
uniform mat4 osg_ViewMatrixInverse;
@ -20,19 +18,16 @@ uniform mat4 osg_ViewMatrixInverse;
void main(void)
{
rawpos = gl_Vertex;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
vec3 ecPosition3 = vec3(gl_ModelViewMatrix * gl_Vertex) / ecPosition.w;
rawpos = gl_Vertex.xyz / gl_Vertex.w;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition.xyz = ecPosition.xyz / ecPosition.w;
vec3 t = normalize(cross(gl_Normal, vec3(1.0,0.0,0.0)));
vec3 b = normalize(cross(gl_Normal,t));
vec3 n = normalize(gl_Normal);
VNormal = normalize(gl_NormalMatrix * gl_Normal);
Normal = normalize(gl_Normal);
lightDir = normalize(vec3(gl_LightSource[0].position));
halfVector = normalize(gl_LightSource[0].halfVector.xyz);
Diffuse = gl_Color * gl_LightSource[0].diffuse;
//Diffuse= gl_Color.rgb * max(0.0, dot(normalize(VNormal), gl_LightSource[0].position.xyz));
// Super hack: if diffuse material alpha is less than 1, assume a
@ -42,7 +37,7 @@ void main(void)
else
alpha = gl_Color.a;
fogCoord = abs(ecPosition3.z);
fogCoord = abs(ecPosition.z);
// Vertex in eye coordinates
vec3 vertVec = ecPosition.xyz;
@ -61,4 +56,4 @@ void main(void)
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}
}