1
0
Fork 0

Merge branch 'master' into f-14b-xiii

This commit is contained in:
Alexis Bory 2011-03-06 19:12:38 +01:00
commit 5049c8164e
50 changed files with 469 additions and 297 deletions

View file

@ -103,13 +103,16 @@ var key = func(v) {
if (cduDisplay == "DEP_ARR_INDEX"){
cduDisplay = "RTE1_ARR";
}
if (cduDisplay == "EICAS_MODES"){
else if (cduDisplay == "EICAS_MODES"){
eicasDisplay = "GEAR";
}
if (cduDisplay == "EICAS_SYN"){
else if (cduDisplay == "EICAS_SYN"){
eicasDisplay = "DRS";
}
if (cduDisplay == "RTE1_LEGS"){
else if (cduDisplay == "MENU"){
eicasDisplay = "EICAS_MODES";
}
else if (cduDisplay == "RTE1_LEGS"){
setprop("/autopilot/route-manager/route/wp[2]/altitude-ft",cduInput);
if (substr(cduInput,0,2) == "FL"){
setprop("/autopilot/route-manager/route/wp[2]/altitude-ft",substr(cduInput,2)*100);
@ -193,7 +196,7 @@ var key = func(v) {
if (cduDisplay == "APP_REF"){
cduDisplay = "INIT_REF";
}
if ((cduDisplay == "IDENT") or (cduDisplay = "PERF_INIT") or (cduDisplay = "POS_INIT") or (cduDisplay = "POS_REF") or (cduDisplay = "THR_LIM") or (cduDisplay = "TO_REF")){
if ((cduDisplay == "IDENT") or (cduDisplay = "MAINT") or (cduDisplay = "PERF_INIT") or (cduDisplay = "POS_INIT") or (cduDisplay = "POS_REF") or (cduDisplay = "THR_LIM") or (cduDisplay = "TO_REF")){
cduDisplay = "INIT_REF";
}
}
@ -201,24 +204,27 @@ var key = func(v) {
if (cduDisplay == "THR_LIM"){
cduDisplay = "TO_REF";
}
if (cduDisplay == "APP_REF"){
else if (cduDisplay == "APP_REF"){
cduDisplay = "THR_LIM";
}
if ((cduDisplay == "RTE1_1") or (cduDisplay == "RTE1_LEGS")){
else if ((cduDisplay == "RTE1_1") or (cduDisplay == "RTE1_LEGS")){
setprop("/autopilot/route-manager/input","@ACTIVATE");
}
if ((cduDisplay == "POS_INIT") or (cduDisplay == "DEP") or (cduDisplay == "RTE1_ARR") or (cduDisplay == "RTE1_DEP")){
else if ((cduDisplay == "POS_INIT") or (cduDisplay == "DEP") or (cduDisplay == "RTE1_ARR") or (cduDisplay == "RTE1_DEP")){
cduDisplay = "RTE1_1";
}
if ((cduDisplay == "IDENT") or (cduDisplay == "TO_REF")){
else if ((cduDisplay == "IDENT") or (cduDisplay == "TO_REF")){
cduDisplay = "POS_INIT";
}
if (cduDisplay == "EICAS_SYN"){
else if (cduDisplay == "EICAS_SYN"){
cduDisplay = "EICAS_MODES";
}
if (cduDisplay == "EICAS_MODES"){
else if (cduDisplay == "EICAS_MODES"){
cduDisplay = "EICAS_SYN";
}
else if (cduDisplay == "INIT_REF"){
cduDisplay = "MAINT";
}
}
setprop("/instrumentation/cdu/display",cduDisplay);
@ -268,8 +274,10 @@ var cdu = func{
if (display == "MENU") {
title = "MENU";
line1l = "<FMC";
line1rt = "EFIS CP";
line1r = "SELECT>";
line2l = "<ACARS";
line2rt = "EICAS CP";
line2r = "SELECT>";
line6l = "<ACMS";
line6r = "CMC>";
@ -364,6 +372,14 @@ var cdu = func{
line6l = "<APPROACH";
line6r = "MAINT>";
}
if (display == "MAINT") {
title = "MAINTENANCE INDEX";
line1l = "<CROS LOAD";
line1r = "BITE>";
line2l = "<PERF FACTORS";
line3l = "<IRS MONITOR";
line6l = "<INDEX";
}
if (display == "NAV_RAD") {
title = "NAV RADIO";
line1lt = "VOR L";
@ -446,10 +462,10 @@ var cdu = func{
line5l = "<RTE COPY";
line6l = "<RTE 2";
if (getprop("/autopilot/route-manager/active") == 1){
line6r = "ACTIVATE>";
line6r = "PERF INIT>";
}
else {
line6r = "PERF INIT>";
line6r = "ACTIVATE>";
}
}
if (display == "RTE1_2") {

View file

@ -555,8 +555,15 @@ var Target = {
get_closure_rate : func() {
var dt = ElapsedSec.getValue() - me.TimeLast.getValue();
var rng = me.Range.getValue();
var t_distance = me.RangeLast.getValue() - rng;
var cr = t_distance/dt*3600;
var lrng = me.RangeLast.getValue();
if ( debug.isnan(rng) or debug.isnan(lrng)) {
print("####### get_closure_rate(): rng or lrng = nan ########");
me.ClosureRate.setValue(0);
me.RangeLast.setValue(0);
return(0);
}
var t_distance = lrng - rng;
var cr = (dt > 0) ? t_distance/dt*3600 : 0;
me.ClosureRate.setValue(cr);
me.RangeLast.setValue(rng);
return(cr);

View file

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

View file

@ -0,0 +1,87 @@
<PropertyList>
<entry>
<ind>0.000</ind>
<dep>0.000</dep>
</entry>
<entry>
<ind>0.050</ind>
<dep>2.799</dep>
</entry>
<entry>
<ind>0.100</ind>
<dep>5.504</dep>
</entry>
<entry>
<ind>0.150</ind>
<dep>8.130</dep>
</entry>
<entry>
<ind>0.200</ind>
<dep>10.688</dep>
</entry>
<entry>
<ind>0.250</ind>
<dep>13.187</dep>
</entry>
<entry>
<ind>0.300</ind>
<dep>15.637</dep>
</entry>
<entry>
<ind>0.350</ind>
<dep>18.044</dep>
</entry>
<entry>
<ind>0.400</ind>
<dep>20.415</dep>
</entry>
<entry>
<ind>0.450</ind>
<dep>22.755</dep>
</entry>
<entry>
<ind>0.500</ind>
<dep>25.068</dep>
</entry>
<entry>
<ind>0.550</ind>
<dep>27.360</dep>
</entry>
<entry>
<ind>0.600</ind>
<dep>29.635</dep>
</entry>
<entry>
<ind>0.650</ind>
<dep>31.896</dep>
</entry>
<entry>
<ind>0.700</ind>
<dep>34.147</dep>
</entry>
<entry>
<ind>0.750</ind>
<dep>36.393</dep>
</entry>
<entry>
<ind>0.800</ind>
<dep>38.635</dep>
</entry>
<entry>
<ind>0.850</ind>
<dep>40.878</dep>
</entry>
<entry>
<ind>0.900</ind>
<dep>43.126</dep>
</entry>
<entry>
<ind>0.950</ind>
<dep>45.381</dep>
</entry>
<entry>
<ind>1.000</ind>
<dep>47.647</dep>
</entry>
</PropertyList>

View file

@ -0,0 +1,87 @@
<?xml version = '1.0' encoding = 'UTF-8' ?>
<PropertyList>
<entry>
<ind>0.000</ind>
<dep>0.000</dep>
</entry>
<entry>
<ind>0.050</ind>
<dep>1.305</dep>
</entry>
<entry>
<ind>0.100</ind>
<dep>2.583</dep>
</entry>
<entry>
<ind>0.150</ind>
<dep>3.836</dep>
</entry>
<entry>
<ind>0.200</ind>
<dep>5.067</dep>
</entry>
<entry>
<ind>0.250</ind>
<dep>6.276</dep>
</entry>
<entry>
<ind>0.300</ind>
<dep>7.467</dep>
</entry>
<entry>
<ind>0.350</ind>
<dep>8.639</dep>
</entry>
<entry>
<ind>0.400</ind>
<dep>9.794</dep>
</entry>
<entry>
<ind>0.450</ind>
<dep>10.934</dep>
</entry>
<entry>
<ind>0.500</ind>
<dep>12.059</dep>
</entry>
<entry>
<ind>0.550</ind>
<dep>13.171</dep>
</entry>
<entry>
<ind>0.600</ind>
<dep>14.270</dep>
</entry>
<entry>
<ind>0.650</ind>
<dep>15.357</dep>
</entry>
<entry>
<ind>0.700</ind>
<dep>16.433</dep>
</entry>
<entry>
<ind>0.750</ind>
<dep>17.498</dep>
</entry>
<entry>
<ind>0.800</ind>
<dep>18.554</dep>
</entry>
<entry>
<ind>0.850</ind>
<dep>19.601</dep>
</entry>
<entry>
<ind>0.900</ind>
<dep>20.639</dep>
</entry>
<entry>
<ind>0.950</ind>
<dep>21.668</dep>
</entry>
<entry>
<ind>1.000</ind>
<dep>22.691</dep>
</entry>
</PropertyList>

View file

@ -2286,8 +2286,7 @@
<animation>
<type>rotate</type>
<object-name>TopLink</object-name>
<property>gear/gear[0]/compression-rotation-deg</property>
<factor>-1</factor>
<property>gear/gear[0]/compression-norm</property>
<center>
<x-m>-0.95412</x-m>
<y-m>0.0</y-m>
@ -2295,16 +2294,16 @@
</center>
<axis>
<x>0.0</x>
<y>1.0</y>
<y>-1.0</y>
<z>0.0</z>
</axis>
<interpolation include="GearScissorInterpolation.xml"/>
</animation>
<animation>
<type>rotate</type>
<object-name>BottomLink</object-name>
<property>gear/gear[0]/compression-rotation-deg</property>
<factor>1</factor>
<property>gear/gear[0]/compression-norm</property>
<center>
<x-m>-1.02349</x-m>
<y-m>0.0</y-m>
@ -2315,6 +2314,7 @@
<y>1.0</y>
<z>0.0</z>
</axis>
<interpolation include="GearScissorInterpolation.xml"/>
</animation>
<animation>
@ -2322,8 +2322,7 @@
<object-name>fairing3</object-name>
<object-name>RightWheelStrut</object-name>
<object-name>RightWheel</object-name>
<property>gear/gear[2]/compression-rotation-deg</property>
<factor>1.0</factor>
<property>gear/gear[2]/compression-norm</property>
<center>
<x-m>0.711</x-m>
<y-m>0.4518</y-m>
@ -2334,6 +2333,7 @@
<y>0.0</y>
<z>0.0</z>
</axis>
<interpolation include="MainRotationInterpolation.xml"/>
</animation>
<animation>
@ -2341,18 +2341,18 @@
<object-name>fairing2</object-name>
<object-name>LeftWheelStrut</object-name>
<object-name>LeftWheel</object-name>
<property>gear/gear[1]/compression-rotation-deg</property>
<factor>-1.0</factor>
<property>gear/gear[1]/compression-norm</property>
<center>
<x-m>0.711</x-m>
<y-m>-0.4518</y-m>
<z-m>-0.70</z-m>
</center>
<axis>
<x>1.0</x>
<x>-1.0</x>
<y>0.0</y>
<z>0.0</z>
</axis>
<interpolation include="MainRotationInterpolation.xml"/>
</animation>
<!--Lights-->

View file

@ -1,137 +0,0 @@
##
# action-sim.nas Updates various simulated features every frame
##
# Initialize local variables
var H = nil;
var L = nil;
var phi = nil;
var C = nil;
# set up filters for these actions
var cdi0_lowpass = aircraft.lowpass.new(0.5);
var cdi1_lowpass = aircraft.lowpass.new(0.5);
var gs0_lowpass = aircraft.lowpass.new(0.5);
var gs1_lowpass = aircraft.lowpass.new(0.5);
# Properties
var propNav0 = props.globals.getNode("instrumentation/nav[0]", 1);
var propNav1 = props.globals.getNode("instrumentation/nav[1]", 1);
var navLights = props.globals.getNode("controls/lighting/nav-lights", 1);
var instrumentsNorm = props.globals.getNode("controls/lighting/instruments-norm", 1);
var instrumentLightFactor = props.globals.getNode("sim/model/material/instruments/factor", 1);
var panelLights = props.globals.getNode("controls/lighting/panel-norm", 1);
var dhN_ft = props.globals.getNode("gear/gear[0]/compression-ft", 1);
var dhR_ft = props.globals.getNode("gear/gear[2]/compression-ft", 1);
var dhL_ft = props.globals.getNode("gear/gear[1]/compression-ft", 1);
var propGear0 = props.globals.getNode("gear/gear[0]", 1);
var propGear1 = props.globals.getNode("gear/gear[1]", 1);
var propGear2 = props.globals.getNode("gear/gear[2]", 1);
# Associate Nodes
var cdiNAV0 = propNav0.getNode("heading-needle-deflection", 1);
var cdiNAV1 = propNav1.getNode("heading-needle-deflection", 1);
var gsNAV0 = propNav0.getNode("gs-needle-deflection-norm", 1);
var gsNAV1 = propNav1.getNode("gs-needle-deflection-norm", 1);
var filteredCDI0 = propNav0.getNode("filtered-cdiNAV0-deflection", 1);
var filteredCDI1 = propNav1.getNode("filtered-cdiNAV1-deflection", 1);
var filteredGS0 = propNav0.getNode("filtered-gsNAV0-deflection", 1);
var filteredGS1 = propNav1.getNode("filtered-gsNAV1-deflection", 1);
var nose_link_rot = propGear0.getNode("compression-rotation-deg", 1);
var left_main_rot = propGear1.getNode("compression-rotation-deg", 1);
var right_main_rot = propGear2.getNode("compression-rotation-deg", 1);
var init_actions = func {
filteredCDI0.setDoubleValue(0.0);
filteredCDI1.setDoubleValue(0.0);
filteredGS0.setDoubleValue(0.0);
filteredGS1.setDoubleValue(0.0);
# Make sure that init_actions is called when the sim is reset
setlistener("sim/signals/reset", init_actions);
# Request that the update fuction be called next frame
settimer(update_actions, 0);
}
var update_actions = func {
# Note: R2D and FT2M are unit conversion factors defined in $FG_ROOT/Nasal/globals.nas
# R2D (radians to degrees) FT2M (feet to meters)
##
# Compute the scissor link angles due to nose strut compression
##
var theta = 0.0;
# Compute the angle the nose gear scissor rotates due to nose gear strut compression
H = 0.240626; # Nose gear oleo strut extended length in m
L = 0.194716; # Nose gear scissor length in m
phi = 0.666058;
C = dhN_ft.getValue()*FT2M;
if (C > 0.0) {
theta = scissor_angle(H,C,L,phi)*R2D;
}
# Compute compression induced main gear rotations
#
# constants
var R_m = 0.919679;
var h0 = 0.63872;
var theta0_rad = 0.803068;
# Right main
var delta_h = dhR_ft.getValue()*FT2M;
var right_alpha_deg = ( math.acos( (h0 - delta_h)/R_m ) - theta0_rad )*R2D;
# Left main
var delta_h = dhL_ft.getValue()*FT2M;
var left_alpha_deg = ( math.acos( (h0 - delta_h)/R_m ) - theta0_rad )*R2D;
# Outputs
instrumentLightFactor.setDoubleValue(instrumentsNorm.getValue());
panelLights.setDoubleValue(instrumentsNorm.getValue());
filteredCDI0.setDoubleValue( cdi0_lowpass.filter(cdiNAV0.getValue()));
filteredCDI1.setDoubleValue(cdi1_lowpass.filter(cdiNAV1.getValue()));
filteredGS0.setDoubleValue(gs0_lowpass.filter(gsNAV0.getValue()));
filteredGS1.setDoubleValue(gs1_lowpass.filter(gsNAV1.getValue()));
nose_link_rot.setDoubleValue(theta);
right_main_rot.setDoubleValue(right_alpha_deg);
left_main_rot.setDoubleValue(left_alpha_deg);
settimer(update_actions, 0);
}
var scissor_angle = func(H,C,L,phi) {
var a = (H - C)/2/L;
# Use 2 iterates of Newton's method and 4th order Taylor series to
# approximate theta where sin(phi - theta) = a
var theta = phi - 2*a/3 - a/3/(1-a*a/2);
return theta;
}
# Setup listener call to start update loop once the fdm is initialized
#
setlistener("sim/signals/fdm-initialized", init_actions);
#
# Listeners to tie the /consumables/fuels/tank[]/selected to
# /fdm/jsbsim/propulsion/tank[]/priority
setlistener("consumables/fuel/tank[0]/selected", func(selected) {
setprop("/fdm/jsbsim/propulsion/tank[0]/priority", selected.getBoolValue() ? 1 : 0);
});
setlistener("consumables/fuel/tank[1]/selected", func(selected) {
setprop("/fdm/jsbsim/propulsion/tank[1]/priority", selected.getBoolValue() ? 1 : 0);
});

View file

@ -5,4 +5,26 @@ aircraft.light.new("sim/model/c172p/lighting/strobes", [0.015, 1.985], strobe_sw
# beacons ===========================================================
var beacon_switch = props.globals.getNode("controls/lighting/beacon", 1);
aircraft.light.new("sim/model/c172p/lighting/beacon-top", [0.10, 0.90], beacon_switch);
aircraft.light.new("sim/model/c172p/lighting/beacon-top", [0.10, 0.90], beacon_switch);
# Control both panel and instrument light intensity with one property
var instrumentsNorm = props.globals.getNode("controls/lighting/instruments-norm", 1);
var instrumentLightFactor = props.globals.getNode("sim/model/material/instruments/factor", 1);
var panelLights = props.globals.getNode("controls/lighting/panel-norm", 1);
var update_intensity = func {
instrumentLightFactor.setDoubleValue(instrumentsNorm.getValue());
panelLights.setDoubleValue(instrumentsNorm.getValue());
settimer(update_intensity, 0);
}
# Setup listener call to start update loop once the fdm is initialized
#
setlistener("sim/signals/fdm-initialized", update_intensity);
# Make sure that update_intensity is called when the sim is reset
setlistener("sim/signals/reset", update_intensity);

View file

@ -0,0 +1,12 @@
#
# Listeners to tie the /consumables/fuels/tank[]/selected to
# /fdm/jsbsim/propulsion/tank[]/priority
setlistener("consumables/fuel/tank[0]/selected", func(selected) {
setprop("/fdm/jsbsim/propulsion/tank[0]/priority", selected.getBoolValue() ? 1 : 0);
});
setlistener("consumables/fuel/tank[1]/selected", func(selected) {
setprop("/fdm/jsbsim/propulsion/tank[1]/priority", selected.getBoolValue() ? 1 : 0);
});

View file

@ -0,0 +1,41 @@
<?xml version = '1.0' encoding = 'UTF-8' ?>
<PropertyList>
<filter>
<name>CDI0 lowpass</name>
<debug>false</debug>
<type>exponential</type>
<filter-time>2.0</filter-time>
<input>instrumentation/nav[0]/heading-needle-deflection</input>
<output>instrumentation/nav[0]/filtered-cdiNAV0-deflection</output>
</filter>
<filter>
<name>CDI1 lowpass</name>
<debug>false</debug>
<type>exponential</type>
<filter-time>2.0</filter-time>
<input>instrumentation/nav[1]/heading-needle-deflection</input>
<output>instrumentation/nav[1]/filtered-cdiNAV1-deflection</output>
</filter>
<filter>
<name>GS0 lowpass</name>
<debug>false</debug>
<type>exponential</type>
<filter-time>2.0</filter-time>
<input>instrumentation/nav[0]/gs-needle-deflection-norm</input>
<output>instrumentation/nav[0]/filtered-gsNAV0-deflection</output>
</filter>
<filter>
<name>GS1 lowpass</name>
<debug>false</debug>
<type>exponential</type>
<filter-time>2.0</filter-time>
<input>instrumentation/nav[1]/gs-needle-deflection-norm</input>
<output>instrumentation/nav[1]/filtered-gsNAV1-deflection</output>
</filter>
</PropertyList>

View file

@ -68,9 +68,17 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
</view>
<systems>
<autopilot>
<name>autopilot helpers</name>
<path>Aircraft/Generic/generic-autopilot-helper.xml</path>
</autopilot>
<autopilot>
<path>Aircraft/c172p/Systems/KAP140.xml</path>
</autopilot>
<autopilot>
<name>FiltersOnly</name>
<path>Aircraft/c172p/Systems/NAVandGSfilters.xml</path>
</autopilot>
<electrical>
<!-- null electrical system path here so we can use a nasal based -->
<!-- model defined later in the nasal section of this file. -->
@ -169,7 +177,7 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<file>Aircraft/c172p/Nasal/immat.nas</file>
<file>Aircraft/c172p/Nasal/doors.nas</file>
<file>Aircraft/c172p/Nasal/light.nas</file>
<file>Aircraft/c172p/Nasal/action-sim.nas</file>
<file>Aircraft/c172p/Nasal/tanks.nas</file>
<file>Aircraft/c172p/Nasal/ki266.nas</file>
<script><![CDATA[
ki266.new(0);

View file

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

View file

@ -9,6 +9,7 @@
<material>
<color-mode-uniform>1</color-mode-uniform> <!-- DIFFUSE -->
</material>
<condition><use>/sim/rendering/shader-effects</use></condition>
</parameters>
<technique n="10">
<predicate>
@ -97,6 +98,11 @@
<name>colorMode</name>
<type>int</type>
<value><use>material/color-mode-uniform</use></value>
</uniform>
<uniform>
<name>condition</name>
<type>float</type>
<value><use>condition</use></value>
</uniform>
</pass>
</technique>

View file

@ -251,7 +251,7 @@ EXAMPLES: You can find examples of both usages in the Hunter and Lightning model
<use>texture[8]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[0]/internal-format</use>
<use>texture[8]/internal-format</use>
</internal-format>
</texture-unit>

View file

@ -2,7 +2,7 @@
<?xml-stylesheet type="text/xsl" href="joystick.xsl"?>
<!-- Saitek AV8R/Aviator
Copyright (C) 2007 - 2010 Anders Gidenstam (anders(at)gidenstam.org)
Copyright (C) 2007 - 2011 Anders Gidenstam (anders(at)gidenstam.org)
This file is released under the GPL license v2 or later.
-->
<PropertyList>
@ -115,10 +115,10 @@
<windows>0</windows>
</number>
<desc>aileron</desc>
<dead-band type="double">0.05</dead-band>
<binding>
<command>property-scale</command>
<property>/controls/flight/aileron</property>
<dead-band type="double">0.01</dead-band>
<offset type="double">0.0</offset>
<squared type="bool">1</squared>
</binding>
@ -133,10 +133,10 @@
<windows>1</windows>
</number>
<desc>elevator</desc>
<dead-band type="double">0.05</dead-band>
<binding>
<command>property-scale</command>
<property>/controls/flight/elevator</property>
<dead-band type="double">0.01</dead-band>
<offset type="double">0.0</offset>
<factor type="double">-1.0</factor>
<squared type="bool">1</squared>
@ -152,10 +152,10 @@
<windows>3</windows>
</number>
<desc>rudder</desc>
<dead-band type="double">0.05</dead-band>
<binding>
<command>property-scale</command>
<property>/controls/flight/rudder</property>
<dead-band type="double">0.01</dead-band>
<offset type="double">0.0</offset>
<factor type="double">1.0</factor>
<squared type="bool">1</squared>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,6 +9,9 @@ varying vec4 diffuse_term;
varying vec3 normal;
varying float fogCoord;
// The conditional, to enable lightmapping
uniform float condition;
uniform sampler2D texture;
uniform sampler2D lightmap_texture;
@ -49,8 +52,10 @@ void main()
color = clamp(color, 0.0, 1.0);
texel = texture2D(texture, gl_TexCoord[0].st);
fragColor = color * texel + specular;
vec3 lightmapTexel = texture2D(lightmap_texture, gl_TexCoord[0].st).rgb;
fragColor.rgb = max(fragColor.rgb, lightmapTexel * gl_FrontMaterial.diffuse.rgb * texel.rgb);
if ( condition >= 1 ) {
vec3 lightmapTexel = texture2D(lightmap_texture, gl_TexCoord[0].st).rgb;
fragColor.rgb = max(fragColor.rgb, lightmapTexel * gl_FrontMaterial.diffuse.rgb * texel.rgb);
}
fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
}

View file

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

View file

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

View file

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

View file

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

View file

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -15,6 +15,7 @@
pushback_position.setpos(0);
setprop("/sim/model/pushback/enabled", 0 );
setprop("/sim/model/pushback/target-speed-fps", 0 );
setprop("/sim/model/pushback/force", 0);
</close>
</nasal>
@ -89,4 +90,4 @@
</group>
</group> </PropertyList>
</group> </PropertyList>

View file

@ -172,17 +172,23 @@
</binding>
</checkbox>
-->
<checkbox>
<halign>left</halign>
<label>Random objects</label>
<label>Random objects (triggers scenery reload)</label>
<name>random-objects</name>
<property>/sim/rendering/random-objects</property>
<binding>
<command>dialog-apply</command>
<object-name>random-objects</object-name>
</binding>
<binding>
<command>reinit</command>
<subsystem>tile-manager</subsystem>
</binding>
</checkbox>
-->
<checkbox>
<halign>left</halign>
<label>Random vegetation</label>

View file

@ -605,6 +605,14 @@
</binding>
</item>
<item>
<label>Reload Scenery</label>
<binding>
<command>reinit</command>
<subsystem>tile-manager</subsystem>
</binding>
</item>
<item>
<label>Nasal Console</label>
<binding>