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> <tile-size>128</tile-size>
<depth-slices>1</depth-slices> <depth-slices>1</depth-slices>
<num-threads>1</num-threads> <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> </clustered-shading>
<binding> <binding>
<buffer>sun-shadowmap-atlas</buffer> <buffer>sun-shadowmap-atlas</buffer>

View file

@ -35,8 +35,8 @@ particular list.
<property>/sim/rendering/shadows/sun-atlas-size</property> <property>/sim/rendering/shadows/sun-atlas-size</property>
<!-- Lights --> <!-- Lights -->
<property>/sim/rendering/dynamic-lighting/enabled</property> <property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/rendering/dynamic-lighting/limit-lights</property> <property>/sim/rendering/dynamic-lighting/max-pointlights</property>
<property>/sim/rendering/dynamic-lighting/max-lights</property> <property>/sim/rendering/dynamic-lighting/max-spotlights</property>
<!-- Scenery --> <!-- Scenery -->
<property>/sim/rendering/scenery-path-suffix[0]/enabled</property> <!-- Pylons --> <property>/sim/rendering/scenery-path-suffix[0]/enabled</property> <!-- Pylons -->
<property>/sim/rendering/scenery-path-suffix[1]/enabled</property> <!-- Roads --> <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/enabled</property>
<property>/sim/rendering/shadows/sun-atlas-size</property> <property>/sim/rendering/shadows/sun-atlas-size</property>
<property>/sim/rendering/dynamic-lighting/enabled</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> </compositor-reload-required>
<restart-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> <enabled type="bool" userarchive="y">false</enabled>
<sun-atlas-size type="int" userarchive="y">2048</sun-atlas-size> <sun-atlas-size type="int" userarchive="y">2048</sun-atlas-size>
</shadows> </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> <photoscenery>
<enabled type="bool" userarchive="y">false</enabled> <enabled type="bool" userarchive="y">false</enabled>
</photoscenery> </photoscenery>

View file

@ -92,13 +92,13 @@
<value>0</value> <value>0</value>
</binding> </binding>
</radio> </radio>
<empty> <empty>
<row>0</row> <row>0</row>
<col>1</col> <col>1</col>
<stretch>true</stretch> <stretch>true</stretch>
</empty> </empty>
<checkbox> <checkbox>
<row>0</row> <row>0</row>
<col>2</col> <col>2</col>
@ -118,7 +118,7 @@
</binding> </binding>
</checkbox> </checkbox>
</group> </group>
</group> </group>
<textbox> <textbox>
@ -162,7 +162,7 @@
<value>1</value> <value>1</value>
</binding> </binding>
</radio> </radio>
</group> </group>
<textbox> <textbox>
@ -178,7 +178,7 @@
<top-line>0</top-line> <top-line>0</top-line>
<property>/sim/gui/dialogs/advanced/als-description</property> <property>/sim/gui/dialogs/advanced/als-description</property>
</textbox> </textbox>
<group> <group>
<layout>hbox</layout> <layout>hbox</layout>
<text> <text>
@ -356,7 +356,7 @@
</script> </script>
</binding> </binding>
</combo> </combo>
<text> <text>
<enable> <enable>
<property>/sim/rendering/shaders/skydome</property> <property>/sim/rendering/shaders/skydome</property>
@ -447,12 +447,12 @@
</color> </color>
<label>These settings can only be changed when using ALS.</label> <label>These settings can only be changed when using ALS.</label>
</text> </text>
<group> <group>
<layout>vbox</layout> <layout>vbox</layout>
<stretch>1</stretch> <stretch>1</stretch>
</group> </group>
</group> </group>
<!-- only for a gap --> <!-- only for a gap -->
@ -465,7 +465,7 @@
</group> </group>
<vrule/> <vrule/>
<!-- only for a gap --> <!-- only for a gap -->
<group> <group>
<layout>vbox</layout> <layout>vbox</layout>
@ -556,11 +556,24 @@
<halign>left</halign> <halign>left</halign>
<label>Limit the number of lights being displayed</label> <label>Limit the number of lights being displayed</label>
<name>limit-lights</name> <name>limit-lights</name>
<property>/sim/rendering/dynamic-lighting/limit-lights</property> <property>/sim/gui/dialogs/advanced/limit-lights</property>
<binding> <binding>
<command>dialog-apply</command> <command>dialog-apply</command>
<object-name>limit-lights</object-name> <object-name>limit-lights</object-name>
</binding> </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> <enable>
<property>/sim/rendering/dynamic-lighting/enabled</property> <property>/sim/rendering/dynamic-lighting/enabled</property>
</enable> </enable>
@ -570,11 +583,11 @@
<layout>hbox</layout> <layout>hbox</layout>
<halign>right</halign> <halign>right</halign>
<text> <text>
<label>Maximum number of lights</label> <label>Maximum number of point lights</label>
<enable> <enable>
<and> <and>
<property>/sim/rendering/dynamic-lighting/enabled</property> <property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/rendering/dynamic-lighting/limit-lights</property> <property>/sim/gui/dialogs/advanced/limit-lights</property>
</and> </and>
</enable> </enable>
</text> </text>
@ -582,13 +595,14 @@
<enable> <enable>
<and> <and>
<property>/sim/rendering/dynamic-lighting/enabled</property> <property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/rendering/dynamic-lighting/limit-lights</property> <property>/sim/gui/dialogs/advanced/limit-lights</property>
</and> </and>
</enable> </enable>
<name>max-lights</name> <name>max-lights</name>
<min>1</min> <min>1</min>
<max>16</max> <max>16</max>
<property>/sim/rendering/dynamic-lighting/max-lights</property> <live>true</live>
<property>/sim/rendering/dynamic-lighting/max-pointlights</property>
<binding> <binding>
<command>dialog-apply</command> <command>dialog-apply</command>
<object-name>max-lights</object-name> <object-name>max-lights</object-name>
@ -598,13 +612,56 @@
<enable> <enable>
<and> <and>
<property>/sim/rendering/dynamic-lighting/enabled</property> <property>/sim/rendering/dynamic-lighting/enabled</property>
<property>/sim/rendering/dynamic-lighting/limit-lights</property> <property>/sim/gui/dialogs/advanced/limit-lights</property>
</and> </and>
</enable> </enable>
<label>12345678</label> <label>12345678</label>
<format>%.0f</format> <format>%.0f</format>
<live>true</live> <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> </text>
</group> </group>
@ -963,7 +1020,7 @@
<layout>vbox</layout> <layout>vbox</layout>
<stretch>1</stretch> <stretch>1</stretch>
</group> </group>
<group> <group>
<layout>hbox</layout> <layout>hbox</layout>
<text> <text>
@ -1075,13 +1132,13 @@
<property>/sim/rendering/clouds3d-vis-range</property> <property>/sim/rendering/clouds3d-vis-range</property>
</text> </text>
</group> </group>
<empty> <empty>
<stretch>1</stretch> <stretch>1</stretch>
</empty> </empty>
</group> </group>
<!-- only for a gap --> <!-- only for a gap -->
<group> <group>
<layout>vbox</layout> <layout>vbox</layout>
@ -1094,7 +1151,7 @@
</group> </group>
<hrule/> <hrule/>
<group> <group>
<empty> <empty>
<stretch>true</stretch> <stretch>true</stretch>
@ -1115,6 +1172,17 @@
<legend>Close</legend> <legend>Close</legend>
<default>true</default> <default>true</default>
<key>Esc</key> <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> <binding>
<command>dialog-close</command> <command>dialog-close</command>
</binding> </binding>
@ -1214,6 +1282,10 @@
setprop("/sim/gui/dialogs/advanced/shadows", "Disabled"); 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 getScenerySuffix = func(layer) {
var suffixes = props.globals.getNode("/sim/rendering", 1).getChildren("scenery-path-suffix"); var suffixes = props.globals.getNode("/sim/rendering", 1).getChildren("scenery-path-suffix");
@ -1319,7 +1391,7 @@
setprop("/sim/gui/dialogs/rendering/placed-objects", "Disabled"); setprop("/sim/gui/dialogs/rendering/placed-objects", "Disabled");
} }
]]> ]]>
</open> </open>
</nasal> </nasal>
</PropertyList> </PropertyList>