1
0
Fork 0

Support choosing the number of lights being displayed

This commit is contained in:
Fernando García Liñán 2021-04-01 03:16:08 +02:00
parent 703ecfc96c
commit 04f2ccc16b
4 changed files with 109 additions and 24 deletions

View file

@ -10,6 +10,12 @@
<tile-size>128</tile-size>
<depth-slices>1</depth-slices>
<num-threads>1</num-threads>
<max-pointlights>
<property>/sim/rendering/dynamic-lighting/max-pointlights</property>
</max-pointlights>
<max-spotlights>
<property>/sim/rendering/dynamic-lighting/max-spotlights</property>
</max-spotlights>
</clustered-shading>
<binding>
<buffer>sun-shadowmap-atlas</buffer>

View file

@ -35,8 +35,8 @@ particular list.
<property>/sim/rendering/shadows/sun-atlas-size</property>
<!-- Lights -->
<property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/rendering/dynamic-lighting/limit-lights</property>
<property>/sim/rendering/dynamic-lighting/max-lights</property>
<property>/sim/rendering/dynamic-lighting/max-pointlights</property>
<property>/sim/rendering/dynamic-lighting/max-spotlights</property>
<!-- Scenery -->
<property>/sim/rendering/scenery-path-suffix[0]/enabled</property> <!-- Pylons -->
<property>/sim/rendering/scenery-path-suffix[1]/enabled</property> <!-- Roads -->
@ -79,6 +79,8 @@ particular list.
<property>/sim/rendering/shadows/enabled</property>
<property>/sim/rendering/shadows/sun-atlas-size</property>
<property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/rendering/dynamic-lighting/max-pointlights</property>
<property>/sim/rendering/dynamic-lighting/max-spotlights</property>
</compositor-reload-required>
<restart-required>

View file

@ -58,6 +58,11 @@ Started September 2000 by David Megginson, david@megginson.com
<enabled type="bool" userarchive="y">false</enabled>
<sun-atlas-size type="int" userarchive="y">2048</sun-atlas-size>
</shadows>
<dynamic-lighting>
<enabled type="bool" userarchive="y">false</enabled>
<max-pointlights type="int" userarchive="y">1024</max-pointlights>
<max-spotlights type="int" userarchive="y">1024</max-spotlights>
</dynamic-lighting>
<photoscenery>
<enabled type="bool" userarchive="y">false</enabled>
</photoscenery>

View file

@ -556,11 +556,24 @@
<halign>left</halign>
<label>Limit the number of lights being displayed</label>
<name>limit-lights</name>
<property>/sim/rendering/dynamic-lighting/limit-lights</property>
<property>/sim/gui/dialogs/advanced/limit-lights</property>
<binding>
<command>dialog-apply</command>
<object-name>limit-lights</object-name>
</binding>
<binding>
<command>nasal</command>
<script>
var limit_lights = getprop("/sim/gui/dialogs/advanced/limit-lights");
if (limit_lights) {
setprop("/sim/rendering/dynamic-lighting/max-pointlights", 8);
setprop("/sim/rendering/dynamic-lighting/max-spotlights", 8);
} else {
setprop("/sim/rendering/dynamic-lighting/max-pointlights", 1024);
setprop("/sim/rendering/dynamic-lighting/max-spotlights", 1024);
}
</script>
</binding>
<enable>
<property>/sim/rendering/dynamic-lighting/enabled</property>
</enable>
@ -570,11 +583,11 @@
<layout>hbox</layout>
<halign>right</halign>
<text>
<label>Maximum number of lights</label>
<label>Maximum number of point lights</label>
<enable>
<and>
<property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/rendering/dynamic-lighting/limit-lights</property>
<property>/sim/gui/dialogs/advanced/limit-lights</property>
</and>
</enable>
</text>
@ -582,13 +595,14 @@
<enable>
<and>
<property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/rendering/dynamic-lighting/limit-lights</property>
<property>/sim/gui/dialogs/advanced/limit-lights</property>
</and>
</enable>
<name>max-lights</name>
<min>1</min>
<max>16</max>
<property>/sim/rendering/dynamic-lighting/max-lights</property>
<live>true</live>
<property>/sim/rendering/dynamic-lighting/max-pointlights</property>
<binding>
<command>dialog-apply</command>
<object-name>max-lights</object-name>
@ -598,13 +612,56 @@
<enable>
<and>
<property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/rendering/dynamic-lighting/limit-lights</property>
<property>/sim/gui/dialogs/advanced/limit-lights</property>
</and>
</enable>
<label>12345678</label>
<format>%.0f</format>
<live>true</live>
<property>/sim/rendering/dynamic-lighting/max-lights</property>
<property>/sim/rendering/dynamic-lighting/max-pointlights</property>
</text>
</group>
<group>
<layout>hbox</layout>
<halign>right</halign>
<text>
<label>Maximum number of spot lights</label>
<enable>
<and>
<property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/gui/dialogs/advanced/limit-lights</property>
</and>
</enable>
</text>
<slider>
<enable>
<and>
<property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/gui/dialogs/advanced/limit-lights</property>
</and>
</enable>
<name>max-lights</name>
<min>1</min>
<max>16</max>
<live>true</live>
<property>/sim/rendering/dynamic-lighting/max-spotlights</property>
<binding>
<command>dialog-apply</command>
<object-name>max-lights</object-name>
</binding>
</slider>
<text>
<enable>
<and>
<property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/gui/dialogs/advanced/limit-lights</property>
</and>
</enable>
<label>12345678</label>
<format>%.0f</format>
<live>true</live>
<property>/sim/rendering/dynamic-lighting/max-spotlights</property>
</text>
</group>
@ -1115,6 +1172,17 @@
<legend>Close</legend>
<default>true</default>
<key>Esc</key>
<binding>
<command>nasal</command>
<script>
if (getprop("/sim/rendering/scenery-reload-required")) {
fgcommand("reinit", props.Node.new({"subsystem": "scenery"}));
}
if (getprop("/sim/rendering/compositor-reload-required")) {
fgcommand("reload-compositor");
}
</script>
</binding>
<binding>
<command>dialog-close</command>
</binding>
@ -1214,6 +1282,10 @@
setprop("/sim/gui/dialogs/advanced/shadows", "Disabled");
}
# Lights
setprop("/sim/gui/dialogs/advanced/limit-lights",
(getprop("/sim/rendering/dynamic-lighting/max-pointlights") < 1024) or (getprop("/sim/rendering/dynamic-lighting/max-spotlights") < 1024));
var getScenerySuffix = func(layer) {
var suffixes = props.globals.getNode("/sim/rendering", 1).getChildren("scenery-path-suffix");
@ -1319,7 +1391,7 @@
setprop("/sim/gui/dialogs/rendering/placed-objects", "Disabled");
}
]]>
</open>
</nasal>
</open>
</nasal>
</PropertyList>