@@ -17,6 +17,7 @@ import { CloseType, useUIContext } from "@/ui/helpers/UIProviderHelpers"
1717import { randomColor } from "@/util/Random"
1818import CommandRegistry from "@/ui/components/CommandRegistry"
1919import {
20+ defaultGraphicsPreferences ,
2021 mediumGraphicsPreferences ,
2122 lowGraphicsPreferences ,
2223 highGraphicsPreferences ,
@@ -248,10 +249,11 @@ const GeneralTab: React.FC = () => {
248249 )
249250}
250251
251- type GraphicsPreset = "low" | "medium" | "high" | "custom"
252+ type GraphicsPreset = "default" | " low" | "medium" | "high" | "custom"
252253
253254const prefsEqual = ( a : GraphicsPreferences , b : GraphicsPreferences ) => {
254255 return (
256+ a . lightIntensity === b . lightIntensity &&
255257 a . fancyShadows === b . fancyShadows &&
256258 a . maxFar === b . maxFar &&
257259 a . cascades === b . cascades &&
@@ -261,12 +263,12 @@ const prefsEqual = (a: GraphicsPreferences, b: GraphicsPreferences) => {
261263}
262264
263265const getGraphicsPreset = ( prefs : GraphicsPreferences ) : GraphicsPreset => {
266+ const defaultPrefs = defaultGraphicsPreferences ( )
264267 const lowPrefs = lowGraphicsPreferences ( )
265- if ( prefs . fancyShadows === lowPrefs . fancyShadows && prefs . antiAliasing === lowPrefs . antiAliasing ) {
266- return "low"
267- }
268268
269- const presets : Array < { key : GraphicsPreset ; prefs : GraphicsPreferences } > = [
269+ const presets : Array < { key : Exclude < GraphicsPreset , "custom" > ; prefs : GraphicsPreferences } > = [
270+ ...( prefsEqual ( defaultPrefs , lowPrefs ) ? [ ] : [ { key : "default" as const , prefs : defaultPrefs } ] ) ,
271+ { key : "low" , prefs : lowPrefs } ,
270272 { key : "medium" , prefs : mediumGraphicsPreferences ( ) } ,
271273 { key : "high" , prefs : highGraphicsPreferences ( ) } ,
272274 ]
@@ -289,6 +291,7 @@ const GraphicsTab: React.FC<GraphicsTabProps> = ({ onActionsChange }) => {
289291 const [ cascades , setCascades ] = useState < number > ( PreferencesSystem . getGraphicsPreferences ( ) . cascades )
290292 const [ shadowMapSize , setShadowMapSize ] = useState < number > ( PreferencesSystem . getGraphicsPreferences ( ) . shadowMapSize )
291293 const [ antiAliasing , setAntiAliasing ] = useState < boolean > ( PreferencesSystem . getGraphicsPreferences ( ) . antiAliasing )
294+ const defaultAndLowGraphicsMatch = prefsEqual ( defaultGraphicsPreferences ( ) , lowGraphicsPreferences ( ) )
292295
293296 const applyGraphicsPreferencesLocally = ( prefs : ReturnType < typeof PreferencesSystem . getGraphicsPreferences > ) => {
294297 setLightIntensity ( prefs . lightIntensity )
@@ -361,13 +364,15 @@ const GraphicsTab: React.FC<GraphicsTabProps> = ({ onActionsChange }) => {
361364 onChange = { e => {
362365 const preset = e . target . value as GraphicsPreset
363366 setSelectedGraphicsPreset ( preset )
364- if ( preset === "low" ) applyGraphicsPreferencesLocally ( lowGraphicsPreferences ( ) )
367+ if ( preset === "default" ) applyGraphicsPreferencesLocally ( defaultGraphicsPreferences ( ) )
368+ else if ( preset === "low" ) applyGraphicsPreferencesLocally ( lowGraphicsPreferences ( ) )
365369 else if ( preset === "medium" ) applyGraphicsPreferencesLocally ( mediumGraphicsPreferences ( ) )
366370 else if ( preset === "high" ) applyGraphicsPreferencesLocally ( highGraphicsPreferences ( ) )
367371 } }
368372 sx = { { width : "100%" } }
369373 >
370- < MenuItem value = "low" > Low Graphics (Default)</ MenuItem >
374+ { ! defaultAndLowGraphicsMatch && < MenuItem value = "default" > Default Graphics</ MenuItem > }
375+ < MenuItem value = "low" > Low Graphics{ defaultAndLowGraphicsMatch ? " (Default)" : "" } </ MenuItem >
371376 < MenuItem value = "medium" > Medium Graphics</ MenuItem >
372377 < MenuItem value = "high" > High Graphics</ MenuItem >
373378 < MenuItem value = "custom" disabled >
0 commit comments