minecraft-renderer 0.1.50 → 0.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/minecraft-renderer.js +54 -54
- package/dist/minecraft-renderer.js.meta.json +1 -1
- package/dist/threeWorker.js +249 -249
- package/package.json +1 -1
- package/src/three/documentRenderer.ts +1 -1
- package/src/three/menuBackground/defaultOptions.ts +4 -14
- package/src/three/menuBackground/futuristic.ts +18 -34
- package/src/three/menuBackground/futuristicMeta.ts +36 -0
- package/src/three/menuBackground/gpuPreference.ts +11 -0
- package/src/three/menuBackground/index.ts +3 -5
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ import Stats from 'stats.js'
|
|
|
14
14
|
import StatsGl from 'stats-gl'
|
|
15
15
|
import * as tween from '@tweenjs/tween.js'
|
|
16
16
|
import type { GraphicsBackendConfig, GraphicsInitOptions } from '../graphicsBackend/types'
|
|
17
|
-
import { gpuPreferenceToWebGLPowerPreference } from '../three/menuBackground/
|
|
17
|
+
import { gpuPreferenceToWebGLPowerPreference } from '../three/menuBackground/gpuPreference'
|
|
18
18
|
import { WorldRendererConfig } from '../graphicsBackend'
|
|
19
19
|
|
|
20
20
|
// ============================================================================
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
FUTURISTIC_SCENE_LABELS,
|
|
7
7
|
MINECRAFT_BLOCK_GROUP_IDS,
|
|
8
8
|
MINECRAFT_BLOCK_GROUP_LABELS
|
|
9
|
-
} from './
|
|
9
|
+
} from './futuristicMeta'
|
|
10
10
|
import { MENU_BACKGROUND_OPTION_DEFAULTS } from './config'
|
|
11
|
+
import type { RendererGpuPreference } from './gpuPreference'
|
|
11
12
|
|
|
12
13
|
export type RendererOptionMeta = {
|
|
13
14
|
possibleValues?: string[] | Array<[string, string]>
|
|
@@ -20,12 +21,8 @@ export type RendererOptionMeta = {
|
|
|
20
21
|
requiresRestart?: boolean
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
export type RendererDefaultOptionKey = keyof typeof RENDERER_DEFAULT_OPTIONS
|
|
24
|
-
|
|
25
24
|
export type RendererMesherPipeline = 'wasm' | 'legacy-js'
|
|
26
25
|
|
|
27
|
-
export type RendererGpuPreference = 'default' | 'high-performance' | 'low-power'
|
|
28
|
-
|
|
29
26
|
export type RendererShaderCubeDebugMode =
|
|
30
27
|
| 'off'
|
|
31
28
|
| 'holes'
|
|
@@ -46,15 +43,6 @@ export function rendererShaderCubeDebugModeToValue(mode: RendererShaderCubeDebug
|
|
|
46
43
|
return SHADER_CUBE_DEBUG_MODE_TO_VALUE[mode]
|
|
47
44
|
}
|
|
48
45
|
|
|
49
|
-
/** Maps stored `gpuPreference` to WebGL `powerPreference` (undefined = browser default). */
|
|
50
|
-
export function gpuPreferenceToWebGLPowerPreference(
|
|
51
|
-
preference: RendererGpuPreference
|
|
52
|
-
): 'high-performance' | 'low-power' | undefined {
|
|
53
|
-
if (preference === 'high-performance') return 'high-performance'
|
|
54
|
-
if (preference === 'low-power') return 'low-power'
|
|
55
|
-
return undefined
|
|
56
|
-
}
|
|
57
|
-
|
|
58
46
|
const MB = MENU_BACKGROUND_OPTION_DEFAULTS
|
|
59
47
|
|
|
60
48
|
/** Default values for options owned by minecraft-renderer (spread into app `defaultOptions`). */
|
|
@@ -97,6 +85,8 @@ export const RENDERER_DEFAULT_OPTIONS = {
|
|
|
97
85
|
fov: 75
|
|
98
86
|
} as const
|
|
99
87
|
|
|
88
|
+
export type RendererDefaultOptionKey = keyof typeof RENDERER_DEFAULT_OPTIONS
|
|
89
|
+
|
|
100
90
|
/** App options storage shape for renderer-owned keys. */
|
|
101
91
|
export type RendererStorageOptions = typeof RENDERER_DEFAULT_OPTIONS
|
|
102
92
|
|
|
@@ -7,28 +7,24 @@ import type { MenuBackgroundView } from './activeView'
|
|
|
7
7
|
import { resizeMenuBackgroundCamera } from './activeView'
|
|
8
8
|
import { loadThreeJsTextureFromBitmap } from '../threeJsUtils'
|
|
9
9
|
import { MENU_BACKGROUND_MOTION_DEFAULTS, MENU_BACKGROUND_OPTION_DEFAULTS } from './config'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
dive: 'Dive',
|
|
29
|
-
orbit: 'Orbit',
|
|
30
|
-
snake: 'Snake'
|
|
31
|
-
}
|
|
10
|
+
import {
|
|
11
|
+
FUTURISTIC_CAMERA_IDS,
|
|
12
|
+
FUTURISTIC_SCENE_IDS,
|
|
13
|
+
MINECRAFT_BLOCK_GROUP_IDS,
|
|
14
|
+
type FuturisticCameraId,
|
|
15
|
+
type FuturisticSceneId,
|
|
16
|
+
type MinecraftBlockGroupId,
|
|
17
|
+
} from './futuristicMeta'
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
FUTURISTIC_SCENE_IDS,
|
|
21
|
+
FUTURISTIC_SCENE_LABELS,
|
|
22
|
+
FUTURISTIC_CAMERA_IDS,
|
|
23
|
+
FUTURISTIC_CAMERA_LABELS,
|
|
24
|
+
MINECRAFT_BLOCK_GROUP_IDS,
|
|
25
|
+
MINECRAFT_BLOCK_GROUP_LABELS,
|
|
26
|
+
} from './futuristicMeta'
|
|
27
|
+
export type { FuturisticSceneId, FuturisticCameraId, MinecraftBlockGroupId } from './futuristicMeta'
|
|
32
28
|
|
|
33
29
|
/** Mouse parallax scale (HTML prototype uses 1). */
|
|
34
30
|
const MOUSE_INFLUENCE = 0.1
|
|
@@ -86,18 +82,6 @@ export const MINECRAFT_BLOCK_GROUPS = {
|
|
|
86
82
|
]
|
|
87
83
|
} as const
|
|
88
84
|
|
|
89
|
-
export const MINECRAFT_BLOCK_GROUP_IDS = ['mixed', 'stainedGlass', 'wool', 'construction', 'glow', 'world'] as const
|
|
90
|
-
export type MinecraftBlockGroupId = typeof MINECRAFT_BLOCK_GROUP_IDS[number]
|
|
91
|
-
|
|
92
|
-
export const MINECRAFT_BLOCK_GROUP_LABELS: Record<MinecraftBlockGroupId, string> = {
|
|
93
|
-
mixed: 'Mixed',
|
|
94
|
-
stainedGlass: 'Stained glass',
|
|
95
|
-
wool: 'Wool',
|
|
96
|
-
construction: 'Construction',
|
|
97
|
-
glow: 'Glow',
|
|
98
|
-
world: 'World (grass & ores)'
|
|
99
|
-
}
|
|
100
|
-
|
|
101
85
|
interface ScenePalette {
|
|
102
86
|
bg: number
|
|
103
87
|
fog: number
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
/** Settings / labels only — no Three.js or DocumentRenderer (safe for defaultOptions imports). */
|
|
3
|
+
|
|
4
|
+
export const FUTURISTIC_SCENE_IDS = ['galaxy', 'nether', 'end', 'cyber', 'light'] as const
|
|
5
|
+
export type FuturisticSceneId = typeof FUTURISTIC_SCENE_IDS[number]
|
|
6
|
+
|
|
7
|
+
export const FUTURISTIC_CAMERA_IDS = ['cruise', 'barrel', 'dive', 'orbit', 'snake'] as const
|
|
8
|
+
export type FuturisticCameraId = typeof FUTURISTIC_CAMERA_IDS[number]
|
|
9
|
+
|
|
10
|
+
export const FUTURISTIC_SCENE_LABELS: Record<FuturisticSceneId, string> = {
|
|
11
|
+
galaxy: 'Galaxy',
|
|
12
|
+
nether: 'Nether',
|
|
13
|
+
end: 'The End',
|
|
14
|
+
cyber: 'Cyber',
|
|
15
|
+
light: 'Light Space'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const FUTURISTIC_CAMERA_LABELS: Record<FuturisticCameraId, string> = {
|
|
19
|
+
cruise: 'Cruise',
|
|
20
|
+
barrel: 'Barrel',
|
|
21
|
+
dive: 'Dive',
|
|
22
|
+
orbit: 'Orbit',
|
|
23
|
+
snake: 'Snake'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const MINECRAFT_BLOCK_GROUP_IDS = ['mixed', 'stainedGlass', 'wool', 'construction', 'glow', 'world'] as const
|
|
27
|
+
export type MinecraftBlockGroupId = typeof MINECRAFT_BLOCK_GROUP_IDS[number]
|
|
28
|
+
|
|
29
|
+
export const MINECRAFT_BLOCK_GROUP_LABELS: Record<MinecraftBlockGroupId, string> = {
|
|
30
|
+
mixed: 'Mixed',
|
|
31
|
+
stainedGlass: 'Stained glass',
|
|
32
|
+
wool: 'Wool',
|
|
33
|
+
construction: 'Construction',
|
|
34
|
+
glow: 'Glow',
|
|
35
|
+
world: 'World (grass & ores)'
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
export type RendererGpuPreference = 'default' | 'high-performance' | 'low-power'
|
|
3
|
+
|
|
4
|
+
/** Maps stored `gpuPreference` to WebGL `powerPreference` (undefined = browser default). */
|
|
5
|
+
export function gpuPreferenceToWebGLPowerPreference(
|
|
6
|
+
preference: RendererGpuPreference
|
|
7
|
+
): 'high-performance' | 'low-power' | undefined {
|
|
8
|
+
if (preference === 'high-performance') return 'high-performance'
|
|
9
|
+
if (preference === 'low-power') return 'low-power'
|
|
10
|
+
return undefined
|
|
11
|
+
}
|
|
@@ -36,13 +36,11 @@ export {
|
|
|
36
36
|
} from './defaultOptions'
|
|
37
37
|
export type {
|
|
38
38
|
RendererDefaultOptionKey,
|
|
39
|
-
RendererGpuPreference,
|
|
40
39
|
RendererMesherPipeline,
|
|
41
40
|
RendererShaderCubeDebugMode,
|
|
42
41
|
RendererOptionMeta,
|
|
43
42
|
RendererStorageOptions
|
|
44
43
|
} from './defaultOptions'
|
|
45
|
-
export {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} from './defaultOptions'
|
|
44
|
+
export { gpuPreferenceToWebGLPowerPreference } from './gpuPreference'
|
|
45
|
+
export type { RendererGpuPreference } from './gpuPreference'
|
|
46
|
+
export { rendererShaderCubeDebugModeToValue } from './defaultOptions'
|