-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathutil.ts
More file actions
45 lines (42 loc) · 1.07 KB
/
util.ts
File metadata and controls
45 lines (42 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
export function toggleFullScreen() {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen()
} else if (document.exitFullscreen) {
document.exitFullscreen()
}
}
export function clamp(min: number, max: number, value: number) {
return Math.max(min, Math.min(max, value))
}
export type QualityPreset = {
dt: number
cellSize: number
gridSizeLongest: number
resolutionScale: number
}
export const qualityPresets: { [presetName: string]: QualityPreset } = {
"Low": {
dt: 0.013 * 2,
cellSize: 0.02 * 2,
resolutionScale: 0.3,
gridSizeLongest: 400 / 2
},
"Medium": {
dt: 0.013,
cellSize: 0.02,
resolutionScale: 1,
gridSizeLongest: 400
},
"High": {
dt: 0.013 / 2,
cellSize: 0.02 / 2,
resolutionScale: 1,
gridSizeLongest: 400 * 2
},
"Ultra": {
dt: 0.013 / 4,
cellSize: 0.02 / 4,
resolutionScale: 1,
gridSizeLongest: 400 * 4
}
}