Skip to content

Commit

Permalink
rest of settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Sisah2 committed Mar 23, 2024
1 parent 8065048 commit 4c823d2
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/ui/activity/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,9 @@ class MainActivity : AppCompatActivity() {
writeSetting("Shadows", "player shadows", if(prefs.getBoolean("gs_player_shadows", false)) "true" else "false")
writeSetting("Shadows", "indoor shadows", if(prefs.getBoolean("gs_indoor_shadows", true)) "true" else "false")
writeSetting("Shadows", "shadow map resolution", prefs.getString("gs_shadow_map_resolution", "1024").toString())
writeSetting("Shadows", "compute scene bounds", prefs.getString("gs_shadow_computation_method", "bounds").toString())
writeSetting("Shadows", "maximum shadow map distance", prefs.getString("gs_shadows_distance", "8192").toString())
writeSetting("Shadows", "shadow fade start", prefs.getString("gs_shadows_fade_start", "0.9").toString())
writeSetting("Shadows", "percentage closer filtering", prefs.getString("gs_shadows_pcf", "1").toString())

// Animations
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/ui/activity/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,20 @@ class FragmentGameSettingsPage(val res: Int) : PreferenceFragment(), OnSharedPre
val extensions = GLES20.glGetString(GLES20.GL_EXTENSIONS)
File(Constants.USER_CONFIG + "/extensions.cfg").writeText(extensions.replace(" ", "\n"))

//egl.eglDestroyContext(eglDisplay, eglContext)
egl.eglDestroyContext(eglDisplay, eglContext)
//egl.eglDestroySurface(eglDisplay, eglSurface)

if (extensions.contains("GL_EXT_depth_clamp") == false && res == R.xml.gs_visuals) {
if (extensions.contains("GL_EXT_depth_clamp") == false) {
findPreference("gs_enable_shadows").isEnabled = false
findPreference("gs_object_shadows").isEnabled = false
findPreference("gs_terrain_shadows").isEnabled = false
findPreference("gs_actor_shadows").isEnabled = false
findPreference("gs_player_shadows").isEnabled = false
findPreference("gs_indoor_shadows").isEnabled = false
findPreference("gs_shadow_map_resolution").isEnabled = false
findPreference("gs_shadow_computation_method").isEnabled = false
findPreference("gs_shadows_distance").isEnabled = false
findPreference("gs_shadows_fade_start").isEnabled = false
findPreference("gs_shadows_pcf").isEnabled = false
}
}
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@
<item>4096</item>
</string-array>

<string-array name="gs_shadow_planes_computation_method_entries">
<item>None</item>
<item>Bounds</item>
<item>Primitives</item>
</string-array>

<string-array name="gs_shadow_planes_computation_method_values">
<item>none</item>
<item>bounds</item>
<item>primitives</item>
</string-array>

<string-array name="gs_shadow_pcf_entries">
<item>Disabled</item>
<item>4 samples</item>
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/res/xml/gs_visuals.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@
android:entryValues="@array/gs_shadow_map_resolution_values"
android:defaultValue="1024" />

<ListPreference
android:key="gs_shadow_computation_method"
android:summary="%s \nComputation method to be used. Bounds (default) for good balance between performance and shadow quality, primitives for better looking shadows or none for no computation"
android:title="Shadow Planes Computation Method"
android:dialogTitle="Shadow Planes Computation Method"
android:entries="@array/gs_shadow_planes_computation_method_entries"
android:entryValues="@array/gs_shadow_planes_computation_method_values"
android:defaultValue="bounds" />

<EditTextPreference
android:key="gs_shadows_distance"
android:title="Shadows Rendering Distance"
Expand All @@ -166,6 +175,15 @@
android:defaultValue="8192"
android:summary="The distance from the camera at which shadows completely disappear."/>

<EditTextPreference
android:key="gs_shadows_fade_start"
android:title="Shadows Fade Start"
android:dialogTitle="Shadows Fade Start.\nShould be in 0.0 - 1.0 range"
android:inputType="numberDecimal"
android:hint="0.9"
android:defaultValue="0.9"
android:summary="The fraction of the limit above at which shadows begin to gradually fade away."/>

<ListPreference
android:key="gs_shadows_pcf"
android:summary="%s \nSmooth out shadows edges if small resolution is set. Higher values may have significant performance impact."
Expand Down

0 comments on commit 4c823d2

Please sign in to comment.