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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecraft-renderer",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "The most Modular Minecraft world renderer with Three.js WebGL backend",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -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/defaultOptions'
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 './futuristic'
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
- export const FUTURISTIC_SCENE_IDS = ['galaxy', 'nether', 'end', 'cyber', 'light'] as const
12
- export type FuturisticSceneId = typeof FUTURISTIC_SCENE_IDS[number]
13
-
14
- export const FUTURISTIC_CAMERA_IDS = ['cruise', 'barrel', 'dive', 'orbit', 'snake'] as const
15
- export type FuturisticCameraId = typeof FUTURISTIC_CAMERA_IDS[number]
16
-
17
- export const FUTURISTIC_SCENE_LABELS: Record<FuturisticSceneId, string> = {
18
- galaxy: 'Galaxy',
19
- nether: 'Nether',
20
- end: 'The End',
21
- cyber: 'Cyber',
22
- light: 'Light Space'
23
- }
24
-
25
- export const FUTURISTIC_CAMERA_LABELS: Record<FuturisticCameraId, string> = {
26
- cruise: 'Cruise',
27
- barrel: 'Barrel',
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
- gpuPreferenceToWebGLPowerPreference,
47
- rendererShaderCubeDebugModeToValue
48
- } from './defaultOptions'
44
+ export { gpuPreferenceToWebGLPowerPreference } from './gpuPreference'
45
+ export type { RendererGpuPreference } from './gpuPreference'
46
+ export { rendererShaderCubeDebugModeToValue } from './defaultOptions'