1
0
Fork 0

Add anti-aliasing controls to the rendering dialog

This commit is contained in:
Fernando García Liñán 2021-04-02 04:07:36 +02:00
parent 14e167a6e2
commit 4f6edde3e9
8 changed files with 102 additions and 35 deletions

View file

@ -19,10 +19,9 @@ particular list.
<PropertyList>
<save-to-file>
<!-- Rendering modes -->
<!-- General -->
<property>/sim/rendering/shaders/skydome</property>
<property>/sim/rendering/shaders/use-shaders</property>
<!-- ALS shaders -->
<property>/sim/rendering/shaders/landmass</property>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shaders/model</property>
@ -30,6 +29,8 @@ particular list.
<property>/sim/rendering/shaders/clouds</property>
<property>/sim/rendering/shaders/wind-effects</property>
<property>/sim/rendering/shaders/vegetation-effects</property>
<property>/sim/rendering/multi-sample-buffers</property>
<property>/sim/rendering/multi-samples</property>
<!-- Shadows -->
<property>/sim/rendering/shadows/enabled</property>
<property>/sim/rendering/shadows/sun-atlas-size</property>
@ -84,6 +85,8 @@ particular list.
</compositor-reload-required>
<restart-required>
<property>/sim/rendering/multi-sample-buffers</property>
<property>/sim/rendering/multi-samples</property>
</restart-required>
</PropertyList>

View file

@ -20,6 +20,8 @@
<wind-effects type="float">2</wind-effects>
<vegetation-effects type="float">0</vegetation-effects>
</shaders>
<multi-sample-buffers type="bool">true</multi-sample-buffers>
<multi-samples type="int">4</multi-samples>
<shadows>
<enabled type="bool">true</enabled>
<sun-atlas-size type="int">4096</sun-atlas-size>

View file

@ -20,6 +20,8 @@
<wind-effects type="float">0</wind-effects>
<vegetation-effects type="float">0</vegetation-effects>
</shaders>
<multi-sample-buffers type="bool">false</multi-sample-buffers>
<multi-samples type="int">0</multi-samples>
<shadows>
<enabled type="bool">true</enabled>
<sun-atlas-size type="int">1024</sun-atlas-size>

View file

@ -20,6 +20,8 @@
<wind-effects type="float">2</wind-effects>
<vegetation-effects type="float">0</vegetation-effects>
</shaders>
<multi-sample-buffers type="bool">true</multi-sample-buffers>
<multi-samples type="int">2</multi-samples>
<shadows>
<enabled type="bool">true</enabled>
<sun-atlas-size type="int">2048</sun-atlas-size>

View file

@ -20,6 +20,8 @@
<wind-effects type="float">0</wind-effects>
<vegetation-effects type="float">0</vegetation-effects>
</shaders>
<multi-sample-buffers type="bool">false</multi-sample-buffers>
<multi-samples type="int">0</multi-samples>
<shadows>
<enabled type="bool">false</enabled>
<sun-atlas-size type="int">1024</sun-atlas-size>

View file

@ -20,6 +20,8 @@
<wind-effects type="float">2</wind-effects>
<vegetation-effects type="float">1</vegetation-effects>
</shaders>
<multi-sample-buffers type="bool">true</multi-sample-buffers>
<multi-samples type="int">8</multi-samples>
<shadows>
<enabled type="bool">true</enabled>
<sun-atlas-size type="int">8192</sun-atlas-size>

View file

@ -54,6 +54,8 @@ Started September 2000 by David Megginson, david@megginson.com
<rendering>
<initialized type="bool">false</initialized>
<materials-file>Materials/regions/materials.xml</materials-file>
<multi-sample-buffers type="bool" userarchive="y">false</multi-sample-buffers>
<multi-samples type="int" userarchive="y">0</multi-samples>
<shadows>
<enabled type="bool" userarchive="y">false</enabled>
<sun-atlas-size type="int" userarchive="y">2048</sun-atlas-size>

View file

@ -54,7 +54,7 @@
<group>
<layout>hbox</layout>
<text>
<label>Rendering Mode</label>
<label>General</label>
<halign>left</halign>
</text>
<hrule>
@ -62,6 +62,20 @@
</hrule>
</group>
<text>
<halign>left</halign>
<label>Select Rendering Mode</label>
</text>
<!-- only for a gap -->
<group>
<layout>vbox</layout>
<default-padding>1</default-padding>
<text>
<label> </label>
</text>
</group>
<group>
<layout>hbox</layout>
<halign>left</halign>
@ -125,7 +139,7 @@
<halign>fill</halign>
<stretch>true</stretch>
<pref-width>400</pref-width>
<pref-height>80</pref-height>
<pref-height>90</pref-height>
<slider>15</slider>
<editable>false</editable>
<wrap>true</wrap>
@ -169,7 +183,7 @@
<halign>fill</halign>
<stretch>true</stretch>
<pref-width>400</pref-width>
<pref-height>100</pref-height>
<pref-height>110</pref-height>
<slider>15</slider>
<editable>false</editable>
<wrap>true</wrap>
@ -178,19 +192,22 @@
<property>/sim/gui/dialogs/advanced/als-description</property>
</textbox>
<group>
<layout>hbox</layout>
<text>
<enable>
<hrule/>
<text>
<visible>
<not>
<property>/sim/rendering/shaders/skydome</property>
</enable>
<label>ALS Shader Settings</label>
<halign>left</halign>
</text>
<hrule>
<stretch>true</stretch>
</hrule>
</group>
</not>
</visible>
<halign>left</halign>
<color>
<red>1.0</red>
<green>0.6</green>
<blue>0.6</blue>
</color>
<label>Some of these settings can only be changed when using ALS.</label>
</text>
<group>
<layout>table</layout>
@ -430,22 +447,48 @@
</binding>
</combo>
</group>
<text>
<row>7</row>
<col>0</col>
<halign>left</halign>
<label>Anti-aliasing</label>
</text>
<combo>
<row>7</row>
<col>1</col>
<name>anti-aliasing</name>
<pref-width>200</pref-width>
<property>/sim/gui/dialogs/advanced/anti-aliasing</property>
<value>Disabled</value>
<value>MSAA 2x</value>
<value>MSAA 4x</value>
<value>MSAA 8x</value>
<binding>
<command>dialog-apply</command>
<object-name>anti-aliasing</object-name>
</binding>
<binding>
<command>nasal</command>
<script>
var val = getprop("/sim/gui/dialogs/advanced/anti-aliasing");
if (val == "MSAA 2x") {
setprop("/sim/rendering/multi-sample-buffers", 1);
setprop("/sim/rendering/multi-samples", 2);
} else if (val == "MSAA 4x") {
setprop("/sim/rendering/multi-sample-buffers", 1);
setprop("/sim/rendering/multi-samples", 4);
} else if (val == "MSAA 8x") {
setprop("/sim/rendering/multi-sample-buffers", 1);
setprop("/sim/rendering/multi-samples", 8);
} else {
setprop("/sim/rendering/multi-sample-buffers", 0);
setprop("/sim/rendering/multi-samples", 0);
}
</script>
</binding>
</combo>
<text>
<visible>
<not>
<property>/sim/rendering/shaders/skydome</property>
</not>
</visible>
<halign>left</halign>
<color>
<red>1.0</red>
<green>0.6</green>
<blue>0.6</blue>
</color>
<label>These settings can only be changed when using ALS.</label>
</text>
</group>
<group>
<layout>vbox</layout>
@ -1206,7 +1249,7 @@
"rendering of large distances. It is recommended to run this " ~
"configuration on relatively powerful hardware.");
# Render Mode
# General
if (getprop("/sim/rendering/shaders/skydome")) {
setprop("/sim/gui/dialogs/advanced/mode/low-spec-mode", 0);
setprop("/sim/gui/dialogs/advanced/mode/als-mode", 1);
@ -1215,8 +1258,6 @@
setprop("/sim/gui/dialogs/advanced/mode/als-mode", 0);
}
# ALS Shader Settings
var landmass_val = getprop("/sim/rendering/shaders/landmass");
if (landmass_val <= 3) {
setprop("/sim/gui/dialogs/advanced/terrain-quality", "Low");
@ -1265,6 +1306,17 @@
setprop("/sim/gui/dialogs/advanced/overlay", "Enabled");
}
var anti_aliasing_val = getprop("/sim/rendering/multi-samples");
if (anti_aliasing_val == 2) {
setprop("/sim/gui/dialogs/advanced/anti-aliasing", "MSAA 2x");
} else if (anti_aliasing_val == 4) {
setprop("/sim/gui/dialogs/advanced/anti-aliasing", "MSAA 4x");
} else if (anti_aliasing_val == 8) {
setprop("/sim/gui/dialogs/advanced/anti-aliasing", "MSAA 8x");
} else {
setprop("/sim/gui/dialogs/advanced/anti-aliasing", "Disabled");
}
# Shadows
if (getprop("/sim/rendering/shadows/enabled")) {
var size = getprop("/sim/rendering/shadows/sun-atlas-size");