graphics_presets_util¶
Source: base/tealdef/gui/menu/graphics_presets_util.d.tl
Notes
Graphics quality presets (desktop and console) and helpers to detect or apply a preset on an AppConfig.
GraphicsPresetsUtil¶
record global base/tealdef/gui/menu/graphics_presets_util.d.tl:3
global record GraphicsPresetsUtil
Load: local graphics_presets_util = ug_require "::/gui/menu/graphics_presets_util.tl" as GraphicsPresetsUtil
Notes
Util table of graphics_presets_util.tl.
Functions
getGraphicPreset(presets : {{string : {any, any}}}, config : AppConfig) : integer base/tealdef/gui/menu/graphics_presets_util.d.tl:4
Call as graphics_presets_util.getGraphicPreset(…)
Notes
Returns the index of the first preset whose values all match the given config.
| Parameter | Type | Description |
|---|---|---|
presets |
{{string : {any, any}}} |
Preset list, e.g. from getDesktopPresets() or getConsolePresets(). |
config |
AppConfig |
Configuration to compare, usually api.util.getAppConfig(). |
Returns integer: Index of the matching preset, or #presets + 1 ("custom") when none matches. Numbers are compared with a tolerance of 0.001.
setGraphicPreset(presets : {{string : {any, any}}}, config : AppConfig, option : integer, inGame : boolean) base/tealdef/gui/menu/graphics_presets_util.d.tl:5
Call as graphics_presets_util.setGraphicPreset(…)
Notes
Writes the values of one preset into an AppConfig object.
| Parameter | Type | Description |
|---|---|---|
presets |
{{string : {any, any}}} |
Preset list, e.g. from getDesktopPresets() or getConsolePresets(). |
config |
AppConfig |
Config object to change, e.g. api.type.AppConfig.new(api.util.getAppConfig()); it still has to be applied with api.util.setAppConfig. |
option |
integer |
Index of the preset. #presets + 1 (custom) does nothing. |
inGame |
boolean |
When true, entries whose second element is true are skipped. |
getDesktopPresets() : {{string : {any, any}}} base/tealdef/gui/menu/graphics_presets_util.d.tl:7
Call as graphics_presets_util.getDesktopPresets(…)
Notes
Returns the four desktop presets, in order low, medium, high, very high.
Returns {{string : {any, any}}}: Preset list covering textureQuality, terrainTextureQuality, numMSAASamples, useSsao, ssrQuality, shadowQuality, geometryQuality, terrainQuality and grassQuality.
getConsolePresets() : {{string : {any, any}}} base/tealdef/gui/menu/graphics_presets_util.d.tl:8
Call as graphics_presets_util.getConsolePresets(…)
Notes
Returns the two console presets, quality (30 Hz) and performance (60 Hz), merged with the base settings of the console generation reported by api.util.getPlaformDeviceSpec().
Returns {{string : {any, any}}}: Preset list; besides the quality settings it also sets refreshRate, resolutionScale, terrainTesselationQuality and useReflection.
getInitialGraphicsPresetDesktop(param : GraphicsPresetParam, appConfig : AppConfig) base/tealdef/gui/menu/graphics_presets_util.d.tl:10
Call as graphics_presets_util.getInitialGraphicsPresetDesktop(…)
Notes
Writes the initial desktop preset into appConfig. With a dedicated graphics card, vram selects medium from 7000, high from 11000 and very high from 15000 (low below 7000); without one the preset is low.
| Parameter | Type | Description |
|---|---|---|
param |
GraphicsPresetParam |
Hardware data from api.util.getGraphicsPresetParam(). |
appConfig |
AppConfig |
Config object to change, e.g. api.type.AppConfig.new(api.util.getAppConfig()); it still has to be applied with api.util.setAppConfig. |
Details
Also sets resolutionScale from the screen height screenExtent[2]: 0.75 from 2160 pixels, 0.8 from 1800, 0.85 from 1600, 0.9 from 1440, otherwise 1.0.
The main menu calls it on the setInitialGraphicsPreset event and then applies the config. The graphics tab of the settings uses it for "Reset to Default". Both use getInitialGraphicsPresetConsole instead when api.util.isConsoleMode() is true.
getInitialGraphicsPresetConsole(appConfig : AppConfig) base/tealdef/gui/menu/graphics_presets_util.d.tl:11
Call as graphics_presets_util.getInitialGraphicsPresetConsole(…)
Notes
Writes the console preset quality (the first entry of getConsolePresets()) into appConfig, including the base settings of the console generation.
| Parameter | Type | Description |
|---|---|---|
appConfig |
AppConfig |
Config object to change; it still has to be applied with api.util.setAppConfig. |