Merge branch 'master' of git://gitorious.org/fg/fgdata
This commit is contained in:
commit
352a9374c9
38 changed files with 4641 additions and 270 deletions
|
@ -81,7 +81,7 @@ var update_loop = func {
|
|||
# and the aircraft maximum rate. Both are expressed
|
||||
# in lbs/min
|
||||
var fuel_rate = math.min(tankers[0].getNode("refuel/max-fuel-transfer-lbs-min", 1).getValue() or 6000,
|
||||
refuelingN.getNode("max-fuel-transfer-lbs-min", 1).getValue());
|
||||
refuelingN.getNode("max-fuel-transfer-lbs-min", 1).getValue() or 6000);
|
||||
var received = UPDATE_PERIOD * fuel_rate / 60;
|
||||
consumed -= received;
|
||||
}
|
||||
|
|
0
Aircraft/Instruments-3d/kln94/auxPages.nas
Normal file
0
Aircraft/Instruments-3d/kln94/auxPages.nas
Normal file
249
Aircraft/Instruments-3d/kln94/cdi.svg
Normal file
249
Aircraft/Instruments-3d/kln94/cdi.svg
Normal file
|
@ -0,0 +1,249 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="744.09448819"
|
||||
height="1052.3622047"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="New document 1">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.4142136"
|
||||
inkscape:cx="447.91003"
|
||||
inkscape:cy="1152.5914"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1574"
|
||||
inkscape:window-height="1278"
|
||||
inkscape:window-x="131"
|
||||
inkscape:window-y="26"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="cdi"
|
||||
transform="translate(-18,-64)">
|
||||
<rect
|
||||
y="63.826897"
|
||||
x="18.384771"
|
||||
height="112.42998"
|
||||
width="494.26764"
|
||||
id="background"
|
||||
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||
<g
|
||||
style="fill:#ffffff"
|
||||
transform="translate(-75.698485,-187.25102)"
|
||||
id="g3776">
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
id="path2987"
|
||||
sodipodi:sides="4"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:arg2="0.78539816"
|
||||
inkscape:flatsided="true"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
transform="translate(49,-23.999995)" />
|
||||
<path
|
||||
transform="translate(84.25,-23.999995)"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
inkscape:randomized="0"
|
||||
inkscape:rounded="0"
|
||||
inkscape:flatsided="true"
|
||||
sodipodi:arg2="0.78539816"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:sides="4"
|
||||
id="path3768"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
sodipodi:type="star" />
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
id="path3770"
|
||||
sodipodi:sides="4"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:arg2="0.78539816"
|
||||
inkscape:flatsided="true"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
transform="translate(119.5,-23.999995)" />
|
||||
<path
|
||||
transform="translate(154.75,-23.999995)"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
inkscape:randomized="0"
|
||||
inkscape:rounded="0"
|
||||
inkscape:flatsided="true"
|
||||
sodipodi:arg2="0.78539816"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:sides="4"
|
||||
id="path3772"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
sodipodi:type="star" />
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
id="path3774"
|
||||
sodipodi:sides="4"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:arg2="0.78539816"
|
||||
inkscape:flatsided="true"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
transform="translate(190,-23.999995)" />
|
||||
</g>
|
||||
<g
|
||||
style="fill:#ffffff"
|
||||
id="g3783"
|
||||
transform="translate(135.01934,-187.25102)">
|
||||
<path
|
||||
transform="translate(49,-23.999995)"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
inkscape:randomized="0"
|
||||
inkscape:rounded="0"
|
||||
inkscape:flatsided="true"
|
||||
sodipodi:arg2="0.78539816"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:sides="4"
|
||||
id="path3785"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
sodipodi:type="star" />
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
id="path3787"
|
||||
sodipodi:sides="4"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:arg2="0.78539816"
|
||||
inkscape:flatsided="true"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
transform="translate(84.25,-23.999995)" />
|
||||
<path
|
||||
transform="translate(119.5,-23.999995)"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
inkscape:randomized="0"
|
||||
inkscape:rounded="0"
|
||||
inkscape:flatsided="true"
|
||||
sodipodi:arg2="0.78539816"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:sides="4"
|
||||
id="path3789"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
sodipodi:type="star" />
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
id="path3791"
|
||||
sodipodi:sides="4"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:arg2="0.78539816"
|
||||
inkscape:flatsided="true"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
transform="translate(154.75,-23.999995)" />
|
||||
<path
|
||||
transform="translate(190,-23.999995)"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
inkscape:randomized="0"
|
||||
inkscape:rounded="0"
|
||||
inkscape:flatsided="true"
|
||||
sodipodi:arg2="0.78539816"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:sides="4"
|
||||
id="path3793"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
sodipodi:type="star" />
|
||||
</g>
|
||||
<rect
|
||||
y="68.069527"
|
||||
x="276.56424"
|
||||
height="50.204582"
|
||||
width="9.1923885"
|
||||
id="center-bar"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none" />
|
||||
</g>
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 236.79631,39.261933 25.4951,-25.495099 25.4951,25.495098 z"
|
||||
id="deviation-marker"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 8.3 KiB |
0
Aircraft/Instruments-3d/kln94/flightplanPages.nas
Normal file
0
Aircraft/Instruments-3d/kln94/flightplanPages.nas
Normal file
1100
Aircraft/Instruments-3d/kln94/kln94.ac
Normal file
1100
Aircraft/Instruments-3d/kln94/kln94.ac
Normal file
File diff suppressed because it is too large
Load diff
BIN
Aircraft/Instruments-3d/kln94/kln94.blend
Normal file
BIN
Aircraft/Instruments-3d/kln94/kln94.blend
Normal file
Binary file not shown.
385
Aircraft/Instruments-3d/kln94/kln94.nas
Normal file
385
Aircraft/Instruments-3d/kln94/kln94.nas
Normal file
|
@ -0,0 +1,385 @@
|
|||
var kln94 = nil;
|
||||
|
||||
var KLN94 = {
|
||||
|
||||
Page: {
|
||||
new : func(owner, s, idx)
|
||||
{
|
||||
m = {
|
||||
parents:[KLN94.Page],
|
||||
section: s,
|
||||
index: idx
|
||||
};
|
||||
return m;
|
||||
},
|
||||
|
||||
# encode various behavioural flags as predicates
|
||||
# real Pages can over-ride these defaults as needed
|
||||
hasActiveIdent: func { return 0; },
|
||||
numberOfCyanLines: func { return 0; },
|
||||
showsCDI: func { return 0; },
|
||||
isMulti: func { return 0; },
|
||||
|
||||
# cursor stuff
|
||||
|
||||
display: func(gps)
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
refresh: func(gps)
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
pageNames : ['APT', 'VOR', 'NDB', 'INT', 'USR', 'ACT', 'NAV', 'FPL', 'SET', 'AUX'],
|
||||
|
||||
PAGE_APT: 0,
|
||||
PAGE_VOR: 1,
|
||||
PAGE_NDB: 2,
|
||||
PAGE_INT: 3,
|
||||
PAGE_USR: 4,
|
||||
PAGE_ACT: 5,
|
||||
PAGE_NAV: 6,
|
||||
PAGE_FPL: 7,
|
||||
PAGE_SET: 8,
|
||||
PAGE_AUX: 9,
|
||||
|
||||
|
||||
PAGE_BAR_HEIGHT: 20,
|
||||
NAV_DATA_WIDTH: 128,
|
||||
|
||||
canvas_settings: {
|
||||
"name": "KLN94",
|
||||
"size": [512, 256],
|
||||
"view": [480, 160],
|
||||
"mipmapping": 1,
|
||||
},
|
||||
|
||||
new : func(prop1, placement)
|
||||
{
|
||||
m = { parents : [KLN94]};
|
||||
|
||||
m.rootNode = props.globals.initNode(prop1);
|
||||
m._setupCanvas(placement);
|
||||
m._page = nil;
|
||||
|
||||
m._messageScreenActive = 0;
|
||||
m._messages = [];
|
||||
|
||||
m._cursorActive = 0;
|
||||
m._cursorField = 0;
|
||||
m._enterAction = nil;
|
||||
|
||||
|
||||
m._setupProps();
|
||||
|
||||
return m;
|
||||
},
|
||||
|
||||
_setupCanvas: func(placement)
|
||||
{
|
||||
me._canvas = canvas.new(KLN94.canvas_settings);
|
||||
var text_style = {
|
||||
'font': "LiberationFonts/LiberationMono-Bold.ttf",
|
||||
'character-size': 34,
|
||||
'character-aspect-ratio': 1.2
|
||||
};
|
||||
|
||||
me.rootNode.initNode('brightness-norm', 0.5, 'DOUBLE');
|
||||
|
||||
me._canvas.setColorBackground(1.0, 0.0, 0.0);
|
||||
me._canvas.addPlacement(placement);
|
||||
|
||||
me._navDataArea = me._canvas.createGroup();
|
||||
me._navDataArea.setTranslation(0, 0);
|
||||
me._navDataLines = [];
|
||||
|
||||
var navAreaH = (KLN94.canvas_settings.view[1] - KLN94.PAGE_BAR_HEIGHT) / 2;
|
||||
var r1 = me._navDataArea.rect(0, 0, KLN94.NAV_DATA_WIDTH, navAreaH);
|
||||
var r2 = me._navDataArea.rect(0, navAreaH, KLN94.NAV_DATA_WIDTH, navAreaH);
|
||||
r1.setColor(0,1,1); # cyan
|
||||
r2.setColor(0,1,1);
|
||||
|
||||
var lineH = (KLN94.canvas_settings.view[1] - KLN94.PAGE_BAR_HEIGHT) / 5;
|
||||
|
||||
for (var i=0; i<4; i +=1) {
|
||||
var t = me._navDataArea.createChild("text");
|
||||
t.setColor(1, 1, 1);
|
||||
t._node.setValues(text_style);
|
||||
t.setAlignment("left-center");
|
||||
t.setTranslation(0.0, (i + 0.5) * lineH);
|
||||
append(me._navDataLines, t);
|
||||
}
|
||||
|
||||
me._pageBarArea = me._canvas.createGroup();
|
||||
me._pageBarArea.setTranslation(0, KLN94.canvas_settings.view[1] - KLN94.PAGE_BAR_HEIGHT);
|
||||
|
||||
var ln = me._pageBarArea.createChild('path');
|
||||
ln.setColor(0,1,1); # cyan
|
||||
|
||||
me._pageBarText = me._pageBarArea.createChild("text");
|
||||
me._pageBarText._node.setValues(text_style);
|
||||
me._pageBarText.setAlignment("left-center");
|
||||
me._pageBarText.setColor(0, 0, 1);
|
||||
|
||||
me._pageBarInverseText = me._pageBarArea.createChild("text");
|
||||
me._pageBarInverseText._node.setValues(text_style);
|
||||
me._pageBarInverseText.setAlignment("left-center");
|
||||
me._pageBarInverseText.setColor(1, 1, 1);
|
||||
me._pageBarInverseText.setColorFill(0, 0, 1);
|
||||
|
||||
me._pageArea = me._canvas.createGroup();
|
||||
me._pageBarArea.setTranslation(100, 0);
|
||||
|
||||
me._pageAreaLines = [];
|
||||
for (var i=0; i<5; i +=1) {
|
||||
var t = me._pageArea.createChild("text");
|
||||
t.setColor(0, 1, 0);
|
||||
t._node.setValues(text_style);
|
||||
t.setAlignment("left-center");
|
||||
t.setTranslation(0.0, (i + 0.5) * lineH);
|
||||
append(me._pageAreaLines, t);
|
||||
}
|
||||
|
||||
# inverted text block
|
||||
me._pageAreaInverted = me._pageArea.createChild("text");
|
||||
me._pageAreaInverted.setColor(0, 0, 0);
|
||||
me._pageAreaInverted.setColorFill(0, 1, 0);
|
||||
me._pageAreaInverted._node.setValues(text_style);
|
||||
me._pageAreaInverted.setAlignment("left-center");
|
||||
|
||||
me._cdiGroup = me._pageArea.createChild("group");
|
||||
canvas.parsesvg(me._cdiGroup, resolvepath('Aircraft/Instruments-3d/kln94/cdi.svg'));
|
||||
me._cdiGroup.setTranslation(0, lineH);
|
||||
},
|
||||
|
||||
_setupProps: func
|
||||
{
|
||||
var p = me.rootNode;
|
||||
me.props = {
|
||||
distanceToActiveNm: p.getNode(),
|
||||
groundspeedKt: p.getNode(),
|
||||
activeIdent: p.getNode(),
|
||||
previousIdent: p.getNode(),
|
||||
obsBearing: p.getNode(),
|
||||
legTrack: p.getNode(),
|
||||
groundTrack: p.getNode(),
|
||||
cdiDeviationNm: p.getNode(),
|
||||
};
|
||||
},
|
||||
|
||||
_setActivePage: func(pg)
|
||||
{
|
||||
me._page = pg;
|
||||
if (pg == nil) return;
|
||||
|
||||
# update line colors
|
||||
for (var l=0; l<4; l+=1) {
|
||||
me._pageAreaLines[l].setColor(0, 1, l < pg.numberOfCyanLines() ? 1 : 0);
|
||||
}
|
||||
|
||||
# hide or show the CDI area as appropriate
|
||||
me._cdiGroup.setVisible(pg.showsCDI());
|
||||
},
|
||||
|
||||
_updateNavData : func
|
||||
{
|
||||
me._navDataLines[0].setText(sprintf('%4dnm', me._props.distanceToActiveNm.getValue()));
|
||||
if (me._page.hasActiveIdent()) {
|
||||
me._navDataLines[1].setText(sprintf('%4dkt', me._props.groundspeedKt.getValue()));
|
||||
} else {
|
||||
me._navDataLines[1].setText(me._props.activeIdent.getValue());
|
||||
}
|
||||
if (me._obsMode) {
|
||||
me._navDataLines[2].setText(sprintf('OBS%03d*', me._props.obsBearing.getValue()));
|
||||
} else {
|
||||
me._navDataLines[2].setText(sprintf('DTK%03d*', me._props.legTrack.getValue()));
|
||||
}
|
||||
me._navDataLines[3].setText(sprintf(' TK%03d*', me._props.groundTrack.getValue()));
|
||||
},
|
||||
|
||||
_updateAnnunciationArea : func
|
||||
{
|
||||
if (size(me._messages) > 0) {
|
||||
# show 'M' symbol
|
||||
}
|
||||
|
||||
if (me._enterAction != nil) {
|
||||
# show 'ENT' symbol
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_updatePageBar : func
|
||||
{
|
||||
# hide in NAV-4 mode
|
||||
if (me.inNav4Mode()) {
|
||||
me._pageBarGroup.setVisible(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (me._cursorActive) {
|
||||
me._pageBarText.setText('');
|
||||
var t = ' * CRSR * ' ~ me.pageNames[activePage] ~ ' * CRSR *';
|
||||
me._pageBarInverseText.setText(t);
|
||||
return;
|
||||
}
|
||||
|
||||
# assemble the string
|
||||
var barString = '';
|
||||
var inverseBarString = '';
|
||||
var activePage = me.pageIndex[0];
|
||||
|
||||
for (var i=0; i < 10; i += 1) {
|
||||
if (activePage == i) {
|
||||
var sep = me.isMultiPage() ? '+' : ' ';
|
||||
inverseBarString ~= me.pageNames[i] ~ sep ~ me.pageIndex[1];
|
||||
barString ~= ' '; # 5 spaces
|
||||
} else {
|
||||
barString ~= ' ' ~ me.pageNames[i];
|
||||
if (i < activePage)
|
||||
inverseBarString ~= ' '; # 4 spaces
|
||||
}
|
||||
}
|
||||
|
||||
me._pageBarText.setText(barString);
|
||||
me._pageBarInverseText.setText(inverseBarString);
|
||||
},
|
||||
|
||||
_setInverted: func(line, firstcol, numcols=1)
|
||||
{
|
||||
var t = me._pageAreaInverted;
|
||||
var cellW = 20.0;
|
||||
var lineH = (KLN94.canvas_settings.view[1] - KLN94.PAGE_BAR_HEIGHT) / 5;
|
||||
t.setTranslation(firstcol * cellW, (line + 0.5) * lineH);
|
||||
t.setText(substr(me._pageAreaLines[line].getText(), firstcol, numcols));
|
||||
t.setVisible(1);
|
||||
},
|
||||
|
||||
_setBlink: func(line, firstcol, numcols=1)
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
isPageActive: func(nm, idx)
|
||||
{
|
||||
if (me._page == nil) return 0;
|
||||
return (me._page.section == nm) and (me._page.index == idx);
|
||||
},
|
||||
|
||||
isMultiPage: func { return me._page.isMulti(); },
|
||||
|
||||
toggleCursor: func
|
||||
{
|
||||
me._cursorActive = !me._cursorActive;
|
||||
if (me._cursorActive) {
|
||||
me._cursorField = 0;
|
||||
}
|
||||
|
||||
me._updatePageBar();
|
||||
},
|
||||
|
||||
messageButton: func
|
||||
{
|
||||
if (me._messageScreenActive) {
|
||||
me._messages = me._messages[1:]; # pop front
|
||||
if (size(me._messages) == 0) {
|
||||
me._messageScreenActive = 0;
|
||||
# refresh normal screen
|
||||
return;
|
||||
}
|
||||
|
||||
me._buildMessageScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
if (size(me._messages) == 0) {
|
||||
debug.dump('no messages to show');
|
||||
return;
|
||||
}
|
||||
|
||||
me._messageScreenActive = 1;
|
||||
me._buildMessageScreen();
|
||||
},
|
||||
|
||||
_buildMessageScreen: func
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
# Nav4 mode is special
|
||||
inNav4Mode: func { return me.isPageActive(NAV, 4); },
|
||||
|
||||
formatDuration: func(timeInSeconds)
|
||||
{
|
||||
if (timeInSeconds > 60) {
|
||||
return sprintf("0:%02d", timeInSeconds);
|
||||
}
|
||||
|
||||
if (timeInSeconds > 3600) {
|
||||
var mins = int(timeInSeconds / 60);
|
||||
var secs = timeInSeconds - (mins * 60);
|
||||
return sprintf("%d:%02d", mins, secs);
|
||||
}
|
||||
|
||||
var hours = int(timeInSeconds / 3600);
|
||||
timeInSeconds -= (hours * 3600);
|
||||
var mins = int(timeInSeconds / 60);
|
||||
var secs = timeInSeconds - (mins * 60);
|
||||
return sprintf("%d:%02d:%02d", hours, mins, secs);
|
||||
},
|
||||
|
||||
formatLatitude: func(lat)
|
||||
{
|
||||
var north = (lat >= 0.0);
|
||||
var latDeg = int(lat);
|
||||
var latMinutes = math.abs(lat - latDeg) * 60;
|
||||
return sprintf('%s%02d*%04.1f', north ? "N" : "S", abs(latDeg), latMinutes);
|
||||
},
|
||||
|
||||
formatLongitude: func(lon)
|
||||
{
|
||||
var east = (lon >= 0.0);
|
||||
var lonDeg = int(lon);
|
||||
var lonMinutes = math.abs(lon - lonDeg) * 60;
|
||||
sprintf("%s%03d*%04.1f", east ? 'E' : 'W', abs(lonDeg), lonMinutes);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
reload_gps = func
|
||||
{
|
||||
kln94._setActivePage(nil); # force existing page to be undisplayed cleanly
|
||||
|
||||
# make the cdu instance available inside the module namespace
|
||||
# we are going to load into.
|
||||
# for a reload this also wipes the existing namespace, which we want
|
||||
globals['kln94_NS'] = { gps: kln94, KLN94:KLN94 };
|
||||
|
||||
var pages = ['navPages.nas', 'infoPages.nas', 'flightplanPages.nas', 'settingPages.nas', 'auxPages.nas'];
|
||||
|
||||
#var settings = props.globals.getNode('/instrumentation/cdu/settings');
|
||||
foreach (var path; pages) {
|
||||
# resolve the path in FG_ROOT, and --fg-aircraft dir, etc
|
||||
var abspath = resolvepath('Aircraft/Instruments-3d/kln94/' ~ path);
|
||||
if (io.stat(abspath) == nil) {
|
||||
debug.dump('KN94 page not found:', path, abspath);
|
||||
continue;
|
||||
}
|
||||
|
||||
# load pages code into a seperate namespace which we defined above
|
||||
# also means we can clean out that namespace later
|
||||
io.load_nasal(abspath, 'kln94_NS');
|
||||
}
|
||||
# cdu.displayPageByTag(getprop('/instrumentation/cdu/settings/boot-page'));
|
||||
};
|
||||
|
||||
setlistener("/nasal/canvas/loaded", func
|
||||
{
|
||||
# create base PGS
|
||||
kln94 = KLN94.new('/instrumentation/gps', {"node": "screen"});
|
||||
reload_gps();
|
||||
}, 1);
|
BIN
Aircraft/Instruments-3d/kln94/kln94.png
Normal file
BIN
Aircraft/Instruments-3d/kln94/kln94.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
164
Aircraft/Instruments-3d/kln94/kln94.xml
Normal file
164
Aircraft/Instruments-3d/kln94/kln94.xml
Normal file
|
@ -0,0 +1,164 @@
|
|||
<PropertyList>
|
||||
|
||||
<path>kln94.ac</path>
|
||||
|
||||
<!--
|
||||
<animation>
|
||||
<type>material</type>
|
||||
<texture alias="../../texture"/>
|
||||
</animation>
|
||||
|
||||
<effect>
|
||||
<inherits-from>Effects/lightmap</inherits-from>
|
||||
<parameters>
|
||||
<texture n="1">
|
||||
<image>Aircraft/Instruments-3d/cdu2/boeing_lightmap.png</image>
|
||||
</texture>
|
||||
<condition><use>/instrumentation/cdu/serviceable</use></condition>
|
||||
|
||||
<factor><use>/instrumentation/cdu/brightness-norm</use></factor>
|
||||
</parameters>
|
||||
<object-name>CDU</object-name>
|
||||
<object-name>Btn.side.r.1</object-name>
|
||||
<object-name>Btn.side.r.2</object-name>
|
||||
<object-name>Btn.side.r.3</object-name>
|
||||
<object-name>Btn.side.r.4</object-name>
|
||||
<object-name>Btn.side.r.5</object-name>
|
||||
<object-name>Btn.side.r.6</object-name>
|
||||
</effect> -->
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>ent-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.enter();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>crsr-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.toggleCursorMode();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>nrst-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.nearestButton();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>dto-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.directTo();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>obs-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.obsButton();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>msg-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.messageButton();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>alt-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.altitudeButton();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>clr-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.clearButton();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>knob</type>
|
||||
<object-name>knob-inner</object-name>
|
||||
<action>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.innerKnob(cmdarg().getNode('offset').getValue());</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>knob</type>
|
||||
<object-name>knob-outer</object-name>
|
||||
<action>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.outerKnob(cmdarg().getNode('offset').getValue());</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
|
||||
<animation>
|
||||
<type>knob</type>
|
||||
<object-name>knob-brightness</object-name>
|
||||
<action>
|
||||
<binding>
|
||||
<command>property-adjust</command>
|
||||
<property>/instrumentation/kln94/brightness-norm</property>
|
||||
<step>0.05</step>
|
||||
<min>0</min>
|
||||
<max>1</max>
|
||||
<wrap>false</wrap>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
</PropertyList>
|
BIN
Aircraft/Instruments-3d/kln94/knob.rgb
Normal file
BIN
Aircraft/Instruments-3d/kln94/knob.rgb
Normal file
Binary file not shown.
80
Aircraft/Instruments-3d/kln94/navPages.nas
Normal file
80
Aircraft/Instruments-3d/kln94/navPages.nas
Normal file
|
@ -0,0 +1,80 @@
|
|||
|
||||
|
||||
var Nav1Page =
|
||||
{
|
||||
a:2,
|
||||
|
||||
|
||||
new: func()
|
||||
{
|
||||
m = {parents: [Nav1Page, KLN94.Page.new(KLN94.PAGE_NAV, 0)]};
|
||||
return m;
|
||||
},
|
||||
|
||||
hasActiveIdent: func { 1 },
|
||||
showsCDI: func { 1 },
|
||||
|
||||
display: func(gps)
|
||||
{
|
||||
if (gps.isDirectToActive()) {
|
||||
|
||||
} else {
|
||||
# leg mode
|
||||
gps.setLine(0, sprintf('%6s->%6s',
|
||||
gps.props.previousIdent.getStringValue(),
|
||||
gps.props.activeIdent.getStringValue())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
gps.setLine(3, ' VNV Off');
|
||||
|
||||
var toFrom = gps.isTo() ? 'To' : 'Fr';
|
||||
var eteToWp1 = gps.formatDuration(gps.props.timeToWaypoint.getIntValue());
|
||||
gps.setLine(4, sprintf('%03d*%s ', bearingToWp1, toFrom) ~ eteToWp1);
|
||||
},
|
||||
|
||||
refresh: func(gps)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var Nav2Page =
|
||||
{
|
||||
new: func()
|
||||
{
|
||||
m = {parents: [Nav2Page, KLN94.Page.new(KLN94.PAGE_NAV, 1)]};
|
||||
return m;
|
||||
},
|
||||
|
||||
display: func(gps)
|
||||
{
|
||||
# select refnavaid!
|
||||
|
||||
gps.setLine(0, ' PRESENT POSN'),
|
||||
gps.setLine(1, ' Ref:%s', gps.refNavaid.id);
|
||||
|
||||
gps.setLine(3, ' ' + gps.formatLatitude(gps.props.indicatedLat.getDoubleValue()));
|
||||
gps.setLine(4, ' ' + gps.formatLongitude(gps.props.indicatedLon.getDoubleValue()));
|
||||
}
|
||||
};
|
||||
|
||||
var Nav3Page =
|
||||
{
|
||||
new: func()
|
||||
{
|
||||
m = {parents: [Nav3Page, KLN94.Page.new(KLN94.PAGE_NAV, 2)]};
|
||||
return m;
|
||||
},
|
||||
};
|
||||
|
||||
var nav1 = Nav1Page.new();
|
||||
gps.addPage(nav1);
|
||||
|
||||
|
||||
gps.addPage(Nav2Page.new());
|
||||
gps.addPage(Nav3Page.new());
|
||||
|
||||
|
||||
|
0
Aircraft/Instruments-3d/kln94/settingPages.nas
Normal file
0
Aircraft/Instruments-3d/kln94/settingPages.nas
Normal file
0
Aircraft/Instruments-3d/kln94/waypointPages.nas
Normal file
0
Aircraft/Instruments-3d/kln94/waypointPages.nas
Normal file
|
@ -11,6 +11,7 @@
|
|||
<altitude><use>/sim/rendering/eye-altitude-m</use></altitude>
|
||||
<cloud_self_shading><use>/environment/cloud-self-shading</use></cloud_self_shading>
|
||||
<moonlight><use>/environment/moonlight</use></moonlight>
|
||||
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
|
||||
<visibility><use>/environment/visibility-m</use></visibility>
|
||||
</parameters>
|
||||
|
||||
|
@ -107,6 +108,11 @@
|
|||
<type>float</type>
|
||||
<value><use>moonlight</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>air_pollution</name>
|
||||
<type>float</type>
|
||||
<value><use>air_pollution</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
<type>float</type>
|
||||
|
|
|
@ -45,6 +45,13 @@
|
|||
<wrap-t>repeat</wrap-t>
|
||||
<internal-format>normalized</internal-format>
|
||||
</texture>
|
||||
<texture n="10">
|
||||
<image>Textures.high/Terrain/packice-overlay.png</image>
|
||||
<filter>linear-mipmap-linear</filter>
|
||||
<wrap-s>repeat</wrap-s>
|
||||
<wrap-t>repeat</wrap-t>
|
||||
<internal-format>normalized</internal-format>
|
||||
</texture>
|
||||
<normalmap_dds type="float">0.0</normalmap_dds>
|
||||
<saturation>
|
||||
<use>/rendering/scene/saturation</use>
|
||||
|
@ -132,6 +139,9 @@
|
|||
<fogtype>
|
||||
<use>/sim/rendering/shaders/skydome</use>
|
||||
</fogtype>
|
||||
<ice_cover>
|
||||
<use>/environment/sea/surface/ice-cover</use>
|
||||
</ice_cover>
|
||||
<!-- sea colors -->
|
||||
<sea_r>
|
||||
<use>/environment/sea/color_r</use>
|
||||
|
@ -312,6 +322,24 @@
|
|||
<use>texture[6]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
<texture-unit>
|
||||
<unit>7</unit>
|
||||
<image>
|
||||
<use>texture[10]/image</use>
|
||||
</image>
|
||||
<filter>
|
||||
<use>texture[10]/filter</use>
|
||||
</filter>
|
||||
<wrap-s>
|
||||
<use>texture[10]/wrap-s</use>
|
||||
</wrap-s>
|
||||
<wrap-t>
|
||||
<use>texture[10]/wrap-t</use>
|
||||
</wrap-t>
|
||||
<internal-format>
|
||||
<use>texture[10]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
|
||||
<program>
|
||||
<vertex-shader>Shaders/water_lightfield.vert</vertex-shader>
|
||||
|
@ -342,6 +370,11 @@
|
|||
<type>sampler-2d</type>
|
||||
<value type="int">6</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>ice_texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">7</value>
|
||||
</uniform>
|
||||
<!-- normalmap is .dds-->
|
||||
<uniform>
|
||||
<name>normalmap_dds</name>
|
||||
|
@ -486,6 +519,11 @@
|
|||
<type>float</type>
|
||||
<value><use>cloud_self_shading</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>ice_cover</name>
|
||||
<type>float</type>
|
||||
<value><use>ice_cover</use></value>
|
||||
</uniform>
|
||||
<!-- sea colors -->
|
||||
<uniform>
|
||||
<name>sea_r</name>
|
||||
|
|
|
@ -404,6 +404,9 @@
|
|||
<color_r type="double" userarchive="n">0.148</color_r>
|
||||
<color_g type="double" userarchive="n">0.27</color_g>
|
||||
<color_b type="double" userarchive="n">0.3</color_b>
|
||||
<surface>
|
||||
<ice-cover> 0.0</ice-cover>
|
||||
</surface>
|
||||
</sea>
|
||||
|
||||
<!-- definitions for the scattering skydome shader -->
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
General Public License for more details.
|
||||
-->
|
||||
<!--
|
||||
Compute local weather related properties
|
||||
Compute Atmospheric Light Shading related properties
|
||||
-->
|
||||
<PropertyList>
|
||||
|
||||
|
@ -45,4 +45,710 @@
|
|||
<type>gain</type>
|
||||
<gain>0.30480</gain>
|
||||
</filter>
|
||||
|
||||
<!-- Properties used by the atmospheric scattering shader, when not being set directly
|
||||
by Advanced Weather -->
|
||||
|
||||
<filter>
|
||||
<!-- Ground visibility. Same as lowest boundary layer. -->
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:ground-visibility-m</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>/environment/config/boundary/entry[0]/visibility-m</input>
|
||||
<output>/environment/ground-visibility-m</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<!-- Ground haze level - assumed to be up to the lowest cloud layer. -->
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:GroundHazeThickness</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
</sum>
|
||||
</expression>
|
||||
</input>
|
||||
<gain>
|
||||
<!-- feet to meters -->
|
||||
<value>0.3048</value>
|
||||
</gain>
|
||||
<u_min>
|
||||
<value>0</value>
|
||||
</u_min>
|
||||
<u_max>
|
||||
<!-- haze maxes out at 6000ft. Could probably do something using lapse rates instead -->
|
||||
<value>2000</value>
|
||||
</u_max>
|
||||
<output>/environment/ground-haze-thickness-m</output>
|
||||
</filter>
|
||||
|
||||
<!-- Build up the ground level scattering from 1 for clear skies to 0.6 for overcast -->
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:GroundScattering:0:Clear</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<equals>
|
||||
<property>/environment/clouds/layer[0]/coverage</property>
|
||||
<value>clear</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<value>1</value>
|
||||
</input>
|
||||
<output>/environment/surface/ground-scattering</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:GroundScattering:0:Few</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<equals>
|
||||
<property>/environment/clouds/layer[0]/coverage</property>
|
||||
<value>few</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<value>0.9</value>
|
||||
</input>
|
||||
<output>/environment/surface/ground-scattering</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:GroundScattering:0:Scattered</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<equals>
|
||||
<property>/environment/clouds/layer[0]/coverage</property>
|
||||
<value>scattered</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<value>0.8</value>
|
||||
</input>
|
||||
<output>/environment/surface/ground-scattering</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:GroundScattering:0:Broken</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<equals>
|
||||
<property>/environment/clouds/layer[0]/coverage</property>
|
||||
<value>broken</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<value>0.7</value>
|
||||
</input>
|
||||
<output>/environment/surface/ground-scattering</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:GroundScattering:0:Overcast</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<equals>
|
||||
<property>/environment/clouds/layer[0]/coverage</property>
|
||||
<value>overcast</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<value>0.6</value>
|
||||
</input>
|
||||
<output>/environment/surface/ground-scattering</output>
|
||||
</filter>
|
||||
|
||||
<!-- TODO: Handle layers beyond the first -->
|
||||
|
||||
<!-- Set the scattering at the aircraft level -->
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Scattering:AircraftAboveLayer</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<greater-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<expression>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
</sum>
|
||||
</expression>
|
||||
</greater-than>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<value>1</value>
|
||||
</input>
|
||||
<output>/rendering/scene/scattering</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Scattering:AircraftBelowLayer</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<less-than-equals>
|
||||
<property>/position/altitude-ft</property>
|
||||
<expression>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
</sum>
|
||||
</expression>
|
||||
</less-than-equals>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>/environment/surface/ground-scattering</input>
|
||||
<output>/rendering/scene/scattering</output>
|
||||
</filter>
|
||||
|
||||
<!-- Clouds self-shading -->
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:CloudSelfShading</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<!-- TODO : Make this sun-angle dependent -->
|
||||
<value>1.0</value>
|
||||
</input>
|
||||
<output>/environment/cloud-self-shading</output>
|
||||
</filter>
|
||||
|
||||
<!-- Skydome parameters - /sim/rendering/[mie|rayleigh|dome-density] -->
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:VisFactor</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<product>
|
||||
<difference>
|
||||
<property>/environment/visibility-m</property>
|
||||
<value>30000</value>
|
||||
</difference>
|
||||
<value>0.000011111</value>
|
||||
</product>
|
||||
</expression>
|
||||
</input>
|
||||
<u_min>0.0</u_min>
|
||||
<u_max>1.0</u_max>
|
||||
<output>/sim/rendering/skydome-vis-factor</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Rayleigh:Low</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<less-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<value>36000</value>
|
||||
</less-than>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<difference>
|
||||
<value>0.0003</value>
|
||||
<product>
|
||||
<property>/sim/rendering/skydome-vis-factor</property>
|
||||
<value>0.0001</value>
|
||||
</product>
|
||||
</difference>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/sim/rendering/rayleigh-no-polution</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Rayleigh:Medium</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<greater-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<value>36000</value>
|
||||
</greater-than>
|
||||
<less-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<value>85000</value>
|
||||
</less-than>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<difference>
|
||||
<difference>
|
||||
<value>0.0003</value>
|
||||
<product>
|
||||
<property>/sim/rendering/skydome-vis-factor</property>
|
||||
<value>0.0001</value>
|
||||
</product>
|
||||
</difference>
|
||||
<product>
|
||||
<difference>
|
||||
<property>/position/altitude-ft</property>
|
||||
<value>36000</value>
|
||||
</difference>
|
||||
<value>0.000000002</value>
|
||||
</product>
|
||||
</difference>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/sim/rendering/rayleigh-no-polution</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Rayleigh:High</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<greater-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<value>85000</value>
|
||||
</greater-than>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<difference>
|
||||
<value>0.0002</value>
|
||||
<product>
|
||||
<property>/sim/rendering/skydome-vis-factor</property>
|
||||
<value>0.0001</value>
|
||||
</product>
|
||||
</difference>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/sim/rendering/rayleigh-no-polution</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Rayleight:Polution:Low</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<less-than-equals>
|
||||
<property>/position/altitude-ft</property>
|
||||
<expression>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
</sum>
|
||||
</expression>
|
||||
</less-than-equals>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<sum>
|
||||
<property>/sim/rendering/rayleigh-no-polution</property>
|
||||
<product>
|
||||
<property>/environment/air-pollution-norm</property>
|
||||
<value>0.0003</value>
|
||||
</product>
|
||||
<product>
|
||||
<property>/environment/air-pollution-norm</property>
|
||||
<value>0.0004</value>
|
||||
<difference>
|
||||
<value>1.0</value>
|
||||
<product>
|
||||
<div>
|
||||
<property>/position/altitude-ft</property>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
<value>1.0</value><!-- to avoid divide by 0 exceptions -->
|
||||
</sum>
|
||||
</div>
|
||||
<div>
|
||||
<property>/position/altitude-ft</property>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
<value>1.0</value><!-- to avoid divide by 0 exceptions -->
|
||||
</sum>
|
||||
</div>
|
||||
</product>
|
||||
</difference>
|
||||
</product>
|
||||
</sum>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/sim/rendering/rayleigh</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Rayleight:Polution:High</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<greater-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<expression>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
</sum>
|
||||
</expression>
|
||||
</greater-than>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<sum>
|
||||
<property>/sim/rendering/rayleigh-no-polution</property>
|
||||
<product>
|
||||
<property>/environment/air-pollution-norm</property>
|
||||
<value>0.0003</value>
|
||||
</product>
|
||||
</sum>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/sim/rendering/rayleigh</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Mie:Low</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<less-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<value>36000</value>
|
||||
</less-than>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<difference>
|
||||
<value>0.005</value>
|
||||
<product>
|
||||
<property>/sim/rendering/skydome-vis-factor</property>
|
||||
<value>0.002</value>
|
||||
</product>
|
||||
</difference>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/sim/rendering/mie</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Mie:Medium</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<greater-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<value>36000</value>
|
||||
</greater-than>
|
||||
<less-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<value>85000</value>
|
||||
</less-than>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<difference>
|
||||
<difference>
|
||||
<value>0.005</value>
|
||||
<product>
|
||||
<property>/sim/rendering/skydome-vis-factor</property>
|
||||
<value>0.002</value>
|
||||
</product>
|
||||
</difference>
|
||||
<product>
|
||||
<difference>
|
||||
<property>/position/altitude-ft</property>
|
||||
<value>36000</value>
|
||||
</difference>
|
||||
<value>0.00000004</value>
|
||||
</product>
|
||||
</difference>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/sim/rendering/mie</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Mie:High</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<greater-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<value>85000</value>
|
||||
</greater-than>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<difference>
|
||||
<value>0.003</value>
|
||||
<product>
|
||||
<property>/sim/rendering/skydome-vis-factor</property>
|
||||
<value>0.002</value>
|
||||
</product>
|
||||
</difference>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/sim/rendering/mie</output>
|
||||
</filter>
|
||||
|
||||
<!-- Density -->
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Density:Low</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<less-than-equals>
|
||||
<property>/position/altitude-ft</property>
|
||||
<expression>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
</sum>
|
||||
</expression>
|
||||
</less-than-equals>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<sum>
|
||||
<value>0.3</value>
|
||||
<product>
|
||||
<property>/environment/air-pollution-norm</property>
|
||||
<value>0.05</value>
|
||||
</product>
|
||||
<product>
|
||||
<property>/environment/air-pollution-norm</property>
|
||||
<value>0.05</value>
|
||||
<difference>
|
||||
<value>1.0</value>
|
||||
<product>
|
||||
<div>
|
||||
<property>/position/altitude-ft</property>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
<value>1.0</value><!-- to avoid divide by 0 exceptions -->
|
||||
</sum>
|
||||
</div>
|
||||
<div>
|
||||
<property>/position/altitude-ft</property>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
<value>1.0</value><!-- to avoid divide by 0 exceptions -->
|
||||
</sum>
|
||||
</div>
|
||||
</product>
|
||||
</difference>
|
||||
</product>
|
||||
</sum>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/sim/rendering/dome-density</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Density:High</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<and>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
<greater-than>
|
||||
<property>/position/altitude-ft</property>
|
||||
<expression>
|
||||
<sum>
|
||||
<property>/environment/clouds/layer[0]/elevation-ft</property>
|
||||
<property>/environment/clouds/layer[0]/thickness-ft</property>
|
||||
</sum>
|
||||
</expression>
|
||||
</greater-than>
|
||||
</and>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<sum>
|
||||
<value>0.3</value>
|
||||
<product>
|
||||
<property>/environment/air-pollution-norm</property>
|
||||
<value>0.05</value>
|
||||
</product>
|
||||
</sum>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/sim/rendering/dome-density</output>
|
||||
</filter>
|
||||
|
||||
<!-- Mean elevation. No easy way to do this, so we'll just use the altitude of the nearest METAR station -->
|
||||
<filter>
|
||||
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:MeanElevation</name>
|
||||
<type>gain</type>
|
||||
<enable>
|
||||
<condition>
|
||||
<not>
|
||||
<property>/nasal/local_weather/enabled</property>
|
||||
<value>true</value>
|
||||
</not>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<expression>
|
||||
<product>
|
||||
<property>/environment/metar[0]/station-elevation-ft</property>
|
||||
<value>0.3048</value>
|
||||
</product>
|
||||
</expression>
|
||||
</input>
|
||||
<output>/environment/mean-terrain-elevation-m</output>
|
||||
</filter>
|
||||
|
||||
</PropertyList>
|
||||
|
|
33
Materials/regions/madagascar.xml
Normal file
33
Materials/regions/madagascar.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- General settings for all Madagascar materials -->
|
||||
<PropertyList>
|
||||
<!-- Define Madagascar 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>40.0</value>
|
||||
</greater-than>
|
||||
<less-than>
|
||||
<property>position/longitude-deg</property>
|
||||
<value>50.0</value>
|
||||
</less-than>
|
||||
<greater-than>
|
||||
<property>position/latitude-deg</property>
|
||||
<value>-35.0</value>
|
||||
</greater-than>
|
||||
<less-than>
|
||||
<property>position/latitude-deg</property>
|
||||
<value>-10.0</value>
|
||||
</less-than>
|
||||
</and>
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
|
||||
</PropertyList>
|
|
@ -2627,6 +2627,186 @@
|
|||
</material>
|
||||
|
||||
|
||||
|
||||
<!-- REGIONAL DEFINITION MADAGASCAR -->
|
||||
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>EvergreenBroadCover</name>
|
||||
<name>EvergreenForest</name>
|
||||
<effect>Effects/forest</effect>
|
||||
<texture-set>
|
||||
<texture>Terrain/rainforest-hawaii.png</texture>
|
||||
<texture n="11">Terrain/rainforest-hawaii.png</texture>
|
||||
<texture n="12">Terrain/shrub-hawaii.png</texture>
|
||||
</texture-set>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<light-coverage>10000000.0</light-coverage>
|
||||
<wood-coverage>4000.0</wood-coverage>
|
||||
<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>35.0</tree-height-m>
|
||||
<tree-width-m>30.0</tree-width-m>
|
||||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>1</bumpiness>
|
||||
</material>
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>GrassCover</name>
|
||||
<name>BareTundraCover</name>
|
||||
<name>MixedTundraCover</name>
|
||||
<name>Cemetery</name>
|
||||
<effect>Effects/landmass-nowood</effect>
|
||||
<texture-set>
|
||||
<texture>Terrain/tundra-hawaii.png</texture>
|
||||
<texture n="11">Terrain/rainforest-hawaii.png</texture>
|
||||
<texture n="12">Terrain/shrub-hawaii.png</texture>
|
||||
<texture n="15">Terrain/airport_grass2.png</texture>
|
||||
</texture-set>
|
||||
<parameters>
|
||||
<hires_overlay_bias>0.0</hires_overlay_bias>
|
||||
</parameters>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<light-coverage>4000000.0</light-coverage>
|
||||
<diffuse>
|
||||
<r>0.93</r>
|
||||
<g>0.95</g>
|
||||
<b>0.93</b>
|
||||
<a>1.0</a>
|
||||
</diffuse>
|
||||
<specular>
|
||||
<r>0.1</r>
|
||||
<g>0.12</g>
|
||||
<b>0.1</b>
|
||||
<a>1.0</a>
|
||||
</specular>
|
||||
<shininess>1.2</shininess>
|
||||
<solid>1</solid>
|
||||
<friction-factor>0.7</friction-factor>
|
||||
<rolling-friction>0.1</rolling-friction>
|
||||
<bumpiness>0.15</bumpiness>
|
||||
<load-resistance>1e30</load-resistance>
|
||||
</material>
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>MixedCropPastureCover</name>
|
||||
<name>MixedCrop</name>
|
||||
<name>ComplexCrop</name>
|
||||
<texture-set>
|
||||
<texture>Terrain/cropgrass-madagascar.png</texture>
|
||||
<texture n="12">Terrain/shrub-hawaii.png</texture>
|
||||
</texture-set>
|
||||
<parameters>
|
||||
<transition_model>0.5</transition_model>
|
||||
</parameters>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<light-coverage>2000000.0</light-coverage>
|
||||
<solid>1</solid>
|
||||
<friction-factor>0.9</friction-factor>
|
||||
<rolling-friction>0.1</rolling-friction>
|
||||
<bumpiness>0.7</bumpiness>
|
||||
<load-resistance>1e30</load-resistance>
|
||||
</material>
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<effect>Effects/crop</effect>
|
||||
<name>DryCropPastureCover</name>
|
||||
<name>DryCrop</name>
|
||||
<texture-set>
|
||||
<texture>Terrain/tundra-hawaii.png</texture>
|
||||
<texture n="11">Terrain/rainforest-hawaii.png</texture>
|
||||
<texture n="12">Terrain/shrub-hawaii.png</texture>
|
||||
</texture-set>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<solid>1</solid>
|
||||
<friction-factor>0.9</friction-factor>
|
||||
<rolling-friction>0.1</rolling-friction>
|
||||
<bumpiness>0.6</bumpiness>
|
||||
<load-resistance>1e30</load-resistance>
|
||||
<light-coverage>2000000.0</light-coverage>
|
||||
<wood-coverage>50000.0</wood-coverage>
|
||||
<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>20.0</tree-height-m>
|
||||
<tree-width-m>12.0</tree-width-m>
|
||||
</material>
|
||||
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>BuiltUpCover</name>
|
||||
<name>Urban</name>
|
||||
<texture>Terrain/town-madagascar.png</texture>
|
||||
<object-mask>Terrain/town-europe.mask.png</object-mask>
|
||||
<xsize>1024</xsize>
|
||||
<ysize>1024</ysize>
|
||||
<light-coverage>100000.0</light-coverage>
|
||||
<emissive>
|
||||
<r>0.05</r>
|
||||
<g>0.05</g>
|
||||
<b>0.02</b>
|
||||
<a>1.0</a>
|
||||
</emissive>
|
||||
<object-group include="Materials/base/town-buildings.xml"/>
|
||||
<building-coverage>500.0</building-coverage>
|
||||
<building-small-ratio>0.9</building-small-ratio>
|
||||
<building-medium-ratio>0.1</building-medium-ratio>
|
||||
<building-large-ratio>0.0</building-large-ratio>
|
||||
<building-medium-max-floors>4</building-medium-max-floors>
|
||||
<wood-coverage>1000.0</wood-coverage>
|
||||
<tree-texture>Trees/tropical-alt-summer.png</tree-texture>
|
||||
<tree-varieties>8</tree-varieties>
|
||||
<tree-range-m alias="/params/forest/tree-range-m"/>
|
||||
<tree-height-m>15.0</tree-height-m>
|
||||
<tree-width-m>10.0</tree-width-m>
|
||||
</material>
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>DeciduousBroadCover</name>
|
||||
<name>DeciduousForest</name>
|
||||
<name>Bog</name>
|
||||
<name>Heath</name>
|
||||
<texture-set>
|
||||
<texture>Terrain/rainforest-hawaii.png</texture>
|
||||
<texture n="12">Terrain/marsh2a.png</texture>
|
||||
</texture-set>
|
||||
<parameters>
|
||||
<intrinsic_wetness>0.4</intrinsic_wetness>
|
||||
</parameters>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<light-coverage>10000000.0</light-coverage>
|
||||
<wood-coverage>4000.0</wood-coverage>
|
||||
<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>
|
||||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>0.85</bumpiness>
|
||||
</material>
|
||||
|
||||
<material include="Materials/regions/madagascar.xml">
|
||||
<name>Sand</name>
|
||||
<texture-set>
|
||||
<texture>Terrain/sand-hawaii4.png</texture>
|
||||
<texture n="11">Terrain/sand-hawaii4.png</texture>
|
||||
</texture-set>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
<light-coverage>10000000.0</light-coverage>
|
||||
<shininess>2.5</shininess>
|
||||
<rolling-friction>0.1</rolling-friction>
|
||||
<friction-factor>0.7</friction-factor>
|
||||
<bumpiness>0.1</bumpiness>
|
||||
</material>
|
||||
|
||||
|
||||
<!-- DEFAULT SUMMER DEFINITIONS -->
|
||||
|
||||
<material>
|
||||
|
|
|
@ -163,6 +163,12 @@ var Coord = {
|
|||
me._pupdate();
|
||||
course *= D2R;
|
||||
dist /= ERAD;
|
||||
|
||||
if (dist < 0.0) {
|
||||
dist = abs(dist);
|
||||
course = course - math.pi;
|
||||
}
|
||||
|
||||
me._lat = math.asin(math.sin(me._lat) * math.cos(dist)
|
||||
+ math.cos(me._lat) * math.sin(dist) * math.cos(course));
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Joystick configuration library.
|
||||
var DIALOGROOT = "/sim/gui/dialogs/joystick-config";
|
||||
var MAX_AXES = 8;
|
||||
var MAX_NASALS = 8;
|
||||
var MAX_BUTTONS = 24;
|
||||
|
||||
# Hash of the custom axis/buttons
|
||||
|
@ -629,7 +630,24 @@ var readConfig = func(dialog_root="/sim/gui/dialogs/joystick-config") {
|
|||
btn.getNode("binding", 1).setValue("None");
|
||||
btn.removeChild("original_binding");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Set up Nasal code.
|
||||
var nasals = js.getChildren("nasal");
|
||||
|
||||
for (var nasal = 0; nasal < MAX_NASALS; nasal = nasal + 1) {
|
||||
var nas = props.globals.getNode(dialog_root ~ "/nasal[" ~ nasal ~ "]", 1);
|
||||
nas.remove();
|
||||
nas = props.globals.getNode(dialog_root ~ "/nasal[" ~ nasal ~ "]", 1);
|
||||
|
||||
# Note that we can't simply use an index into the buttons array
|
||||
# as that doesn't work for a sparsley populated set of buttons.
|
||||
# E.g. one with n="3"
|
||||
var a = js.getNode("nasal[" ~ nasal ~ "]");
|
||||
if (a != nil) {
|
||||
props.copy(a, nas.getNode("original_script", 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var writeConfig = func(dialog_root="/sim/gui/dialogs/joystick-config", reset=0) {
|
||||
|
@ -647,6 +665,12 @@ var writeConfig = func(dialog_root="/sim/gui/dialogs/joystick-config", reset=0)
|
|||
config.getNode("name", 1).setValue(id);
|
||||
}
|
||||
|
||||
var nasals = props.globals.getNode(dialog_root).getChildren("nasal");
|
||||
forindex (var nas; nasals) {
|
||||
var nasalscript = config.getNode("nasal[" ~ nas ~ "]", 1);
|
||||
props.copy(props.globals.getNode(dialog_root ~ "/nasal[" ~ nas ~ "]/original_script", 1), nasalscript);
|
||||
}
|
||||
|
||||
var axes = props.globals.getNode(dialog_root).getChildren("axis");
|
||||
forindex (var axis; axes) {
|
||||
var name = getprop(dialog_root ~ "/axis[" ~ axis ~ "]/binding");
|
||||
|
|
|
@ -384,13 +384,13 @@ else if (type == "Altocumulus"){
|
|||
|
||||
#characterize the cloud
|
||||
cloudAssembly.bottom_shade = 0.7;
|
||||
cloudAssembly.n_sprites = 10;
|
||||
cloudAssembly.min_width = 400.0 * mult;
|
||||
cloudAssembly.max_width = 700.0 * mult;
|
||||
cloudAssembly.n_sprites = 6;
|
||||
cloudAssembly.min_width = 40.0 * mult;
|
||||
cloudAssembly.max_width = 600.0 * mult;
|
||||
cloudAssembly.min_height = 400.0 * mult;
|
||||
cloudAssembly.max_height = 700.0 * mult;
|
||||
cloudAssembly.min_cloud_width = 1200 * mult * mult;
|
||||
cloudAssembly.min_cloud_height = 1200 * mult * mult;
|
||||
cloudAssembly.max_height = 600.0 * mult;
|
||||
cloudAssembly.min_cloud_width = 1000 * mult * mult;
|
||||
cloudAssembly.min_cloud_height = 1000 * mult * mult;
|
||||
cloudAssembly.z_scale = 0.8;
|
||||
|
||||
#signal that new routines are used
|
||||
|
@ -424,16 +424,15 @@ else if (type == "Stratus (structured)"){
|
|||
|
||||
#signal that new routines are used
|
||||
path = "new";
|
||||
|
||||
}
|
||||
else if (type == "Altocumulus perlucidus"){
|
||||
|
||||
# new code
|
||||
|
||||
else if (type == "Stratus structured CS"){
|
||||
|
||||
cloudAssembly = local_weather.cloud.new(type, subtype);
|
||||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.7;}
|
||||
else {mult = 1.0;}
|
||||
|
||||
mult = mult * local_weather.cloud_size_scale;
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/altocumulus_sheet1.rgb";
|
||||
|
@ -441,7 +440,36 @@ else if (type == "Altocumulus perlucidus"){
|
|||
cloudAssembly.num_tex_y = 3;
|
||||
|
||||
#characterize the cloud
|
||||
cloudAssembly.bottom_shade = 0.8;
|
||||
cloudAssembly.bottom_shade = 0.4;
|
||||
cloudAssembly.n_sprites = 6;
|
||||
cloudAssembly.min_width = 1000.0 * mult;
|
||||
cloudAssembly.max_width = 1000.0 * mult;
|
||||
cloudAssembly.min_height = 1000.0 * mult;
|
||||
cloudAssembly.max_height = 1000.0 * mult;
|
||||
cloudAssembly.min_cloud_width = 1305 * mult;
|
||||
cloudAssembly.min_cloud_height = 1305.0 * mult;
|
||||
cloudAssembly.z_scale = 0.3;
|
||||
|
||||
#signal that new routines are used
|
||||
path = "new";
|
||||
}
|
||||
|
||||
else if (type == "Altocumulus perlucidus"){
|
||||
|
||||
# new code
|
||||
cloudAssembly = local_weather.cloud.new(type, subtype);
|
||||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.7;}
|
||||
else if (subtype == "huge") {mult = 1.5;}
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/altocumulus_sheet1.rgb";
|
||||
cloudAssembly.num_tex_x = 3;
|
||||
cloudAssembly.num_tex_y = 3;
|
||||
|
||||
#characterize the cloud
|
||||
cloudAssembly.bottom_shade = 0.7;
|
||||
cloudAssembly.n_sprites = 25;
|
||||
cloudAssembly.min_width = 1700.0 * mult;
|
||||
cloudAssembly.max_width = 2500.0 * mult;
|
||||
|
@ -508,7 +536,7 @@ else if (type == "Cirrocumulus (cloudlet)") {
|
|||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.6;}
|
||||
else {mult = 1.0;}
|
||||
else if (subtype == "huge") {mult = 1.5;}
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/cirrocumulus_sheet1.rgb";
|
||||
|
@ -527,9 +555,6 @@ else if (type == "Cirrocumulus (cloudlet)") {
|
|||
cloudAssembly.z_scale = 0.3;
|
||||
|
||||
path = "new";
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (type == "Cirrocumulus (new)") {
|
||||
|
||||
|
@ -537,7 +562,7 @@ else if (type == "Cirrocumulus (new)") {
|
|||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.7;}
|
||||
else {mult = 1.0;}
|
||||
else {mult = 1.3;}
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/cirrocumulus_sheet1.rgb";
|
||||
|
@ -559,6 +584,36 @@ else if (type == "Cirrocumulus (new)") {
|
|||
path = "new";
|
||||
}
|
||||
|
||||
else if (type == "Fogpatch") {
|
||||
|
||||
cloudAssembly = local_weather.cloud.new(type, subtype);
|
||||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.7;}
|
||||
else {mult = 1.0;}
|
||||
|
||||
mult = mult * local_weather.cloud_size_scale;
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/fogpatch_sheet1.rgb";
|
||||
cloudAssembly.num_tex_x = 1;
|
||||
cloudAssembly.num_tex_y = 1;
|
||||
|
||||
#characterize the cloud
|
||||
cloudAssembly.bottom_shade = 1.0;
|
||||
cloudAssembly.n_sprites = 1;
|
||||
cloudAssembly.min_width = 300.0 * mult;
|
||||
cloudAssembly.max_width = 300.0 * mult;
|
||||
cloudAssembly.min_height = 300.0 * mult;
|
||||
cloudAssembly.max_height = 300.0 * mult;
|
||||
cloudAssembly.min_cloud_width = 305.0 * mult;
|
||||
cloudAssembly.min_cloud_height = 305.0 * mult;
|
||||
cloudAssembly.z_scale = 0.5;
|
||||
|
||||
#signal that new routines are used
|
||||
path = "new";
|
||||
}
|
||||
|
||||
else if (type == "Nimbus") {
|
||||
|
||||
cloudAssembly = local_weather.cloud.new(type, subtype);
|
||||
|
@ -698,6 +753,35 @@ else if (type == "Cirrostratus") {
|
|||
path = "new";
|
||||
|
||||
}
|
||||
else if (type == "Cirrostratus (small)") {
|
||||
|
||||
cloudAssembly = local_weather.cloud.new(type, subtype);
|
||||
|
||||
var mult = 1.0;
|
||||
if (subtype == "small") {mult = 0.45;}
|
||||
else {mult = 0.7;}
|
||||
|
||||
# characterize the basic texture sheet
|
||||
cloudAssembly.texture_sheet = "/Models/Weather/cirrostratus_sheet1.rgb";
|
||||
cloudAssembly.num_tex_x = 2;
|
||||
cloudAssembly.num_tex_y = 2;
|
||||
|
||||
#characterize the cloud
|
||||
cloudAssembly.bottom_shade = 1.0;
|
||||
cloudAssembly.n_sprites = 2;
|
||||
cloudAssembly.min_width = 3500.0 * mult;
|
||||
cloudAssembly.max_width = 4000.0 * mult;
|
||||
cloudAssembly.min_height = 3500.0 * mult;
|
||||
cloudAssembly.max_height = 4000.0 * mult;
|
||||
cloudAssembly.min_cloud_width = 4500.0 * mult;
|
||||
cloudAssembly.min_cloud_height = 4500.0 * mult;
|
||||
cloudAssembly.z_scale = 0.5;
|
||||
|
||||
#signal that new routines are used
|
||||
path = "new";
|
||||
|
||||
}
|
||||
|
||||
else if (type == "Fog (thin)") {
|
||||
if (subtype == "small") {
|
||||
if (rn > 0.8) {path = "Models/Weather/stratus_thin1.xml";}
|
||||
|
|
|
@ -80,6 +80,190 @@ for (var i=0; i<ny; i=i+1)
|
|||
}
|
||||
|
||||
|
||||
###########################################################
|
||||
# place an advanced undulatus pattern
|
||||
###########################################################
|
||||
|
||||
var create_adv_undulatus = func (arg) {
|
||||
|
||||
var markov_array = [];
|
||||
var rnd_array = [];
|
||||
var max_num_clouds = int(arg.xsize/arg.cloud_spacing)+1;
|
||||
var max_num_streaks = int(arg.ysize/arg.undulatus_spacing)+1;
|
||||
var path = "Models/Weather/blank.ac";
|
||||
var counter = 0;
|
||||
|
||||
append(markov_array,0.0);
|
||||
|
||||
var rn = 0.0;
|
||||
arg.dir = arg.dir + 90.0;
|
||||
|
||||
for (var i=1; i<max_num_clouds; i=i+1)
|
||||
{
|
||||
rn = rand();
|
||||
append(markov_array, markov_array[i-1] + 2.0 * (rn -0.5) * arg.undulatus_amplitude + arg.undulatus_slant);
|
||||
append(rnd_array, rn);
|
||||
}
|
||||
|
||||
for (i=0; i< max_num_streaks; i=i+1)
|
||||
{
|
||||
var streak_ypos = -0.5 * arg.ysize + i * arg.undulatus_spacing;
|
||||
var aspect_num_clouds = int((arg.aspect + (1.0-arg.aspect) * i/max_num_streaks) * max_num_clouds);
|
||||
|
||||
for (var j = 0; j< aspect_num_clouds; j=j+1)
|
||||
{
|
||||
var y = streak_ypos + markov_array[j];
|
||||
var x = -0.5 * arg.xsize + j * arg.cloud_spacing;
|
||||
|
||||
x = x - arg.Dx + 2.0 * rand() * arg.Dx;
|
||||
y = y - arg.Dy + 2.0 * rand() * arg.Dy;
|
||||
|
||||
var flag = 0;
|
||||
var bias =1.0 - (1.0* abs(i-0.5 * max_num_streaks)/max_num_streaks + 1.0* abs(j-0.5 * aspect_num_clouds)/aspect_num_clouds);
|
||||
var comp = -.25 * rnd_array[j] + 0.75 * bias;
|
||||
|
||||
comp = comp + arg.size_bias;
|
||||
if (comp > 0.7)
|
||||
{
|
||||
flag = 1;
|
||||
path = select_cloud_model(arg.type,"large")
|
||||
}
|
||||
else if (comp > 0.4)
|
||||
{
|
||||
flag = 1;
|
||||
path = select_cloud_model(arg.type,"small")
|
||||
}
|
||||
|
||||
var lat = arg.blat + m_to_lat * (y * math.cos(arg.dir) - x * math.sin(arg.dir));
|
||||
var lon = arg.blon + m_to_lon * (x * math.cos(arg.dir) + y * math.sin(arg.dir));
|
||||
|
||||
var alt = arg.balt + arg.alt_var * 2 * (rand() - 0.5);
|
||||
|
||||
if (flag > 0)
|
||||
{create_cloud_vec(path, lat, lon, alt, 0.0); counter = counter +1;}
|
||||
}
|
||||
|
||||
}
|
||||
print("Cloud count: ",counter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
###########################################################
|
||||
# place a stick bundle pattern
|
||||
###########################################################
|
||||
|
||||
var sgn = func (x) {
|
||||
|
||||
if (x<0.0) {return -1.0;}
|
||||
else {return 1.0;}
|
||||
}
|
||||
|
||||
var create_stick_bundle = func (arg) {
|
||||
|
||||
var path = "Models/Weather/blank.ac";
|
||||
var base_size_scale = local_weather.cloud_size_scale;
|
||||
|
||||
for (var i = 0; i<arg.n_sticks; i=i+1)
|
||||
{
|
||||
var stick_x = 0.5 * math.pow(rand(),2.0) * arg.xsize * sgn(rand()-0.5);
|
||||
var stick_y = 0.5 * math.pow(rand(),2.0) * arg.ysize * sgn(rand()-0.5);
|
||||
|
||||
var stick_length = arg.stick_length_min + int(rand() * (arg.stick_length_max - arg.stick_length_min) );
|
||||
var stick_Dphi = arg.stick_Dphi_min + rand() * (arg.stick_Dphi_max - arg.stick_Dphi_min);
|
||||
var stick_size_scale = 0.8 + 0.2 * rand();
|
||||
for (var j=0; j<stick_length;j=j+1)
|
||||
{
|
||||
var y = stick_y;
|
||||
var x = stick_x - 0.5 * stick_length * arg.cloud_spacing;
|
||||
var inc = j * arg.cloud_spacing;
|
||||
var pos_size_scale = base_size_scale + base_size_scale * 2.0* (1.0 - 2.0* abs(0.5 * stick_length - j)/stick_length);
|
||||
local_weather.cloud_size_scale = pos_size_scale;
|
||||
local_weather.cloud_size_scale = stick_size_scale * local_weather.cloud_size_scale;
|
||||
inc = inc * stick_size_scale;
|
||||
|
||||
x = x + inc * math.cos(stick_Dphi);
|
||||
y = y + inc * math.sin(stick_Dphi);
|
||||
|
||||
x = x - arg.Dx + 2.0 * rand() * arg.Dx;
|
||||
y = y - arg.Dy + 2.0 * rand() * arg.Dy;
|
||||
|
||||
path = select_cloud_model(arg.type,"large");
|
||||
|
||||
var lat = arg.blat + m_to_lat * (y * math.cos(arg.dir) - x * math.sin(arg.dir));
|
||||
var lon = arg.blon + m_to_lon * (x * math.cos(arg.dir) + y * math.sin(arg.dir));
|
||||
|
||||
var alt = arg.balt + arg.alt_var * 2 * (rand() - 0.5);
|
||||
|
||||
create_cloud_vec(path, lat, lon, alt, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###########################################################
|
||||
# place a nested domains pattern
|
||||
###########################################################
|
||||
|
||||
var create_domains = func (arg) {
|
||||
|
||||
var path = "Models/Weather/blank.ac";
|
||||
|
||||
for (var j=0; j<arg.n_domains; j=j+1)
|
||||
{
|
||||
var domain_pos_x = -0.5 * arg.xsize + rand() * arg.xsize;
|
||||
var domain_pos_y = -0.5 * arg.ysize + rand() * arg.ysize;
|
||||
|
||||
var domain_size_x = arg.min_domain_size_x + rand() * (arg.max_domain_size_x - arg.min_domain_size_x);
|
||||
var domain_size_y = arg.min_domain_size_y + rand() * (arg.max_domain_size_y - arg.min_domain_size_y);
|
||||
|
||||
var n_node = int(arg.node_fraction * arg.n);
|
||||
var n_halo = int(arg.halo_fraction * arg.n);
|
||||
var n_bulk = arg.n - n_node - n_halo;
|
||||
|
||||
for (var i=0; i<n_halo; i=i+1)
|
||||
{
|
||||
var x = domain_pos_x - 0.5 * domain_size_x + rand() * domain_size_x;
|
||||
var y = domain_pos_y - 0.5 * domain_size_y + rand() * domain_size_y;
|
||||
var lat = arg.blat + m_to_lat * (y * math.cos(arg.dir) - x * math.sin(arg.dir));
|
||||
var lon = arg.blon + m_to_lon * (x * math.cos(arg.dir) + y * math.sin(arg.dir));
|
||||
var alt = arg.balt + arg.alt_var * 2 * (rand() - 0.5);
|
||||
if ((abs(x-domain_pos_x) < 0.3 * domain_size_x) or (abs(y-domain_pos_y) < 0.3 * domain_size_y))
|
||||
{path = select_cloud_model(arg.htype,arg.hsubtype);
|
||||
create_cloud_vec(path, lat, lon, alt, 0.0);}
|
||||
}
|
||||
for (i=0; i<n_bulk; i=i+1)
|
||||
{
|
||||
x = domain_pos_x - 0.5 * 0.4* domain_size_x + rand() * 0.4* domain_size_x;
|
||||
y = domain_pos_y - 0.5 * 0.4* domain_size_y + rand() * 0.4* domain_size_y;
|
||||
lat = arg.blat + m_to_lat * (y * math.cos(arg.dir) - x * math.sin(arg.dir));
|
||||
lon = arg.blon + m_to_lon * (x * math.cos(arg.dir) + y * math.sin(arg.dir));
|
||||
alt = arg.balt + arg.alt_var * 2 * (rand() - 0.5);
|
||||
if ((abs(x-domain_pos_x) < 0.4 * domain_size_x) or (abs(y-domain_pos_y) < 0.4 * domain_size_y))
|
||||
{
|
||||
path = select_cloud_model(arg.type,arg.subtype);
|
||||
create_cloud_vec(path, lat, lon, alt, 0.0);
|
||||
}
|
||||
}
|
||||
for (i=0; i<n_node; i=i+1)
|
||||
{
|
||||
x = domain_pos_x - 0.5 * 0.1* domain_size_x + rand() * 0.1* domain_size_x;
|
||||
y = domain_pos_y - 0.5 * 0.1* domain_size_y + rand() * 0.1* domain_size_y;
|
||||
lat = arg.blat + m_to_lat * (y * math.cos(arg.dir) - x * math.sin(arg.dir));
|
||||
lon = arg.blon + m_to_lon * (x * math.cos(arg.dir) + y * math.sin(arg.dir));
|
||||
alt = arg.balt + arg.alt_var * 2 * (rand() - 0.5);
|
||||
path = select_cloud_model(arg.ntype,arg.nsubtype);
|
||||
create_cloud_vec(path, lat, lon, alt, 0.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
###########################################################
|
||||
# place a Cumulus alley pattern
|
||||
|
|
|
@ -699,7 +699,7 @@ else
|
|||
# compute the cloud layer self shading correction
|
||||
|
||||
var sun_angle = 1.57079632675 - getprop("/sim/time/sun-angle-rad");
|
||||
var cloud_layer_shading = 1.0 - ((1.0 - scatt_max) * math.pow(math.cos(sun_angle),100.0));
|
||||
var cloud_layer_shading = 1.0 - (0.8*(1.0 - scatt_max) * math.pow(math.cos(sun_angle),100.0));
|
||||
|
||||
# compute the overcast haze
|
||||
|
||||
|
@ -1224,7 +1224,7 @@ if (ev.vis_flag ==1)
|
|||
# then set the new value in current and execute change
|
||||
cNode.getNode("visibility-m").setValue(vis);
|
||||
#compat_layer.setVisibility(vis);
|
||||
#print(vis);
|
||||
print(vis);
|
||||
compat_layer.setVisibilitySmoothly(vis);
|
||||
|
||||
# then count the number of active volumes on entry (we need that to determine
|
||||
|
@ -4488,6 +4488,10 @@ if (lowest_layer_turbulence < 0.0) {lowest_layer_turbulence = 0.0;}
|
|||
|
||||
var top_shade = 1.0;
|
||||
|
||||
# global cloud size scale;
|
||||
|
||||
var cloud_size_scale = 1.0;
|
||||
|
||||
# globals keeping track of the lifetime when building a Cumulus from individual cloudlets
|
||||
|
||||
var cloud_fractional_lifetime = 0.0;
|
||||
|
@ -4582,7 +4586,7 @@ setprop(lw~"effect-volumes/number-active-sat",0);
|
|||
# setprop(lw~"config/max-vis-range-m", 120000.0);
|
||||
setprop(lw~"config/temperature-offset-degc", 0.0);
|
||||
|
||||
# setprop("/sim/rendering/eye-altitude-m", getprop("/position/altitude-ft") * ft_to_m);
|
||||
setprop("/sim/rendering/eye-altitude-m", getprop("/position/altitude-ft") * ft_to_m);
|
||||
|
||||
# create properties for tile management
|
||||
|
||||
|
|
|
@ -122,9 +122,11 @@ time_lw = time_lw + dt_lw;
|
|||
#var terminator_offset = sun_angle / 0.017451 * 110000.0;# + 250000.0;
|
||||
#setprop("/environment/terminator-relative-position-m",terminator_offset);
|
||||
|
||||
# var viewpos = geo.viewer_position();
|
||||
var viewpos = geo.viewer_position();
|
||||
|
||||
# setprop("/environment/alt-in-haze-m", getprop("/environment/ground-haze-thickness-m")-viewpos.alt());
|
||||
# setprop("/sim/rendering/eye-altitude-m", viewpos.alt());
|
||||
|
||||
#setprop("/sim/rendering/eye-altitude-m", viewpos.alt());
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,13 +1,13 @@
|
|||
# route_manager.nas - default FlightPlan delegate corresponding to the build
|
||||
# in route-manager dialog. Intended to provide a sensible default behaviour,
|
||||
# but be disabled by an aircraft-specific FMS / GPS system.
|
||||
# route_manager.nas - FlightPlan delegate(s) corresponding to the built-
|
||||
# in route-manager dialog and GPS. Intended to provide a sensible default behaviour,
|
||||
# but can be disabled by an aircraft-specific FMS / GPS system.
|
||||
|
||||
var RouteManagerDelegate = {
|
||||
new: func(fp) {
|
||||
# if this property is set, don't build a delegate at all
|
||||
if (getprop('/autopilot/route-manager/disable-fms'))
|
||||
return nil;
|
||||
|
||||
# if this property is set, don't build a delegate at all
|
||||
if (getprop('/autopilot/route-manager/disable-route-manager'))
|
||||
return nil;
|
||||
|
||||
var m = { parents: [RouteManagerDelegate] };
|
||||
m.flightplan = fp;
|
||||
return m;
|
||||
|
@ -82,17 +82,70 @@ var RouteManagerDelegate = {
|
|||
fgcommand("activate-flightplan", props.Node.new({"activate": 0}));
|
||||
},
|
||||
|
||||
endOfFlightPlan: func
|
||||
{
|
||||
debug.dump("end of flight-plan, deactivating");
|
||||
fgcommand("activate-flightplan", props.Node.new({"activate": 0}));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var FMSDelegate = {
|
||||
new: func(fp) {
|
||||
# if this property is set, don't build a delegate at all
|
||||
if (getprop('/autopilot/route-manager/disable-fms'))
|
||||
return nil;
|
||||
|
||||
var m = { parents: [FMSDelegate], flightplan:fp, landingCheck:nil };
|
||||
return m;
|
||||
},
|
||||
|
||||
_landingCheckTimeout: func
|
||||
{
|
||||
var cur = me.flightplan.currentWP();
|
||||
var wow = getprop('gear/gear[0]/wow');
|
||||
var gs = getprop('velocities/groundspeed-kt');
|
||||
if (wow and (gs < 25)) {
|
||||
debug.dump('touchdown on destination runway, end of route.');
|
||||
me.landingCheck.stop();
|
||||
# record touch-down time?
|
||||
me.flightplan.finish();
|
||||
}
|
||||
},
|
||||
|
||||
waypointsChanged: func
|
||||
{
|
||||
},
|
||||
|
||||
endOfFlightPlan: func
|
||||
{
|
||||
debug.dump('end of flight-plan');
|
||||
},
|
||||
|
||||
currentWaypointChanged: func
|
||||
{
|
||||
debug.dump('saw current WP changed, now ' ~ me.flightplan.current);
|
||||
if (me.landingCheck != nil) {
|
||||
me.landingCheck.stop();
|
||||
me.landingCheck = nil; # delete timer
|
||||
}
|
||||
|
||||
#debug.dump('saw current WP changed, now ' ~ me.flightplan.current);
|
||||
var active = me.flightplan.currentWP();
|
||||
if (active == nil) return;
|
||||
|
||||
if (active.alt_cstr_type != 'none') {
|
||||
debug.dump('new WP has valid altitude restriction, setting on AP');
|
||||
setprop('/autopilot/settings/target-altitude-ft', active.alt_cstr);
|
||||
}
|
||||
|
||||
var activeRunway = active.runway();
|
||||
if ((activeRunway != nil) and (activeRunway.id == me.flightplan.destination_runway.id)) {
|
||||
me.landingCheck = maketimer(2.0, me, FMSDelegate._landingCheckTimeout);
|
||||
me.landingCheck.start();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
# debug.dump('register routemanager delegate factory');
|
||||
|
||||
registerFlightPlanDelegate(FMSDelegate.new);
|
||||
registerFlightPlanDelegate(RouteManagerDelegate.new);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ var identity = {
|
|||
|
||||
|
||||
var Tanker = {
|
||||
new: func(aiid, callsign, tacan, type, model, kias, maxfuel, pattern, heading, coord) {
|
||||
new: func(aiid, callsign, tacan, type, model, kias, maxfuel, pattern, contacts, heading, coord) {
|
||||
var m = { parents: [Tanker] };
|
||||
m.callsign = callsign;
|
||||
m.tacan = tacan;
|
||||
|
@ -79,6 +79,7 @@ var Tanker = {
|
|||
m.out_of_range_time = 0;
|
||||
m.interval = 10;
|
||||
m.length = pattern;
|
||||
m.contacts = contacts;
|
||||
m.roll = 0;
|
||||
m.coord = geo.Coord.new(coord);
|
||||
m.anchor = geo.Coord.new(coord).apply_course_distance(m.track_course, m.length); # ARCP
|
||||
|
@ -155,7 +156,7 @@ var Tanker = {
|
|||
}
|
||||
|
||||
var distance = dt * (me.ktas - me.headwind) * NM2M / 3600;
|
||||
var deviation = me.roll ? 0.5 * dt * 1085.941 * math.tan(me.roll * D2R) / me.ktas : 0;
|
||||
var deviation = me.roll ? dt * 1085.941 * math.tan(me.roll * D2R) / me.ktas : 0;
|
||||
|
||||
if (me.mode == "leg") {
|
||||
if (me.lastmode != "leg") {
|
||||
|
@ -218,12 +219,46 @@ var Tanker = {
|
|||
me.brgN.setDoubleValue(me.bearing);
|
||||
me.elevN.setDoubleValue(elev);
|
||||
|
||||
me.contactN.setBoolValue(me.distance < ac_contact_dist and
|
||||
dalt > 0 and
|
||||
abs(view.normdeg(me.bearing - ac_hdg)) < 20);
|
||||
# Determine if any of the contact points are in contact
|
||||
var offset_x = getprop("/systems/refuel/offset-x-m") or 0;
|
||||
var offset_y = getprop("/systems/refuel/offset-y-m") or 0;
|
||||
var offset_z = getprop("/systems/refuel/offset-z-m") or 0;
|
||||
var roll = getprop("/orientation/roll-deg") * globals.D2R;
|
||||
|
||||
# Determine contact position
|
||||
var probe_pos = geo.Coord.new(me.ac);
|
||||
|
||||
probe_pos.apply_course_distance(ac_hdg, offset_x);
|
||||
probe_pos.apply_course_distance(ac_hdg + 90, offset_y * math.cos(roll) + offset_z * math.sin(roll));
|
||||
probe_pos.set_alt(me.ac.alt() + offset_z * math.cos(roll) - offset_y * math.sin(roll));
|
||||
|
||||
me.hOffsetN.setDoubleValue(me.bearing - ac_hdg);
|
||||
me.vOffsetN.setDoubleValue(elev - ac_pitch);
|
||||
me.contactN.setBoolValue(0);
|
||||
|
||||
foreach (var c; me.contacts) {
|
||||
var drogue_pos = geo.Coord.new(me.coord);
|
||||
|
||||
# Offset longitudonally
|
||||
drogue_pos.apply_course_distance(me.course, c.x);
|
||||
|
||||
var r = me.roll * globals.D2R;
|
||||
|
||||
# Offset laterally, taking into account any roll
|
||||
drogue_pos.apply_course_distance(me.course +90, c.y * math.cos(r) + c.z * math.sin(r));
|
||||
|
||||
# Offset vertically, again, taking into account any roll
|
||||
drogue_pos.set_alt(drogue_pos.alt() + c.z * math.cos(r) - c.y * math.sin(r));
|
||||
|
||||
#print("Distance: " ~ probe_pos.distance_to(drogue_pos) ~ " vs. " ~ me.distance);
|
||||
|
||||
if (probe_pos.distance_to(drogue_pos) < ac_contact_dist and
|
||||
abs(view.normdeg(me.course - ac_hdg)) < 20) {
|
||||
# Contact!
|
||||
me.contactN.setBoolValue(1);
|
||||
}
|
||||
}
|
||||
|
||||
me.hOffsetN.setDoubleValue(view.normdeg(me.bearing - ac_hdg));
|
||||
me.vOffsetN.setDoubleValue(view.normdeg(elev - ac_pitch));
|
||||
|
||||
var droll = me.roll_target - me.roll;
|
||||
if (droll > 0) {
|
||||
|
@ -278,13 +313,27 @@ var create_tanker = func(tanker_node, course) {
|
|||
var spd = tanker_node.getNode("speed-kts", 1).getValue() or 250;
|
||||
var pattern = (tanker_node.getNode("pattern-length-nm", 1).getValue() or 50) * NM2M;
|
||||
var maxfuel = tanker_node.getNode("max-fuel-transfer-lbs-min", 1).getValue() or 6000;
|
||||
|
||||
var contacts = [];
|
||||
|
||||
foreach (var contact; tanker_node.getChildren("contact")) {
|
||||
var x = (contact.getNode("x-m") != nil) ? contact.getNode("x-m").getValue() : 0;
|
||||
var y = (contact.getNode("y-m") != nil) ? contact.getNode("y-m").getValue() : 0;
|
||||
var z = (contact.getNode("z-m") != nil) ? contact.getNode("z-m").getValue() : 0;
|
||||
append(contacts, { "x" : x, "y" : y, "z" : z });
|
||||
}
|
||||
|
||||
|
||||
if (size(contacts) == 0) {
|
||||
append(contacts, {x: 0, y:0, z:0});
|
||||
}
|
||||
|
||||
var alt = int(10 + rand() * 15) * 1000; # FL100--FL250
|
||||
alt = skip_cloud_layer(alt * FT2M);
|
||||
var dist = 6000 + rand() * 4000;
|
||||
var coord = geo.aircraft_position().apply_course_distance(course, dist).set_alt(alt);
|
||||
|
||||
Tanker.new(aiid, callsign, tacanid, type, model, spd, maxfuel, pattern, course, coord);
|
||||
Tanker.new(aiid, callsign, tacanid, type, model, spd, maxfuel, pattern, contacts, course, coord);
|
||||
}
|
||||
|
||||
# Request a new tanker
|
||||
|
|
|
@ -12,6 +12,7 @@ uniform float altitude;
|
|||
uniform float cloud_self_shading;
|
||||
uniform float visibility;
|
||||
uniform float moonlight;
|
||||
uniform float air_pollution;
|
||||
|
||||
attribute vec3 usrAttr1;
|
||||
attribute vec3 usrAttr2;
|
||||
|
@ -151,8 +152,8 @@ void main(void)
|
|||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0);
|
||||
light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
light_diffuse.b = light_func(lightArg -1.2 * air_pollution, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0);
|
||||
light_diffuse.g = light_func(lightArg -0.6 * air_pollution, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
light_diffuse.a = 1.0;
|
||||
|
||||
|
@ -160,9 +161,9 @@ void main(void)
|
|||
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, (1.0 - smoothstep(0.5,0.9, min(scattering, cloud_self_shading) ))));
|
||||
|
||||
// correct ambient light intensity and hue before sunrise
|
||||
if (earthShade < 0.8)
|
||||
if (earthShade < 0.6)
|
||||
{
|
||||
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade ) ));
|
||||
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.6,earthShade ) ));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
// Ambient term comes in gl_Color.rgb.
|
||||
varying vec4 diffuse_term;
|
||||
varying vec3 normal;
|
||||
//varying vec2 nvec;
|
||||
varying vec3 relPos;
|
||||
varying vec2 rawPos;
|
||||
//varying vec2 worldPos;
|
||||
varying vec3 worldPos;
|
||||
varying vec3 ecViewdir;
|
||||
varying vec3 ecNormal;
|
||||
|
||||
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
@ -20,7 +19,7 @@ uniform sampler2D mix_texture;
|
|||
uniform sampler2D grain_texture;
|
||||
uniform sampler2D dot_texture;
|
||||
uniform sampler2D gradient_texture;
|
||||
//uniform sampler2D foam_texture;
|
||||
|
||||
|
||||
|
||||
//varying float yprime_alt;
|
||||
|
@ -71,6 +70,10 @@ float rand2D(in vec2 co){
|
|||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
float rand3D(in vec3 co){
|
||||
return fract(sin(dot(co.xyz ,vec3(12.9898,78.233,144.7272))) * 43758.5453);
|
||||
}
|
||||
|
||||
float cosine_interpolate(in float a, in float b, in float x)
|
||||
{
|
||||
float ft = x * 3.1415927;
|
||||
|
@ -103,6 +106,39 @@ float interpolatedNoise2D(in float x, in float y)
|
|||
return simple_interpolate(i1 , i2 , fractional_y);
|
||||
}
|
||||
|
||||
float interpolatedNoise3D(in float x, in float y, in float z)
|
||||
{
|
||||
float integer_x = x - fract(x);
|
||||
float fractional_x = x - integer_x;
|
||||
|
||||
float integer_y = y - fract(y);
|
||||
float fractional_y = y - integer_y;
|
||||
|
||||
float integer_z = z - fract(z);
|
||||
float fractional_z = z - integer_z;
|
||||
|
||||
float v1 = rand3D(vec3(integer_x, integer_y, integer_z));
|
||||
float v2 = rand3D(vec3(integer_x+1.0, integer_y, integer_z));
|
||||
float v3 = rand3D(vec3(integer_x, integer_y+1.0, integer_z));
|
||||
float v4 = rand3D(vec3(integer_x+1.0, integer_y +1.0, integer_z));
|
||||
|
||||
float v5 = rand3D(vec3(integer_x, integer_y, integer_z+1.0));
|
||||
float v6 = rand3D(vec3(integer_x+1.0, integer_y, integer_z+1.0));
|
||||
float v7 = rand3D(vec3(integer_x, integer_y+1.0, integer_z+1.0));
|
||||
float v8 = rand3D(vec3(integer_x+1.0, integer_y +1.0, integer_z+1.0));
|
||||
|
||||
|
||||
float i1 = simple_interpolate(v1,v5, fractional_z);
|
||||
float i2 = simple_interpolate(v2,v6, fractional_z);
|
||||
float i3 = simple_interpolate(v3,v7, fractional_z);
|
||||
float i4 = simple_interpolate(v4,v8, fractional_z);
|
||||
|
||||
float ii1 = simple_interpolate(i1,i2,fractional_x);
|
||||
float ii2 = simple_interpolate(i3,i4,fractional_x);
|
||||
|
||||
|
||||
return simple_interpolate(ii1 , ii2 , fractional_y);
|
||||
}
|
||||
|
||||
|
||||
float Noise2D(in vec2 coord, in float wavelength)
|
||||
|
@ -111,6 +147,11 @@ return interpolatedNoise2D(coord.x/wavelength, coord.y/wavelength);
|
|||
|
||||
}
|
||||
|
||||
float Noise3D(in vec3 coord, in float wavelength)
|
||||
{
|
||||
return interpolatedNoise3D(coord.x/wavelength, coord.y/wavelength, coord.z/wavelength);
|
||||
}
|
||||
|
||||
float dotNoise2D(in float x, in float y, in float fractionalMaxDotSize)
|
||||
{
|
||||
float integer_x = x - fract(x);
|
||||
|
@ -259,10 +300,10 @@ float noise_25m = Noise2D(rawPos.xy, 25.0);
|
|||
float noise_50m = Noise2D(rawPos.xy, 50.0);
|
||||
|
||||
|
||||
float noise_250m = Noise2D(rawPos.xy,250.0);
|
||||
float noise_500m = Noise2D(rawPos.xy, 500.0);
|
||||
float noise_1500m = Noise2D(rawPos.xy, 1500.0);
|
||||
float noise_2000m = Noise2D(rawPos.xy, 2000.0);
|
||||
float noise_250m = Noise3D(worldPos.xyz,250.0);
|
||||
float noise_500m = Noise3D(worldPos.xyz, 500.0);
|
||||
float noise_1500m = Noise3D(worldPos.xyz, 1500.0);
|
||||
float noise_2000m = Noise3D(worldPos.xyz, 2000.0);
|
||||
|
||||
// dot noise
|
||||
|
||||
|
|
|
@ -20,14 +20,12 @@
|
|||
// bugs with gl_FrontFacing in the fragment shader.
|
||||
varying vec4 diffuse_term;
|
||||
varying vec3 normal;
|
||||
//varying vec2 nvec;
|
||||
varying vec3 relPos;
|
||||
varying vec2 rawPos;
|
||||
//varying vec2 worldPos;
|
||||
varying vec3 worldPos;
|
||||
varying vec3 ecViewdir;
|
||||
|
||||
//varying float earthShade;
|
||||
//varying float yprime_alt;
|
||||
|
||||
varying float mie_angle;
|
||||
varying float steepness;
|
||||
varying float grad_dir;
|
||||
|
@ -42,15 +40,13 @@ uniform float visibility;
|
|||
uniform float overcast;
|
||||
uniform float ground_scattering;
|
||||
uniform float eye_alt;
|
||||
//uniform float eye_lat;
|
||||
//uniform float eye_lon;
|
||||
uniform float moonlight;
|
||||
|
||||
uniform mat4 osg_ViewMatrixInverse;
|
||||
|
||||
float earthShade;
|
||||
float yprime_alt;
|
||||
//float mie_angle;
|
||||
|
||||
|
||||
|
||||
// This is the value used in the skydome scattering shader - use the same here for consistency?
|
||||
|
@ -84,21 +80,12 @@ void main()
|
|||
float vertex_alt;
|
||||
float scattering;
|
||||
|
||||
rawPos = gl_Vertex.xy;
|
||||
rawPos = gl_Vertex.xy;
|
||||
worldPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz;
|
||||
|
||||
// try making a continuous coordinate system
|
||||
//vec4 worldPos3D = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex);
|
||||
|
||||
//rawPos = worldPos3d.yz;
|
||||
//float x1 = sin(eye_lon) * worldPos3D.y + cos(eye_lon) * worldPos3D.z;
|
||||
//float y1 = cos(eye_lon) * worldPos3D.y - sin(eye_lon) * worldPos3D.z;
|
||||
|
||||
//y1 = cos(eye_lat) * y1 + sin(eye_lat) * worldPos3D.x;
|
||||
|
||||
//worldPos = vec2 (x1, y1);
|
||||
|
||||
steepness = dot(normalize(gl_Normal), vec3 (0.0, 0.0, 1.0));
|
||||
grad_dir = dot(normalize(gl_Normal.xy), vec2 (1.0, 0.0));
|
||||
steepness = dot(normalize(gl_Normal), vec3 (0.0, 0.0, 1.0));
|
||||
grad_dir = dot(normalize(gl_Normal.xy), vec2 (1.0, 0.0));
|
||||
|
||||
// this code is copied from default.vert
|
||||
|
||||
|
@ -277,7 +264,12 @@ else // the faster, full-day version without lightfields
|
|||
|
||||
light_ambient = light_ambient * ((1.0+steepness)/2.0 * 1.2 + (1.0-steepness)/2.0 * 0.2);
|
||||
|
||||
//light_ambient.rgb = 0.1 * light_ambient.rgb;
|
||||
// deeper shadows when there is lots of direct light
|
||||
|
||||
float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smoothstep(0.1,0.5,overcast)) * smoothstep(0.4,1.5,earthShade);
|
||||
|
||||
light_ambient.rgb = light_ambient.rgb * (1.0 - shade_depth);
|
||||
light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * shade_depth);
|
||||
|
||||
// default lighting based on texture and material using the light we have just computed
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d));
|
|||
void main()
|
||||
{
|
||||
|
||||
vec4 light_diffuse;
|
||||
//vec4 light_diffuse;
|
||||
vec4 light_ambient;
|
||||
|
||||
vec3 shadedFogColor = vec3(0.65, 0.67, 0.78);
|
||||
|
@ -155,11 +155,11 @@ if (terminator < 1000000.0) // the full, sunrise and sunset computation
|
|||
|
||||
|
||||
|
||||
light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0);
|
||||
light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
light_diffuse.a = 1.0;
|
||||
light_diffuse = light_diffuse * scattering;
|
||||
//light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0);
|
||||
//light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
//light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
//light_diffuse.a = 1.0;
|
||||
//light_diffuse = light_diffuse * scattering;
|
||||
|
||||
light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33);
|
||||
light_ambient.g = light_ambient.r * 0.4/0.33;
|
||||
|
@ -178,8 +178,8 @@ if (earthShade < 0.5)
|
|||
intensity = length(light_ambient.rgb);
|
||||
light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade) ));
|
||||
|
||||
intensity = length(light_diffuse.rgb);
|
||||
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.7,earthShade) ));
|
||||
//intensity = length(light_diffuse.rgb);
|
||||
//light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.7,earthShade) ));
|
||||
}
|
||||
|
||||
|
||||
|
@ -211,16 +211,16 @@ else // the faster, full-day version without lightfields
|
|||
mie_angle = 1.0;
|
||||
|
||||
if (terminator > 3000000.0)
|
||||
{light_diffuse = vec4 (1.0, 1.0, 1.0, 1.0);
|
||||
{//light_diffuse = vec4 (1.0, 1.0, 1.0, 1.0);
|
||||
light_ambient = vec4 (0.33, 0.4, 0.5, 1.0); }
|
||||
else
|
||||
{
|
||||
|
||||
lightArg = (terminator/100000.0 - 10.0)/20.0;
|
||||
light_diffuse.b = 0.78 + lightArg * 0.21;
|
||||
light_diffuse.g = 0.907 + lightArg * 0.091;
|
||||
light_diffuse.r = 0.904 + lightArg * 0.092;
|
||||
light_diffuse.a = 1.0;
|
||||
//light_diffuse.b = 0.78 + lightArg * 0.21;
|
||||
//light_diffuse.g = 0.907 + lightArg * 0.091;
|
||||
//light_diffuse.r = 0.904 + lightArg * 0.092;
|
||||
//light_diffuse.a = 1.0;
|
||||
|
||||
light_ambient.r = 0.316 + lightArg * 0.016;
|
||||
light_ambient.g = light_ambient.r * 0.4/0.33;
|
||||
|
@ -228,16 +228,17 @@ else // the faster, full-day version without lightfields
|
|||
light_ambient.a = 1.0;
|
||||
}
|
||||
|
||||
light_diffuse = light_diffuse * scattering;
|
||||
//light_diffuse = light_diffuse * scattering;
|
||||
yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude);
|
||||
}
|
||||
|
||||
light_ambient.rgb = light_ambient.rgb * (1.0 + smoothstep(1000000.0, 3000000.0,terminator));
|
||||
|
||||
// tree shader lighting
|
||||
|
||||
vec3 diffuse = gl_FrontMaterial.diffuse.rgb * max(0.1, n);
|
||||
//vec3 diffuse = gl_FrontMaterial.diffuse.rgb * max(0.1, n);
|
||||
vec4 ambientColor = gl_FrontLightModelProduct.sceneColor + light_ambient * gl_FrontMaterial.ambient;
|
||||
gl_FrontColor = ambientColor + light_diffuse * vec4(diffuse, 1.0);
|
||||
gl_FrontColor = ambientColor;// + light_diffuse * vec4(diffuse, 1.0);
|
||||
gl_FrontColor.a = mie_angle; gl_BackColor.a = mie_angle;
|
||||
//gl_FrontColor.a = 1.0; gl_BackColor.a = 1.0;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ uniform sampler2D water_normalmap;
|
|||
uniform sampler2D water_dudvmap;
|
||||
uniform sampler2D sea_foam;
|
||||
uniform sampler2D perlin_normalmap;
|
||||
uniform sampler2D ice_texture;
|
||||
|
||||
uniform sampler3D Noise;
|
||||
|
||||
|
@ -23,8 +24,8 @@ varying vec4 waterTex2; //moving texcoords
|
|||
varying vec4 waterTex4; //viewts
|
||||
varying vec3 viewerdir;
|
||||
varying vec3 lightdir;
|
||||
//varying vec3 specular_light;
|
||||
varying vec3 relPos;
|
||||
varying vec3 rawPos;
|
||||
|
||||
varying float earthShade;
|
||||
varying float yprime_alt;
|
||||
|
@ -49,6 +50,7 @@ uniform float scattering;
|
|||
uniform float ground_scattering;
|
||||
uniform float cloud_self_shading;
|
||||
uniform float eye_alt;
|
||||
uniform float ice_cover;
|
||||
uniform float sea_r;
|
||||
uniform float sea_g;
|
||||
uniform float sea_b;
|
||||
|
@ -68,6 +70,93 @@ vec3 fog_Func(vec3 color, int type);
|
|||
|
||||
/////// functions /////////
|
||||
|
||||
float rand2D(in vec2 co){
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
float rand3D(in vec3 co){
|
||||
return fract(sin(dot(co.xyz ,vec3(12.9898,78.233,144.7272))) * 43758.5453);
|
||||
}
|
||||
|
||||
float cosine_interpolate(in float a, in float b, in float x)
|
||||
{
|
||||
float ft = x * 3.1415927;
|
||||
float f = (1.0 - cos(ft)) * .5;
|
||||
|
||||
return a*(1.0-f) + b*f;
|
||||
}
|
||||
|
||||
float simple_interpolate(in float a, in float b, in float x)
|
||||
{
|
||||
return a + smoothstep(0.0,1.0,x) * (b-a);
|
||||
}
|
||||
|
||||
float interpolatedNoise2D(in float x, in float y)
|
||||
{
|
||||
float integer_x = x - fract(x);
|
||||
float fractional_x = x - integer_x;
|
||||
|
||||
float integer_y = y - fract(y);
|
||||
float fractional_y = y - integer_y;
|
||||
|
||||
float v1 = rand2D(vec2(integer_x, integer_y));
|
||||
float v2 = rand2D(vec2(integer_x+1.0, integer_y));
|
||||
float v3 = rand2D(vec2(integer_x, integer_y+1.0));
|
||||
float v4 = rand2D(vec2(integer_x+1.0, integer_y +1.0));
|
||||
|
||||
float i1 = simple_interpolate(v1 , v2 , fractional_x);
|
||||
float i2 = simple_interpolate(v3 , v4 , fractional_x);
|
||||
|
||||
return simple_interpolate(i1 , i2 , fractional_y);
|
||||
}
|
||||
|
||||
float interpolatedNoise3D(in float x, in float y, in float z)
|
||||
{
|
||||
float integer_x = x - fract(x);
|
||||
float fractional_x = x - integer_x;
|
||||
|
||||
float integer_y = y - fract(y);
|
||||
float fractional_y = y - integer_y;
|
||||
|
||||
float integer_z = z - fract(z);
|
||||
float fractional_z = z - integer_z;
|
||||
|
||||
float v1 = rand3D(vec3(integer_x, integer_y, integer_z));
|
||||
float v2 = rand3D(vec3(integer_x+1.0, integer_y, integer_z));
|
||||
float v3 = rand3D(vec3(integer_x, integer_y+1.0, integer_z));
|
||||
float v4 = rand3D(vec3(integer_x+1.0, integer_y +1.0, integer_z));
|
||||
|
||||
float v5 = rand3D(vec3(integer_x, integer_y, integer_z+1.0));
|
||||
float v6 = rand3D(vec3(integer_x+1.0, integer_y, integer_z+1.0));
|
||||
float v7 = rand3D(vec3(integer_x, integer_y+1.0, integer_z+1.0));
|
||||
float v8 = rand3D(vec3(integer_x+1.0, integer_y +1.0, integer_z+1.0));
|
||||
|
||||
|
||||
float i1 = simple_interpolate(v1,v5, fractional_z);
|
||||
float i2 = simple_interpolate(v2,v6, fractional_z);
|
||||
float i3 = simple_interpolate(v3,v7, fractional_z);
|
||||
float i4 = simple_interpolate(v4,v8, fractional_z);
|
||||
|
||||
float ii1 = simple_interpolate(i1,i2,fractional_x);
|
||||
float ii2 = simple_interpolate(i3,i4,fractional_x);
|
||||
|
||||
|
||||
return simple_interpolate(ii1 , ii2 , fractional_y);
|
||||
}
|
||||
|
||||
float Noise2D(in vec2 coord, in float wavelength)
|
||||
{
|
||||
return interpolatedNoise2D(coord.x/wavelength, coord.y/wavelength);
|
||||
|
||||
}
|
||||
|
||||
float Noise3D(in vec3 coord, in float wavelength)
|
||||
{
|
||||
return interpolatedNoise3D(coord.x/wavelength, coord.y/wavelength, coord.z/wavelength);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void rotationmatrix(in float angle, out mat4 rotmat)
|
||||
{
|
||||
rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0,
|
||||
|
@ -199,6 +288,12 @@ void main(void)
|
|||
const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02);
|
||||
const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25);
|
||||
|
||||
float noise_50m = Noise3D(rawPos.xyz, 50.0);
|
||||
float noise_250m = Noise3D(rawPos.xyz,250.0);
|
||||
float noise_1500m = Noise3D(rawPos.xyz,1500.0);
|
||||
float noise_2000m = Noise3D(rawPos.xyz,2000.0);
|
||||
float noise_2500m = Noise3D(rawPos.xyz, 2500.0);
|
||||
|
||||
mat4 RotationMatrix;
|
||||
|
||||
// compute direction to viewer
|
||||
|
@ -332,6 +427,7 @@ void main(void)
|
|||
if (normalmap_dds > 0)
|
||||
{vNorm = -vNorm;} //dds fix
|
||||
|
||||
vNorm = vNorm * (0.5 + 0.5 * noise_250m);
|
||||
|
||||
//load reflection
|
||||
|
||||
|
@ -342,6 +438,7 @@ void main(void)
|
|||
refl.b = sea_b;
|
||||
refl.a = 1.0;
|
||||
|
||||
refl.g = refl.g * (0.9 + 0.2* noise_2500m);
|
||||
|
||||
float intensity;
|
||||
// de-saturate for reduced light
|
||||
|
@ -435,7 +532,16 @@ void main(void)
|
|||
|
||||
|
||||
|
||||
finalColor *= ambient_light;
|
||||
// add ice
|
||||
vec4 ice_texel = texture2D(ice_texture, vec2(waterTex2) * 0.2 );
|
||||
|
||||
float nSum = 0.5 * (noise_250m + noise_50m);
|
||||
float mix_factor = smoothstep(1.0 - ice_cover, 1.04-ice_cover, nSum);
|
||||
finalColor = mix(finalColor, ice_texel, mix_factor * ice_texel.a);
|
||||
finalColor.a = 1.0;
|
||||
|
||||
|
||||
finalColor *= ambient_light;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ varying vec4 waterTex1;
|
|||
varying vec4 waterTex2;
|
||||
varying vec4 waterTex4;
|
||||
varying vec3 relPos;
|
||||
|
||||
varying vec3 rawPos;
|
||||
|
||||
varying vec3 viewerdir;
|
||||
varying vec3 lightdir;
|
||||
|
@ -31,6 +31,7 @@ uniform float visibility;
|
|||
uniform float overcast;
|
||||
uniform float ground_scattering;
|
||||
|
||||
uniform mat4 osg_ViewMatrixInverse;
|
||||
|
||||
vec3 specular_light;
|
||||
|
||||
|
@ -72,6 +73,7 @@ void main(void)
|
|||
|
||||
|
||||
vec3 shadedFogColor = vec3(0.65, 0.67, 0.78);
|
||||
rawPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz;
|
||||
|
||||
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
|
|
|
@ -148,6 +148,9 @@
|
|||
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Snow thickness</label>
|
||||
<halign>left</halign>
|
||||
<row>3</row>
|
||||
|
@ -155,6 +158,9 @@
|
|||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>thin</label>
|
||||
<halign>right</halign>
|
||||
<row>3</row>
|
||||
|
@ -162,6 +168,9 @@
|
|||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>snow-thickness</name>
|
||||
<row>3</row>
|
||||
<col>2</col>
|
||||
|
@ -176,29 +185,91 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>thick</label>
|
||||
<halign>left</halign>
|
||||
<row>3</row>
|
||||
<col>3</col>
|
||||
</text>
|
||||
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Ice cover</label>
|
||||
<halign>left</halign>
|
||||
<row>4</row>
|
||||
<col>0</col>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>none</label>
|
||||
<halign>right</halign>
|
||||
<row>4</row>
|
||||
<col>1</col>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>ice-cover</name>
|
||||
<row>4</row>
|
||||
<col>2</col>
|
||||
<min>0.0</min>
|
||||
<max>1.0</max>
|
||||
<live>true</live>
|
||||
<property>/environment/sea/surface/ice-cover</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
<object-name>ice-cover</object-name>
|
||||
</binding>
|
||||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>thick</label>
|
||||
<halign>left</halign>
|
||||
<row>4</row>
|
||||
<col>3</col>
|
||||
</text>
|
||||
|
||||
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Dust cover</label>
|
||||
<halign>left</halign>
|
||||
<row>4</row>
|
||||
<row>5</row>
|
||||
<col>0</col>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>none</label>
|
||||
<halign>right</halign>
|
||||
<row>4</row>
|
||||
<row>5</row>
|
||||
<col>1</col>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>dust-level</name>
|
||||
<row>4</row>
|
||||
<row>5</row>
|
||||
<col>2</col>
|
||||
<min>0.0</min>
|
||||
<max>0.7</max>
|
||||
|
@ -211,29 +282,41 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>dusty</label>
|
||||
<halign>left</halign>
|
||||
<row>4</row>
|
||||
<row>5</row>
|
||||
<col>3</col>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Wetness</label>
|
||||
<halign>left</halign>
|
||||
<row>5</row>
|
||||
<row>6</row>
|
||||
<col>0</col>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>dry</label>
|
||||
<halign>right</halign>
|
||||
<row>5</row>
|
||||
<row>6</row>
|
||||
<col>1</col>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>wetness</name>
|
||||
<row>5</row>
|
||||
<row>6</row>
|
||||
<col>2</col>
|
||||
<min>0.0</min>
|
||||
<max>0.7</max>
|
||||
|
@ -246,30 +329,42 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>wet</label>
|
||||
<halign>left</halign>
|
||||
<row>5</row>
|
||||
<row>6</row>
|
||||
<col>3</col>
|
||||
</text>
|
||||
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Vegetation</label>
|
||||
<halign>left</halign>
|
||||
<row>6</row>
|
||||
<row>7</row>
|
||||
<col>0</col>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>none</label>
|
||||
<halign>right</halign>
|
||||
<row>6</row>
|
||||
<row>7</row>
|
||||
<col>1</col>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>lichen-level</name>
|
||||
<row>6</row>
|
||||
<row>7</row>
|
||||
<col>2</col>
|
||||
<min>0.0</min>
|
||||
<max>0.7</max>
|
||||
|
@ -282,30 +377,42 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>mossy</label>
|
||||
<halign>left</halign>
|
||||
<row>6</row>
|
||||
<row>7</row>
|
||||
<col>3</col>
|
||||
</text>
|
||||
|
||||
|
||||
<text>
|
||||
<label>Season</label>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>Season (experimental)</label>
|
||||
<halign>left</halign>
|
||||
<row>7</row>
|
||||
<row>8</row>
|
||||
<col>0</col>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>summer</label>
|
||||
<halign>right</halign>
|
||||
<row>7</row>
|
||||
<row>8</row>
|
||||
<col>1</col>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<name>season</name>
|
||||
<row>7</row>
|
||||
<row>8</row>
|
||||
<col>2</col>
|
||||
<min>0.0</min>
|
||||
<max>2.0</max>
|
||||
|
@ -318,9 +425,12 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<enable>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
</enable>
|
||||
<label>late autumn</label>
|
||||
<halign>left</halign>
|
||||
<row>7</row>
|
||||
<row>8</row>
|
||||
<col>3</col>
|
||||
</text>
|
||||
|
||||
|
|
|
@ -4,23 +4,134 @@
|
|||
<height>430</height>
|
||||
<modal>false</modal>
|
||||
<nasal>
|
||||
<open>
|
||||
<open><![CDATA[
|
||||
|
||||
var gps = props.globals.getNode("/instrumentation/gps/", 1);
|
||||
var dlg = props.globals.getNode("/sim/gui/dialogs/gps", 1);
|
||||
var cmd = gps.getNode("command", 1);
|
||||
var scratch = gps.getNode("scratch");
|
||||
|
||||
scratch.getNode("exact", 1).setBoolValue(0);
|
||||
var searchType = scratch.getNode("type", 1);
|
||||
var searchQuery = scratch.getNode("query", 1);
|
||||
|
||||
var copySearchArgs = func {
|
||||
searchType.setValue(dlg.getNode("search-type").getValue());
|
||||
searchQuery.setValue(dlg.getNode("search-query").getValue());
|
||||
}
|
||||
var scratch = gps.getNode("scratch", 1);
|
||||
var scratchValid = scratch.getNode("valid", 1);
|
||||
var searchIsWaypoints = 0;
|
||||
var anySpec = 'vor,airport,heliport,ils,seaport,fix,ndb,waypoint,tacan,city,town';
|
||||
|
||||
var updateSearchResults = func(isWpts, index = 0)
|
||||
{
|
||||
searchIsWaypoints = isWpts;
|
||||
dlg.getNode("scratch-index", 1).setValue(index);
|
||||
|
||||
var lastIndex = size(searchResults) - 1;
|
||||
dlg.getNode("scratch-has-next", 1).setValue((index + 1) < lastIndex);
|
||||
|
||||
if (size(searchResults) < 1) {
|
||||
scratchValid.setBoolValue(0);
|
||||
return;
|
||||
}
|
||||
|
||||
updateScratch();
|
||||
}
|
||||
|
||||
var updateScratch = func
|
||||
{
|
||||
var result = searchResults[dlg.getNode("scratch-index").getValue()];
|
||||
if (result == nil) {
|
||||
scratchValid.setBoolValue(0);
|
||||
return;
|
||||
}
|
||||
|
||||
scratchValid.setBoolValue(1);
|
||||
scratch.getNode("latitude-deg", 1).setValue(result.lat);
|
||||
scratch.getNode("longitude-deg", 1).setValue(result.lon);
|
||||
scratch.getNode("ident", 1).setValue(result.id);
|
||||
var cd = nil;
|
||||
|
||||
if (searchIsWaypoints) {
|
||||
scratch.getNode("type", 1).setValue('WPT');
|
||||
|
||||
cd = result.courseAndDistanceFrom(geo.aircraft_position());
|
||||
} else {
|
||||
var ty = result.type;
|
||||
scratch.getNode("type", 1).setValue(ty);
|
||||
scratch.getNode("name", 1).setValue(result.name);
|
||||
scratch.getNode("altitude-ft", 1).setValue(result.elevation);
|
||||
|
||||
if (ty == 'vor') {
|
||||
scratch.getNode("frequency-mhz", 1).setValue(result.frequency);
|
||||
} elsif (ty == 'ndb') {
|
||||
scratch.getNode("frequency-khz", 1).setValue(result.frequency);
|
||||
}
|
||||
|
||||
cd = positioned.courseAndDistance(result);
|
||||
}
|
||||
|
||||
|
||||
scratch.getNode("mag-bearing-deg", 1).setValue(cd[0] + magvar());
|
||||
scratch.getNode("distance-nm", 1).setValue(cd[1]);
|
||||
|
||||
gui.dialog_update("gps");
|
||||
}
|
||||
|
||||
var doSearch = func()
|
||||
{
|
||||
var ty = dlg.getNode("search-type").getValue();
|
||||
if (ty == 'any') ty = anySpec;
|
||||
|
||||
var query = dlg.getNode("search-query").getValue();
|
||||
searchResults = positioned.sortByRange(positioned.findByIdent(query, ty));
|
||||
updateSearchResults(0);
|
||||
}
|
||||
|
||||
var doSearchNames = func
|
||||
{
|
||||
var ty = dlg.getNode("search-type").getValue();
|
||||
if (ty == 'any') ty = anySpec;
|
||||
var query = dlg.getNode("search-query").getValue();
|
||||
searchResults = positioned.sortByRange(positioned.findByName(query, ty));
|
||||
updateSearchResults(0);
|
||||
}
|
||||
|
||||
var doSearchNearest = func
|
||||
{
|
||||
var ty = dlg.getNode("search-type").getValue();
|
||||
searchResults = positioned.findWithinRange(200.0, ty);
|
||||
updateSearchResults(0);
|
||||
}
|
||||
|
||||
var doLoadRouteWaypoint = func
|
||||
{
|
||||
var fp = flightplan();
|
||||
searchResults = [];
|
||||
for (var i=0; i < fp.getPlanSize(); i+=1) {
|
||||
append(searchResults, fp.getWP(i));
|
||||
}
|
||||
updateSearchResults(1, fp.current);
|
||||
}
|
||||
|
||||
var doScratchPrevious = func
|
||||
{
|
||||
var index = dlg.getNode("scratch-index").getValue();
|
||||
if (index == 0) return;
|
||||
dlg.getNode("scratch-index").setValue(index - 1);
|
||||
dlg.getNode("scratch-has-next", 1).setValue(size(searchResults) > 1);
|
||||
updateScratch();
|
||||
}
|
||||
|
||||
var doScratchNext = func
|
||||
{
|
||||
var index = dlg.getNode("scratch-index").getValue();
|
||||
var lastIndex = size(searchResults) - 1;
|
||||
if (index == lastIndex) return;
|
||||
|
||||
dlg.getNode("scratch-has-next", 1).setValue((index + 1) < lastIndex);
|
||||
dlg.getNode("scratch-index").setValue(index + 1);
|
||||
updateScratch();
|
||||
}
|
||||
|
||||
var searchResults = [];
|
||||
updateSearchResults(0);
|
||||
|
||||
var slaved = props.globals.getNode("/instrumentation/nav[0]/slaved-to-gps", 1);
|
||||
</open>
|
||||
]]></open>
|
||||
|
||||
</nasal>
|
||||
<name>gps</name>
|
||||
<layout>vbox</layout>
|
||||
|
@ -304,6 +415,8 @@
|
|||
<value>ndb</value>
|
||||
<value>fix</value>
|
||||
<value>wpt</value>
|
||||
<value>city</value>
|
||||
<value>town</value>
|
||||
<live>true</live>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
|
@ -336,36 +449,21 @@
|
|||
<legend>Search</legend>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
copySearchArgs();
|
||||
cmd.setValue("search");
|
||||
</script>
|
||||
<script>doSearch()</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
<legend>Search Names</legend>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
copySearchArgs();
|
||||
cmd.setValue("search-names");
|
||||
</script>
|
||||
<script>doSearchNames()</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
<legend>Nrst</legend>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
copySearchArgs();
|
||||
scratch.getNode("max-results", 1).setIntValue(10);
|
||||
|
||||
# ensure scratch pos is invalid, so we use current GPS
|
||||
# position as the search origin
|
||||
scratch.getNode("longitude-deg", 1).setDoubleValue(-9999);
|
||||
scratch.getNode("latitude-deg", 1).setDoubleValue(-9999);
|
||||
cmd.setValue("nearest")
|
||||
</script>
|
||||
<script>doSearchNearest()</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
|
@ -375,11 +473,7 @@
|
|||
<legend>Actv RTE WPT</legend>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
scratch.getNode("results", 1).clearValue();
|
||||
scratch.getNode("index", 1).setIntValue(-1);
|
||||
cmd.setValue("load-route-wpt")
|
||||
</script>
|
||||
<script>doLoadRouteWaypoint()</script>
|
||||
</binding>
|
||||
</button>
|
||||
<empty>
|
||||
|
@ -484,7 +578,7 @@
|
|||
<button>
|
||||
<enable>
|
||||
<greater-than>
|
||||
<property>/instrumentation/gps/scratch/index</property>
|
||||
<property>/sim/gui/dialogs/gps/scratch-index</property>
|
||||
<value>0</value>
|
||||
</greater-than>
|
||||
</enable>
|
||||
|
@ -494,12 +588,12 @@
|
|||
<key>left</key>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>cmd.setValue("previous")</script>
|
||||
<script>doScratchPrevious()</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
<enable>
|
||||
<property>/instrumentation/gps/scratch/has-next</property>
|
||||
<property>/sim/gui/dialogs/gps/scratch-has-next</property>
|
||||
</enable>
|
||||
<row>5</row>
|
||||
<col>1</col>
|
||||
|
@ -507,7 +601,7 @@
|
|||
<key>right</key>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>cmd.setValue("next")</script>
|
||||
<script>doScratchNext()</script>
|
||||
</binding>
|
||||
</button>
|
||||
</group>
|
||||
|
|
|
@ -224,9 +224,38 @@ command interface /autopilot/route-manager/input:
|
|||
gui.dialog_update("route-manager", "approach");
|
||||
}
|
||||
|
||||
|
||||
var initPosition = func {
|
||||
var routeActive = routem.getNode("active").getValue();
|
||||
if (routeActive) return;
|
||||
|
||||
# FIXME have user waypoints check
|
||||
var fp = flightplan();
|
||||
|
||||
var airborne = getprop('/gear/gear[0]/wow') == 0;
|
||||
if (airborne) {
|
||||
debug.dump('route-manager dialog, init in-air, clearing departure settings');
|
||||
fp.departure = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
# we're on the ground, find the nearest airport to start from
|
||||
if (fp.departure == nil) {
|
||||
var apts = findAirportsWithinRange(25.0);
|
||||
if (size(apts) == 0) return; # no airports nearby
|
||||
fp.departure = apts[0]; # use the closest one
|
||||
}
|
||||
|
||||
if (fp.departure_runway == nil) {
|
||||
debug.dump('selecting departure runway');
|
||||
var rwy = fp.departure.findBestRunwayForPos( geo.aircraft_position() );
|
||||
fp.departure_runway = rwy;
|
||||
}
|
||||
}
|
||||
|
||||
# initialise departure values based on current position
|
||||
cmd.setValue("@posinit");
|
||||
initPosition();
|
||||
|
||||
updateRunways();
|
||||
updateSIDs();
|
||||
|
|
|
@ -388,6 +388,12 @@
|
|||
<command>dialog-apply</command>
|
||||
<object-name>manual-weather-config</object-name>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
controller.refresh();
|
||||
</script>
|
||||
</binding>
|
||||
</checkbox>
|
||||
</group>
|
||||
</group>
|
||||
|
|
Loading…
Add table
Reference in a new issue