@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / index / QualitySystem
Class: QualitySystem ​
Defined in: quality/QualitySystem.ts:46
Applies graphics settings to the renderer: pixel ratio, shadows and post effects, from the player's preset or the device's recommendation, and keeps the frame rate up with dynamic resolution. Reads and writes world.settings.graphics.
Does nothing in the editor, or while an XR headset is presenting (the headset sets its own resolution).
Implements ​
Constructors ​
Constructor ​
new QualitySystem(options?): QualitySystem;Defined in: quality/QualitySystem.ts:71
Parameters ​
| Parameter | Type |
|---|---|
options | QualitySystemOptions |
Returns ​
QualitySystem
Properties ​
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
runsWhilePaused | readonly | true | true | Keep ticking while the world is paused. Leave it unset for anything that moves the game on: such a system stops at world.pause() and picks up where it was at world.resume(). | quality/QualitySystem.ts:47 |
Accessors ​
device ​
Get Signature ​
get device(): DeviceProfile | null;Defined in: quality/QualitySystem.ts:76
The device, as detected on the first frame.
Returns ​
DeviceProfile | null
recommended ​
Get Signature ​
get recommended(): QualityRecommendation;Defined in: quality/QualitySystem.ts:81
The preset this device should start on, and why.
Returns ​
limits ​
Get Signature ​
get limits(): QualityLimits;Defined in: quality/QualitySystem.ts:86
What's applied now.
Returns ​
level ​
Get Signature ​
get level(): 0 | 1 | 2 | 3;Defined in: quality/QualitySystem.ts:91
0 low .. 3 ultra. Scale content by it.
Returns ​
0 | 1 | 2 | 3
fps ​
Get Signature ​
get fps(): number;Defined in: quality/QualitySystem.ts:96
Frames a second, averaged over the last second or so.
Returns ​
number
resolutionScale ​
Get Signature ​
get resolutionScale(): number;Defined in: quality/QualitySystem.ts:101
The dynamic-resolution scale, 1 when it isn't lowering anything.
Returns ​
number
Methods ​
setPreset() ​
setPreset(preset): void;Defined in: quality/QualitySystem.ts:106
Choose a preset (or auto) and save it.
Parameters ​
| Parameter | Type |
|---|---|
preset | "auto" | QualityPresetName |
Returns ​
void
onChange() ​
onChange(listener): () => void;Defined in: quality/QualitySystem.ts:111
Called whenever what's applied changes. Returns an unsubscribe.
Parameters ​
| Parameter | Type |
|---|---|
listener | QualityListener |
Returns ​
() => void
shouldRunFrame() ​
shouldRunFrame(nowMs): boolean;Defined in: quality/QualitySystem.ts:120
Whether the host's loop should run this frame, for a frame-rate cap. Hosts that own their requestAnimationFrame loop call it first.
Parameters ​
| Parameter | Type |
|---|---|
nowMs | number |
Returns ​
boolean
update() ​
update(world, deltaTime): void;Defined in: quality/QualitySystem.ts:185
Parameters ​
| Parameter | Type |
|---|---|
world | World |
deltaTime | number |
Returns ​
void
Implementation of ​
dispose() ​
dispose(): void;Defined in: quality/QualitySystem.ts:260
Returns ​
void

