1
0
Fork 0

LOD: Increase detailed range to 100km, fix reload when changed

This commit is contained in:
Richard Harrison 2018-11-01 01:39:18 +01:00
parent 6a68a623c9
commit 2d3042abf9

View file

@ -4,6 +4,29 @@
<nasal> <nasal>
<open> <open>
<![CDATA[ <![CDATA[
var reload_props = [
"/sim/rendering/static-lod/rough-delta",
"/sim/rendering/static-lod/bare-delta"];
var reload_vals = {};
foreach (var p; reload_props) {
reload_vals[p] = getprop(p);
}
check_for_reload = func{
var reinit = 0;
foreach (var p; reload_props) {
if (reload_vals[p] != getprop(p)) {
reinit = 1;
}
}
if (reinit) {
fgcommand("reload-materials", props.Node.new());
fgcommand("reinit", props.Node.new({"subsystem": "scenery"}));
}
};
var lodDIALOG = cmdarg(); var lodDIALOG = cmdarg();
var dlgLOD = props.Node.new({"dialog-name": "static-lod"}); var dlgLOD = props.Node.new({"dialog-name": "static-lod"});
@ -245,7 +268,7 @@
<property>/sim/rendering/static-lod/detailed</property> <property>/sim/rendering/static-lod/detailed</property>
<live>1</live> <live>1</live>
<min>0</min> <min>0</min>
<max>5000</max> <max>100000</max>
<binding> <binding>
<command>dialog-apply</command> <command>dialog-apply</command>
<object-name>scenery-detailed</object-name> <object-name>scenery-detailed</object-name>
@ -577,18 +600,8 @@
<command>nasal</command> <command>nasal</command>
<script> <script>
<![CDATA[ <![CDATA[
var reinit = 0; check_for_reload();
foreach (var p; reload_props) { ]]>
if (reload_vals[p] != getprop(p)) {
reinit = 1;
}
}
if (reinit) {
fgcommand("reload-materials", props.Node.new());
fgcommand("reinit", props.Node.new({"subsystem": "scenery"}));
}
]]>
</script> </script>
</binding> </binding>
<binding> <binding>
@ -604,7 +617,14 @@
<binding> <binding>
<command>dialog-apply</command> <command>dialog-apply</command>
</binding> </binding>
</button> <binding>
<command>nasal</command>
<script>
<![CDATA[
check_for_reload();
]]>
</script>
</binding> </button>
<empty> <empty>
<stretch>true</stretch> <stretch>true</stretch>
</empty> </empty>