1
0
Fork 0

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

Conflicts:
	Aircraft/victor/victor-set.xml
This commit is contained in:
willie 2010-09-02 19:00:08 +01:00
commit 2571d8e9aa
11 changed files with 178 additions and 177 deletions

View file

@ -36,7 +36,7 @@
<write-mask>false</write-mask> <write-mask>false</write-mask>
</depth> </depth>
<render-bin> <render-bin>
<bin-number>9</bin-number> <bin-number>10</bin-number>
<bin-name>DepthSortedBin</bin-name> <bin-name>DepthSortedBin</bin-name>
</render-bin> </render-bin>
<texture-unit> <texture-unit>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PropertyList> <PropertyList>
<name>Effects/cropgrass</name> <name>Effects/cropgrass</name>
<inherits-from>Effects/terrain-default</inherits-from> <inherits-from>Effects/crop</inherits-from>
<parameters> <parameters>
<texture n="2"> <texture n="2">
<image>Textures/Terrain/cropgrass.png</image> <image>Textures/Terrain/cropgrass.png</image>
@ -18,92 +18,4 @@
</texture> </texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level> <snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
</parameters> </parameters>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/crop-shader</property>
<property>/sim/rendering/shader-effects</property>
<or>
<less-equal>
<value type="float">2.0</value>
<glversion/>
</less-equal>
<and>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<!-- Use material values that are either inherited from the
terrain-default effect or supplied by an effect derived
from this one e.g., one created in the materials library. -->
<material>
<ambient><use>material/ambient</use></ambient>
<diffuse><use>material/diffuse</use></diffuse>
<specular><use>material/specular</use></specular>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<blend><use>transparent</use></blend>
<alpha-test><use>transparent</use></alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number><use>render-bin/bin-number</use></bin-number>
<bin-name><use>render-bin/bin-name</use></bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<type>noise</type>
</texture-unit>
<texture-unit>
<unit>1</unit>
<image><use>texture[2]/image</use></image>
<filter><use>texture[2]/filter</use></filter>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[2]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<type>1d</type>
<image><use>texture[3]/image</use></image>
<filter><use>texture[3]/filter</use></filter>
<wrap-s><use>texture[3]/wrap-s</use></wrap-s>
<internal-format>
<use>texture[3]/internal-format</use>
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/crop.vert</vertex-shader>
<fragment-shader>Shaders/crop.frag</fragment-shader>
</program>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>SampleTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>ColorsTex</name>
<type>sampler-1d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value><use>snow-level</use></value>
</uniform>
</pass>
</technique>
</PropertyList> </PropertyList>

View file

@ -49,7 +49,7 @@
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/crop-shader</property> <property>/sim/rendering/transition-shader</property>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shader-effects</property>
<or> <or>
<less-equal> <less-equal>

View file

@ -49,7 +49,7 @@
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/crop-shader</property> <property>/sim/rendering/transition-shader</property>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shader-effects</property>
<or> <or>
<less-equal> <less-equal>

View file

@ -49,7 +49,7 @@
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/crop-shader</property> <property>/sim/rendering/transition-shader</property>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shader-effects</property>
<or> <or>
<less-equal> <less-equal>

View file

@ -113,7 +113,7 @@
<aloft> <aloft>
<entry> <entry>
<elevation-ft>3000</elevation-ft> <elevation-ft>5000</elevation-ft>
<wind-from-heading-deg>300</wind-from-heading-deg> <wind-from-heading-deg>300</wind-from-heading-deg>
<wind-speed-kt>10</wind-speed-kt> <wind-speed-kt>10</wind-speed-kt>
<visibility-m>16093.44</visibility-m> <visibility-m>16093.44</visibility-m>
@ -128,7 +128,7 @@
</entry> </entry>
<entry> <entry>
<elevation-ft>6000</elevation-ft> <elevation-ft>10000</elevation-ft>
<wind-from-heading-deg>310</wind-from-heading-deg> <wind-from-heading-deg>310</wind-from-heading-deg>
<wind-speed-kt>20</wind-speed-kt> <wind-speed-kt>20</wind-speed-kt>
<turbulence> <turbulence>
@ -141,7 +141,7 @@
</entry> </entry>
<entry> <entry>
<elevation-ft>9000</elevation-ft> <elevation-ft>18000</elevation-ft>
<wind-from-heading-deg>320</wind-from-heading-deg> <wind-from-heading-deg>320</wind-from-heading-deg>
<wind-speed-kt>30</wind-speed-kt> <wind-speed-kt>30</wind-speed-kt>
<wind-heading-change-deg>35</wind-heading-change-deg> <wind-heading-change-deg>35</wind-heading-change-deg>
@ -149,7 +149,7 @@
</entry> </entry>
<entry> <entry>
<elevation-ft>30000</elevation-ft> <elevation-ft>24000</elevation-ft>
<wind-from-heading-deg>330</wind-from-heading-deg> <wind-from-heading-deg>330</wind-from-heading-deg>
<wind-speed-kt>50</wind-speed-kt> <wind-speed-kt>50</wind-speed-kt>
<wind-heading-change-deg>35</wind-heading-change-deg> <wind-heading-change-deg>35</wind-heading-change-deg>
@ -157,7 +157,7 @@
</entry> </entry>
<entry> <entry>
<elevation-ft>40000</elevation-ft> <elevation-ft>30000</elevation-ft>
<wind-from-heading-deg>340</wind-from-heading-deg> <wind-from-heading-deg>340</wind-from-heading-deg>
<wind-speed-kt>70</wind-speed-kt> <wind-speed-kt>70</wind-speed-kt>
<wind-heading-change-deg>35</wind-heading-change-deg> <wind-heading-change-deg>35</wind-heading-change-deg>

View file

@ -111,7 +111,7 @@
<!-- split the wind vector into it's components --> <!-- split the wind vector into it's components -->
<filter> <filter>
<name>MetarController:wind-from-north-kt</name> <name>MetarController:wind-from-north-fps</name>
<type>exponential</type> <type>exponential</type>
<filter-time>30</filter-time> <filter-time>30</filter-time>
<enable> <enable>
@ -119,22 +119,12 @@
<property>/environment/metar/valid</property> <property>/environment/metar/valid</property>
</condition> </condition>
</enable> </enable>
<input> <input>/environment/metar/base-wind-from-north-fps</input>
<expression> <output>/environment/config/boundary/entry[0]/wind-from-north-fps</output>
<cos>
<product>
<property>/environment/metar/base-wind-dir-deg</property>
<value>0.0174533</value>
</product>
</cos>
</expression>
<scale>/environment/metar/base-wind-speed-kt</scale>
</input>
<output>/environment/metar/base-wind-from-north-kt</output>
</filter> </filter>
<filter> <filter>
<name>MetarController:wind-from-east-kt</name> <name>MetarController:wind-from-east-fps</name>
<type>exponential</type> <type>exponential</type>
<filter-time>30</filter-time> <filter-time>30</filter-time>
<enable> <enable>
@ -142,71 +132,8 @@
<property>/environment/metar/valid</property> <property>/environment/metar/valid</property>
</condition> </condition>
</enable> </enable>
<input> <input>/environment/metar/base-wind-from-east-fps</input>
<expression> <output>/environment/config/boundary/entry[0]/wind-from-east-fps</output>
<sin>
<product>
<property>/environment/metar/base-wind-dir-deg</property>
<value>0.0174533</value>
</product>
</sin>
</expression>
<scale>/environment/metar/base-wind-speed-kt</scale>
</input>
<output>/environment/metar/base-wind-from-east-kt</output>
</filter>
<filter>
<name>MetarController::wind-speed-kt</name>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>
<expression>
<!-- pythagoras in markup language -->
<sqrt>
<sum>
<product>
<property>/environment/metar/base-wind-from-east-kt</property>
<property>/environment/metar/base-wind-from-east-kt</property>
</product>
<product>
<property>/environment/metar/base-wind-from-north-kt</property>
<property>/environment/metar/base-wind-from-north-kt</property>
</product>
</sum>
</sqrt>
</expression>
</input>
<output>/environment/config/boundary/entry[0]/wind-speed-kt</output>
<type>gain</type>
<gain>1.0</gain>
</filter>
<filter>
<name>MetarController:wind-from-heading-deg</name>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>
<expression>
<atan2>
<property>/environment/metar/base-wind-from-east-kt</property>
<property>/environment/metar/base-wind-from-north-kt</property>
</atan2>
</expression>
</input>
<output>/environment/config/boundary/entry[0]/wind-from-heading-deg</output>
<type>gain</type>
<gain>57.3</gain> <!-- radians to degree -->
<period>
<min>0</min>
<max>360</max>
</period>
</filter> </filter>
<!-- Adjust the wind-vector for the layers --> <!-- Adjust the wind-vector for the layers -->

11
Nasal/seaport.nas Normal file
View file

@ -0,0 +1,11 @@
_setlistener("/sim/presets/latitude-deg", func {
print("*** NEW LOCATION ***");
settimer(func {
var typ = getprop("/sim/type");
var lat = getprop("/position/latitude-deg");
var lon = getprop("/position/longitude-deg");
var g = geodinfo(lat, lon);
if ((g != nil and g[1] != nil and g[1].solid) and (typ == "seaplane") )
fgcommand("dialog-show", props.Node.new({ "dialog-name": "seaport" }));
}, 8);
}, 1);

View file

@ -127,6 +127,7 @@ var MP_share_pp = "environment/wildfire/share-events";
var save_on_exit_pp = "environment/wildfire/save-on-exit"; var save_on_exit_pp = "environment/wildfire/save-on-exit";
var restore_on_startup_pp = "environment/wildfire/restore-on-startup"; var restore_on_startup_pp = "environment/wildfire/restore-on-startup";
var crash_fire_pp = "environment/wildfire/fire-on-crash"; var crash_fire_pp = "environment/wildfire/fire-on-crash";
var impact_fire_pp = "environment/wildfire/fire-on-impact";
var report_score_pp = "environment/wildfire/report-score"; var report_score_pp = "environment/wildfire/report-score";
# Internal properties to control the models # Internal properties to control the models
var models_enabled_pp = "environment/wildfire/models/enabled"; var models_enabled_pp = "environment/wildfire/models/enabled";
@ -820,6 +821,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
}); });
props.globals.initNode(MP_share_pp, 1, "BOOL"); props.globals.initNode(MP_share_pp, 1, "BOOL");
props.globals.initNode(crash_fire_pp, 1, "BOOL"); props.globals.initNode(crash_fire_pp, 1, "BOOL");
props.globals.initNode(impact_fire_pp, 1, "BOOL");
props.globals.initNode(save_on_exit_pp, 0, "BOOL"); props.globals.initNode(save_on_exit_pp, 0, "BOOL");
props.globals.initNode(restore_on_startup_pp, 0, "BOOL"); props.globals.initNode(restore_on_startup_pp, 0, "BOOL");
props.globals.initNode(models_enabled_pp, 1, "BOOL"); props.globals.initNode(models_enabled_pp, 1, "BOOL");
@ -855,6 +857,22 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
wildfire.ignite(geo.aircraft_position()); wildfire.ignite(geo.aircraft_position());
}); });
# Detect impact
var impact_node = props.globals.getNode("sim/ai/aircraft/impact/bomb", 1);
setlistener("sim/ai/aircraft/impact/bomb", func(n) {
if (getprop(impact_fire_pp) and n.getBoolValue()){
var node = props.globals.getNode(n.getValue(), 1);
var impactpos = geo.Coord.new();
impactpos.set_latlon(
node.getNode("impact/latitude-deg").getValue(),
node.getNode("impact/longitude-deg").getValue()
);
wildfire.ignite(impactpos);
}
});
printlog("info", "Wildfire ... initialized."); printlog("info", "Wildfire ... initialized.");
}); });
############################################################################### ###############################################################################
@ -917,6 +935,7 @@ var dialog = {
["Share over MP", MP_share_pp], ["Share over MP", MP_share_pp],
["Show 3d models", models_enabled_pp], ["Show 3d models", models_enabled_pp],
["Crash starts fire", crash_fire_pp], ["Crash starts fire", crash_fire_pp],
["Impact starts fire", impact_fire_pp],
["Report score", report_score_pp], ["Report score", report_score_pp],
["Save on exit", save_on_exit_pp]]) { ["Save on exit", save_on_exit_pp]]) {
var w = content.addChild("checkbox"); var w = content.addChild("checkbox");

View file

@ -271,6 +271,15 @@
</binding> </binding>
</checkbox> </checkbox>
<checkbox>
<halign>left</halign>
<label>Transition effects</label>
<property>/sim/rendering/transition-shader</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<checkbox> <checkbox>
<halign>left</halign> <halign>left</halign>
<label>Persistent contrails</label> <label>Persistent contrails</label>

123
gui/dialogs/seaport.xml Normal file
View file

@ -0,0 +1,123 @@
<?xml version="1.0"?>
<PropertyList>
<name>seaport</name>
<layout>vbox</layout>
<nasal>
<!--
Our coastlines are too unrealiable to just teleport to the nearest seaport.
We may have to search around its reported location until we actually find water.
-->
<open>
var label = cmdarg().getNode("text/label");
var apt = airportinfo("seaport");
var rwys = apt.runways;
var lat = apt.lat;
var lon = apt.lon;
label.setValue(" The nearest seaport is \"" ~ apt.name ~ "\" (" ~ apt.id ~ ") ");
var goto_seaport = func {
var rwyid = keys(rwys)[0];
var rwy = rwys[rwyid];
print("SP: going to seaport ", apt.id, "/", rwyid, " (\"", apt.name, "\")");
setprop("/sim/presets/airport-id", apt.id);
teleport(rwy.lat, rwy.lon);
settimer(verify, 4);
}
var verify = func {
var p = geo.aircraft_position();
if (on_water(p.lat(), p.lon())) {
print("SP: seaport center is on water");
return;
}
foreach (var r; keys(rwys)) {
print("SP: trying runway ", r);
var lat = rwys[r].lat;
var lon = rwys[r].lon;
if (on_water(lat, lon)) {
setprop("/sim/presets/runway", r);
setprop("/sim/presets/heading-deg", rwys[r].heading);
print("SP: runway ", r, " is on water");
return teleport(lat, lon);
}
}
print("SP: trying circle");
for (var dist = 500; dist &lt;= 1500; dist += 500) {
print("SP:\tat distance ", dist, " m");
for (var course = 0; course &lt; 360; course += 60) {
print("SP:\t\tat course ", course, " degree");
p.set_latlon(apt.lat, apt.lon);
p.apply_course_distance(course, dist);
if (on_water(p.lat(), p.lon())) {
print("SP: found water");
setprop("/sim/presets/heading-deg", course);
return teleport(p.lat(), p.lon());
}
}
}
print("SP: no water found");
}
var teleport = func(lat, lon) {
setprop("/sim/presets/latitude-deg", lat);
setprop("/sim/presets/longitude-deg", lon);
fgcommand("presets-commit");
}
var on_water = func(lat, lon) {
var g = geodinfo(lat, lon);
return g != nil and g[1] != nil and !g[1].solid;
}
</open>
</nasal>
<group>
<layout>hbox</layout>
<empty><stretch>1</stretch></empty>
<text>
<label>Location inappropriate for a seaplane</label>
</text>
<empty><stretch>1</stretch></empty>
</group>
<hrule/>
<text>
<label></label>
</text>
<group>
<layout>hbox</layout>
<button>
<legend>Stay anyway</legend>
<equal>1</equal>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<legend>Go to seaport</legend>
<default>1</default>
<equal>1</equal>
<binding>
<command>nasal</command>
<script>goto_seaport()</script>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>