1
0
Fork 0

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

This commit is contained in:
Erik Hofman 2012-08-02 19:03:22 +02:00
commit 46b6ab02af
155 changed files with 52245 additions and 12529 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 438 KiB

After

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 KiB

After

Width:  |  Height:  |  Size: 337 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 448 KiB

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 KiB

After

Width:  |  Height:  |  Size: 430 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -117,11 +117,11 @@ var apPower = func {
# print("v_test = ", v_test);
if (valueTest > 0.5) {
# autopilot just powered up
print("power up");
print("CENTURY IIB power up");
apInit();
} elsif (valueTest < -0.5) {
# autopilot just lost power
print("power lost");
print("CENTURY IIB power lost");
apInit();
# note: all button and knobs disabled in functions below
}

View file

@ -170,11 +170,11 @@ var apPower = func {
# print("v_test = ", v_test);
if (valueTest > 0.5) {
# autopilot just powered up
print("power up");
print("CENTURYIII power up");
apInit();
} elsif (valueTest < -0.5) {
# autopilot just lost power
print("power lost");
print("CENTURYIII power lost");
apInit();
# note: all button and knobs disabled in functions below
}

View file

@ -254,12 +254,12 @@ var apPower = func {
# print("v_test = ", v_test);
if (valueTest > 0.5) {
# autopilot just powered up
print("power up");
print("KAP140 power up");
apInit();
altAlert();
} elsif (valueTest < -0.5) {
# autopilot just lost power
print("power lost");
print("KAP140 power lost");
apInit();
annunciatorAltAlert.getNode("state").setBoolValue(0);
annunciatorBeep.getNode("state").setBoolValue(0);

View file

@ -4,7 +4,7 @@ OBJECT world
kids 5
OBJECT poly
name "Face"
texture "/home/david/src/blender/Instruments/ai/ai01.rgb"
texture "ai01.rgb"
texrep 1 1
numvert 6
-0.003966 0.04 -0.04
@ -31,7 +31,7 @@ refs 4
kids 0
OBJECT poly
name "Pitch"
texture "/home/david/src/blender/Instruments/ai/ai04.rgb"
texture "ai04.rgb"
texrep 1 1
numvert 6
-0.002938 0.014505 -0.021294
@ -58,7 +58,7 @@ refs 4
kids 0
OBJECT poly
name "Bezel"
texture "/home/david/src/blender/Instruments/ai/ai05.rgb"
texture "ai05.rgb"
texrep 1 1
numvert 6
-0.001913 0.006477 -0.012
@ -85,7 +85,7 @@ refs 4
kids 0
OBJECT poly
name "Ring"
texture "/home/david/src/blender/Instruments/ai/ai02.rgb"
texture "ai02.rgb"
texrep 1 1
numvert 6
-0.000922 0.04 -0.04
@ -112,7 +112,7 @@ refs 4
kids 0
OBJECT poly
name "Front"
texture "/home/david/src/blender/Instruments/ai/ai03.rgb"
texture "ai03.rgb"
texrep 1 1
numvert 6
-1e-05 0.04 -0.04

View file

@ -88,7 +88,7 @@ refs 3
kids 0
OBJECT poly
name "Face"
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/alt/altimeter.rgb"
texture "altimeter.rgb"
crease 45.000000
numvert 4
0 0.04 -0.04
@ -109,7 +109,7 @@ name "inhg"
loc -0.000238663 0.000547649 0.00323039
data 12
Cylinder.015
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/alt/altimeter.rgb"
texture "altimeter.rgb"
crease 30.000000
numvert 6
0.001139 -0.00614271 -0.0291783
@ -137,7 +137,7 @@ kids 0
OBJECT poly
name "disk"
loc 0 -0.0305765 0.0300321
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/alt/knob.rgb"
texture "knob.rgb"
crease 101.000000
numvert 20
0.01 0.00396059 0.00479285

View file

@ -4,7 +4,7 @@ OBJECT world
kids 3
OBJECT poly
name "Background"
texture "/home/david/src/blender/Instruments/Textures/asi-260-knot.rgb"
texture "asi-260-knot.rgb"
numvert 4
-0.000524 0.050345 -0.05
-0.000524 -0.049655 -0.05
@ -21,7 +21,7 @@ refs 4
kids 0
OBJECT poly
name "Needle"
texture "/home/david/src/blender/Instruments/Textures/asi-260-knot.rgb"
texture "asi-260-knot.rgb"
numvert 4
0.002039 0.03301 -0.005
0.002039 9.7e-05 -0.005
@ -38,7 +38,7 @@ refs 4
kids 0
OBJECT poly
name "Scale"
texture "/home/david/src/blender/Instruments/Textures/asi-260-knot.rgb"
texture "asi-260-knot.rgb"
numvert 4
0.004861 0.050345 -0.05
0.004861 -0.049655 -0.05

View file

@ -52,7 +52,7 @@ refs 3
kids 0
OBJECT poly
name "Face"
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/asi/asi.rgb"
texture "asi.rgb"
crease 45.000000
numvert 4
0 0.04 -0.04

View file

@ -13,7 +13,7 @@
<red>1.0</red>
<green>0.2</green>
<blue>0.0</blue>
<factor-prop>/sim/model//material/instruments/factor</factor-prop>
<factor-prop>/sim/model/material/instruments/factor</factor-prop>
</emission>
</animation>

View file

@ -4,7 +4,7 @@ OBJECT world
kids 5
OBJECT poly
name "Background"
texture "/home/david/src/blender/Instruments/Textures/attitude-indicator.rgb"
texture "attitude-indicator.rgb"
numvert 4
-7.2e-05 -0.037166 -0.038157
-7.2e-05 -0.037166 0.036843
@ -21,7 +21,7 @@ refs 4
kids 0
OBJECT poly
name "Float"
texture "/home/david/src/blender/Instruments/Textures/attitude-indicator.rgb"
texture "attitude-indicator.rgb"
numvert 4
0.001422 -0.018106 -0.029359
0.001422 -0.018106 0.02871
@ -38,7 +38,7 @@ refs 4
kids 0
OBJECT poly
name "Scale"
texture "/home/david/src/blender/Instruments/Textures/attitude-indicator.rgb"
texture "attitude-indicator.rgb"
numvert 4
0.002915 -0.055916 -0.056907
0.002915 -0.055916 0.055593
@ -55,7 +55,7 @@ refs 4
kids 0
OBJECT poly
name "Face"
texture "/home/david/src/blender/Instruments/Textures/attitude-indicator.rgb"
texture "attitude-indicator.rgb"
numvert 4
0.005072 -0.037166 -0.038157
0.005072 -0.037166 0.036843
@ -72,7 +72,7 @@ refs 4
kids 0
OBJECT poly
name "Markings"
texture "/home/david/src/blender/Instruments/Textures/attitude-indicator.rgb"
texture "attitude-indicator.rgb"
numvert 4
0.006902 -0.018106 -0.029359
0.006902 -0.018106 0.02871

View file

@ -75,7 +75,7 @@ refs 4
kids 0
OBJECT poly
name "Face"
texture "/home/david/src/blender/Instruments/clock/clock.rgb"
texture "clock.rgb"
texrep 1 1
numvert 4
0 0.026 -0.026

View file

@ -4,7 +4,7 @@ OBJECT world
kids 1
OBJECT poly
name "Ring"
texture "/home/david/src/blender/Instruments/comp/comp.rgb"
texture "comp.rgb"
texrep 1 1
numvert 48
-0.012335 0.019626 -0.012335

View file

@ -27,7 +27,7 @@ refs 4
kids 0
OBJECT poly
name "Face"
texture "/home/david/src/blender/Instruments/egt/egt-01.rgb"
texture "egt-01.rgb"
texrep 1 1
numvert 4
0 0.028452 -0.028452

View file

@ -7,7 +7,7 @@ kids 9
OBJECT poly
name "Face"
loc 0.000119331 0 0
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/hi/hi01.rgb"
texture "hi01.rgb"
crease 45.000000
numvert 6
-0.001458 0.04 -0.04
@ -34,7 +34,7 @@ refs 4
kids 0
OBJECT poly
name "Front"
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/hi/hi02.rgb"
texture "hi02.rgb"
crease 45.000000
numvert 6
0 0.04 -0.04
@ -62,7 +62,7 @@ kids 0
OBJECT poly
name "OBS-Knob"
loc 0 -0.0297401 0.0293165
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/hi/knob.rgb"
texture "knob.rgb"
crease 101.000000
numvert 20
0.01 9.31323e-09 0
@ -261,7 +261,7 @@ kids 0
OBJECT poly
name "Hdg-Knob"
loc 0 -0.0300775 -0.0298089
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/hi/knob.rgb"
texture "knob.rgb"
crease 101.000000
numvert 20
0.01 0.00396059 0.00479285
@ -460,7 +460,7 @@ kids 0
OBJECT poly
name "HdgBug"
loc 0.00155131 0 0
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/hi/hi03.rgb"
texture "hi03.rgb"
crease 45.000000
numvert 6
-0.0011 0 -0.04

View file

@ -12,7 +12,7 @@
<red>1.0</red>
<green>0.2</green>
<blue>0.0</blue>
<factor-prop>/sim/model//material/instruments/factor</factor-prop>
<factor-prop>/sim/model/material/instruments/factor</factor-prop>
</emission>
</animation>
@ -24,7 +24,7 @@
<red>0.45</red>
<green>0.09</green>
<blue>0.00001</blue>
<factor-prop>/sim/model//material/instruments/factor</factor-prop>
<factor-prop>/sim/model/material/instruments/factor</factor-prop>
</emission>
</animation>
@ -94,6 +94,32 @@
<wrap>1</wrap>
</binding>
</action>
<action>
<name>small decrease (scrollwheel)</name>
<button>3</button>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/autopilot/settings/heading-bug-deg</property>
<step>-1</step>
<min>0</min>
<max>360</max>
<wrap>1</wrap>
</binding>
</action>
<action>
<name>small increase (scrollwheel)</name>
<button>4</button>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/autopilot/settings/heading-bug-deg</property>
<step>1</step>
<min>0</min>
<max>360</max>
<wrap>1</wrap>
</binding>
</action>
</animation>
<animation>
@ -126,6 +152,32 @@
<wrap>1</wrap>
</binding>
</action>
<action>
<name>small decrease (scrollwheel)</name>
<button>3</button>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/autopilot/settings/heading-bug-deg</property>
<step>-1</step>
<min>0</min>
<max>360</max>
<wrap>1</wrap>
</binding>
</action>
<action>
<name>small increase (scrollwheel)</name>
<button>4</button>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/autopilot/settings/heading-bug-deg</property>
<step>1</step>
<min>0</min>
<max>360</max>
<wrap>1</wrap>
</binding>
</action>
</animation>
<!-- Heading Offset -->
@ -159,6 +211,32 @@
<wrap>1</wrap>
</binding>
</action>
<action>
<name>small decrease (scrollwheel)</name>
<button>3</button>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/instrumentation/heading-indicator/offset-deg</property>
<step>-1</step>
<min>0</min>
<max>360</max>
<wrap>1</wrap>
</binding>
</action>
<action>
<name>small increase (scrollwheel)</name>
<button>4</button>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/instrumentation/heading-indicator/offset-deg</property>
<step>1</step>
<min>0</min>
<max>360</max>
<wrap>1</wrap>
</binding>
</action>
</animation>
<animation>
@ -191,6 +269,32 @@
<wrap>1</wrap>
</binding>
</action>
<action>
<name>small decrease (scrollwheel)</name>
<button>3</button>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/instrumentation/heading-indicator/offset-deg</property>
<step>-1</step>
<min>0</min>
<max>360</max>
<wrap>1</wrap>
</binding>
</action>
<action>
<name>small increase (scrollwheel)</name>
<button>4</button>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/instrumentation/heading-indicator/offset-deg</property>
<step>1</step>
<min>0</min>
<max>360</max>
<wrap>1</wrap>
</binding>
</action>
</animation>
</PropertyList>

View file

@ -4,7 +4,7 @@ OBJECT world
kids 1
OBJECT poly
name "Plane"
texture "/home/david/src/blender/Avionics/kx170b/kx170b-01.rgb"
texture "kx170b-01.rgb"
texrep 1 1
numvert 4
0 0.036 -0.09

View file

@ -5,7 +5,7 @@ kids 1
OBJECT poly
name "RadioStack"
loc 0.000486599 0.0692169 -8.90131e-05
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/radio_stack/panel-tex02.rgb"
texture "panel-tex02.rgb"
crease 45.000000
numvert 4
0 0.0657509 -0.0804673

View file

@ -27,7 +27,7 @@ refs 3
kids 0
OBJECT poly
name "Face"
texture "/home/david/src/blender/Instruments/tach/tach.rgb"
texture "tach.rgb"
texrep 1 1
numvert 4
0 0.04 -0.04

View file

@ -4,7 +4,7 @@ OBJECT world
kids 3
OBJECT poly
name "Ball"
texture "/home/david/src/blender/Instruments/tc/tc02.rgb"
texture "tc02.rgb"
texrep 1 1
numvert 6
-0.002953 -0.009821 -0.003159
@ -31,7 +31,7 @@ refs 4
kids 0
OBJECT poly
name "Face"
texture "/home/david/src/blender/Instruments/tc/tc01.rgb"
texture "tc01.rgb"
texrep 1 1
numvert 6
-0.001458 0.04 -0.04
@ -58,7 +58,7 @@ refs 4
kids 0
OBJECT poly
name "Airplane"
texture "/home/david/src/blender/Instruments/tc/tc03.rgb"
texture "tc03.rgb"
texrep 1 1
numvert 6
0 0.008224 -0.025483

View file

@ -30,7 +30,7 @@ refs 4
kids 0
OBJECT poly
name "Face"
texture "/usr/local/FlightGear-0.9/data/Aircraft/Instruments-3d/vac/vac-face.rgb"
texture "vac-face.rgb"
crease 45.000000
numvert 4
0 0.026 -0.026

View file

@ -32,7 +32,7 @@ refs 3
kids 0
OBJECT poly
name "Face"
texture "/home/david/src/blender/Instruments/vsi/vsi.rgb"
texture "vsi.rgb"
texrep 1 1
numvert 4
0 0.04 -0.04

View file

@ -11,8 +11,7 @@
<type>select</type>
<object-name>indicator</object-name>
<condition>
<property>/instrumentation/adf[0]/serviceable</property>
<property>/instrumentation/adf[0]/power-btn</property>
<property>/instrumentation/adf[0]/operable</property>
</condition>
</animation>
<animation>

0
Aircraft/c172p/Models/Pedals/pedals.xml Executable file → Normal file
View file

0
Aircraft/c172p/Models/Yoke/yoke.xml Executable file → Normal file
View file

File diff suppressed because it is too large Load diff

View file

@ -115,7 +115,7 @@
<object-name>Propeller.Fast</object-name>
</effect>
<!-- Immatriculatoin -->
<!-- Immatriculation -->
<model>
<path>Aircraft/c172p/Models/Immat/immat.xml</path>
<offsets>
@ -2304,6 +2304,7 @@
<animation>
<type>rotate</type>
<object-name>rudder</object-name>
<object-name>rudder_1</object-name>
<object-name>navlight_back</object-name>
<object-name>RearNavLightOff</object-name>
<property>surface-positions/rudder-pos-norm</property>
@ -2440,6 +2441,18 @@
</condition>
</animation>
<animation>
<type>select</type>
<object-name>TaxiLightCone</object-name>
<condition>
<and>
<property>/sim/rendering/rembrandt/enabled</property>
<property>controls/lighting/taxi-light</property>
</and>
</condition>
</animation>
<!--landinglight-->
<animation>
<type>select</type>
@ -2470,39 +2483,88 @@
<z>0.536</z>
</position>
<direction>
<x>-29</x>
<y>6.76</y>
<z>-3.6</z>
<x>-1</x>
<y>0</y>
<z>-0.1</z>
</direction>
<ambient>
<r>0.03</r>
<g>0.03</g>
<b>0.03</b>
<r>0.5</r>
<g>0.5</g>
<b>0.55</b>
<a>1.0</a>
</ambient>
<diffuse>
<r>0.7</r>
<g>0.7</g>
<b>0.6</b>
<r>0.95</r>
<g>0.95</g>
<b>0.8</b>
<a>1.0</a>
</diffuse>
<specular>
<r>0.7</r>
<g>0.7</g>
<r>0.95</r>
<g>0.95</g>
<b>0.8</b>
<a>1.0</a>
</specular>
<attenuation>
<c>1.0</c>
<l>0.0</l>
<q>0.00015</q>
</attenuation>
<exponent>25</exponent>
<cutoff>85</cutoff>
<near-m>2</near-m>
<far-m>250</far-m>
</animation>
<animation>
<type>light</type>
<light-type>spot</light-type>
<name>TaxiLight</name>
<object-name>TaxiLightCone</object-name>
<nopreview/>
<condition>
<property>controls/lighting/taxi-light</property>
</condition>
<position>
<x>-0.078</x>
<y>-3.086</y>
<z>0.536</z>
</position>
<direction>
<x>-1</x>
<y>0</y>
<z>-0.3</z>
</direction>
<ambient>
<r>0.5</r>
<g>0.5</g>
<b>0.55</b>
<a>1.0</a>
</ambient>
<diffuse>
<r>0.85</r>
<g>0.85</g>
<b>0.65</b>
<a>1.0</a>
</diffuse>
<specular>
<r>0.85</r>
<g>0.85</g>
<b>0.7</b>
<a>1.0</a>
</specular>
<attenuation>
<c>1.0</c>
<l>0.002</l>
<q>0.00005</q>
<l>0.0</l>
<q>0.0018</q>
</attenuation>
<exponent>30.0</exponent>
<cutoff>40</cutoff>
<exponent>4.5</exponent>
<cutoff>160</cutoff>
<near-m>2</near-m>
<far-m>50</far-m>
<far-m>150</far-m>
</animation>
<animation>
<type>select</type>
<object-name>landinglightcover</object-name>

View file

@ -9,23 +9,22 @@
# Initialize internal values
#
battery = nil;
alternator = nil;
var battery = nil;
var alternator = nil;
last_time = 0.0;
var last_time = 0.0;
vbus_volts = 0.0;
ebus1_volts = 0.0;
ebus2_volts = 0.0;
var vbus_volts = 0.0;
var ebus1_volts = 0.0;
var ebus2_volts = 0.0;
ammeter_ave = 0.0;
var ammeter_ave = 0.0;
##
# Initialize the electrical system
#
init_electrical = func {
print("Initializing Nasal Electrical System");
battery = BatteryClass.new();
alternator = AlternatorClass.new();
@ -35,8 +34,9 @@ init_electrical = func {
setprop("/controls/switches/master-avionics", 1);
setprop("/systems/electrical/outputs/autopilot",0.0);
# Request that the update fuction be called next frame
# Request that the update function be called next frame
settimer(update_electrical, 0);
print("Electrical system initialized");
}
@ -47,12 +47,12 @@ init_electrical = func {
BatteryClass = {};
BatteryClass.new = func {
obj = { parents : [BatteryClass],
ideal_volts : 24.0,
ideal_amps : 30.0,
amp_hours : 12.75,
charge_percent : 1.0,
charge_amps : 7.0 };
var obj = { parents : [BatteryClass],
ideal_volts : 24.0,
ideal_amps : 30.0,
amp_hours : 12.75,
charge_percent : 1.0,
charge_amps : 7.0 };
return obj;
}
@ -62,8 +62,8 @@ BatteryClass.new = func {
#
BatteryClass.apply_load = func( amps, dt ) {
amphrs_used = amps * dt / 3600.0;
percent_used = amphrs_used / me.amp_hours;
var amphrs_used = amps * dt / 3600.0;
var percent_used = amphrs_used / me.amp_hours;
me.charge_percent -= percent_used;
if ( me.charge_percent < 0.0 ) {
me.charge_percent = 0.0;
@ -76,13 +76,13 @@ BatteryClass.apply_load = func( amps, dt ) {
##
# Return output volts based on percent charged. Currently based on a simple
# polynomal percent charge vs. volts function.
# polynomial percent charge vs. volts function.
#
BatteryClass.get_output_volts = func {
x = 1.0 - me.charge_percent;
tmp = -(3.0 * x - 1.0);
factor = (tmp*tmp*tmp*tmp*tmp + 32) / 32;
var x = 1.0 - me.charge_percent;
var tmp = -(3.0 * x - 1.0);
var factor = (tmp*tmp*tmp*tmp*tmp + 32) / 32;
return me.ideal_volts * factor;
}
@ -95,9 +95,9 @@ BatteryClass.get_output_volts = func {
#
BatteryClass.get_output_amps = func {
x = 1.0 - me.charge_percent;
tmp = -(3.0 * x - 1.0);
factor = (tmp*tmp*tmp*tmp*tmp + 32) / 32;
var x = 1.0 - me.charge_percent;
var tmp = -(3.0 * x - 1.0);
var factor = (tmp*tmp*tmp*tmp*tmp + 32) / 32;
return me.ideal_amps * factor;
}
@ -109,11 +109,11 @@ BatteryClass.get_output_amps = func {
AlternatorClass = {};
AlternatorClass.new = func {
obj = { parents : [AlternatorClass],
rpm_source : "/engines/engine[0]/rpm",
rpm_threshold : 800.0,
ideal_volts : 28.0,
ideal_amps : 60.0 };
var obj = { parents : [AlternatorClass],
rpm_source : "/engines/engine[0]/rpm",
rpm_threshold : 800.0,
ideal_volts : 28.0,
ideal_amps : 60.0 };
setprop( obj.rpm_source, 0.0 );
return obj;
}
@ -126,13 +126,13 @@ AlternatorClass.apply_load = func( amps, dt ) {
# Scale alternator output for rpms < 800. For rpms >= 800
# give full output. This is just a WAG, and probably not how
# it really works but I'm keeping things "simple" to start.
rpm = getprop( me.rpm_source );
factor = rpm / me.rpm_threshold;
var rpm = getprop( me.rpm_source );
var factor = rpm / me.rpm_threshold;
if ( factor > 1.0 ) {
factor = 1.0;
}
# print( "alternator amps = ", me.ideal_amps * factor );
available_amps = me.ideal_amps * factor;
var available_amps = me.ideal_amps * factor;
return available_amps - amps;
}
@ -144,8 +144,8 @@ AlternatorClass.get_output_volts = func {
# scale alternator output for rpms < 800. For rpms >= 800
# give full output. This is just a WAG, and probably not how
# it really works but I'm keeping things "simple" to start.
rpm = getprop( me.rpm_source );
factor = rpm / me.rpm_threshold;
var rpm = getprop( me.rpm_source );
var factor = rpm / me.rpm_threshold;
if ( factor > 1.0 ) {
factor = 1.0;
}
@ -162,8 +162,8 @@ AlternatorClass.get_output_amps = func {
# scale alternator output for rpms < 800. For rpms >= 800
# give full output. This is just a WAG, and probably not how
# it really works but I'm keeping things "simple" to start.
rpm = getprop( me.rpm_source );
factor = rpm / me.rpm_threshold;
var rpm = getprop( me.rpm_source );
var factor = rpm / me.rpm_threshold;
if ( factor > 1.0 ) {
factor = 1.0;
}
@ -177,13 +177,13 @@ AlternatorClass.get_output_amps = func {
#
update_electrical = func {
time = getprop("/sim/time/elapsed-sec");
dt = time - last_time;
var time = getprop("/sim/time/elapsed-sec");
var dt = time - last_time;
last_time = time;
update_virtual_bus( dt );
# Request that the update fuction be called again next frame
# Request that the update function be called again next frame
settimer(update_electrical, 0);
}
@ -194,24 +194,23 @@ update_electrical = func {
#
update_virtual_bus = func( dt ) {
serviceable = getprop("/systems/electrical/serviceable");
var serviceable = getprop("/systems/electrical/serviceable");
var external_volts = 0.0;
var load = 0.0;
var battery_volts = 0.0;
var alternator_volts = 0.0;
if ( serviceable ) {
battery_volts = battery.get_output_volts();
alternator_volts = alternator.get_output_volts();
} else {
battery_volts = 0.0;
alternator_volts = 0.0;
battery_volts = battery.get_output_volts();
alternator_volts = alternator.get_output_volts();
}
external_volts = 0.0;
load = 0.0;
# switch state
master_bat = getprop("/controls/engines/engine[0]/master-bat");
master_alt = getprop("/controls/engines/engine[0]/master-alt");
var master_bat = getprop("/controls/engines/engine[0]/master-bat");
var master_alt = getprop("/controls/engines/engine[0]/master-alt");
# determine power source
bus_volts = 0.0;
power_source = nil;
var bus_volts = 0.0;
var power_source = nil;
if ( master_bat ) {
bus_volts = battery_volts;
power_source = "battery";
@ -235,10 +234,10 @@ update_virtual_bus = func( dt ) {
}
setprop("systems/electrical/outputs/starter[0]", starter_volts);
if (starter_volts > 1) {
setprop("controls/engines/engine[0]/starter",1);
setprop("controls/engines/engine[0]/magnetos",3);
setprop("controls/engines/engine[0]/starter",1);
setprop("controls/engines/engine[0]/magnetos",3);
} else {
setprop("controls/engines/engine[0]/starter",0);
setprop("controls/engines/engine[0]/starter",0);
}
# bus network (1. these must be called in the right order, 2. the
@ -250,7 +249,7 @@ update_virtual_bus = func( dt ) {
load += avionics_bus_2();
# system loads and ammeter gauge
ammeter = 0.0;
var ammeter = 0.0;
if ( bus_volts > 1.0 ) {
# normal load
load += 15.0;
@ -272,7 +271,7 @@ update_virtual_bus = func( dt ) {
}
# filter ammeter needle pos
ammeter_ave = 0.8 * ammeter_ave + 0.2 * ammeter;
var ammeter_ave = 0.8 * ammeter_ave + 0.2 * ammeter;
# outputs
setprop("/systems/electrical/amps", ammeter_ave);
@ -285,9 +284,9 @@ update_virtual_bus = func( dt ) {
electrical_bus_1 = func() {
# we are fed from the "virtual" bus
bus_volts = vbus_volts;
load = 0.0;
var bus_volts = vbus_volts;
var load = 0.0;
# Cabin Lights Power
if ( getprop("/controls/circuit-breakers/cabin-lights-pwr") ) {
setprop("/systems/electrical/outputs/cabin-lights", bus_volts);
@ -333,8 +332,8 @@ electrical_bus_1 = func() {
electrical_bus_2 = func() {
# we are fed from the "virtual" bus
bus_volts = vbus_volts;
load = 0.0;
var bus_volts = vbus_volts;
var load = 0.0;
# Turn Coordinator Power
setprop("/systems/electrical/outputs/turn-coordinator", bus_volts);
@ -381,13 +380,12 @@ electrical_bus_2 = func() {
cross_feed_bus = func() {
# we are fed from either of the electrical bus 1 or 2
var bus_volts = ebus2_volts;
if ( ebus1_volts > ebus2_volts ) {
bus_volts = ebus1_volts;
} else {
bus_volts = ebus2_volts;
}
load = 0.0;
var load = 0.0;
setprop("/systems/electrical/outputs/annunciators", bus_volts);
@ -397,20 +395,18 @@ cross_feed_bus = func() {
avionics_bus_1 = func() {
master_av = getprop("/controls/switches/master-avionics");
var bus_volts = 0.0;
var load = 0.0;
# we are fed from the electrical bus 1
var master_av = getprop("/controls/switches/master-avionics");
if ( master_av ) {
bus_volts = ebus1_volts;
} else {
bus_volts = 0.0;
}
load = 0.0;
# Avionics Fan Power
setprop("/systems/electrical/outputs/avionics-fan", bus_volts);
# GPS Power
setprop("/systems/electrical/outputs/gps", bus_volts);
@ -435,15 +431,13 @@ avionics_bus_1 = func() {
avionics_bus_2 = func() {
master_av = getprop("/controls/switches/master-avionics");
var master_av = getprop("/controls/switches/master-avionics");
# we are fed from the electrical bus 2
var bus_volts = 0.0;
if ( master_av ) {
bus_volts = ebus2_volts;
} else {
bus_volts = 0.0;
}
load = 0.0;
var load = 0.0;
# NavCom 2 Power
setprop("/systems/electrical/outputs/nav[1]", bus_volts);

View file

@ -0,0 +1,41 @@
##################################################################
#
# These are the helper functions for the kma20 audio panel
# Maintainer: Thorsten Brehm (brehmt at gmail dot com)
#
# Usage:
# just create one instance of kma20 class for each kma20 panel
# you have in your aircraft:
# kma20.new(0);
#
# KMA20 audio panel properties:
# root: /instrumentation/kma20
# knob: microphone/radio selector (com1/2)
# auto: selects COM1/2 based on microphone selector
# com1: enable/disable COM1 audio (e.g. for ATIS)
# com2: enable/disable COM2 audio (e.g. for ATIS)
# nav1: enable/disable NAV1 station identifier
# nav2: enable/disable NAV2 station identifier
# adf: enable/disable ADF station identifier
# dme: enable/disable DME station identifier
# mkr: enable/disable marker beacon audio
# sens: beacon receiver sensitivity
var kma20 = {};
kma20.new = func(rootPath) {
var obj = {};
obj.parents = [kma20];
setlistener(rootPath ~ "/com1", func(v) {setprop("/instrumentation/comm/volume", 0.7*(v.getValue() != 0));}, 1);
setlistener(rootPath ~ "/com2", func(v) {setprop("/instrumentation/comm[1]/volume", 0.7*(v.getValue() != 0));}, 1);
setlistener(rootPath ~ "/nav1", func(v) {setprop("/instrumentation/nav/audio-btn", (v.getValue() != 0));}, 1);
setlistener(rootPath ~ "/nav2", func(v) {setprop("/instrumentation/nav[1]/audio-btn", (v.getValue() != 0));}, 1);
setlistener(rootPath ~ "/adf", func(v) {setprop("/instrumentation/adf/ident-audible", (v.getValue() != 0));}, 1);
setlistener(rootPath ~ "/dme", func(v) {setprop("/instrumentation/dme/ident", (v.getValue() != 0));}, 1);
setlistener(rootPath ~ "/mkr", func(v) {setprop("/instrumentation/marker-beacon/audio-btn",(v.getValue() != 0));}, 1);
print( "KMA20 audio panel initialized" );
return obj;
};
var kma20_0 = kma20.new( "/instrumentation/kma20" );

View file

@ -68,10 +68,12 @@ This tutorial will teach you how to set the altimeter based on the ATIS (Automat
<step>
<message>In this lesson, you'll learn how to set the altimeter to the Livermore ATIS. I've already
set the radio to the correct frequency - 119.65 MHz</message>
<wait>10</wait>
</step>
<step>
<message>Listen to the ATIS message. If you cannot hear it, check the Sound Configuration item in the File menu.</message>
<wait>10</wait>
</step>
<step>
@ -79,10 +81,11 @@ This tutorial will teach you how to set the altimeter based on the ATIS (Automat
We can set this using Equipment->Instrument Settings, or we can adjust
the altimeter so that the altimeter matches the altitude of Livermore - 380ft.
</message>
<wait>10</wait>
<view>
<heading-offset-deg>353.8</heading-offset-deg>
<pitch-offset-deg>-17.3</pitch-offset-deg>
<pitch-offset-deg>-20.3</pitch-offset-deg>
<roll-offset-deg>0.0</roll-offset-deg>
<x-offset-m>-0.2</x-offset-m>
<y-offset-m>0.3</y-offset-m>
@ -99,7 +102,7 @@ This tutorial will teach you how to set the altimeter based on the ATIS (Automat
<view>
<heading-offset-deg>353.8</heading-offset-deg>
<pitch-offset-deg>-17.3</pitch-offset-deg>
<pitch-offset-deg>-20.3</pitch-offset-deg>
<roll-offset-deg>0.0</roll-offset-deg>
<x-offset-m>-0.2</x-offset-m>
<y-offset-m>0.3</y-offset-m>
@ -119,7 +122,7 @@ This tutorial will teach you how to set the altimeter based on the ATIS (Automat
<message>Set the altimeter to 380 feet, or the pressure setting to 29.97 inHG.</message>
<view>
<heading-offset-deg>353.8</heading-offset-deg>
<pitch-offset-deg>-17.3</pitch-offset-deg>
<pitch-offset-deg>-20.3</pitch-offset-deg>
<roll-offset-deg>0.0</roll-offset-deg>
<x-offset-m>-0.2</x-offset-m>
<y-offset-m>0.3</y-offset-m>

View file

@ -11,7 +11,7 @@ The Cessna 172 glides at a ratio of 10:1 at a best glide speed of 90kts IAS. The
Both KSFO (San Francisco International) and KHAF (Half Moon Bay) are within glide distance. In real life, you would opt for the larger of the two airports, but for an extra challenge, try to land at KHAF.
</description>
<timeofday>evening</timeofday>
<timeofday>dusk</timeofday>
<presets>
<airport-id>KHAF</airport-id>
<on-ground>0</on-ground>
@ -58,6 +58,7 @@ Both KSFO (San Francisco International) and KHAF (Half Moon Bay) are within glid
<step>
<message>We're happily cruising along, enjoying an evenings flight.</message>
<wait>10</wait>
</step>
<step>

View file

@ -62,12 +62,14 @@ weather, the altimeter setting and the runway in use.
<step>
<message>In this lesson, you'll learn how to tune the radio to the Livermore ATIS.
The radio is in the middle of the center console.</message>
<wait>10</wait>
</step>
<step>
<message>There are 4 radios on this aircraft - two for communication (COMM1, COMM2) and two for navigation (NAV1, NAV2).
Each radio has an active frequency and a standby frequency.
We tune the radio by changing the standby frequency, and then swapping the active and standby. </message>
<wait>10</wait>
</step>
<step>
<message>To change the standby frequency, you can click on the left side of the knob to decrease it, and the right side to increase it. </message>

View file

@ -71,6 +71,7 @@ For more information on the before takeoff checklist, see Section 2-11 of the FA
</set>
<message>You can access the pre-takeoff checklist by pressing ?,
or selecting Help->Aircraft Help from the menu.</message>
<wait>10</wait>
</step>
<step>

View file

@ -7,6 +7,7 @@ This tutorial will take you through the pre-startup checklist and starting the C
</description>
<audio-dir>Aircraft/c172p/Tutorials/startup</audio-dir>
<timeofday>morning</timeofday>
<presets>
<airport-id>KLVK</airport-id>
<on-ground>1</on-ground>
@ -58,28 +59,31 @@ This tutorial will take you through the pre-startup checklist and starting the C
<step>
<message>Welcome to Livermore Municipal Airport. In this lesson we'll go through the pre-startup checks and start the aircraft.</message>
<wait>10</wait>
</step>
<step>
<message>Before we start up, we need to brief what we'll do in case of an engine fire on startup. As
this isn't our aircraft, and we're fully insured, we'll simply open the door and run away.</message>
<wait>10</wait>
</step>
<step>
<message>Next, we check our seatbelts, and seat adjustments. Cessnas can get worn seat rails that
sometimes cause the seat to slip backwards, often just as you take off, so make sure it is secure.</message>
<wait>10</wait>
</step>
<step>
<message>The fuel selector is set to BOTH, the Mixture control is fully rich, and the carb heat is off. </message>
<message>The fuel selector is set to BOTH, the Mixture control is fully rich, and the carb heat is off.</message>
<view>
<heading-offset-deg>347.2</heading-offset-deg>
<pitch-offset-deg>-21.8</pitch-offset-deg>
<heading-offset-deg>344.0</heading-offset-deg>
<pitch-offset-deg>-48.7</pitch-offset-deg>
<roll-offset-deg>0.0</roll-offset-deg>
<x-offset-m>-0.2</x-offset-m>
<y-offset-m>0.3</y-offset-m>
<z-offset-m>0.4</z-offset-m>
<field-of-view>55.0</field-of-view>
<y-offset-m>0.235</y-offset-m>
<z-offset-m>0.36</z-offset-m>
<field-of-view>37.0</field-of-view>
</view>
</step>
@ -138,6 +142,7 @@ This tutorial will take you through the pre-startup checklist and starting the C
<step>
<message>Now, we'll check no-one is about to walk into our propeller.</message>
<wait>2</wait>
<view>
<heading-offset-deg>44.0</heading-offset-deg>
<pitch-offset-deg>-15.7</pitch-offset-deg>
@ -151,6 +156,7 @@ This tutorial will take you through the pre-startup checklist and starting the C
<step>
<message>Looks clear.</message>
<wait>2</wait>
<view>
<heading-offset-deg>296.6</heading-offset-deg>
<pitch-offset-deg>-10.4</pitch-offset-deg>
@ -183,6 +189,10 @@ This tutorial will take you through the pre-startup checklist and starting the C
<property>/sim/panel-hotspots</property>
<value>true</value>
</set>
<set>
<property>/sim/model/hide-yoke</property>
<value>true</value>
</set>
<error>
<message>Click the middle hotspot three times, so both magnetos are on and the key
is set to BOTH.</message>
@ -262,6 +272,10 @@ This tutorial will take you through the pre-startup checklist and starting the C
<property>/sim/panel-hotspots</property>
<value>false</value>
</set>
<set>
<property>/sim/model/hide-yoke</property>
<value>false</value>
</set>
<error>
<message>You can release the starter motor now - the engine is running</message>
<condition>

View file

@ -61,6 +61,7 @@ This tutorial will teach you how to take-off, and climb at 600 feet per minute.
nose-wheel steering and rudder. As the aircraft takes off, you will use the ailerons and elevator
to control the direction and attitude of the aircraft.
</message>
<wait>10</wait>
</step>
<step>
@ -69,6 +70,7 @@ This tutorial will teach you how to take-off, and climb at 600 feet per minute.
in "yoke" mode with the left mouse button held down.
To switch the mouse to yoke mode, press the right mouse button until it displays as a + sign.
</message>
<wait>10</wait>
</step>
<step>

View file

@ -96,6 +96,7 @@ For more information on taxiing, see Section 2-9 of the FAA Airplane Flying Hand
<step>
<message>In this lesson we'll taxi the aircraft from its parking
position infront of the FBO, along taxiways Juliet and Alpha to the run-up area near runway 07L.</message>
<wait>10</wait>
</step>
<step>

View file

@ -25,7 +25,7 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<flight-model archive="y">jsb</flight-model>
<aero archive="y">c172p</aero>
<allow-toggle-cockpit>true</allow-toggle-cockpit>
<allow-toggle-cockpit type="bool">true</allow-toggle-cockpit>
<model>
<path archive="y">Aircraft/c172p/Models/c172p.xml</path>
@ -51,7 +51,7 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<fairing2 type="bool">false</fairing2>
<fairing3 type="bool">false</fairing3>
</c172p>
<hide-yoke type="bool">false</hide-yoke>
</model>
<startup>
@ -69,10 +69,10 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<view>
<internal type="bool" archive="y">true</internal>
<config>
<x-offset-m archive="y">-0.21</x-offset-m>
<y-offset-m archive="y">0.235</y-offset-m>
<z-offset-m archive="y">0.36</z-offset-m>
<pitch-offset-deg>-12</pitch-offset-deg>
<x-offset-m archive="y" type="double">-0.21</x-offset-m>
<y-offset-m archive="y" type="double">0.235</y-offset-m>
<z-offset-m archive="y" type="double">0.36</z-offset-m>
<pitch-offset-deg type="double">-12</pitch-offset-deg>
</config>
</view>
@ -98,6 +98,12 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<help include="c172-help.xml"/>
<tutorials include="Tutorials/c172-tutorials.xml"/>
<dimensions>
<radius-m type="double">5</radius-m>
</dimensions>
<aircraft-class type="string">ga</aircraft-class>
<aircraft-operator type="string">NONE</aircraft-operator>
<multiplay>
<chat_display>1</chat_display>
@ -129,12 +135,14 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<controls>
<flight>
<aileron-trim>0.027</aileron-trim>
<rudder-trim>0.0</rudder-trim>
<aileron-trim type="double">0.027</aileron-trim>
<rudder-trim type="double">0.0</rudder-trim>
</flight>
<engines>
<engine n="0">
<magnetos>3</magnetos>
<magnetos type="int">3</magnetos>
<master-bat type="bool">true</master-bat>
<master-alt type="bool">true</master-alt>
</engine>
</engines>
<lighting>
@ -143,8 +151,17 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<strobe type="bool">false</strobe>
<beacon type="bool">false</beacon>
<nav-lights type="bool">false</nav-lights>
<taxi-light type="bool">false</taxi-light>
</lighting>
<switches>
<master-avionics type="bool">true</master-avionics>
<starter type="bool">false</starter>
</switches>
<engines>
<engine>
<master-bat type="bool">true</master-bat>
<master-alt type="bool">true</master-alt>
</engine>
</engines>
</controls>
<autopilot>
@ -178,6 +195,16 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<encoder>
<serviceable type="bool">true</serviceable>
</encoder>
<adf n="0">
<ident-audible type="bool">false</ident-audible>
<volume type="double">0.7</volume>
</adf>
<nav n="0">
<volume type="double">0.7</volume>
</nav>
<nav n="1">
<volume type="double">0.7</volume>
</nav>
</instrumentation>
<engines>
@ -197,6 +224,7 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<file>Aircraft/c172p/Nasal/doors.nas</file>
<file>Aircraft/c172p/Nasal/light.nas</file>
<file>Aircraft/c172p/Nasal/tanks.nas</file>
<file>Aircraft/c172p/Nasal/kma20.nas</file>
<file>Aircraft/c172p/Nasal/ki266.nas</file>
<script><![CDATA[
ki266.new(0);
@ -220,8 +248,8 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
</script>
</kap140>
<kr87>
<file>Aircraft/c172p/Nasal/kr87.nas</file>
</kr87>
<file>Aircraft/c172p/Nasal/kr87.nas</file>
</kr87>
</nasal>
<payload>
<weight>
@ -256,6 +284,14 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
</weight>
</payload>
<limits>
<mass-and-balance>
<maximum-ramp-mass-lbs>2407</maximum-ramp-mass-lbs>
<maximum-takeoff-mass-lbs>2400</maximum-takeoff-mass-lbs>
<maximum-landing-mass-lbs>2400</maximum-landing-mass-lbs>
</mass-and-balance>
</limits>
<input>
<keyboard>
<key n="76">

0
Aircraft/ufo/Models/ufo.xml Executable file → Normal file
View file

View file

@ -46,6 +46,8 @@ effect : The effect to be used for this material. (default:
ambient, diffuse, specular, emissive, and shininess are copied into the
parameter section of the effect created for this material.
parameters : Additional parameters to be used in the effect. See README.effects for format information.
wrapu : True if the texture should repeat horizontally over a surface, false if
it should not repeat (default: true).

View file

@ -38,10 +38,13 @@ in detail below:
tutorial selection dialog
<description>...</description> mandatory; longer description for the dialog
<audio-dir>...</audio-dir> optional; defines where to load sound samples
<interval>5</interval> optional; defines default loop interval in sec
<timeofday>noon</timeofday> optional; defines daytime; any of "dawn",
"morning", "noon", "afternoon",
"evening", "dusk", "midnight", "real"
<step-time> optional; period between each step being executed. Default 5
<exit-time> optional; period between exit/abort conditions being checked. Default 1
<nasal>
... optional; initial Nasal code; see below
</nasal>
@ -72,10 +75,7 @@ in detail below:
<nasal>
... optional; Nasal code
</nasal>
<interval>10</interval> optional; run loop next in this many seconds
</init> (default: 5); doesn't change global
interval
</init>
<step> mandatory; well, not really, but if there's not
at least one <step>, then the whole tutorial
@ -100,7 +100,7 @@ in detail below:
... optional; Nasal code that is executed when the
</nasal> step is entered
<interval>10</interval> optional; run loop next in this many seconds
<wait>10</wait> optional; wait period after initial messages etc.
<error> optional; allowed several times
<message>..</message> optional; text displayed/spoken
@ -113,8 +113,6 @@ in detail below:
<nasal>
... optional; Nasal code that is executed when the
</nasal> error condition was fulfilled
<interval>10</interval> optional; run loop next in this many seconds
</error>
<exit> optional; defines when to leave this <step>

View file

@ -3,74 +3,255 @@
<name>Effects/building</name>
<inherits-from>Effects/model-combined-deferred</inherits-from>
<parameters>
<texture n="0">
<type>2d</type>
<image>Textures/buildings.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<!-- Normal Map -->
<normalmap-enabled type="int"> 0 </normalmap-enabled>
<normalmap-dds type="int"> 0 </normalmap-dds>
<normalmap-tiling type="float"> 1.0 </normalmap-tiling>
<!-- Light Map -->
<texture n="3">
<image>Textures/buildings-lightmap.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
<internal-format>normalized</internal-format>
<texture n="0">
<type>2d</type>
<image>Textures/buildings.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<!-- Normal Map -->
<normalmap-enabled type="int"> 0 </normalmap-enabled>
<normalmap-dds type="int"> 0 </normalmap-dds>
<normalmap-tiling type="float"> 1.0 </normalmap-tiling>
<!-- Light Map -->
<texture n="3">
<image>Textures/buildings-lightmap.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<lightmap-enabled type="int"> 1 </lightmap-enabled>
<lightmap-multi type="int"> 0 </lightmap-multi>
<lightmap-factor type="float" n="0">
<use>/sim/time/sun-angle-rad</use>
</lightmap-factor>
<lightmap-color type="vec3d" n="0"> 0.3 0.3 0.3 </lightmap-color>
<!--<lightmap-factor type="float" n="1">1.0</lightmap-factor>
<lightmap-color type="vec3d" n="1"> 1.0 1.0 1.0 </lightmap-color>
<lightmap-factor type="float" n="2">1.0</lightmap-factor>
<lightmap-color type="vec3d" n="2"> 1.0 1.0 1.0 </lightmap-color>
<lightmap-factor type="float" n="3">1.0</lightmap-factor>
<lightmap-color type="vec3d" n="3"> 1.0 1.0 1.0 </lightmap-color>-->
<!-- Reflection -->
<reflection-enabled type="int"> 1 </reflection-enabled>
<reflect-map-enabled type="int"> 1 </reflect-map-enabled>
<reflection-correction type="float"> 0.10 </reflection-correction>
<reflection-dynamic type="int"> 0 </reflection-dynamic>
<reflection-fresnel type="float"> 0.0 </reflection-fresnel>
<reflection-rainbow type="float"> 0.0 </reflection-rainbow>
<reflection-noise type="float"> 0.0 </reflection-noise>
<texture n= "5" >
<type>cubemap</type>
<images>
<positive-x>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/1.png</positive-x>
<negative-x>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/4.png</negative-x>
<positive-y>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/2.png</positive-y>
<negative-y>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/3.png</negative-y>
<positive-z>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/6.png</positive-z>
<negative-z>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/5.png</negative-z>
</images>
</texture>
<lightmap-enabled type="int"> 1 </lightmap-enabled>
<lightmap-multi type="int"> 0 </lightmap-multi>
<lightmap-factor type="float" n="0">
<use>/sim/time/sun-angle-rad</use>
</lightmap-factor>
<lightmap-color type="vec3d" n="0"> 0.3 0.3 0.3 </lightmap-color>
<!--<lightmap-factor type="float" n="1">1.0</lightmap-factor>
<lightmap-color type="vec3d" n="1"> 1.0 1.0 1.0 </lightmap-color>
<lightmap-factor type="float" n="2">1.0</lightmap-factor>
<lightmap-color type="vec3d" n="2"> 1.0 1.0 1.0 </lightmap-color>
<lightmap-factor type="float" n="3">1.0</lightmap-factor>
<lightmap-color type="vec3d" n="3"> 1.0 1.0 1.0 </lightmap-color>-->
<!-- Reflection -->
<reflection-enabled type="int"> 1 </reflection-enabled>
<reflect-map-enabled type="int"> 1 </reflect-map-enabled>
<reflection-correction type="float"> 0.10 </reflection-correction>
<reflection-dynamic type="int"> 0 </reflection-dynamic>
<reflection-fresnel type="float"> 0.0 </reflection-fresnel>
<reflection-rainbow type="float"> 0.0 </reflection-rainbow>
<reflection-noise type="float"> 0.0 </reflection-noise>
<!--Ambient correction -->
<ambient-correction type="float"> 0.0 </ambient-correction>
<dirt-enabled type="int"> 0 </dirt-enabled>
<dirt-color type="vec3d"> 0.0 0.0 0.0 </dirt-color>
<dirt-factor type="float"> 0.0 </dirt-factor>
<material>
<active>true</active>
<color-mode-uniform>1</color-mode-uniform>
<ambient type="vec4d">0.6 0.6 0.6 1.0</ambient>
<diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse>
<specular type="vec4d">0.0 0.0 0.0 1.0</specular>
<emissive type="vec4d">0.02 0.02 0.02 1.0</emissive>
<shininess>0.0</shininess>
<color-mode>ambient-and-diffuse</color-mode>
<color-mode-uniform>ambient-and-diffuse</color-mode-uniform>
<!-- DIFFUSE -->
<!--Ambient correction -->
<ambient-correction type="float"> 0.0 </ambient-correction>
<dirt-enabled type="int"> 0 </dirt-enabled>
<dirt-color type="vec3d"> 0.0 0.0 0.0 </dirt-color>
<dirt-factor type="float"> 0.0 </dirt-factor>
<material>
<active>true</active>
<color-mode-uniform>1</color-mode-uniform>
<ambient type="vec4d">0.6 0.6 0.6 1.0</ambient>
<diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse>
<specular type="vec4d">0.0 0.0 0.0 1.0</specular>
<emissive type="vec4d">0.02 0.02 0.02 1.0</emissive>
<shininess>0.1</shininess>
<color-mode>ambient-and-diffuse</color-mode>
<color-mode-uniform>ambient-and-diffuse</color-mode-uniform>
<!-- DIFFUSE -->
</material>
<material-id>0</material-id>
<blend>
<active>0</active>
<source>0</source>
<destination>0</destination>
<active>0</active>
<source>0</source>
<destination>0</destination>
</blend>
<shade-model>flat</shade-model>
<cull-face>back</cull-face>
<rendering-hint>opaque</rendering-hint>
<!-- fog include for atmospheric scattering-->
<visibility><use>/environment/ground-visibility-m</use></visibility>
<avisibility><use>/environment/visibility-m</use></avisibility>
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
<scattering><use>/rendering/scene/scattering</use></scattering>
<ground_scattering><use>/environment/surface/scattering</use></ground_scattering>
<terminator><use>/environment/terminator-relative-position-m</use></terminator>
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<terrain_alt><use>/environment/mean-terrain-elevation-m</use></terrain_alt>
<overcast><use>/rendering/scene/overcast</use></overcast>
<eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
<mysnow_level><use>/environment/mysnow-level-m</use></mysnow_level>
<dust_cover_factor><use>/environment/surface/dust-cover-factor</use></dust_cover_factor>
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<fogstructure><use>/environment/fog-structure</use></fogstructure>
<!-- END fog include -->
</parameters>
<!-- Atmospheric scattering technique -->
<technique n="5">
<predicate>
<and>
<property>/sim/rendering/shaders/skydome</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>
<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>false</alpha-test>
<shade-model>flat</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 n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/default.vert</vertex-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">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>
<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>
<blend>false</blend>
<alpha-test>false</alpha-test>
<shade-model>flat</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>
<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/terrain-haze.vert</vertex-shader>
<fragment-shader>Shaders/terrain-haze.frag</fragment-shader>
</program>
<uniform>
<name>visibility</name>
<type>float</type>
<value><use>visibility</use></value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value><use>avisibility</use></value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value><use>lthickness</use></value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value><use>scattering</use></value>
</uniform>
<uniform>
<name>ground_scattering</name>
<type>float</type>
<value><use>ground_scattering</use></value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value><use>terminator</use></value>
</uniform>
<uniform>
<name>terrain_alt</name>
<type>float</type>
<value><use>terrain_alt</use></value>
</uniform>
<uniform>
<name>overcast</name>
<type>float</type>
<value><use>overcast</use></value>
</uniform>
<uniform>
<name>eye_alt</name>
<type>float</type>
<value><use>eye_alt</use></value>
</uniform>
<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="8">
<pass>
<texture-unit n="4">
@ -115,4 +296,4 @@
</texture-unit>
</pass>
</technique>
</PropertyList>
</PropertyList>

View file

@ -340,29 +340,41 @@
<pass>
<name>sky-clouds</name>
<debug-property>/sim/rendering/rembrandt/debug/lighting/sky</debug-property>
</pass>
<pass>
<name>ambient</name>
<type>fullscreen</type>
<effect>Effects/ambient</effect>
<order-num>1</order-num>
<debug-property>/sim/rendering/rembrandt/debug/lighting/ambient</debug-property>
</pass>
<pass>
<name>sunlight</name>
<type>fullscreen</type>
<effect>Effects/sunlight</effect>
<order-num>2</order-num>
</pass>
<pass>
<name>lights</name>
<order-num>3</order-num>
<debug-property>/sim/rendering/rembrandt/debug/lighting/sunlight</debug-property>
</pass>
<pass>
<name>fog</name>
<type>fullscreen</type>
<effect>Effects/fog</effect>
<order-num>4</order-num>
<order-num>3</order-num>
<debug-property>/sim/rendering/rembrandt/debug/lighting/fog</debug-property>
</pass>
<pass>
<name>lights</name>
<order-num>4</order-num>
<debug-property>/sim/rendering/rembrandt/debug/lighting/lights</debug-property>
</pass>
<!-- pass>
<name>debug</name>
<type>fullscreen</type>
<effect>Effects/debug</effect>
<order-num>5</order-num>
<debug-property>/sim/rendering/rembrandt/debug/lighting/debug</debug-property>
</pass -->
</stage>
<stage>

View file

@ -12,7 +12,7 @@
<destination>one-minus-src-alpha</destination>
</blend>
<render-bin>
<bin-number>10000</bin-number>
<bin-number>1</bin-number>
<bin-name>RenderBin</bin-name>
</render-bin>
<texture-unit>

View file

@ -25,7 +25,6 @@ the objects that use it, and replaces it with the default shader.
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
<extension-supported>GL_EXT_gpu_shader4</extension-supported>
</and>
</predicate>
<pass>

View file

@ -169,8 +169,6 @@ please see Docs/README.model-combined.eff for documentation
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
<extension-supported>GL_EXT_gpu_shader4</extension-supported>
<extension-supported>GL_ARB_texture_rg</extension-supported>
</and>
</predicate>
<pass>

View file

@ -102,7 +102,6 @@
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
<extension-supported>GL_EXT_gpu_shader4</extension-supported>
</and>
</predicate>
<pass>
@ -247,7 +246,7 @@
</material>
<cull-face>back</cull-face>
<program>
<vertex-shader>Shaders/reflect-bump-spec.vert</vertex-shader>
<vertex-shader>Shaders/runway-gbuffer.vert</vertex-shader>
<fragment-shader>Shaders/runway-gbuffer.frag</fragment-shader>
<fragment-shader>Shaders/gbuffer-functions.frag</fragment-shader>
<fragment-shader>Shaders/gbuffer-encode.frag</fragment-shader>

View file

@ -8,7 +8,24 @@
<g_sample_rad type="float">0.03</g_sample_rad>
<random_size type="float">800.0</random_size>
</parameters>
<technique n="11">
<technique n="10">
<predicate>
<and>
<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>
<extension-supported>GL_EXT_gpu_shader4</extension-supported>
</and>
</predicate>
<pass>
<texture-unit>
<unit>0</unit>
@ -81,4 +98,77 @@
</uniform>
</pass>
</technique>
<technique n="11">
<pass>
<texture-unit>
<unit>0</unit>
<type>buffer</type>
<name>depth</name>
</texture-unit>
<texture-unit>
<unit>1</unit>
<type>buffer</type>
<name>normal</name>
</texture-unit>
<texture-unit>
<unit>2</unit>
<type>buffer</type>
<name>spec-emis</name>
</texture-unit>
<texture-unit>
<unit>3</unit>
<type>noise</type>
</texture-unit>
<program>
<vertex-shader>Shaders/ssao.vert</vertex-shader>
<fragment-shader>Shaders/ssao-ati.frag</fragment-shader>
<fragment-shader>Shaders/gbuffer-functions.frag</fragment-shader>
</program>
<uniform>
<name>depth_tex</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>normal_tex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>spec_emis_tex</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>noise_tex</name>
<type>sampler-2d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>g_scale</name>
<type>float</type>
<value><use>g_scale</use></value>
</uniform>
<uniform>
<name>g_bias</name>
<type>float</type>
<value><use>g_bias</use></value>
</uniform>
<uniform>
<name>g_intensity</name>
<type>float</type>
<value><use>g_intensity</use></value>
</uniform>
<uniform>
<name>g_sample_rad</name>
<type>float</type>
<value><use>g_sample_rad</use></value>
</uniform>
<uniform>
<name>random_size</name>
<type>float</type>
<value><use>random_size</use></value>
</uniform>
</pass>
</technique>
</PropertyList>

View file

@ -31,7 +31,7 @@
<internal-format>normalized</internal-format>
</texture>
<texture n="10">
<image>Textures.high/Terrain/snow3.dds</image>
<image>Textures.high/Terrain/snow3.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
@ -679,7 +679,7 @@
</pass>
</technique>
<technique n="12">
<pass>
<lighting>true</lighting>

View file

@ -3,14 +3,14 @@
<name>Effects/transition-base-dirt</name>
<inherits-from>Effects/transition</inherits-from>
<parameters>
<texture n="3">
<image>Textures.high/Terrain/dirt3.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<transitions type="float">1.0</transitions>
<inverse type="float">0.0</inverse>
<texture n="3">
<image>Textures.high/Terrain/dirt3.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<transitions type="float">1.0</transitions>
<inverse type="float">0.0</inverse>
</parameters>
</PropertyList>

View file

@ -3,16 +3,14 @@
<name>Effects/transition-base-rock</name>
<inherits-from>Effects/transition</inherits-from>
<parameters>
<texture n="3">
<image>Textures.high/Terrain/grass12.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<transitions type="float">1.0</transitions>
<inverse type="float">1.0</inverse>
<texture n="3">
<image>Textures.high/Terrain/herbtundra.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<transitions type="float">1.0</transitions>
<inverse type="float">1.0</inverse>
</parameters>
</PropertyList>

View file

@ -3,28 +3,28 @@
<name>Effects/transition-base-grass-rock</name>
<inherits-from>Effects/transition</inherits-from>
<parameters>
<texture n="2">
<image>Textures.high/Terrain/grass10c.dds</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.high/Terrain/rock7.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="4">
<image>Textures.high/Terrain.winter/mixedforest1c.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<transitions type="float">2.0</transitions>
<inverse type="float">0.0</inverse>
<texture n="2">
<image>Textures.high/Terrain/grass10c.dds</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.high/Terrain/rock7.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="4">
<image>Textures.high/Terrain.winter/mixedforest1c.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<transitions type="float">2.0</transitions>
<inverse type="float">0.0</inverse>
</parameters>
</PropertyList>

View file

@ -3,16 +3,14 @@
<name>Effects/transition-base-rock</name>
<inherits-from>Effects/transition</inherits-from>
<parameters>
<texture n="3">
<image>Textures.high/Terrain/rock7.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<transitions type="float">1.0</transitions>
<inverse type="float">0.0</inverse>
<texture n="3">
<image>Textures.high/Terrain/rock7.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<transitions type="float">1.0</transitions>
<inverse type="float">0.0</inverse>
</parameters>
</PropertyList>

View file

@ -94,10 +94,6 @@ parameters :
<and>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/rembrandt/enabled</property>
<less-equal>
<value type="float">4.0</value>
<float-property>/sim/rendering/shaders/water</float-property>
</less-equal>
<or>
<less-equal>
<value type="float">2.0</value>
@ -110,7 +106,6 @@ parameters :
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
<extension-supported>GL_EXT_gpu_shader4</extension-supported>
</and>
</predicate>
@ -394,6 +389,10 @@ parameters :
<predicate>
<and>
<property>/sim/rendering/shaders/transition</property>
<equal>
<value type="float">0.0</value>
<float-property>/sim/rendering/rembrandt/enabled</float-property>
</equal>
<or>
<less-equal>
<value type="float">2.0</value>

View file

@ -31,8 +31,6 @@
<dust_cover_factor><use>/environment/surface/dust-cover-factor</use></dust_cover_factor>
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<fogstructure><use>/environment/fog-structure</use></fogstructure>
<render-bin-number><use>/sim/rendering/tree-bin</use></render-bin-number>
<render-bin-name><use>/sim/rendering/tree-bin-name</use></render-bin-name>
<!-- END fog include -->
</parameters>
@ -70,6 +68,10 @@
<source>src-alpha</source>
<destination>one-minus-src-alpha</destination>
</blend>
<alpha-test>
<comparison>gequal</comparison>
<reference type="float">0.1</reference>
</alpha-test>
<texture-unit>
<unit>0</unit>
<type>2d</type>
@ -109,6 +111,10 @@
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
</texture-unit>
<alpha-test>
<comparison>gequal</comparison>
<reference type="float">0.1</reference>
</alpha-test>
<program>
<vertex-shader>Shaders/tree-haze.vert</vertex-shader>
<fragment-shader>Shaders/tree-haze.frag</fragment-shader>

File diff suppressed because it is too large Load diff

View file

@ -523,7 +523,6 @@
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
<extension-supported>GL_EXT_gpu_shader4</extension-supported>
</and>
</predicate>
<pass>
@ -913,7 +912,6 @@
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
<extension-supported>GL_EXT_gpu_shader4</extension-supported>
</and>
</predicate>
<pass>

View file

@ -19,6 +19,7 @@ $Id$
<name>CH PRODUCTS CH PRO PEDALS USB </name>
<name>CH Products CH Pro Pedals USB Rudder Pedals </name>
<name>CH PRO PEDALS USB </name>
<name>CH Pro Pedals USB</name>
<axis n="0">
<desc>Brake left</desc>

View file

@ -4,6 +4,7 @@
<name>CH PRODUCTS CH FLIGHT SIM YOKE USB </name>
<name>CH FLIGHT SIM YOKE USB </name>
<name>CH Flight Sim Yoke USB</name>
<axis n="0">
<desc>Aileron</desc>

View file

@ -32,6 +32,7 @@
<name>Pro Flight Cessna Yoke</name>
<axis n="0">
<name>Yoke left/right</name>
<desc>Aileron</desc>
<binding>
<command>property-scale</command>
@ -39,6 +40,7 @@
</binding>
</axis>
<axis n="1">
<name>Yoke forward/backwards</name>
<desc>Elevator</desc>
<binding>
<command>property-scale</command>
@ -48,6 +50,7 @@
</axis>
<!-- Throttle Quadrant -->
<axis n="2">
<name>Black Lever</name>
<desc>Throttle</desc>
<binding>
<command>nasal</command>
@ -59,6 +62,7 @@
<unix>3</unix>
<windows>4</windows>
</number>
<name>Blue lever</name>
<desc>Propellor Pitch</desc>
<binding>
<command>nasal</command>
@ -70,6 +74,7 @@
<unix>4</unix>
<windows>3</windows>
</number>
<name>Red lever</name>
<desc>Mixture</desc>
<binding>
<command>nasal</command>
@ -82,6 +87,7 @@
<unix>5</unix>
<windows>6</windows>
</number>
<name>Coolie hat left/right</name>
<desc>View Heading</desc>
<low>
<repeatable>true</repeatable>
@ -110,6 +116,7 @@
<number>
<unix>6</unix>
</number>
<name>Coolie hat up/down</name>
<desc>View Elevation</desc>
<low>
<repeatable>true</repeatable>
@ -138,6 +145,7 @@
<number>
<windows>7</windows>
</number>
<name>Coolie hat up/down</name>
<desc>View Elevation</desc>
<low>
<repeatable>true</repeatable>
@ -167,11 +175,11 @@
<!-- Red Button on left stalk -->
<button n="0">
<name>PTT</name>
<name>Red button</name>
<desc>Push To Talk (FGCom)</desc>
<binding>
<command>nasal</command>
<script>controls.ptt(1)</script>
<command>nasal</command>
<script>controls.ptt(1)</script>
</binding>
<mod-up>
<binding>
@ -179,45 +187,48 @@
<script>controls.ptt(0)</script>
</binding>
</mod-up>
</button>
<!-- Black button on right stalk -->
<button n="1">
<desc>Reset view</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>
setprop("/sim/current-view/view-number", 0);
setprop("/sim/current-view/goal-pitch-offset-deg", getprop("/sim/view[0]/config/pitch-offset-deg"));
setprop("/sim/current-view/goal-heading-offset-deg", 0.0);
#setprop("/sim/current-view/field-of-view", getprop("/sim/view/config/default-field-of-view-deg"));
</script>
</binding>
<button n="1">
<name>Black button</name>
<desc>Reset view</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>
setprop("/sim/current-view/view-number", 0);
setprop("/sim/current-view/goal-pitch-offset-deg", getprop("/sim/view[0]/config/pitch-offset-deg"));
setprop("/sim/current-view/goal-heading-offset-deg", 0.0);
#setprop("/sim/current-view/field-of-view", getprop("/sim/view/config/default-field-of-view-deg"));
</script>
</binding>
</button>
<!-- Left hand four-way switch -->
<button n="2">
<desc>View Decrease</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>view.decrease(0.75)</script>
</binding>
</button>
<button n="2">
<name>Left rocker switch up</name>
<desc>View Decrease</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>view.decrease(0.75)</script>
</binding>
</button>
<button n="3">
<desc>View Increase</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>view.increase(0.75)</script>
</binding>
</button>
<button n="3">
<name>Left rocker switch down</name>
<desc>View Increase</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>view.increase(0.75)</script>
</binding>
</button>
<!-- Right hand vertical two-way switch -->
<!-- Right hand vertical two-way switch -->
<button n="4">
<name>Right vertical rocker switch up</name>
<desc>Elevator trim up</desc>
<repeatable>true</repeatable>
<binding>
@ -226,6 +237,7 @@
</binding>
</button>
<button n="5">
<name>Right vertical rocker switch down</name>
<desc>Elevator trim down</desc>
<repeatable>true</repeatable>
<binding>
@ -234,9 +246,9 @@
</binding>
</button>
<!-- Right hand horizontal two-way switch -->
<!-- Right hand horizontal two-way switch -->
<button n="6">
<name>Right horizontal rocker switch right</name>
<desc>Rudder trim right</desc>
<repeatable>true</repeatable>
<binding>
@ -245,6 +257,7 @@
</binding>
</button>
<button n="7">
<name>Right horizontal rocker switch left</name>
<desc>Rudder trim left</desc>
<repeatable>true</repeatable>
<binding>
@ -253,29 +266,30 @@
</binding>
</button>
<!-- Left four-way switch - horizontal -->
<button n="11">
<desc>View Cycle Backwards</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>view.stepView(-1)</script>
</binding>
</button>
<button n="12">
<desc>View Cycle Forwards</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>view.stepView(1)</script>
</binding>
</button>
<!-- Left four-way switch - horizontal -->
<button n="11">
<name>Right rocker switch left</name>
<desc>View Cycle Backwards</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>view.stepView(-1)</script>
</binding>
</button>
<button n="12">
<name>Right rocker switch right</name>
<desc>View Cycle Forwards</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>view.stepView(1)</script>
</binding>
</button>
<!-- Buttons on the throttle Quadrant -->
<button n="13"> <!-- Labled as T1 -->
<name>T1</name>
<desc>Flaps up</desc>
<repeatable>false</repeatable>
<binding>
@ -290,6 +304,7 @@
</mod-up>
</button>
<button n="14"> <!-- Labled as T2 -->
<name>T2</name>
<desc>Flaps down</desc>
<repeatable>false</repeatable>
<binding>
@ -304,6 +319,7 @@
</mod-up>
</button>
<button n="15"> <!-- Labled as T3 -->
<name>T3</name>
<desc>Gear up</desc>
<repeatable>false</repeatable>
<binding>
@ -318,6 +334,7 @@
</mod-up>
</button>
<button n="16"> <!-- Labled as T4 -->
<name>T4</name>
<desc>Gear down</desc>
<repeatable>false</repeatable>
<binding>
@ -332,6 +349,7 @@
</mod-up>
</button>
<button n="17"> <!-- Labled as T5 -->
<name>T5</name>
<desc>Retract Spoilers</desc>
<repeatable>false</repeatable>
<binding>
@ -347,6 +365,7 @@
</button>
<button n="18"> <!-- Labled as T6 -->
<name>T6</name>
<desc>Deploy Spoilers</desc>
<repeatable>false</repeatable>
<binding>
@ -361,7 +380,8 @@
</mod-up>
</button>
<button n="22">
<desc>Yoke Mode 0</desc>
<name>Yoke mode switch left</name>
<desc>Coolie hat sensitivity low</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-assign</command>
@ -370,7 +390,8 @@
</binding>
</button>
<button n="23">
<desc>Yoke Mode 1</desc>
<name>Yoke mode switch middle</name>
<desc>Coolie hat sensitivity medium</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-assign</command>
@ -379,7 +400,8 @@
</binding>
</button>
<button n="24">
<desc>Yoke Mode 2</desc>
<name>Yoke mode switch right</name>
<desc>Coolie hat sensitivity high</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-assign</command>

View file

@ -12,13 +12,12 @@
90.0 0.315
95.0 0.286
100.0 0.257
105.0 0.215
110.0 0.215
115.0 0.215
120.0 0.215
130.0 0.215
140.0 0.215
150.0 0.215
160.0 0.215
170.0 0.215
180.0 0.215
105.0 0.127
115.0 0.000
120.0 0.000
130.0 0.000
140.0 0.000
150.0 0.000
160.0 0.000
170.0 0.000
180.0 0.000

View file

@ -400,22 +400,6 @@ Shared parameters for various materials.
<bumpiness>0.1</bumpiness>
</material>
<material n="2006">
<name>BarrenCover</name>
<name>Dirt</name>
<name>OpenMining</name>
<name>Rock</name>
<name>Dump</name>
<effect>Effects/transition-base-grass-inverse</effect>
<texture>Terrain/rock.png</texture>
<xsize>500</xsize>
<ysize>500</ysize>
<solid>1</solid>
<friction-factor>0.9</friction-factor>
<rolling-friction>0.1</rolling-friction>
<bumpiness>0.3</bumpiness>
</material>
<material n="2007">
<name>Lava</name>
<name>Burnt</name>

10
Materials/base/rock.xml Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!-- common rock settings -->
<PropertyList>
<xsize>500</xsize>
<ysize>500</ysize>
<solid>1</solid>
<friction-factor>0.9</friction-factor>
<rolling-friction>0.1</rolling-friction>
<bumpiness>0.3</bumpiness>
</PropertyList>

View file

@ -1,102 +1,102 @@
<?xml version="1.0"?>
<!-- common water settings -->
<PropertyList>
<xsize>400</xsize>
<ysize>400</ysize>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Geometry/container_carrier.ac</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/ContainerShip.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/Freighter.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/LargeTrawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/SailBoatUnderSail.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/CruiseShip.xml</path>
<coverage-m2>5000000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/MPPShip.xml</path>
<coverage-m2>5000000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<ambient>
<r>0.0</r>
<g>0.0</g>
<b>0.0</b>
<a>1.0</a>
</ambient>
<diffuse>
<r>0.4</r>
<g>0.4</g>
<b>0.4</b>
<a>1.0</a>
</diffuse>
<specular>
<r>0.0</r>
<g>0.0</g>
<b>0.2</b>
<a>1.0</a>
</specular>
<shininess>0</shininess>
<solid>0</solid>
<rolling-friction>2</rolling-friction>
<bumpiness>0.8</bumpiness>
<xsize>400</xsize>
<ysize>400</ysize>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Geometry/container_carrier.ac</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/ContainerShip.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/Freighter.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/LargeTrawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/SailBoatUnderSail.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/CruiseShip.xml</path>
<coverage-m2>5000000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/MPPShip.xml</path>
<coverage-m2>5000000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<ambient>
<r>0.0</r>
<g>0.0</g>
<b>0.0</b>
<a>1.0</a>
</ambient>
<diffuse>
<r>0.4</r>
<g>0.4</g>
<b>0.4</b>
<a>1.0</a>
</diffuse>
<specular>
<r>0.0</r>
<g>0.0</g>
<b>0.2</b>
<a>1.0</a>
</specular>
<shininess>0</shininess>
<solid>0</solid>
<rolling-friction>2</rolling-friction>
<bumpiness>0.8</bumpiness>
</PropertyList>

View file

@ -836,9 +836,9 @@
<name>Sclerophyllous</name>
<name>Heath</name>
<texture>Terrain/shrub.dds</texture>
<texture>Terrain/shrub1.dds</texture>
<!--<texture>Terrain/shrub1.dds</texture>
<texture>Terrain/shrub2.dds</texture>
<texture>Terrain/shrub3.dds</texture>
<texture>Terrain/shrub3.dds</texture>-->
<xsize>2000</xsize>
<ysize>2000</ysize>
<diffuse>
@ -1031,7 +1031,7 @@
<material include="Materials/base/water.xml">
<name>Ocean</name>
<effect>Effects/water-dds</effect>
<texture>Terrain/water.png</texture>
<texture>Terrain/water.dds</texture>
</material>
<material>
@ -1050,10 +1050,10 @@
<name>Estuary</name>
<name>Watercourse</name>
<name>Saline</name>
<texture>Terrain/estuary.dds</texture>
<texture>Terrain/water-inland.dds</texture>
<!--<texture>Terrain/water-lake.png</texture>-->
<xsize>400</xsize>
<ysize>400</ysize>
<xsize>128</xsize>
<ysize>128</ysize>
<ambient>
<r>0.0</r>
<g>0.0</g>
@ -1158,7 +1158,7 @@
<name>Cemetery</name>
<effect>Effects/transition-base-rock</effect>
<texture>Terrain/grass10c.dds</texture>
<texture>Terrain/grass10b.dds</texture>
<!-- <texture>Terrain/grass10b.dds</texture> -->
<xsize>500</xsize>
<ysize>500</ysize>
<light-coverage>4000000.0</light-coverage>
@ -1193,8 +1193,8 @@
<name>HerbTundra</name>
<effect>Effects/transition-base-rock</effect>
<texture>Terrain/herbtundra.dds</texture>
<texture>Terrain/herbtundra2.dds</texture>
<texture>Terrain/herbtundra3.dds</texture>
<!-- <texture>Terrain/herbtundra2.dds</texture>
<texture>Terrain/herbtundra3.dds</texture>-->
<xsize>2000</xsize>
<ysize>2000</ysize>
<light-coverage>4000000.0</light-coverage>
@ -1251,7 +1251,7 @@
<name>Greenspace</name>
<effect>Effects/transition-base-dirt</effect>
<texture>Terrain/grass10b.dds</texture>
<texture>Terrain/grass10c.dds</texture>
<!-- <texture>Terrain/grass10c.dds</texture> -->
<xsize>250</xsize>
<ysize>250</ysize>
<light-coverage>4000000.0</light-coverage>
@ -1286,12 +1286,16 @@
<name>MixedCropPastureCover</name>
<name>MixedCrop</name>
<name>ComplexCrop</name>
<texture>Terrain/mixedcrop1.dds</texture>
<texture>Terrain/countryside1.green.dds</texture>
<texture>Terrain/countryside2.green.dds</texture>
<!-- <texture>Terrain/mixedcrop1.dds</texture>
<texture>Terrain/mixedcrop4.dds</texture>
<texture>Terrain/mixedcrop3.dds</texture>
<object-mask>Terrain/mixedcrop1.mask.png</object-mask>
<texture>Terrain/mixedcrop3.dds</texture>-->
<object-mask>Terrain/countryside1.green.mask.png</object-mask>
<object-mask>Terrain/countryside2.green.mask.png</object-mask>
<!-- <object-mask>Terrain/mixedcrop1.mask.png</object-mask>
<object-mask>Terrain/mixedcrop4.mask.png</object-mask>
<object-mask>Terrain/mixedcrop3.mask.png</object-mask>
<object-mask>Terrain/mixedcrop3.mask.png</object-mask>-->
<xsize>2000</xsize>
<ysize>2000</ysize>
<light-coverage>2000000.0</light-coverage>
@ -1301,7 +1305,7 @@
<bumpiness>0.7</bumpiness>
<load-resistance>1e30</load-resistance>
<object-group include="Materials/base/farm-buildings.xml"/>
<wood-coverage>10000.0</wood-coverage>
<wood-coverage>2000.0</wood-coverage>
<tree-texture>Trees/mixed-summer.dds</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
@ -1323,12 +1327,14 @@
<name>Olives</name>
<name>Vineyard</name>
<name>Rice</name>
<texture>Terrain/irrcrop1.dds</texture>
<texture>Terrain/irrcrop.dds</texture>
<!--<texture>Terrain/irrcrop1.dds</texture>
<texture>Terrain/irrcrop2.dds</texture>
<texture>Terrain/irrcrop3.dds</texture>
<object-mask>Terrain/irrcrop1.mask.png</object-mask>
<texture>Terrain/irrcrop3.dds</texture>-->
<object-mask>Terrain/irrcrop-dds.mask.png</object-mask>
<!--<object-mask>Terrain/irrcrop1.mask.png</object-mask>
<object-mask>Terrain/irrcrop2.mask.png</object-mask>
<object-mask>Terrain/irrcrop3.mask.png</object-mask>
<object-mask>Terrain/irrcrop3.mask.png</object-mask>-->
<xsize>2000</xsize>
<ysize>2000</ysize>
<light-coverage>2000000.0</light-coverage>
@ -1338,7 +1344,7 @@
<bumpiness>0.6</bumpiness>
<load-resistance>1e30</load-resistance>
<object-group include="Materials/base/farm-buildings.xml"/>
<wood-coverage>10000.0</wood-coverage>
<wood-coverage>2000.0</wood-coverage>
<tree-texture>Trees/mixed-summer.dds</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
@ -1357,14 +1363,14 @@
<name>DryCropPastureCover</name>
<name>DryCrop</name>
<texture-set>
<texture>Terrain/countryside1.green.dds</texture>
<texture>Terrain/uk_countryside1.dds</texture>
<texture n="4">Terrain.winter/countryside1.winter.dds</texture>
</texture-set>
<!--<texture-set>
<texture>Terrain/countryside2.green.dds</texture>
<texture-set>
<texture>Terrain/uk_countryside2.dds</texture>
<texture n="4">Terrain.winter/countryside2.winter.dds</texture>
</texture-set>
<texture-set>
<!--<texture-set>
<texture>Terrain/countryside3.green.dds</texture>
<texture n="4">Terrain.winter/countryside3.winter.dds</texture>
</texture-set>
@ -1374,8 +1380,8 @@
</texture-set> -->
<object-mask>Terrain/countryside1.green.mask.png</object-mask>
<object-mask>Terrain/countryside2.green.mask.png</object-mask>
<object-mask>Terrain/countryside3.green.mask.png</object-mask>
<object-mask>Terrain/countryside4.green.mask.png</object-mask>
<!--<object-mask>Terrain/countryside3.green.mask.png</object-mask>
<object-mask>Terrain/countryside4.green.mask.png</object-mask>-->
<xsize>1800</xsize>
<ysize>1800</ysize>
<solid>1</solid>
@ -1385,7 +1391,7 @@
<load-resistance>1e30</load-resistance>
<light-coverage>2000000.0</light-coverage>
<object-group include="Materials/base/farm-buildings.xml"/>
<wood-coverage>4000.0</wood-coverage>
<wood-coverage>2000.0</wood-coverage>
<tree-texture>Trees/deciduous-summer.dds</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
@ -1432,10 +1438,12 @@
<name>CropGrassCover</name>
<name>CropGrass</name>
<name>Grassland</name>
<texture>Terrain/cropgrass1.dds</texture>
<texture>Terrain/cropgrass2.dds</texture>
<xsize>1500</xsize>
<ysize>1500</ysize>
<texture>Terrain/cropgrass.dds</texture>
<!--<texture>Terrain/cropgrass1.dds</texture>
<texture>Terrain/cropgrass2.dds</texture>-->
<object-mask>Terrain/cropgrass-dds.mask.png</object-mask>
<xsize>1399</xsize>
<ysize>1399</ysize>
<light-coverage>2000000.0</light-coverage>
<diffuse>
<r>0.93</r>
@ -1455,7 +1463,9 @@
<rolling-friction>0.1</rolling-friction>
<bumpiness>0.3</bumpiness>
<load-resistance>1e30</load-resistance>
<wood-coverage>500000.0</wood-coverage>
<light-coverage>2000000.0</light-coverage>
<object-group include="Materials/base/farm-buildings.xml"/>
<wood-coverage>2000.0</wood-coverage>
<tree-texture>Trees/deciduous-summer.dds</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
@ -1515,7 +1525,7 @@
<name>AgroForest</name>
<effect>Effects/transition-base-dirt</effect>
<texture>Terrain/cropwood.dds</texture>
<object-mask>Terrain/cropwood.mask.png</object-mask>
<object-mask>Terrain/cropwood-dds.mask.png</object-mask>
<xsize>1500</xsize>
<ysize>1500</ysize>
<light-coverage>2000000.0</light-coverage>
@ -1524,7 +1534,9 @@
<rolling-friction>0.6</rolling-friction>
<bumpiness>0.7</bumpiness>
<load-resistance>10</load-resistance>
<wood-coverage>4000.0</wood-coverage>
<light-coverage>2000000.0</light-coverage>
<object-group include="Materials/base/farm-buildings.xml"/>
<wood-coverage>2000.0</wood-coverage>
<tree-texture>Trees/mixed-summer.dds</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
@ -2162,12 +2174,12 @@
<effect>Effects/transition-base-dirt</effect>
<texture >Terrain.winter/countryside1.winter.dds</texture>
<texture >Terrain.winter/countryside2.winter.dds</texture>
<texture >Terrain.winter/countryside3.winter.dds</texture>
<texture >Terrain.winter/countryside3.winter.dds</texture>
<!--<texture >Terrain.winter/countryside3.winter.dds</texture>
<texture >Terrain.winter/countryside3.winter.dds</texture>-->
<object-mask>Terrain/countryside1.green.mask.png</object-mask>
<object-mask>Terrain/countryside2.green.mask.png</object-mask>
<object-mask>Terrain/countryside3.green.mask.png</object-mask>
<object-mask>Terrain/countryside4.green.mask.png</object-mask>
<!--<object-mask>Terrain/countryside3.green.mask.png</object-mask>
<object-mask>Terrain/countryside4.green.mask.png</object-mask>-->
<xsize>1800</xsize>
<ysize>1800</ysize>
<solid>1</solid>
@ -2340,6 +2352,15 @@
<!-- end winter-->
<material include="Materials/base/rock.xml">
<name>BarrenCover</name>
<name>Dirt</name>
<name>OpenMining</name>
<name>Rock</name>
<name>Dump</name>
<effect>Effects/transition-base-grass-inverse</effect>
<texture>Terrain/rock7.dds</texture>
</material>
<!-- runway and taxiway signs -->

View file

@ -2199,6 +2199,15 @@
<!-- end winter-->
<material include="Materials/base/rock.xml">
<name>BarrenCover</name>
<name>Dirt</name>
<name>OpenMining</name>
<name>Rock</name>
<name>Dump</name>
<texture>Terrain/rock.png</texture>
</material>
<!-- runway and taxiway signs -->
<material include="Materials/base/glyphs-yellow.xml">

View file

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!-- Set of generic farm buildings, for inclusion in a materials file -->
<PropertyList>
<range-m>5000</range-m>
<object>
<path>Models/Buildings/red-barn.ac</path>
<path>Models/Buildings/cow-stable.ac</path>
<path>Models/Agriculture/farmhouse1.ac</path>
<path>Models/Agriculture/farmhouse2.ac</path>
<path>Models/Agriculture/farmhouse3.ac</path>
<coverage-m2>5000</coverage-m2>
<heading-type>mask</heading-type>
</object>
</PropertyList>

View file

@ -0,0 +1,45 @@
<?xml version="1.0"?>
<!-- General settings for all caribbean materials -->
<PropertyList>
<!-- Define the caribbean as a box with given latitude/longitude -->
<condition>
<and>
<greater-than>
<property>position/longitude-deg</property>
<value>-85.0</value>
</greater-than>
<less-than>
<property>position/longitude-deg</property>
<value>-40.0</value>
</less-than>
<greater-than>
<property>position/latitude-deg</property>
<value>11.0</value>
</greater-than>
<less-than>
<property>position/latitude-deg</property>
<value>25</value>
</less-than>
</and>
</condition>
<!-- Caribbean buildings definitions. Notes that these will be used for -->
<!-- both towns and cities -->
<building-texture>Textures/buildings-caribbean.png</building-texture>
<building-lightmap>Textures/buildings-caribbean-lightmap.png</building-lightmap>
<building-small-min-floors>1</building-small-min-floors>
<building-small-max-floors>2</building-small-max-floors>
<building-small-max-width-m>20.0</building-small-max-width-m>
<building-small-min-depth-m>8.0</building-small-min-depth-m>
<building-small-max-depth-m>20.0</building-small-max-depth-m>
<building-medium-min-floors>1</building-medium-min-floors>
<building-medium-max-floors>3</building-medium-max-floors>
<!-- Appropriate tropical trees -->
<tree-texture>Trees/tropical-summer.png</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
<tree-height-m>25.0</tree-height-m>
<tree-width-m>15.0</tree-width-m>
</PropertyList>

View file

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<!-- General settings for all European materials -->
<PropertyList>
<!-- Define Europe as a box with given latitude/longitude -->
<condition>
<and>
<equals>
<property>sim/startup/season</property>
<value>summer</value>
</equals>
<and>
<greater-than>
<property>position/longitude-deg</property>
<value>-20.0</value>
</greater-than>
<less-than>
<property>position/longitude-deg</property>
<value>40.0</value>
</less-than>
<greater-than>
<property>position/latitude-deg</property>
<value>35.0</value>
</greater-than>
</and>
</and>
</condition>
<!-- European buildings definitions. Notes that these will be used for -->
<!-- both towns and cities -->
<building-texture>Textures/buildings.png</building-texture>
<building-lightmap>Textures/buildings-lightmap.png</building-lightmap>
</PropertyList>

View file

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<!-- General settings for all Hawaii materials -->
<PropertyList>
<!-- Define Hawaii as a box with given latitude/longitude -->
<condition>
<and>
<greater-than>
<property>position/longitude-deg</property>
<value>-179.0</value>
</greater-than>
<less-than>
<property>position/longitude-deg</property>
<value>-154.0</value>
</less-than>
<greater-than>
<property>position/latitude-deg</property>
<value>18.8</value>
</greater-than>
<less-than>
<property>position/latitude-deg</property>
<value>28.5</value>
</less-than>
</and>
</condition>
<!-- Hawaiian buildings definitions. Notes that these will be used for -->
<!-- both towns and cities -->
<building-texture>Textures/buildings-caribbean.png</building-texture>
<building-lightmap>Textures/buildings-caribbean-lightmap.png</building-lightmap>
<building-small-min-floors>1</building-small-min-floors>
<building-small-max-floors>2</building-small-max-floors>
<building-small-max-width-m>20.0</building-small-max-width-m>
<building-small-min-depth-m>8.0</building-small-min-depth-m>
<building-small-max-depth-m>20.0</building-small-max-depth-m>
<building-medium-min-floors>1</building-medium-min-floors>
<building-medium-max-floors>3</building-medium-max-floors>
</PropertyList>

File diff suppressed because it is too large Load diff

View file

@ -1193,18 +1193,20 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
}
#### end of temporary hack for /sim/auto-coordination
if (getprop("/sim/startup/save-on-exit")) {
if (!getprop("/sim/startup/restore-defaults")) {
# load user-specific aircraft settings
data.load();
var n = props.globals.getNode("/sim/aircraft-data");
if (n != nil)
foreach (var c; n.getChildren("path"))
if (c.getType() != "NONE")
data.add(c.getValue());
} else {
}
if (!getprop("/sim/startup/save-on-exit"))
{
# prevent saving
data._save_ = func nil;
data._loop_ = func nil;
}
});

828
Nasal/canvas/api.nas Normal file
View file

@ -0,0 +1,828 @@
# Helper function to create a node with the first available index for the given
# path relative to the given node
#
var _createNodeWithIndex = func(node, path, min_index = 0)
{
# TODO do we need an upper limit? (50000 seems already seems unreachable)
for(var i = min_index; i < 50000; i += 1)
{
var p = path ~ "[" ~ i ~ "]";
if( node.getNode(p) == nil )
return node.getNode(p, 1);
}
debug.warn("Unable to get child (already 50000 exist)");
return nil;
};
# Internal helper
var _createColorNodes = func(parent, name)
{
var node = parent.getNode(name, 1);
return [ node.getNode("red", 1),
node.getNode("green", 1),
node.getNode("blue", 1),
node.getNode("alpha", 1) ];
};
var _setColorNodes = func(nodes, color)
{
if( typeof(nodes) != "vector" )
{
debug.warn("This element doesn't support setting color");
return;
}
if( size(color) == 1 )
color = color[0];
if( typeof(color) != "vector" )
return debug.warn("Wrong type for color");
if( size(color) < 3 or size(color) > 4 )
return debug.warn("Color needs 3 or 4 values (RGB or RGBA)");
for(var i = 0; i < size(color); i += 1)
nodes[i].setDoubleValue( color[i] );
if( size(color) == 3 )
# default alpha is 1
nodes[3].setDoubleValue(1);
};
var _arg2valarray = func
{
var ret = arg;
while ( typeof(ret) == "vector"
and size(ret) == 1 and typeof(ret[0]) == "vector" )
ret = ret[0];
return ret;
}
# Transform
# ==============================================================================
# A transformation matrix which is used to transform an #Element on the canvas.
# The dimensions of the matrix are 3x3 where the last row is always 0 0 1:
#
# a c e
# b d f
# 0 0 1
#
# See http://www.w3.org/TR/SVG/coords.html#TransformMatrixDefined for details.
#
var Transform = {
new: func(node, vals = nil)
{
var m = {
parents: [Transform],
_node: node,
a: node.getNode("m[0]", 1),
b: node.getNode("m[1]", 1),
c: node.getNode("m[2]", 1),
d: node.getNode("m[3]", 1),
e: node.getNode("m[4]", 1),
f: node.getNode("m[5]", 1)
};
var use_vals = typeof(vals) == 'vector' and size(vals) == 6;
# initialize to identity matrix
m.a.setDoubleValue(use_vals ? vals[0] : 1);
m.b.setDoubleValue(use_vals ? vals[1] : 0);
m.c.setDoubleValue(use_vals ? vals[2] : 0);
m.d.setDoubleValue(use_vals ? vals[3] : 1);
m.e.setDoubleValue(use_vals ? vals[4] : 0);
m.f.setDoubleValue(use_vals ? vals[5] : 0);
return m;
},
setTranslation: func
{
var trans = _arg2valarray(arg);
me.e.setDoubleValue(trans[0]);
me.f.setDoubleValue(trans[1]);
return me;
},
# Set rotation (Optionally around a specified point instead of (0,0))
#
# setRotation(rot)
# setRotation(rot, cx, cy)
#
# @note If using with rotation center different to (0,0) don't use
# #setTranslation as it would interfere with the rotation.
setRotation: func(angle)
{
var center = _arg2valarray(arg);
var s = math.sin(angle);
var c = math.cos(angle);
me.a.setDoubleValue(c);
me.b.setDoubleValue(s);
me.c.setDoubleValue(-s);
me.d.setDoubleValue(c);
if( size(center) == 2 )
{
me.e.setDoubleValue( (-center[0] * c) + (center[1] * s) + center[0] );
me.f.setDoubleValue( (-center[0] * s) - (center[1] * c) + center[1] );
}
return me;
},
# Set scale (either as parameters or array)
#
# If only one parameter is given its value is used for both x and y
# setScale(x, y)
# setScale([x, y])
setScale: func
{
var scale = _arg2valarray(arg);
me.a.setDoubleValue(scale[0]);
me.d.setDoubleValue(size(scale) >= 2 ? scale[1] : scale[0]);
return me;
},
getScale: func()
{
# TODO handle rotation
return [me.a.getValue(), me.d.getValue()];
}
};
# Element
# ==============================================================================
# Baseclass for all elements on a canvas
#
var Element = {
# Constructor
#
# @param parent Parent node (In the property tree)
# @param type Type string (Used as node name)
# @param id ID/Name (Should be unique)
new: func(parent, type, id)
{
# arg can contain the node to be used instead of creating a new one
var args = _arg2valarray(arg);
if( size(args) == 1 )
{
var node = args[0];
if( !isa(node, props.Node) )
return debug.warn("Not a props.Node!");
}
else
var node = _createNodeWithIndex(parent, type);
var m = {
parents: [Element],
_node: node,
_center: [
node.getNode("center[0]"),
node.getNode("center[1]")
]
};
if( id != nil )
m._node.getNode("id", 1).setValue(id);
return m;
},
# Destructor (has to be called manually!)
del: func()
{
me._node.remove();
},
set: func(key, value)
{
me._node.getNode(key, 1).setValue(value);
return me;
},
setBool: func(key, value)
{
me._node.getNode(key, 1).setBoolValue(value);
return me;
},
setDouble: func(key, value)
{
me._node.getNode(key, 1).setDoubleValue(value);
return me;
},
setInt: func(key, value)
{
me._node.getNode(key, 1).setIntValue(value);
return me;
},
# Trigger an update of the element
#
# Elements are automatically updated once a frame, with a delay of one frame.
# If you wan't to get an element updated in the current frame you have to use
# this method.
update: func()
{
me.setInt("update", 1);
},
# Hide/Show element
#
# @param visible Whether the element should be visible
setVisible: func(visible = 1)
{
me.setBool("visible", visible);
},
# Hide element (Shortcut for setVisible(0))
hide: func me.setVisible(0),
# Show element (Shortcut for setVisible(1))
show: func me.setVisible(1),
#
setGeoPosition: func(lat, lon)
{
me._getTf()._node.getNode("m-geo[4]", 1).setValue("N" ~ lat);
me._getTf()._node.getNode("m-geo[5]", 1).setValue("E" ~ lon);
return me;
},
# Create a new transformation matrix
#
# @param vals Default values (Vector of 6 elements)
createTransform: func(vals = nil)
{
var node = _createNodeWithIndex(me._node, "tf", 1); # tf[0] is reserved for
# setRotation
return Transform.new(node, vals);
},
# Shortcut for setting translation
setTranslation: func { me._getTf().setTranslation(arg); return me; },
# Set rotation around transformation center (see #setCenter).
#
# @note This replaces the the existing transformation. For additional scale or
# translation use additional transforms (see #createTransform).
setRotation: func(rot)
{
if( me['_tf_rot'] == nil )
# always use the first matrix slot to ensure correct rotation
# around transformation center.
me['_tf_rot'] = Transform.new(me._node.getNode("tf[0]", 1));
me._tf_rot.setRotation(rot, me.getCenter());
return me;
},
# Shortcut for setting scale
setScale: func { me._getTf().setScale(arg); return me; },
# Shortcut for getting scale
getScale: func me._getTf().getScale(),
# Set the line/text color
#
# @param color Vector of 3 or 4 values in [0, 1]
setColor: func { _setColorNodes(me.color, arg); return me; },
# Set the fill/background/boundingbox color
#
# @param color Vector of 3 or 4 values in [0, 1]
setColorFill: func { _setColorNodes(me.color_fill, arg); return me; },
#
getBoundingBox: func()
{
var bb = me._node.getNode("bounding-box");
var min_x = bb.getNode("min-x").getValue();
if( min_x != nil )
return [ min_x,
bb.getNode("min-y").getValue(),
bb.getNode("max-x").getValue(),
bb.getNode("max-y").getValue() ];
else
return [0, 0, 0, 0];
},
# Set transformation center (currently only used for rotation)
setCenter: func()
{
var center = _arg2valarray(arg);
if( size(center) != 2 )
return debug.warn("invalid arg");
if( me._center[0] == nil )
me._center[0] = me._node.getNode("center[0]", 1);
if( me._center[1] == nil )
me._center[1] = me._node.getNode("center[1]", 1);
me._center[0].setDoubleValue(center[0] or 0);
me._center[1].setDoubleValue(center[1] or 0);
return me;
},
# Get transformation center
getCenter: func()
{
var bb = me.getBoundingBox();
var center = [0, 0];
if( me._center[0] != nil )
center[0] = me._center[0].getValue() or 0;
if( me._center[1] != nil )
center[1] = me._center[1].getValue() or 0;
if( bb[0] >= bb[2] or bb[1] >= bb[3] )
return center;
return [ 0.5 * (bb[0] + bb[2]) + center[0],
0.5 * (bb[1] + bb[3]) + center[1] ];
},
# Internal Transform for convenience transform functions
_getTf: func
{
if( me['_tf'] == nil )
me['_tf'] = me.createTransform();
return me._tf;
}
};
# Group
# ==============================================================================
# Class for a group element on a canvas
#
var Group = {
new: func(parent, id, type = "group")
{
# special case: if called from #getElementById the third argument is the
# existing node so we need to rearange the variables a bit.
if( typeof(type) != "scalar" )
{
var arg = [type];
var type = "group";
}
return { parents: [Group, Element.new(parent, type, id, arg)] };
},
# Create a child of given type with specified id.
# type can be group, text
createChild: func(type, id = nil)
{
var factory = me._element_factories[type];
if( factory == nil )
{
debug.dump("canvas.Group.createChild(): unknown type (" ~ type ~ ")");
return nil;
}
return factory(me._node, id);
},
# Get first child with given id (breadth-first search)
#
# @note Use with care as it can take several miliseconds (for me eg. ~2ms).
getElementById: func(id)
{
# TODO can we improve the queue or better port this to C++ or use some kind
# of lookup hash? Searching is really slow now...
var stack = [me._node];
var index = 0;
while( index < size(stack) )
{
var node = stack[index];
index += 1;
if( node != me._node )
{
var node_id = node.getNode("id");
if( node_id != nil and node_id.getValue() == id )
return me._element_factories[ node.getName() ]
(
nil,
nil,
# use the existing node
node
);
}
foreach(var c; node.getChildren())
# element nodes have type NONE and valid element names (those in the the
# factor list)
if( c.getType() == "NONE"
and me._element_factories[ c.getName() ] != nil )
append(stack, c);
}
},
# Remove all children
removeAllChildren: func()
{
foreach(var type; keys(me._element_factories))
me._node.removeChildren(type, 0);
return me;
}
};
# Map
# ==============================================================================
# Class for a group element on a canvas with possibly geopgraphic positions
# which automatically get projected according to the specified projection.
#
var Map = {
new: func(parent, id)
{
return { parents: [Map, Group.new(parent, id, "map", arg)] };
}
# TODO
};
# Text
# ==============================================================================
# Class for a text element on a canvas
#
var Text = {
new: func(parent, id)
{
var m = {
parents: [Text, Element.new(parent, "text", id, arg)]
};
m.color = _createColorNodes(m._node, "color");
m.color_fill = _createColorNodes(m._node, "color-fill");
return m;
},
# Set the text
setText: func(text)
{
# add space because osg seems to remove last character if its a space
me.set("text", typeof(text) == 'scalar' ? text ~ ' ' : "");
},
# Set alignment
#
# @param algin String, one of:
# left-top
# left-center
# left-bottom
# center-top
# center-center
# center-bottom
# right-top
# right-center
# right-bottom
# left-baseline
# center-baseline
# right-baseline
# left-bottom-baseline
# center-bottom-baseline
# right-bottom-baseline
#
setAlignment: func(align)
{
me.set("alignment", align);
},
# Set the font size
setFontSize: func(size, aspect = 1)
{
me.setDouble("character-size", size);
me.setDouble("character-aspect-ratio", aspect);
},
# Set font (by name of font file)
setFont: func(name)
{
me.set("font", name);
},
# Enumeration of values for drawing mode:
TEXT: 1, # The text itself
BOUNDINGBOX: 2, # A bounding box (only lines)
FILLEDBOUNDINGBOX: 4, # A filled bounding box
ALIGNMENT: 8, # Draw a marker (cross) at the position of the text
# Set draw mode. Binary combination of the values above. Since I haven't found
# a bitwise or we have to use a + instead.
#
# eg. my_text.setDrawMode(Text.TEXT + Text.BOUNDINGBOX);
setDrawMode: func(mode)
{
me.setInt("draw-mode", mode);
},
# Set bounding box padding
setPadding: func(pad)
{
me.setDouble("padding", pad);
},
setMaxWidth: func(w)
{
me.setDouble("max-width", w);
}
};
# Path
# ==============================================================================
# Class for an (OpenVG) path element on a canvas
#
var Path = {
# Path segment commands (VGPathCommand)
VG_CLOSE_PATH: 0,
VG_MOVE_TO: 2,
VG_MOVE_TO_ABS: 2,
VG_MOVE_TO_REL: 3,
VG_LINE_TO: 4,
VG_LINE_TO_ABS: 4,
VG_LINE_TO_REL: 5,
VG_HLINE_TO: 6,
VG_HLINE_TO_ABS: 6,
VG_HLINE_TO_REL: 7,
VG_VLINE_TO: 8,
VG_VLINE_TO_ABS: 8,
VG_VLINE_TO_REL: 9,
VG_QUAD_TO: 10,
VG_QUAD_TO_ABS: 10,
VG_QUAD_TO_REL: 11,
VG_CUBIC_TO: 12,
VG_CUBIC_TO_ABS: 12,
VG_CUBIC_TO_REL: 13,
VG_SQUAD_TO: 14,
VG_SQUAD_TO_ABS: 14,
VG_SQUAD_TO_REL: 15,
VG_SCUBIC_TO: 16,
VG_SCUBIC_TO_ABS: 16,
VG_SCUBIC_TO_REL: 17,
VG_SCCWARC_TO: 20, # Note that CC and CCW commands are swapped. This is
VG_SCCWARC_TO_ABS:20, # needed due to the different coordinate systems used.
VG_SCCWARC_TO_REL:21, # In OpenVG values along the y-axis increase from bottom
VG_SCWARC_TO: 18, # to top, whereas in the Canvas system it is flipped.
VG_SCWARC_TO_ABS: 18,
VG_SCWARC_TO_REL: 19,
VG_LCCWARC_TO: 24,
VG_LCCWARC_TO_ABS:24,
VG_LCCWARC_TO_REL:25,
VG_LCWARC_TO: 22,
VG_LCWARC_TO_ABS: 22,
VG_LCWARC_TO_REL: 23,
# Number of coordinates per command
num_coords: [
0, 0, # VG_CLOSE_PATH
2, 2, # VG_MOVE_TO
2, 2, # VG_LINE_TO
1, 1, # VG_HLINE_TO
1, 1, # VG_VLINE_TO
4, 4, # VG_QUAD_TO
6, 6, # VG_CUBIC_TO
2, 2, # VG_SQUAD_TO
4, 4, # VG_SCUBIC_TO
5, 5, # VG_SCCWARC_TO
5, 5, # VG_SCWARC_TO
5, 5, # VG_LCCWARC_TO
5, 5 # VG_LCWARC_TO
],
#
new: func(parent, id)
{
var m = {
parents: [Path, Element.new(parent, "path", id, arg)],
_num_cmds: 0,
_num_coords: 0
};
m.color = _createColorNodes(m._node, "color");
m.color_fill = _createColorNodes(m._node, "color-fill");
return m;
},
# Remove all existing path data
reset: func
{
me._node.removeChildren('cmd', 0);
me._node.removeChildren('coord', 0);
me._node.removeChildren('coord-geo', 0);
me._num_cmds = 0;
me._num_coords = 0;
return me;
},
# Set the path data (commands and coordinates)
setData: func(cmds, coords)
{
me.reset();
me._node.setValues({cmd: cmds, coord: coords});
me._num_cmds = size(cmds);
me._num_coords = size(coords);
return me;
},
setDataGeo: func(cmds, coords)
{
me.reset();
me._node.setValues({cmd: cmds, 'coord-geo': coords});
me._num_cmds = size(cmds);
me._num_coords = size(coords);
return me;
},
# Add a path segment
addSegment: func(cmd, coords...)
{
var coords = _arg2valarray(coords);
var num_coords = me.num_coords[cmd];
if( size(coords) != num_coords )
debug.warn
(
"Invalid number of arguments (expected " ~ (num_coords + 1) ~ ")"
);
else
{
me.setInt("cmd[" ~ (me._num_cmds += 1) ~ "]", cmd);
for(var i = 0; i < num_coords; i += 1)
me.setDouble("coord[" ~ (me._num_coords += 1) ~ "]", coords[i]);
}
return me;
},
# Move path cursor
moveTo: func me.addSegment(me.VG_MOVE_TO_ABS, arg),
move: func me.addSegment(me.VG_MOVE_TO_REL, arg),
# Add a line
lineTo: func me.addSegment(me.VG_LINE_TO_ABS, arg),
line: func me.addSegment(me.VG_LINE_TO_REL, arg),
# Add a horizontal line
horizTo: func me.addSegment(me.VG_HLINE_TO_ABS, arg),
horiz: func me.addSegment(me.VG_HLINE_TO_REL, arg),
# Add a vertical line
vertTo: func me.addSegment(me.VG_VLINE_TO_ABS, arg),
vert: func me.addSegment(me.VG_VLINE_TO_REL, arg),
# Add a quadratic Bézier curve
quadTo: func me.addSegment(me.VG_QUAD_TO_ABS, arg),
quad: func me.addSegment(me.VG_QUAD_TO_REL, arg),
# Add a cubic Bézier curve
cubicTo: func me.addSegment(me.VG_CUBIC_TO_ABS, arg),
cubic: func me.addSegment(me.VG_CUBIC_TO_REL, arg),
# Add a smooth quadratic Bézier curve
quadTo: func me.addSegment(me.VG_SQUAD_TO_ABS, arg),
quad: func me.addSegment(me.VG_SQUAD_TO_REL, arg),
# Add a smooth cubic Bézier curve
cubicTo: func me.addSegment(me.VG_SCUBIC_TO_ABS, arg),
cubic: func me.addSegment(me.VG_SCUBIC_TO_REL, arg),
# Draw an elliptical arc (shorter counter-clockwise arc)
arcSmallCCWTo: func me.addSegment(me.VG_SCCWARC_TO_ABS, arg),
arcSmallCCW: func me.addSegment(me.VG_SCCWARC_TO_REL, arg),
# Draw an elliptical arc (shorter clockwise arc)
arcSmallCWTo: func me.addSegment(me.VG_SCWARC_TO_ABS, arg),
arcSmallCW: func me.addSegment(me.VG_SCWARC_TO_REL, arg),
# Draw an elliptical arc (longer counter-clockwise arc)
arcLargeCCWTo: func me.addSegment(me.VG_LCCWARC_TO_ABS, arg),
arcLargeCCW: func me.addSegment(me.VG_LCCWARC_TO_REL, arg),
# Draw an elliptical arc (shorter clockwise arc)
arcLargeCWTo: func me.addSegment(me.VG_LCWARC_TO_ABS, arg),
arcLargeCW: func me.addSegment(me.VG_LCWARC_TO_REL, arg),
# Close the path (implicit lineTo to first point of path)
close: func me.addSegment(me.VG_CLOSE_PATH),
setStrokeLineWidth: func(width)
{
me.setDouble('stroke-width', width);
},
# Set stroke linecap
#
# @param linecap String, "butt", "round" or "square"
#
# See http://www.w3.org/TR/SVG/painting.html#StrokeLinecapProperty for details
setStrokeLineCap: func(linecap)
{
me.set('stroke-linecap', linecap);
},
# Set stroke dasharray
#
# @param pattern Vector, Vector of alternating dash and gap lengths
# [on1, off1, on2, ...]
setStrokeDashArray: func(pattern)
{
me._node.removeChildren('stroke-dasharray');
if( typeof(pattern) == 'vector' )
me._node.setValues({'stroke-dasharray': pattern});
else
debug.warn("setStrokeDashArray: vector expected!");
return me;
},
# Set the fill color and enable filling this path
#
# @param color Vector of 3 or 4 values in [0, 1]
setColorFill: func { _setColorNodes(me.color_fill, arg); me.setFill(1); },
# Enable/disable filling this path
setFill: func(fill)
{
me.setBool("fill", fill);
}
};
# Element factories used by #Group elements to create children
Group._element_factories = {
"group": Group.new,
"map": Map.new,
"text": Text.new,
"path": Path.new
};
# Canvas
# ==============================================================================
# Class for a canvas
#
var Canvas = {
# Place this canvas somewhere onto the object. Pass criterions for placement
# as a hash, eg:
#
# my_canvas.addPlacement({
# "texture": "EICAS.png",
# "node": "PFD-Screen",
# "parent": "Some parent name"
# });
#
# Note that we can choose whichever of the three filter criterions we use for
# matching the target object for our placement. If none of the three fields is
# given every texture of the model will be replaced.
addPlacement: func(vals)
{
var placement = _createNodeWithIndex(me.texture, "placement");
placement.setValues(vals);
return placement;
},
# Create a new group with the given name
#
# @param id Optional id/name for the group
createGroup: func(id = nil)
{
return Group.new(me.texture, id);
},
# Set the background color
#
# @param color Vector of 3 or 4 values in [0, 1]
setColorBackground: func { _setColorNodes(me.color, arg); return me; }
};
# Create a new canvas. Pass parameters as hash, eg:
#
# var my_canvas = canvas.new({
# "name": "PFD-Test",
# "size": [512, 512],
# "view": [768, 1024],
# "mipmapping": 1
# });
var new = func(vals)
{
var m = { parents: [Canvas] };
m.texture = _createNodeWithIndex
(
props.globals.getNode("canvas", 1),
"texture"
);
m.color = _createColorNodes(m.texture, "color-background");
m.texture.setValues(vals);
return m;
};
# Get the first existing canvas with the given name
#
# @param name Name of the canvas
# @return #Canvas, if canvas with #name exists
# nil, otherwise
var get = func(name)
{
var node_canvas = nil;
if( isa(name, props.Node) )
node_canvas = name;
else if( typeof(name) == 'scalar' )
{
var canvas_root = props.globals.getNode("canvas");
if( canvas_root == nil )
return nil;
foreach(var c; canvas_root.getChildren("texture"))
{
if( c.getValue("name") == name )
node_canvas = c;
}
}
if( node_canvas == nil )
{
debug.warn("Canvas not found: " ~ name);
return nil;
}
return {
parents: [Canvas],
texture: node_canvas,
color: _createColorNodes(node_canvas, "color-background")
};
};
# ------------------------------------------------------------------------------
# Show warnings if API used with too old version of FlightGear without Canvas
# support (Wrapped in anonymous function do not polute the canvas namespace)
(func {
var version_str = getprop("/sim/version/flightgear");
if( string.scanf(version_str, "%u.%u.%u", var fg_version = []) < 1 )
debug.warn("Canvas: Error parsing flightgear version (" ~ version_str ~ ")");
else
{
if( fg_version[0] < 2
or (fg_version[0] == 2 and fg_version[1] < 8) )
{
debug.warn("Canvas: FlightGear version too old (" ~ version_str ~ ")");
gui.popupTip
(
"FlightGear v2.8.0 or newer needed for Canvas support!",
600,
{button: {legend: "Ok", binding: {command: "dialog-close"}}}
);
}
} })();

439
Nasal/canvas/svg.nas Normal file
View file

@ -0,0 +1,439 @@
# Parse an xml file into a canvas group element
#
# @param group The canvas.Group instance to append the parsed elements to
# @param path The path of the svg file (absolute or relative to FG_ROOT)
# @param options Optional hash of options
var parsesvg = func(group, path, options = nil)
{
if( !isa(group, Group) )
die("Invalid argument group (type != Group)");
if( options == nil )
options = {};
if( typeof(options) != "hash" )
die("Options need to be of type hash!");
var custom_font_mapper = options['font-mapper'];
var font_mapper = func(family, weight)
{
if( typeof(custom_font_mapper) == 'func' )
{
var font = custom_font_mapper(family, weight);
if( font != nil )
return font;
}
return "LiberationFonts/LiberationMono-Bold.ttf";
};
var level = 0;
var skip = 0;
var stack = [group];
var close_stack = []; # helper for check tag closing
# lookup table for element ids (for <use> element)
var id_dict = {};
# ----------------------------------------------------------------------------
# Create a new child an push it onto the stack
var pushElement = func(type, id = nil)
{
append(stack, stack[-1].createChild(type, id));
append(close_stack, level);
if( typeof(id) == 'scalar' and size(id) )
id_dict[ id ] = stack[-1];
};
# ----------------------------------------------------------------------------
# Parse a transformation (matrix)
# http://www.w3.org/TR/SVG/coords.html#TransformAttribute
var parseTransform = func(tf)
{
if( tf == nil )
return;
tf = std.string.new(tf);
var end = 0;
while(1)
{
var start_type = tf.find_first_not_of("\t\n ", end);
if( start_type < 0 )
break;
var end_type = tf.find_first_of("(\t\n ", start_type + 1);
if( end_type < 0 )
break;
var start_args = tf.find('(', end_type);
if( start_args < 0 )
break;
var values = [];
end = start_args;
while(1)
{
var start_num = tf.find_first_not_of(",\t\n ", end + 1);
if( start_num < 0 )
break;
if( tf[start_num] == ')' )
break;
end = tf.find_first_of("),\t\n ", start_num + 1);
if( end < 0 )
break;
append(values, tf.substr(start_num, end - start_num));
}
var type = tf.substr(start_type, end_type - start_type);
if( type == "translate" )
# translate(<tx> [<ty>]), which specifies a translation by tx and ty. If
# <ty> is not provided, it is assumed to be zero.
stack[-1].createTransform().setTranslation
(
values[0],
size(values) > 1 ? values[1] : 0,
);
else if( type == "matrix" )
{
if( size(values) == 6 )
stack[-1].createTransform(values);
else
debug.dump('invalid transform', type, values);
}
else
debug.dump(['unknown transform', type, values]);
}
};
# ----------------------------------------------------------------------------
# Parse a path
# http://www.w3.org/TR/SVG/paths.html#PathData
# map svg commands OpenVG commands
var cmd_map = {
z: Path.VG_CLOSE_PATH,
m: Path.VG_MOVE_TO,
l: Path.VG_LINE_TO,
h: Path.VG_HLINE_TO,
v: Path.VG_VLINE_TO,
q: Path.VG_QUAD_TO,
c: Path.VG_CUBIC_TO,
t: Path.VG_SQUAD_TO,
s: Path.VG_SCUBIC_TO
};
var parsePath = func(d)
{
if( d == nil )
return;
var path_data = std.string.new(d);
var pos = 0;
var cmds = [];
var coords = [];
while(1)
{
# skip trailing spaces
pos = path_data.find_first_not_of("\t\n ", pos);
if( pos < 0 )
break;
# get command
var cmd = path_data.substr(pos, 1);
pos += 1;
# and get all following arguments
var args = [];
while(1)
{
pos = path_data.find_first_not_of(",\t\n ", pos);
if( pos < 0 )
break;
var start_num = pos;
pos = path_data.find_first_not_of("e-.0123456789", start_num);
if( start_num == pos )
break;
append(args, path_data.substr(start_num, pos > 0 ? pos - start_num : nil));
}
# now execute the command
var rel = string.islower(cmd[0]);
var cmd = string.lc(cmd);
if( cmd == 'a' )
{
for(var i = 0; i + 7 <= size(args); i += 7)
{
# SVG: (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+
# OpenVG: rh,rv,rot,x0,y0
if( args[i + 3] )
var cmd_vg = args[i + 4] ? Path.VG_LCCWARC_TO : Path.VG_LCWARC_TO;
else
var cmd_vg = args[i + 4] ? Path.VG_SCCWARC_TO : Path.VG_SCWARC_TO;
append(cmds, rel ? cmd_vg + 1: cmd_vg);
append(coords, args[i],
args[i + 1],
args[i + 2],
args[i + 5],
args[i + 6] );
}
if( math.mod(size(args), 7) > 0 )
debug.dump('too much coords for cmd', cmd, args);
}
else
{
var cmd_vg = cmd_map[cmd];
if( cmd_vg == nil )
{
debug.dump('command not found', cmd, args);
continue;
}
var num_coords = Path.num_coords[int(cmd_vg)];
if( num_coords == 0 )
append(cmds, cmd_vg);
else
{
for(var i = 0; i + num_coords <= size(args); i += num_coords)
{
append(cmds, rel ? cmd_vg + 1: cmd_vg);
for(var j = i; j < i + num_coords; j += 1)
append(coords, args[j]);
# If a moveto is followed by multiple pairs of coordinates, the
# subsequent pairs are treated as implicit lineto commands.
if( cmd == 'm' )
cmd_vg = cmd_map['l'];
}
if( math.mod(size(args), num_coords) > 0 )
debug.warn('too much coords for cmd: ' ~ cmd);
}
}
}
stack[-1].setData(cmds, coords);
};
# ----------------------------------------------------------------------------
# Parse a css style attribute
var parseStyle = func(style)
{
if( style == nil )
return {};
var styles = {};
foreach(var part; split(';', style))
{
if( !size(part = string.trim(part)) )
continue;
if( size(part = split(':',part)) != 2 )
continue;
var key = string.trim(part[0]);
if( !size(key) )
continue;
var value = string.trim(part[1]);
if( !size(value) )
continue;
styles[key] = value;
}
return styles;
}
# ----------------------------------------------------------------------------
# Parse a css color
var parseColor = func(s)
{
var color = [0, 0, 0];
if( s == nil )
return color;
if( size(s) == 7 and substr(s, 0, 1) == '#' )
{
return [ std.stoul(substr(s, 1, 2), 16) / 255,
std.stoul(substr(s, 3, 2), 16) / 255,
std.stoul(substr(s, 5, 2), 16) / 255 ];
}
return color;
};
# ----------------------------------------------------------------------------
# XML parsers element open callback
var start = func(name, attr)
{
level += 1;
if( skip )
return;
if( level == 1 )
{
if( name != 'svg' )
die("Not an svg file (root=" ~ name ~ ")");
else
return;
}
var style = parseStyle(attr['style']);
if( style['display'] == 'none' )
{
skip = level - 1;
return;
}
else if( name == "g" )
{
pushElement('group', attr['id']);
}
else if( name == "text" )
{
pushElement('text', attr['id']);
stack[-1].setTranslation(attr['x'], attr['y']);
# http://www.w3.org/TR/SVG/text.html#TextAnchorProperty
var h_align = style["text-anchor"];
if( h_align == "end" )
h_align = "right";
else if( h_align == "middle" )
h_align = "center";
else # "start"
h_align = "left";
stack[-1].setAlignment(h_align ~ "-baseline");
# TODO vertical align
stack[-1].setColor(parseColor(style['fill']));
stack[-1].setFont
(
font_mapper(style["font-family"], style["font-weight"])
);
var font_size = style["font-size"];
if( font_size != nil )
# eg. font-size: 123px
stack[-1].setFontSize(substr(font_size, 0, size(font_size) - 2));
}
else if( name == "path" or name == "rect" )
{
pushElement('path', attr['id']);
var d = attr['d'];
if( name == "rect" )
{
var width = attr['width'];
var height = attr['height'];
var x = attr['x'];
var y = attr['y'];
d = sprintf("M%f,%f v%f h%f v%fz", x, y, height, width, -height);
}
parsePath(d);
var w = style['stroke-width'];
stack[-1].setStrokeLineWidth( w != nil ? w : 1 );
stack[-1].setColor(parseColor(style['stroke']));
var linecap = style['stroke-linecap'];
if( linecap != nil )
stack[-1].setStrokeLineCap(style['stroke-linecap']);
var fill = style['fill'];
if( fill != nil and fill != "none" )
stack[-1].setColorFill(parseColor(fill));
# http://www.w3.org/TR/SVG/painting.html#StrokeDasharrayProperty
var dash = style['stroke-dasharray'];
if( dash and size(dash) > 3 )
# at least 2 comma separated values...
stack[-1].setStrokeDashArray(split(',', dash));
var cx = attr['inkscape:transform-center-x'];
var cy = attr['inkscape:transform-center-y'];
if( cx != nil or cy != nil )
stack[-1].setCenter(cx or 0, -(cy or 0));
}
else if( name == "tspan" )
{
return;
}
else if( name == "use" )
{
var ref = attr["xlink:href"];
if( ref == nil or size(ref) < 2 or ref[0] != `#` )
return debug.dump("Invalid or missing href", ref);
var el_src = id_dict[ substr(ref, 1) ];
if( el_src == nil )
return print("parsesvg: Reference to unknown element (" ~ ref ~ ")");
# Create new element and copy sub branch from source node
pushElement(el_src._node.getName(), attr['id']);
props.copy(el_src._node, stack[-1]._node);
# copying also overrides the id so we need to set it again
stack[-1]._node.getNode("id").setValue(attr['id']);
}
else
{
print("parsesvg: skipping unknown element '" ~ name ~ "'");
skip = level;
return;
}
parseTransform(attr['transform']);
};
# XML parsers element close callback
var end = func(name)
{
level -= 1;
if( skip )
{
if( level <= skip )
skip = 0;
return;
}
if( size(close_stack) and (level + 1) == close_stack[-1] )
{
pop(stack);
pop(close_stack);
}
};
# XML parsers element data callback
var data = func(data)
{
if( skip )
return;
if( size(data) and isa(stack[-1], Text) )
stack[-1].setText(data);
};
if( path[0] != '/' )
path = getprop("/sim/fg-root") ~ "/" ~ path;
call(func parsexml(path, start, end, data), nil, var err = []);
if( size(err) )
{
debug.dump(err);
return 0;
}
return 1;
}

View file

@ -274,17 +274,11 @@ var adjEngControl = func {
# arg[0] is the throttle increment
# arg[1] is the auto-throttle target speed increment
var incThrottle = func {
var auto = props.globals.getNode("/autopilot/locks/speed", 1);
var passive = props.globals.getNode("/autopilot/locks/passive-mode", 1);
if (!auto.getValue() or passive.getValue()) {
foreach(var e; engines) {
if(e.selected.getValue()) {
var node = e.controls.getNode("throttle", 1);
var val = node.getValue() + arg[0];
node.setValue(val < -1.0 ? -1.0 : val > 1.0 ? 1.0 : val);
}
}
} else {
var passive = getprop("/autopilot/locks/passive-mode");
var locked = getprop("/autopilot/locks/speed");
# Note: passive/locked may be nil on aircraft without A/P
if ((passive == 0) and (locked))
{
var node = props.globals.getNode("/autopilot/settings/target-speed-kt", 1);
if (node.getValue() == nil) {
node.setValue(0.0);
@ -294,28 +288,29 @@ var incThrottle = func {
node.setValue(0.0);
}
}
else
{
foreach(var e; engines)
{
if(e.selected.getValue())
{
var node = e.controls.getNode("throttle", 1);
var val = node.getValue() + arg[0];
node.setValue(val < -1.0 ? -1.0 : val > 1.0 ? 1.0 : val);
}
}
}
}
##
# arg[0] is the aileron increment
# arg[1] is the autopilot target heading increment
var incAileron = func {
var auto = props.globals.getNode("/autopilot/locks/heading", 1);
var passive = props.globals.getNode("/autopilot/locks/passive-mode", 1);
if (!auto.getValue() or passive.getValue()){
var aileron = props.globals.getNode("/controls/flight/aileron");
if (aileron.getValue() == nil) {
aileron.setValue(0.0);
}
aileron.setValue(aileron.getValue() + arg[0]);
if (aileron.getValue() < -1.0) {
aileron.setValue(-1.0);
}
if (aileron.getValue() > 1.0) {
aileron.setValue(1.0);
}
}
if (auto.getValue() == "dg-heading-hold") {
var passive = getprop("/autopilot/locks/passive-mode");
var locked = getprop("/autopilot/locks/heading");
# Note: passive/locked may be nil on aircraft without A/P
if ((passive == 0) and (locked == "dg-heading-hold"))
{
var node = props.globals.getNode("/autopilot/settings/heading-bug-deg", 1);
if (node.getValue() == nil) {
node.setValue(0.0);
@ -328,7 +323,8 @@ var incAileron = func {
node.setValue(node.getValue() - 360.0);
}
}
if (auto.getValue() == "true-heading-hold") {
else if ((passive == 0) and (locked == "true-heading-hold"))
{
var node = props.globals.getNode("/autopilot/settings/true-heading-deg", 1);
if (node.getValue() == nil) {
node.setValue(0.0);
@ -341,15 +337,42 @@ var incAileron = func {
node.setValue(node.getValue() - 360.0);
}
}
else
{
var aileron = props.globals.getNode("/controls/flight/aileron");
if (aileron.getValue() == nil) {
aileron.setValue(0.0);
}
aileron.setValue(aileron.getValue() + arg[0]);
if (aileron.getValue() < -1.0) {
aileron.setValue(-1.0);
}
if (aileron.getValue() > 1.0) {
aileron.setValue(1.0);
}
}
}
##
# arg[0] is the elevator increment
# arg[1] is the autopilot target altitude increment
var incElevator = func {
var auto = props.globals.getNode("/autopilot/locks/altitude", 1);
var passive = props.globals.getNode("/autopilot/locks/passive-mode", 1);
if (!auto.getValue() or auto.getValue() == 0 or passive.getValue()) {
var passive = getprop("/autopilot/locks/passive-mode");
var locked = getprop("/autopilot/locks/altitude");
# Note: passive/locked may be nil on aircraft without A/P
if ((passive == 0) and (locked =="altitude-hold"))
{
var node = props.globals.getNode("/autopilot/settings/target-altitude-ft", 1);
if (node.getValue() == nil) {
node.setValue(0.0);
}
node.setValue(node.getValue() + arg[1]);
if (node.getValue() < 0.0) {
node.setValue(0.0);
}
}
else
{
var elevator = props.globals.getNode("/controls/flight/elevator");
if (elevator.getValue() == nil) {
elevator.setValue(0.0);
@ -361,15 +384,6 @@ var incElevator = func {
if (elevator.getValue() > 1.0) {
elevator.setValue(1.0);
}
} elsif (auto.getValue() == "altitude-hold") {
var node = props.globals.getNode("/autopilot/settings/target-altitude-ft", 1);
if (node.getValue() == nil) {
node.setValue(0.0);
}
node.setValue(node.getValue() + arg[1]);
if (node.getValue() < 0.0) {
node.setValue(0.0);
}
}
}

View file

@ -856,47 +856,55 @@ var showWeightDialog = func {
var contentArea = dialog[name].addChild("group");
contentArea.set("layout", "hbox");
contentArea.set("default-padding", 10);
dialog[name].addChild("empty");
var limits = dialog[name].addChild("group");
limits.set("layout", "table");
limits.set("halign", "center");
var row = 0;
var massLimits = props.globals.getNode("/limits/mass-and-balance");
var tablerow = func(name, node, format ) {
var n = isa( node, props.Node ) ? node : massLimits.getNode( node );
if( n == nil ) return;
var label = limits.addChild("text");
label.set("row", row);
label.set("col", 0);
label.set("halign", "right");
label.set("label", name ~ ":");
var val = limits.addChild("text");
val.set("row", row);
val.set("col", 1);
val.set("halign", "left");
val.set("label", "0123457890123456789");
val.set("format", format);
val.set("property", n.getPath());
val.set("live", 1);
row += 1;
}
var grossWgt = props.globals.getNode(fdmdata.grosswgt);
if(grossWgt != nil) {
var gwg = dialog[name].addChild("group");
gwg.set("layout", "hbox");
gwg.addChild("empty").set("stretch", 1);
gwg.addChild("text").set("label", "Gross Weight:");
var txt = gwg.addChild("text");
txt.set("label", "0123456789");
txt.set("format", "%.0f lb");
txt.set("property", fdmdata.grosswgt);
txt.set("live", 1);
gwg.addChild("empty").set("stretch", 1);
tablerow("Gross Weight", grossWgt, "%.0f lb");
}
var massLimits = props.globals.getNode("/limits/mass-and-balance");
if(massLimits != nil ) {
tablerow("Max. Ramp Weight", "maximum-ramp-mass-lbs", "%.0f lb" );
tablerow("Max. Takeoff Weight", "maximum-takeoff-mass-lbs", "%.0f lb" );
tablerow("Max. Landing Weight", "maximum-landing-mass-lbs", "%.0f lb" );
tablerow("Max. Zero Fuel Weight", "maximum-zero-fuel-mass-lbs", "%.0f lb" );
}
var weightitem = func( group, name, node, format ) {
group.set("layout", "hbox");
var n = isa( node, props.Node ) ? node : massLimits.getNode( node );
if( n == nil ) return;
group.addChild("empty").set("stretch", 1);
group.addChild("text").set("label", name ~ ":" );
var txt = group.addChild("text");
txt.set("label", "");
txt.set("format", format );
txt.set("property", n.getPath() );
txt.set("live", 1);
group.addChild("empty").set("stretch", 1);
}
weightitem( dialog[name].addChild("group"), "Max. Ramp Weight", "maximum-ramp-mass-lbs", "%.0f lb" );
weightitem( dialog[name].addChild("group"), "Max. Takeoff Weight", "maximum-takeoff-mass-lbs", "%.0f lb" );
weightitem( dialog[name].addChild("group"), "Max. Landing Weight", "maximum-landing-mass-lbs", "%.0f lb" );
weightitem( dialog[name].addChild("group"), "Max. Zero Fuel Weight", "maximum-zero-fuel-mass-lbs", "%.0f lb" );
if( fdmdata.cg != nil ) {
var n = massLimits.getNode("cg/dimension");
weightitem( dialog[name].addChild("group"), "CG", fdmdata.cg, "%.1f " ~ (n == nil ? "in" : n.getValue()));
}
weightitem = nil;
if( fdmdata.cg != nil ) {
var n = props.globals.getNode("/limits/mass-and-balance/cg/dimension");
tablerow("Center of Gravity", fdmdata.cg, "%.1f " ~ (n == nil ? "in" : n.getValue()));
}
dialog[name].addChild("hrule");
@ -934,6 +942,7 @@ var showWeightDialog = func {
tcell(fuelTable, "text", 0, 0).set("label", "Tank");
tcell(fuelTable, "text", 0, 3).set("label", "Pounds");
tcell(fuelTable, "text", 0, 4).set("label", "Gallons");
tcell(fuelTable, "text", 0, 5).set("label", "Fraction");
var tanks = props.globals.getNode("/consumables/fuel").getChildren("tank");
for(var i=0; i<size(tanks); i+=1) {
@ -951,6 +960,9 @@ var showWeightDialog = func {
if(cap == nil ) { continue; }
cap = cap.getValue();
# Ignore tanks of capacity 0
if (cap == 0) { continue; }
var title = tcell(fuelTable, "text", i+1, 0);
title.set("label", tname);
title.set("halign", "right");
@ -974,15 +986,52 @@ var showWeightDialog = func {
lbs.set("property", tankprop ~ "/level-lbs");
lbs.set("label", "0123456");
lbs.set("format", cap < 1 ? "%.3f" : cap < 10 ? "%.2f" : "%.1f" );
lbs.set("halign", "right");
lbs.set("live", 1);
var gals = tcell(fuelTable, "text", i+1, 4);
gals.set("property", tankprop ~ "/level-gal_us");
gals.set("label", "0123456");
gals.set("format", cap < 1 ? "%.3f" : cap < 10 ? "%.2f" : "%.1f" );
gals.set("halign", "right");
gals.set("live", 1);
var per = tcell(fuelTable, "text", i+1, 5);
per.set("property", tankprop ~ "/level-norm");
per.set("label", "0123456");
per.set("format", "%.2f");
per.set("halign", "right");
per.set("live", 1);
}
varbar = tcell(fuelTable, "hrule", size(tanks)+1, 0);
varbar.set("colspan", 6);
var total_label = tcell(fuelTable, "text", size(tanks)+2, 2);
total_label.set("label", "Total:");
total_label.set("halign", "right");
var lbs = tcell(fuelTable, "text", size(tanks)+2, 3);
lbs.set("property", "/consumables/fuel/total-fuel-lbs");
lbs.set("label", "0123456");
lbs.set("format", "%.1f" );
lbs.set("halign", "right");
lbs.set("live", 1);
var gals = tcell(fuelTable, "text",size(tanks) +2, 4);
gals.set("property", "/consumables/fuel/total-fuel-gal_us");
gals.set("label", "0123456");
gals.set("format", "%.1f" );
gals.set("halign", "right");
gals.set("live", 1);
var per = tcell(fuelTable, "text", size(tanks)+2, 5);
per.set("property", "/consumables/fuel/total-fuel-norm");
per.set("label", "0123456");
per.set("format", "%.2f");
per.set("halign", "right");
per.set("live", 1);
var weightArea = contentArea.addChild("group");
weightArea.set("layout", "vbox");
weightArea.addChild("text").set("label", "Payload");
@ -1392,4 +1441,4 @@ var update_shader_settings = func() {
};
_setlistener("/sim/rendering/shaders/custom-settings", func { update_shader_settings() } );
_setlistener("/sim/rendering/shaders/quality-level-internal", func { update_shader_settings() } );
update_shader_settings();
update_shader_settings();

View file

@ -208,9 +208,9 @@ var remove = func(vector, item)
# checks if an item is in a vector
var isin = func(vector, v)
{
for (var i = 0; i < size(vector); i += 1)
foreach (var item; vector)
{
if (vector[i] == v) return 1;
if (item == v) return 1;
}
return 0;
};
@ -665,10 +665,9 @@ var toggle_jetway_from_coord = func(door, hood, heading, lat, lon = nil)
var closest_jetway = nil;
var closest_jetway_dist = nil;
var closest_jetway_coord = nil;
for (var i = 0; i < size(jetways); i += 1)
foreach (var jetway; jetways)
{
if (jetways[i] == nil) continue;
var jetway = jetways[i];
if (jetway == nil) continue;
var jetway_coord = geo.Coord.new();
jetway_coord.set_latlon(jetway.lat, jetway.lon);
@ -718,6 +717,7 @@ var load_airport_jetways = func(airport)
if (isin(loaded_airports, airport)) return;
var tree = props.globals.getNode("/sim/paths/use-custom-scenery-data", 1).getBoolValue() ? io.read_airport_properties(airport, "jetways") : (io.stat(root ~ "/AI/Airports/" ~ airport ~ "/jetways.xml") == nil ? nil : io.read_properties(root ~ "/AI/Airports/" ~ airport ~ "/jetways.xml"));
if (tree == nil) return;
append(loaded_airports, airport);
print_debug("Loading jetways for airport " ~ airport);
var nodes = tree.getChildren("jetway");
@ -726,11 +726,7 @@ var load_airport_jetways = func(airport)
var loop = func(id)
{
if (id != loadids[airport]) return;
if (i >= size(nodes))
{
append(loaded_airports, airport);
return;
}
if (i >= size(nodes)) return;
var jetway = nodes[i];
var model = jetway.getNode("model", 1).getValue() or return;
var gate = jetway.getNode("gate", 1).getValue() or "";
@ -783,18 +779,17 @@ var update_jetways = func(loopid)
# if jetways disabled, unload jetways and terminate
if (!on_switch.getBoolValue())
{
for (var i = 0; i < size(jetways); i += 1)
foreach (var jetway; jetways)
{
if (jetways[i] != nil) jetways[i].remove();
if (jetway != nil) jetway.remove();
}
setsize(jetways, 0);
setsize(loaded_airports, 0);
return;
}
# interpolate jetway values
for (var i = 0; i < size(jetways); i += 1)
foreach (var jetway; jetways)
{
var jetway = jetways[i];
if (jetway == nil) continue;
if (jetway._active or jetway._edit)
{

74
Nasal/std/string.nas Normal file
View file

@ -0,0 +1,74 @@
# ------------------------------------------------------------------------------
# A C++ like string class (http://en.cppreference.com/w/cpp/string/basic_string)
# ------------------------------------------------------------------------------
# capture global string
var _string = string;
var string = {
# public:
new: func(str)
{
return { parents: [string], _str: str };
},
find_first_of: func(s, pos = 0)
{
return me._find(pos, size(me._str), s, 1);
},
find: func(s, pos = 0)
{
return me.find_first_of(s, pos);
},
find_first_not_of: func(s, pos = 0)
{
return me._find(pos, size(me._str), s, 0);
},
substr: func(pos, len = nil)
{
return substr(me._str, pos, len);
},
size: func()
{
return size(me._str);
},
# private:
_eq: func(pos, s)
{
for(var i = 0; i < size(s); i += 1)
if( me._str[pos] == s[i] )
return 1;
return 0;
},
_find: func(first, last, s, eq)
{
var sign = first <= last ? 1 : -1;
for(var i = first; sign * i < last; i += sign)
if( me._eq(i, s) == eq )
return i;
return -1;
}
};
# converts a string to an unsigned integer
var stoul = func(str, base = 10)
{
var val = 0;
for(var pos = 0; pos < size(str); pos += 1)
{
var c = str[pos];
if( _string.isdigit(c) )
var digval = c - `0`;
else if( _string.isalpha(c) )
var digval = _string.toupper(c) - `A` + 10;
else
break;
if( digval >= base )
break;
val = val * base + digval;
}
return val;
};

View file

@ -2,8 +2,8 @@
# ---------------------------------------------------------------------------------------
var step_interval = 0.0; # time between tutorial steps (default is set below)
var exit_interval = 0.0; # time between fulfillment of a step and the start of the next step (default is set below)
var step_interval = 0; # time between tutorial steps (default is set below)
var exit_interval = 0; # time between fulfillment of a step and the start of the next step (default is set below)
var loop_id = 0;
var tutorialN = nil;
@ -67,8 +67,8 @@ var startTutorial = func {
last_step_time = time_elapsedN.getValue();
steps = tutorialN.getChildren("step");
step_interval = read_double(tutorialN, "step-time", 5.0); # time between tutorial steps
exit_interval = read_double(tutorialN, "exit-time", 1.0); # time between fulfillment of steps
step_interval = read_int(tutorialN, "step-time", 5); # time between tutorial steps
exit_interval = read_int(tutorialN, "exit-time", 1); # time between fulfillment of steps
run_nasal(tutorialN);
set_models(tutorialN.getNode("models"));
@ -133,9 +133,12 @@ var stopTutorial = func {
# - Otherwise display the instructions for the step.
#
var step_tutorial = func(id) {
# Check to ensure that this is the currently running tutorial.
id == loop_id or return;
var continue_after = func(n, dflt) {
settimer(func { step_tutorial(id) }, read_double(n, "wait", dflt));
var continue_after = func(n, w) {
settimer(func { step_tutorial(id) }, w);
}
# <end>
@ -159,7 +162,10 @@ var step_tutorial = func(id) {
step_countN.setIntValue(step_iter_count = 0);
do_group(step, "Tutorial step " ~ current_step);
return continue_after(step, step_interval);
# A <wait> tag affects only the initial entry to the step
var w = read_int(step, "wait", step_interval);
return continue_after(step, w);
}
step_countN.setIntValue(step_iter_count += 1);
@ -221,12 +227,11 @@ var do_group = func(node, default_msg = nil) {
run_nasal(node);
}
var read_double = func(node, child, default) {
var read_int = func(node, child, default) {
var c = node.getNode(child);
if (c == nil)
return default;
c = c.getValue();
c = int(c.getValue());
return c != nil ? c : default;
}

View file

@ -15,11 +15,13 @@ void main() {
// Position and scaling
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;
float sr = sin(gl_FogCoord);
float cr = cos(gl_FogCoord);
float sr = sin(gl_FogCoord + gl_Color.x);
float cr = cos(gl_FogCoord + gl_Color.x);
// Rotation of the generic quad to specific one for the tree.
position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr)));
// Move to correct location (stored in gl_Color)
position = position + gl_Color.xyz;
gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0);

View file

@ -56,8 +56,8 @@ void relWind(out float rel_wind_speed_kts, out float rel_wind_from_rad)
float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts;
//combine relative speeds north and east to get relative windspeed in kts
rel_wind_speed_kts = sqrt(pow(abs(rel_wind_speed_from_east_kts), 2)
+ pow(abs(rel_wind_speed_from_north_kts), 2));
rel_wind_speed_kts = sqrt(pow(abs(rel_wind_speed_from_east_kts), 2.0)
+ pow(abs(rel_wind_speed_from_north_kts), 2.0));
//calculate the relative wind direction
float rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts));
@ -79,8 +79,8 @@ void main()
{
mat4 RotationMatrix;
float relWindspd=0;
float relWinddir=0;
float relWindspd=0.0;
float relWinddir=0.0;
// compute relative wind speed and direction
relWind (relWindspd, relWinddir);
@ -93,9 +93,9 @@ void main()
vec4 pos = gl_Vertex;
vec4 oldpos = gl_Vertex;
float freq = (10 * relWindspd) + 10;
float freq = (10.0 * relWindspd) + 10.0;
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 += sin((pos.z * 5.0 + tsec * freq/2.0)/5.0) * 0.125 ;
pos.y *= pow(pos.x - Offset, 2.0) * AmpFactor;

View file

@ -19,37 +19,51 @@ vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex );
vec3 normal_decode(vec2 enc);
void main() {
vec3 ray = ecPosition.xyz / ecPosition.w;
vec3 ecPos3 = ray;
vec3 ray = ecPosition.xyz / ecPosition.w;
vec3 ecPos3 = ray;
vec3 viewDir = normalize(ray);
vec2 coords = gl_FragCoord.xy / fg_BufferSize;
vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg);
vec4 spec_emis = texture2D( spec_emis_tex, coords );
vec2 coords = gl_FragCoord.xy / fg_BufferSize;
vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg);
vec4 spec_emis = texture2D( spec_emis_tex, coords );
vec3 pos = position(viewDir, coords, depth_tex);
if ( pos.z < ecPos3.z ) // Negative direction in z
discard; // Don't light surface outside the light volume
vec3 VP = LightPosition.xyz - pos;
if ( dot( VP, VP ) > ( Far * Far ) )
discard; // Don't light surface outside the light volume
if ( pos.z < ecPos3.z ) // Negative direction in z
discard; // Don't light surface outside the light volume
float d = length( VP );
VP /= d;
vec3 VP = LightPosition.xyz - pos;
if ( dot( VP, VP ) > ( Far * Far ) )
discard; // Don't light surface outside the light volume
vec3 halfVector = normalize(VP - viewDir);
float d = length( VP );
VP /= d;
vec3 halfVector = normalize(VP - viewDir);
float att = 1.0 / (Attenuation.x + Attenuation.y * d + Attenuation.z *d*d);
float nDotVP = max(0.0, dot(normal, VP));
float nDotHV = max(0.0, dot(normal, halfVector));
vec4 color = texture2D( color_tex, coords );
vec4 Iamb = Ambient * color * att;
vec4 Idiff = Diffuse * color * att * nDotVP;
vec3 Ispec = pow( nDotHV, spec_emis.y ) * spec_emis.x * att * Specular.rgb;
gl_FragColor = vec4(Iamb.rgb + Idiff.rgb + Ispec, 1.0);
float cosAngIncidence = clamp(dot(normal, VP), 0.0, 1.0);
float nDotVP = max(0.0, dot(normal, VP));
float nDotHV = max(0.0, dot(normal, halfVector));
vec4 color_material = texture2D( color_tex, coords );
vec3 color = color_material.rgb;
vec3 Iamb = Ambient.rgb * color * att;
vec3 Idiff = Diffuse.rgb * color * att * nDotVP;
float matID = color_material.a * 255.0;
float spec_intensity = spec_emis.x;
float spec_att = att;
if (matID == 254.0) { // 254: water, 255: Ubershader
spec_intensity = 1.0; // spec_color shouldn't depend on cloud cover when rendering spot light
spec_att = min(10.0 * att, 1.0); // specular attenuation reduced on water
}
vec3 Ispec = vec3(0.0);
if (cosAngIncidence > 0.0)
Ispec = pow( nDotHV, spec_emis.y * 128.0 ) * spec_intensity * spec_att * Specular.rgb;
gl_FragColor = vec4(Iamb + Idiff + Ispec, 1.0);
}

View file

@ -23,45 +23,62 @@ vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex );
vec3 normal_decode(vec2 enc);
void main() {
vec3 ray = ecPosition.xyz / ecPosition.w;
vec3 ecPos3 = ray;
vec3 ray = ecPosition.xyz / ecPosition.w;
vec3 ecPos3 = ray;
vec3 viewDir = normalize(ray);
vec2 coords = gl_FragCoord.xy / fg_BufferSize;
vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg);
vec4 spec_emis = texture2D( spec_emis_tex, coords );
vec2 coords = gl_FragCoord.xy / fg_BufferSize;
vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg);
vec4 spec_emis = texture2D( spec_emis_tex, coords );
vec3 pos = position(viewDir, coords, depth_tex);
if ( pos.z < ecPos3.z ) // Negative direction in z
discard; // Don't light surface outside the light volume
vec3 VP = LightPosition.xyz - pos;
if ( dot( VP, VP ) > ( Far * Far ) )
discard; // Don't light surface outside the light volume
if ( pos.z < ecPos3.z ) // Negative direction in z
discard; // Don't light surface outside the light volume
float d = length( VP );
VP /= d;
vec3 VP = LightPosition.xyz - pos;
if ( dot( VP, VP ) > ( Far * Far ) )
discard; // Don't light surface outside the light volume
vec3 halfVector = normalize(VP - viewDir);
float d = length( VP );
VP /= d;
vec3 halfVector = normalize(VP - viewDir);
float att = 1.0 / (Attenuation.x + Attenuation.y * d + Attenuation.z *d*d);
float spotDot = dot(-VP, normalize(LightDirection.xyz));
float spotAttenuation = 0.0;
if (spotDot < CosCutoff)
spotAttenuation = 0.0;
else
spotAttenuation = pow(spotDot, Exponent);
att *= spotAttenuation;
float nDotVP = max(0.0, dot(normal, VP));
float nDotHV = max(0.0, dot(normal, halfVector));
vec4 color = texture2D( color_tex, coords );
vec4 Iamb = Ambient * color * att;
vec4 Idiff = Diffuse * color * att * nDotVP;
vec3 Ispec = pow( nDotHV, spec_emis.y ) * spec_emis.x * att * Specular.rgb;
gl_FragColor = vec4(Iamb.rgb + Idiff.rgb + Ispec, 1.0);
float spotDot = dot(-VP, normalize(LightDirection.xyz));
float spotAttenuation = 0.0;
if (spotDot < CosCutoff)
spotAttenuation = 0.0;
else
spotAttenuation = pow(spotDot, Exponent);
att *= spotAttenuation;
float cosAngIncidence = clamp(dot(normal, VP), 0.0, 1.0);
float nDotVP = max(0.0, dot(normal, VP));
float nDotHV = max(0.0, dot(normal, halfVector));
vec4 color_material = texture2D( color_tex, coords );
vec3 color = color_material.rgb;
vec3 Iamb = Ambient.rgb * color * att;
vec3 Idiff = Diffuse.rgb * color * att * nDotVP;
float matID = color_material.a * 255.0;
float spec_intensity = spec_emis.x;
float spec_att = att;
if (matID == 254.0) { // 254: water, 255: Ubershader
spec_intensity = 1.0; // spec_color shouldn't depend on cloud cover when rendering spot light
spec_att = min(10.0 * att, 1.0); // specular attenuation reduced on water
}
vec3 Ispec = vec3(0.0);
if (cosAngIncidence > 0.0)
Ispec = pow( nDotHV, spec_emis.y * 128.0 ) * spec_intensity * spec_att * Specular.rgb;
if (matID >= 254.0)
Idiff += Ispec * spec_emis.x;
gl_FragColor = vec4(Iamb + Idiff + Ispec, 1.0);
}

View file

@ -50,12 +50,14 @@ void main (void)
if (normalmap_dds > 0)
N = -N;
float nFactor = 1.0 - N.z;
float lightness = dot(texel.rgb, vec3( 0.3, 0.59, 0.11 ));
// calculate the specular light
float refl_correction = spec_adjust * 1.9 - 1.0;
float shininess = max (0.35, refl_correction) * nmap.a;
float refl_correction = spec_adjust * 2.5 - 1.0;
float shininess = max (0.35, refl_correction) * nmap.a * nFactor;
float specular = dot(vec3(0.5*shininess), vec3( 0.3, 0.59, 0.11 ));
float specular = dot(vec3(1.0) * lightness , vec3( 0.3, 0.59, 0.11 )) * nFactor;
vec4 color = vec4(1.0);
@ -65,7 +67,7 @@ void main (void)
vec3 viewVec = normalize(vViewVec);
// Map a rainbowish color
float v = dot(viewVec, normalize(VNormal));
float v = abs(dot(viewVec, normalize(VNormal)));
vec4 rainbow = texture2D(Rainbow, vec2(v, 0.0));
// Map a fresnel effect
@ -83,7 +85,7 @@ void main (void)
MixFactor = 0.75 * smoothstep(0.0, 1.0, MixFactor);
reflFactor = max(map.a * (texel.r + texel.g), 1.0 - MixFactor) * (1.0- N.z) + transparency_offset ;
reflFactor = max(map.a * (texel.r + texel.g), 1.0 - MixFactor) * nFactor + transparency_offset ;
reflFactor =0.75 * smoothstep(0.05, 1.0, reflFactor);
// set ambient adjustment to remove bluiness with user input
@ -96,12 +98,12 @@ void main (void)
vec4 reflfrescolor = mix(reflcolor, fresnel, fresneliness * v);
vec4 noisecolor = mix(reflfrescolor, noisevec, noisiness);
vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0);
vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0) * nFactor;
vec4 mixedcolor = mix(texel, raincolor, reflFactor);
vec4 mixedcolor = mix(texel, raincolor * (1.0 - refl_correction * (1.0 - lightness)), reflFactor);
// the final reflection
vec4 fragColor = vec4(color.rgb * mixedcolor.rgb + ambient_Correction, color.a);
vec4 fragColor = vec4(color.rgb * mixedcolor.rgb + ambient_Correction * nFactor, color.a);
encode_gbuffer(N, fragColor.rgb, 1, specular, shininess, emission, gl_FragCoord.z);
}

View file

@ -0,0 +1,70 @@
// -*- mode: C; -*-
// Licence: GPL v2
// © Emilian Huminiuc and Vivian Meazza 2011
varying vec3 rawpos;
varying float fogCoord;
varying vec3 VNormal;
varying vec3 VTangent;
varying vec3 VBinormal;
varying vec3 Normal;
varying vec3 vViewVec;
varying vec3 reflVec;
varying vec4 Diffuse;
varying float alpha;
uniform mat4 osg_ViewMatrixInverse;
attribute vec3 tangent;
attribute vec3 binormal;
////fog "include"////////
// uniform int fogType;
//
// void fog_Func(int type);
/////////////////////////
void main(void)
{
rawpos = gl_Vertex.xyz / gl_Vertex.w;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition.xyz = ecPosition.xyz / ecPosition.w;
//fogCoord = ecPosition.z;
//fog_Func(fogType);
vec3 n = normalize(gl_Normal);
vec3 t = cross(gl_Normal, vec3(1.0,0.0,0.0));
vec3 b = cross(n,t);
VNormal = gl_NormalMatrix * gl_Normal;
VTangent = normalize(gl_NormalMatrix * tangent);
VBinormal = normalize(gl_NormalMatrix * binormal);
Normal = normalize(gl_Normal);
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)
alpha = gl_FrontMaterial.diffuse.a;
else
alpha = gl_Color.a;
// Vertex in eye coordinates
vec3 vertVec = ecPosition.xyz;
vViewVec.x = dot(t, vertVec);
vViewVec.y = dot(b, vertVec);
vViewVec.z = dot(n, vertVec);
// calculate the reflection vector
vec4 reflect_eye = vec4(reflect(vertVec, VNormal), 0.0);
reflVec = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz;
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

@ -38,8 +38,6 @@ uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
vec3 fog_Func(vec3 color, int type);
void main (void)
{
//vec3 halfV;
@ -61,9 +59,9 @@ void main (void)
if (normalmap_dds > 0)
N = -N;
float lightness = dot(texel.rgb, vec3( 0.3, 0.59, 0.11 ));
// calculate the specular light
float refl_correction = spec_adjust * 1.9 - 1.0;
float refl_correction = spec_adjust * 2.5 - 1.0;
float shininess = max (0.35, refl_correction);
float nDotVP = max(0.0, dot(N, normalize(gl_LightSource[0].position.xyz)));
float nDotHV = max(0.0, dot(N, normalize(gl_LightSource[0].halfVector.xyz)));
@ -74,17 +72,20 @@ void main (void)
pf = pow(nDotHV, /*gl_FrontMaterial.*/shininess);
vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP;
vec4 Specular = vec4(vec3(0.5*shininess), 1.0)* gl_LightSource[0].specular * pf;
//vec4 Specular = vec4(vec3(0.5*shininess), 1.0)* gl_LightSource[0].specular * pf;
vec4 Specular = vec4(1.0)* lightness * gl_LightSource[0].specular * pf;
vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse;
color += Specular * vec4(vec3(0.5*shininess), 1.0) * nmap.a;
//color += Specular * vec4(vec3(0.5*shininess), 1.0) * nmap.a;
float nFactor = 1.0 - N.z;
color += Specular * vec4(1.0) * nmap.a * nFactor;
color.a = texel.a * alpha;
color = clamp(color, 0.0, 1.0);
vec3 viewVec = normalize(vViewVec);
// Map a rainbowish color
float v = dot(viewVec, normalize(VNormal));
float v = abs(dot(viewVec, normalize(VNormal)));
vec4 rainbow = texture2D(Rainbow, vec2(v, 0.0));
// Map a fresnel effect
@ -113,17 +114,18 @@ void main (void)
// add fringing fresnel and rainbow effects and modulate by reflection
vec4 reflcolor = mix(reflection, rainbow, rainbowiness * v);
reflcolor += Specular * nmap.a;
reflcolor += Specular * nmap.a * nFactor;
vec4 reflfrescolor = mix(reflcolor, fresnel, fresneliness * v);
vec4 noisecolor = mix(reflfrescolor, noisevec, noisiness);
vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0);
raincolor += Specular * nmap.a;
raincolor += Specular * nmap.a * nFactor;
vec4 mixedcolor = mix(texel, raincolor, reflFactor);
vec4 mixedcolor = mix(texel, raincolor * (1.0 - refl_correction * (1.0 - lightness)), reflFactor); //* (1.0 - 0.5 * transparency_offset )
// the final reflection
vec4 fragColor = vec4(color.rgb * mixedcolor.rgb + ambient_Correction.rgb, color.a);
fragColor += Specular * nmap.a;
vec4 fragColor = vec4(color.rgb * mixedcolor.rgb + ambient_Correction.rgb * (1.0 - refl_correction * (1.0 - 0.8 * lightness)) * nFactor, color.a);
fragColor += Specular * nmap.a * nFactor;
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
gl_FragColor = fragColor;

63
Shaders/ssao-ati.frag Normal file
View file

@ -0,0 +1,63 @@
#version 120
uniform sampler2D normal_tex;
uniform sampler2D depth_tex;
uniform sampler2D spec_emis_tex;
uniform sampler3D noise_tex;
uniform vec2 fg_BufferSize;
uniform vec3 fg_Planes;
uniform vec4 fg_du;
uniform vec4 fg_dv;
uniform float g_scale;
uniform float g_bias;
uniform float g_intensity;
uniform float g_sample_rad;
uniform float random_size;
uniform int osg_FrameNumber;
varying vec4 ray;
const vec2 v[4] = vec2[](vec2(1.0,0.0),vec2(-1.0,0.0),vec2(0.0,1.0),vec2(0.0,-1.0));
vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex );
vec3 normal_decode(vec2 enc);
vec2 getRandom( in vec2 uv ) {
int level = osg_FrameNumber - ((osg_FrameNumber / 64) * 64);
return normalize( texture3D( noise_tex, vec3(uv*50.0, float(level) / 64.0) ).xy * 0.14 - 0.07 );
}
vec3 getPosition(in vec2 uv, in vec2 uv0, in vec4 ray0) {
vec2 duv = uv - uv0;
vec4 ray = ray0 + fg_du * duv.x + fg_dv * duv.y;
vec3 viewDir = normalize( ray.xyz );
return position(viewDir, uv, depth_tex);
}
float doAmbientOcclusion(in vec2 tcoord, in vec2 uv, in vec3 p, in vec3 cnorm, in vec4 ray) {
vec3 diff = getPosition(tcoord+uv,tcoord,ray)-p;
float d = length(diff);
vec3 v = diff / d;
d *= g_scale;
return max(0.0, dot( cnorm,v ) - g_bias) * (1.0/(1.0+d)) * g_intensity;
}
void main() {
vec2 coords = gl_TexCoord[0].xy;
float initialized = texture2D( spec_emis_tex, coords ).a;
if ( initialized < 0.1 )
discard;
vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg);
vec3 viewDir = normalize(ray.xyz);
vec3 pos = position(viewDir, coords, depth_tex);
vec2 rand = getRandom(coords);
float ao = 0.0;
float rad = g_sample_rad;
int iterations = 4;
for (int j = 0; j < 1; ++j ) {
vec2 coord1 = reflect( v[j], rand ) * rad;
vec2 coord2 = vec2( coord1.x*0.707 - coord1.y*0.707, coord1.x*0.707 + coord1.y*0.707 );
ao += doAmbientOcclusion(coords,coord1*0.25,pos,normal,ray);
ao += doAmbientOcclusion(coords,coord2*0.5,pos,normal,ray);
ao += doAmbientOcclusion(coords,coord1*0.75,pos,normal,ray);
ao += doAmbientOcclusion(coords,coord2,pos,normal,ray);
}
ao /= 16.0;
gl_FragColor = vec4( vec3(1.0 - ao), 1.0 );
}

View file

@ -6,6 +6,7 @@ uniform sampler2D spec_emis_tex;
uniform sampler2DShadow shadow_tex;
uniform vec4 fg_SunDiffuseColor;
uniform vec4 fg_SunSpecularColor;
uniform vec4 fg_SunAmbientColor;
uniform vec3 fg_SunDirection;
uniform vec3 fg_Planes;
uniform int fg_ShadowNumber;
@ -60,8 +61,6 @@ void main() {
if ( spec_emis.a < 0.1 )
discard;
vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg);
float len = length(normal);
normal /= len;
vec3 viewDir = normalize(ray);
vec3 pos = position( viewDir, coords, depth_tex );
@ -71,17 +70,18 @@ void main() {
lightDir = normalize( lightDir );
vec3 color = texture2D( color_tex, coords ).rgb;
vec3 Idiff = clamp( dot( lightDir, normal ), 0.0, 1.0 ) * color * fg_SunDiffuseColor.rgb;
vec3 halfDir = lightDir - viewDir;
len = length( halfDir );
vec3 halfDir = normalize( lightDir - viewDir );
vec3 Ispec = vec3(0.0);
vec3 Iemis = spec_emis.z * color;
if (len > 0.0001) {
halfDir /= len;
Ispec = pow( clamp( dot( halfDir, normal ), 0.0, 1.0 ), spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb;
}
float cosAngIncidence = clamp(dot(normal, lightDir), 0.0, 1.0);
float blinnTerm = clamp( dot( halfDir, normal ), 0.0, 1.0 );
if (cosAngIncidence > 0.0)
Ispec = pow( blinnTerm, spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb;
float matID = texture2D( color_tex, coords ).a * 255.0;
if (matID == 255.0)
if (matID >= 254.0)
Idiff += Ispec * spec_emis.x;
gl_FragColor = vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0);

View file

@ -17,25 +17,24 @@ void main() {
if ( spec_emis.a < 0.1 )
discard;
vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg);
float len = length(normal);
normal /= len;
vec3 viewDir = normalize(ray);
vec3 lightDir = (fg_ViewMatrix * vec4( fg_SunDirection, 0.0 )).xyz;
lightDir = normalize( lightDir );
vec3 color = texture2D( color_tex, coords ).rgb;
vec3 Idiff = clamp( dot( lightDir, normal ), 0.0, 1.0 ) * color * fg_SunDiffuseColor.rgb;
vec3 halfDir = lightDir - viewDir;
len = length( halfDir );
vec3 halfDir = normalize( lightDir - viewDir );
vec3 Ispec = vec3(0.0);
vec3 Iemis = spec_emis.z * color;
if (len > 0.0001) {
halfDir /= len;
Ispec = pow( clamp( dot( halfDir, normal ), 0.0, 1.0 ), spec_emis.y * 255.0 ) * spec_emis.x * fg_SunSpecularColor.rgb;
}
float cosAngIncidence = clamp(dot(normal, lightDir), 0.0, 1.0);
float blinnTerm = clamp( dot( halfDir, normal ), 0.0, 1.0 );
if (cosAngIncidence > 0.0)
Ispec = pow( blinnTerm, spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb;
float matID = texture2D( color_tex, coords ).a * 255.0;
if (matID == 255.0)
if (matID >= 254.0)
Idiff += Ispec * spec_emis.x;
gl_FragColor = vec4(Idiff + Ispec + Iemis, 1.0);

View file

@ -62,8 +62,6 @@ void main() {
if ( spec_emis.a < 0.1 )
discard;
vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg);
float len = length(normal);
normal /= len;
vec3 viewDir = normalize(ray);
vec3 pos = position( viewDir, coords, depth_tex );
@ -87,19 +85,21 @@ void main() {
}
vec3 lightDir = (fg_ViewMatrix * vec4( fg_SunDirection, 0.0 )).xyz;
lightDir = normalize( lightDir );
vec3 color = texture2D( color_tex, coords ).rgb;
vec4 color_material = texture2D( color_tex, coords );
vec3 color = color_material.rgb;
vec3 Idiff = clamp( dot( lightDir, normal ), 0.0, 1.0 ) * color * fg_SunDiffuseColor.rgb;
vec3 halfDir = lightDir - viewDir;
len = length( halfDir );
vec3 halfDir = normalize( lightDir - viewDir );
vec3 Ispec = vec3(0.0);
vec3 Iemis = spec_emis.z * color;
if (len > 0.0001) {
halfDir /= len;
Ispec = pow( clamp( dot( halfDir, normal ), 0.0, 1.0 ), spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb;
}
float matID = texture2D( color_tex, coords ).a * 255.0;
if (matID == 255.0)
float cosAngIncidence = clamp(dot(normal, lightDir), 0.0, 1.0);
float blinnTerm = clamp( dot( halfDir, normal ), 0.0, 1.0 );
if (cosAngIncidence > 0.0)
Ispec = pow( blinnTerm, spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb;
float matID = color_material.a * 255.0;
if (matID >= 254.0) // 254: Water, 255: Ubershader
Idiff += Ispec * spec_emis.x;
gl_FragColor = vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0);

View file

@ -1,10 +1,12 @@
// -*-C++-*-
// Texture switching based on face slope and snow level
// based on earlier work by Frederic Bouvier, Tim Moore, and Yves Sablonier.
// <EFBFBD> Emilian Huminiuc 2011
// © Emilian Huminiuc 2011
// Ambient term comes in gl_Color.rgb.
varying vec4 diffuse_term;
#version 120
varying vec4 RawPos;
varying vec3 normal;
varying vec3 Vnormal;
@ -14,11 +16,11 @@ uniform float Transitions;
uniform float InverseSlope;
uniform float RainNorm;
uniform float CloudCover0;
uniform float CloudCover1;
uniform float CloudCover2;
uniform float CloudCover3;
uniform float CloudCover4;
uniform float CloudCover0;
uniform float CloudCover1;
uniform float CloudCover2;
uniform float CloudCover3;
uniform float CloudCover4;
uniform sampler2D BaseTex;
uniform sampler2D SecondTex;
@ -35,100 +37,64 @@ vec3 fog_Func(vec3 color, int type);
void main()
{
float MixFactor;
float NdotL;
float NdotHV;
float fogFactor;
float cover;
float slope;
float L1;
float L2;
float wetness;
float pf;
float pf = 0.0;
vec3 n;
vec3 lightDir;
vec3 halfVector;
vec3 lightDir = gl_LightSource[0].position.xyz;
vec3 halfVector = gl_LightSource[0].halfVector.xyz;
vec4 texel;
vec4 fragColor;
vec4 color;
vec4 specular;
vec4 Noise;
vec4 texel = vec4(0.0);
vec4 specular = vec4(0.0);
lightDir = gl_LightSource[0].position.xyz;
halfVector = gl_LightSource[0].halfVector.xyz;
float cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
//color = gl_Color;
specular = vec4(0.0);
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
Noise = texture3D(NoiseTex, RawPos.xyz*0.0011);
MixFactor = Noise.r * Noise.g * Noise.b; //Mixing Factor to create a more organic looking boundary
vec4 Noise = texture3D(NoiseTex, RawPos.xyz * 0.0011);
float MixFactor = Noise.r * Noise.g * Noise.b; //Mixing Factor to create a more organic looking boundary
MixFactor *= 300.0;
MixFactor = clamp(MixFactor, 0.0, 1.0);
L1 = 0.90 - 0.02 * MixFactor; //first transition slope
L2 = 0.78 + 0.04 * MixFactor; //Second transition slope
float L1 = 0.90 - 0.02 * MixFactor; //first transition slope
float L2 = 0.78 + 0.04 * MixFactor; //Second transition slope
// If gl_Color.a == 0, this is a back-facing polygon and the
// Vnormal should be reversed.
n = (2.0 * gl_Color.a - 1.0) * Vnormal;
n = normalize(n);
// vec3 n = (2.0 * gl_Color.a - 1.0) * Vnormal;
vec3 n = normalize(Vnormal);
// NdotL = dot(n, lightDir);
// if (NdotL > 0.0) {
// color += diffuse_term * NdotL;
// NdotHV = max(dot(n, halfVector), 0.0);
// if (gl_FrontMaterial.shininess > 0.0)
// specular.rgb = (gl_FrontMaterial.specular.rgb
// * gl_LightSource[0].specular.rgb
// * pow(NdotHV, gl_FrontMaterial.shininess));
// }
float nDotVP = max(0.0, dot(n, normalize(gl_LightSource[0].position.xyz)));
float nDotHV = max(0.0, dot(n, normalize(gl_LightSource[0].halfVector.xyz)));
vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP;
float nDotVP = max(0.0, dot(n, normalize(gl_LightSource[0].position.xyz)));
float nDotHV = max(0.0, dot(n, normalize(gl_LightSource[0].halfVector.xyz)));
vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP;
if (nDotVP == 0.0)
pf = 0.0;
else
if (nDotVP > 0.0)
pf = pow(nDotHV, gl_FrontMaterial.shininess);
if (gl_FrontMaterial.shininess > 0.0)
specular = gl_FrontMaterial.specular * gl_LightSource[0].specular * pf;
color = gl_FrontMaterial.emission +
gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient) +
Diffuse * gl_FrontMaterial.diffuse;
vec4 diffuseColor = gl_FrontMaterial.emission +
vec4(1.0) * (gl_LightModel.ambient + gl_LightSource[0].ambient) +
Diffuse * gl_FrontMaterial.diffuse;
color += specular * gl_FrontMaterial.specular;
diffuseColor += specular * gl_FrontMaterial.specular;
color.a = diffuse_term.a;
// This shouldn't be necessary, but our lighting becomes very
// saturated. Clamping the color before modulating by the texture
// is closer to what the OpenGL fixed function pipeline does.
color = clamp(color, 0.0, 1.0);
diffuseColor = clamp(diffuseColor, 0.0, 1.0);
//Select texture based on slope
slope = normalize(normal).z;
float slope = normalize(normal).z;
//pull the texture fetch outside flow control to fix aliasing artefacts :(
vec4 baseTexel = texture2D(BaseTex, gl_TexCoord[0].st);
vec4 secondTexel = texture2D(SecondTex, gl_TexCoord[0].st);
vec4 thirdTexel = texture2D(ThirdTex, gl_TexCoord[0].st);
vec4 snowTexel = texture2D(SnowTex, gl_TexCoord[0].st);
vec4 baseTexel = texture2D(BaseTex, gl_TexCoord[0].st);
vec4 secondTexel = texture2D(SecondTex, gl_TexCoord[0].st);
vec4 thirdTexel = texture2D(ThirdTex, gl_TexCoord[0].st);
vec4 snowTexel = texture2D(SnowTex, gl_TexCoord[0].st);
//Normal transition. For more abrupt faces apply another texture (or 2).
if (InverseSlope == 0.0) {
//Do we do an intermediate transition
if (Transitions >= 1.5) {
if (slope >= L1) {
//texel = mix(texture2D(SecondTex, gl_TexCoord[0].st), texture2D(BaseTex, gl_TexCoord[0].st), smoothstep(L1, L1 + 0.03 * MixFactor, slope));
texel = baseTexel;
}
if (slope >= L2 && slope < L1){
@ -172,10 +138,10 @@ void main()
}
//darken textures with wetness
wetness = 1.0 - 0.3 * RainNorm;
float wetness = 1.0 - 0.3 * RainNorm;
texel.rgb = texel.rgb * wetness;
float altitude = RawPos.z;
float altitude = RawPos.z;
//Snow texture for areas higher than SnowLevel
if (altitude >= SnowLevel - (1000.0 * slope + 300.0 * MixFactor) && slope > L2 - 0.12) {
texel = mix(texel, mix(texel, snowTexel, smoothstep(L2 - 0.09 * MixFactor, L2, slope)),
@ -185,7 +151,7 @@ void main()
);
}
fragColor = color * texel + specular;
vec4 fragColor = diffuseColor * texel + specular;
if(cover >= 2.5){
fragColor.rgb = fragColor.rgb * 1.2;
@ -194,7 +160,6 @@ void main()
fragColor.b = fragColor.b * (0.5 + 0.25 * cover);
}
//fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
fragColor.rgb *= 1.2 - 0.4 * MixFactor;
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
gl_FragColor = fragColor;

View file

@ -1,65 +1,21 @@
// -*-C++-*-
// -*-C++-*-
// Texture switching based on face slope and snow level
// based on earlier work by Frederic Bouvier, Tim Moore, and Yves Sablonier.
// © Emilian Huminiuc 2011
// 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.
#version 120
#define MODE_OFF 0
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
// The constant 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, RawPos;
varying vec3 normal, Vnormal;
//varying float fogCoord;
uniform int colorMode;
// ////fog "include"////////
// uniform int fogType;
//
// void fog_Func(int type);
// /////////////////////////
varying vec4 RawPos;
varying vec3 normal;
varying vec3 Vnormal;
void main()
{
RawPos = gl_Vertex;
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = normalize(gl_Normal);
Vnormal = 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 constant_term = gl_FrontMaterial.emission + ambient_color *
(gl_LightModel.ambient + 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 = constant_term.rgb; gl_FrontColor.a = 1.0;
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
//fogCoord = abs(ecPosition.z / ecPosition.w);
//fog_Func(fogType);
Vnormal = normalize(gl_NormalMatrix * gl_Normal);
}

View file

@ -28,9 +28,6 @@ varying float earthShade;
varying float yprime_alt;
varying float mie_angle;
uniform int colorMode;
uniform float hazeLayerAltitude;
uniform float terminator;
@ -41,7 +38,6 @@ uniform float overcast;
//uniform float scattering;
uniform float ground_scattering;
// This is the value used in the skydome scattering shader - use the same here for consistency?
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@ -75,8 +71,12 @@ void main()
float numVarieties = gl_Normal.z;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
float sr = sin(gl_FogCoord);
float cr = cos(gl_FogCoord);
// Determine the rotation for the tree. The Fog Coordinate provides rotation information
// to rotate one of the quands by 90 degrees. We then apply an additional position seed
// so that trees aren't all oriented N/S
float sr = sin(gl_FogCoord + gl_Color.x);
float cr = cos(gl_FogCoord + gl_Color.x);
gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0);
// scaling
@ -84,6 +84,8 @@ void main()
// Rotation of the generic quad to specific one for the tree.
position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr)));
// Move to correct location (stored in gl_Color)
position = position + gl_Color.xyz;
gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0);
@ -95,7 +97,7 @@ void main()
vec4 diffuse_color = gl_FrontMaterial.diffuse * max(0.1, n);
//diffuse_color.a = 1.0;
vec4 ambient_color = gl_FrontLightModelProduct.sceneColor + gl_LightSource[0].ambient * gl_FrontMaterial.ambient;
vec4 ambient_color = gl_FrontMaterial.ambient;
// here start computations for the haze layer
// we need several geometrical quantities

View file

@ -18,8 +18,12 @@ void main(void)
float numVarieties = gl_Normal.z;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
float sr = sin(gl_FogCoord);
float cr = cos(gl_FogCoord);
// Determine the rotation for the tree. The Fog Coordinate provides rotation information
// to rotate one of the quands by 90 degrees. We then apply an additional position seed
// so that trees aren't all oriented N/S
float sr = sin(gl_FogCoord + gl_Color.x);
float cr = cos(gl_FogCoord + gl_Color.x);
gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0);
// scaling

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