minecraft-renderer 0.1.63 → 0.1.65

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.
@@ -2,27 +2,7 @@
2
2
  import { PlayerAnimation } from 'skinview3d'
3
3
 
4
4
  const clamp01 = (v) => Math.max(0, Math.min(1, v))
5
- const clamp = (v, a, b) => Math.max(a, Math.min(b, v))
6
5
  const mix = (a, b, t) => a + (b - a) * t
7
- const wrapPi = (a) => {
8
- a = (a + Math.PI) % (Math.PI * 2)
9
- if (a < 0) a += Math.PI * 2
10
- return a - Math.PI
11
- }
12
-
13
- /**
14
- * @typedef {{
15
- * playerRot: any,
16
- * bodyPos: any, bodyRot: any,
17
- * leftArmPos: any, leftArmRot: any,
18
- * rightArmPos: any, rightArmRot: any,
19
- * leftLegPos: any, leftLegRot: any,
20
- * rightLegPos: any, rightLegRot: any,
21
- * headPos: any, headRot: any,
22
- * capePos: any, capeRot: any,
23
- * elytraPos: any, elytraRot: any,
24
- * }} Defaults
25
- */
26
6
 
27
7
  function updateElytraRightWing(player) {
28
8
  const elytra = player?.elytra
@@ -53,32 +33,24 @@ export class WalkingGeneralSwing extends PlayerAnimation {
53
33
  isMoving = true
54
34
  isCrouched = false
55
35
 
56
- /** @type {number} 0..1 */
57
- moveAmount = 0
58
- /** @type {number} 0..1 */
59
- runAmount = 0
60
-
61
- /** @type {number} radians */
62
- lookYaw = 0
63
- /** @type {number} radians */
64
- lookPitch = 0
65
-
66
36
  _dt = 0
67
37
  _phase = 0
68
- _idlePhase = 0
69
-
70
38
  _moveBlend = 0
71
- _runBlend = 0
72
- _crouchBlend = 0
73
-
74
- _lookYawBlend = 0
75
- _lookPitchBlend = 0
76
39
 
77
40
  /** @type {number | null} */
78
41
  _swingTime = null
79
42
  _swingDuration = 0.25
80
43
 
81
- /** @type {Defaults | null} */
44
+ /** @type {{
45
+ bodyPos: any, bodyRot: any,
46
+ leftArmPos: any, leftArmRot: any,
47
+ rightArmPos: any, rightArmRot: any,
48
+ leftLegPos: any, leftLegRot: any,
49
+ rightLegPos: any, rightLegRot: any,
50
+ headPos: any, headRot: any,
51
+ capePos: any, capeRot: any,
52
+ elytraPos: any, elytraRot: any,
53
+ } | null} */
82
54
  _defaults = null
83
55
 
84
56
  update(player, delta) {
@@ -96,39 +68,29 @@ export class WalkingGeneralSwing extends PlayerAnimation {
96
68
  }
97
69
  }
98
70
 
99
- resetLocomotion() {
100
- this._moveBlend = 0
101
- this._runBlend = 0
102
- this._crouchBlend = 0
103
- this._phase = 0
104
- }
105
-
106
71
  _captureDefaults(player) {
107
- const skin = player?.skin
108
72
  this._defaults = {
109
- playerRot: player?.rotation?.clone?.(),
73
+ bodyPos: player.skin.body.position.clone(),
74
+ bodyRot: player.skin.body.rotation.clone(),
110
75
 
111
- bodyPos: skin?.body?.position?.clone?.(),
112
- bodyRot: skin?.body?.rotation?.clone?.(),
76
+ leftArmPos: player.skin.leftArm.position.clone(),
77
+ leftArmRot: player.skin.leftArm.rotation.clone(),
78
+ rightArmPos: player.skin.rightArm.position.clone(),
79
+ rightArmRot: player.skin.rightArm.rotation.clone(),
113
80
 
114
- leftArmPos: skin?.leftArm?.position?.clone?.(),
115
- leftArmRot: skin?.leftArm?.rotation?.clone?.(),
116
- rightArmPos: skin?.rightArm?.position?.clone?.(),
117
- rightArmRot: skin?.rightArm?.rotation?.clone?.(),
81
+ leftLegPos: player.skin.leftLeg.position.clone(),
82
+ leftLegRot: player.skin.leftLeg.rotation.clone(),
83
+ rightLegPos: player.skin.rightLeg.position.clone(),
84
+ rightLegRot: player.skin.rightLeg.rotation.clone(),
118
85
 
119
- leftLegPos: skin?.leftLeg?.position?.clone?.(),
120
- leftLegRot: skin?.leftLeg?.rotation?.clone?.(),
121
- rightLegPos: skin?.rightLeg?.position?.clone?.(),
122
- rightLegRot: skin?.rightLeg?.rotation?.clone?.(),
86
+ headPos: player.skin.head.position.clone(),
87
+ headRot: player.skin.head.rotation.clone(),
123
88
 
124
- headPos: skin?.head?.position?.clone?.(),
125
- headRot: skin?.head?.rotation?.clone?.(),
89
+ capePos: player.cape.position.clone(),
90
+ capeRot: player.cape.rotation.clone(),
126
91
 
127
- capePos: player?.cape?.position?.clone?.(),
128
- capeRot: player?.cape?.rotation?.clone?.(),
129
-
130
- elytraPos: player?.elytra?.position?.clone?.(),
131
- elytraRot: player?.elytra?.rotation?.clone?.(),
92
+ elytraPos: player.elytra.position.clone(),
93
+ elytraRot: player.elytra.rotation.clone(),
132
94
  }
133
95
  }
134
96
 
@@ -136,152 +98,102 @@ export class WalkingGeneralSwing extends PlayerAnimation {
136
98
  const d = this._defaults
137
99
  if (!d) return
138
100
 
139
- const skin = player?.skin
140
- const cape = player?.cape
141
- const elytra = player?.elytra
142
-
143
- if (d.playerRot && player?.rotation) player.rotation.copy(d.playerRot)
101
+ player.skin.body.position.copy(d.bodyPos)
102
+ player.skin.body.rotation.copy(d.bodyRot)
144
103
 
145
- if (d.bodyPos && skin?.body?.position) skin.body.position.copy(d.bodyPos)
146
- if (d.bodyRot && skin?.body?.rotation) skin.body.rotation.copy(d.bodyRot)
104
+ player.skin.leftArm.position.copy(d.leftArmPos)
105
+ player.skin.leftArm.rotation.copy(d.leftArmRot)
106
+ player.skin.rightArm.position.copy(d.rightArmPos)
107
+ player.skin.rightArm.rotation.copy(d.rightArmRot)
147
108
 
148
- if (d.leftArmPos && skin?.leftArm?.position) skin.leftArm.position.copy(d.leftArmPos)
149
- if (d.leftArmRot && skin?.leftArm?.rotation) skin.leftArm.rotation.copy(d.leftArmRot)
109
+ player.skin.leftLeg.position.copy(d.leftLegPos)
110
+ player.skin.leftLeg.rotation.copy(d.leftLegRot)
111
+ player.skin.rightLeg.position.copy(d.rightLegPos)
112
+ player.skin.rightLeg.rotation.copy(d.rightLegRot)
150
113
 
151
- if (d.rightArmPos && skin?.rightArm?.position) skin.rightArm.position.copy(d.rightArmPos)
152
- if (d.rightArmRot && skin?.rightArm?.rotation) skin.rightArm.rotation.copy(d.rightArmRot)
114
+ player.skin.head.position.copy(d.headPos)
115
+ player.skin.head.rotation.copy(d.headRot)
153
116
 
154
- if (d.leftLegPos && skin?.leftLeg?.position) skin.leftLeg.position.copy(d.leftLegPos)
155
- if (d.leftLegRot && skin?.leftLeg?.rotation) skin.leftLeg.rotation.copy(d.leftLegRot)
117
+ player.cape.position.copy(d.capePos)
118
+ player.cape.rotation.copy(d.capeRot)
156
119
 
157
- if (d.rightLegPos && skin?.rightLeg?.position) skin.rightLeg.position.copy(d.rightLegPos)
158
- if (d.rightLegRot && skin?.rightLeg?.rotation) skin.rightLeg.rotation.copy(d.rightLegRot)
159
-
160
- if (d.headPos && skin?.head?.position) skin.head.position.copy(d.headPos)
161
- if (d.headRot && skin?.head?.rotation) skin.head.rotation.copy(d.headRot)
162
-
163
- if (d.capePos && cape?.position) cape.position.copy(d.capePos)
164
- if (d.capeRot && cape?.rotation) cape.rotation.copy(d.capeRot)
165
-
166
- if (d.elytraPos && elytra?.position) elytra.position.copy(d.elytraPos)
167
- if (d.elytraRot && elytra?.rotation) elytra.rotation.copy(d.elytraRot)
120
+ player.elytra.position.copy(d.elytraPos)
121
+ player.elytra.rotation.copy(d.elytraRot)
168
122
  }
169
123
 
170
124
  animate(player) {
171
125
  const dt = this._dt || 0
126
+
172
127
  if (!this._defaults) this._captureDefaults(player)
173
128
  this._applyDefaults(player)
174
129
 
175
- const externalMove = typeof this.moveAmount === 'number' ? this.moveAmount : (this.isMoving ? 1 : 0)
176
- const externalRun = typeof this.runAmount === 'number' ? this.runAmount : (this.isRunning ? 1 : 0)
177
-
178
- const targetMove = clamp01(externalMove)
179
- const targetRun = clamp01(externalRun)
180
- const targetCrouch = this.isCrouched ? 1 : 0
181
-
182
- const kMove = Math.min(1, dt * 8)
183
- const kRun = Math.min(1, dt * 6)
184
- const kCrouch = Math.min(1, dt * 7)
185
-
130
+ const targetMove = this.isMoving ? 1 : 0
131
+ const kMove = Math.min(1, dt * 20)
186
132
  this._moveBlend += (targetMove - this._moveBlend) * kMove
187
- this._runBlend += (targetRun - this._runBlend) * kRun
188
- this._crouchBlend += (targetCrouch - this._crouchBlend) * kCrouch
189
133
 
190
- const moveBlend = clamp01(this._moveBlend)
191
- const runBlend = clamp01(this._runBlend)
192
- const crouchBlend = clamp01(this._crouchBlend)
134
+ const speed = this.isRunning ? 10 : 8
135
+ this._phase += dt * speed * this._moveBlend
193
136
 
194
- const baseSpeed = mix(8, 10, runBlend)
195
- const crouchSpeedMul = mix(1, 0.55, crouchBlend)
196
- const speed = baseSpeed * crouchSpeedMul
137
+ const t = this._phase + (this.isRunning ? Math.PI * 0.5 : 0)
138
+ let reset = false
197
139
 
198
- this._phase += dt * speed * moveBlend
199
- this._idlePhase += dt * 1.15
140
+ applyCrouchPose(player, this.isCrouched ? 1 : 0)
200
141
 
201
- const t = this._phase + (runBlend > 0.5 ? Math.PI * 0.5 : 0)
202
-
203
- if (this.switchAnimationCallback) {
204
- const boundary = Math.abs(Math.sin(t))
205
- if (boundary < 0.02) {
206
- const cb = this.switchAnimationCallback
207
- this.switchAnimationCallback = null
208
- cb?.()
142
+ const boundary = this.isRunning ? Math.cos(t) : Math.sin(t)
143
+ if (Math.abs(boundary) < 0.02) {
144
+ if (this.switchAnimationCallback) {
145
+ reset = true
209
146
  }
210
147
  }
211
148
 
212
- applyCrouchPose(player, crouchBlend)
213
-
214
- const maxYaw = (80 * Math.PI) / 180
215
- const maxPitch = (75 * Math.PI) / 180
216
- const targetLookYaw = clamp(wrapPi(this.lookYaw || 0), -maxYaw, maxYaw)
217
- const targetLookPitch = clamp(this.lookPitch || 0, -maxPitch, maxPitch)
218
-
219
- const kLook = Math.min(1, dt * 14)
220
- this._lookYawBlend += (targetLookYaw - this._lookYawBlend) * kLook
221
- this._lookPitchBlend += (targetLookPitch - this._lookPitchBlend) * kLook
222
-
223
- if (player?.skin?.head?.rotation) {
224
- player.skin.head.rotation.y += this._lookYawBlend
225
- player.skin.head.rotation.x += this._lookPitchBlend
149
+ if (this.isRunning) {
150
+ player.skin.leftLeg.rotation.x = Math.cos(t + Math.PI) * 1.3
151
+ player.skin.rightLeg.rotation.x = Math.cos(t) * 1.3
152
+ } else {
153
+ player.skin.leftLeg.rotation.x = Math.sin(t) * 0.5
154
+ player.skin.rightLeg.rotation.x = Math.sin(t + Math.PI) * 0.5
226
155
  }
227
156
 
228
- const idleStrength = (1 - moveBlend) * (1 - 0.25 * runBlend)
229
- if (idleStrength > 0.0001 && player?.skin) {
230
- const b = Math.sin(this._idlePhase)
231
- player.skin.body.rotation.x += b * 0.02 * idleStrength
232
- player.skin.head.rotation.x += -b * 0.015 * idleStrength
233
- player.skin.leftArm.rotation.x += b * 0.03 * idleStrength
234
- player.skin.rightArm.rotation.x += -b * 0.03 * idleStrength
235
- if (player?.cape?.rotation) player.cape.rotation.x += Math.sin(this._idlePhase * 0.7) * 0.03 * idleStrength
236
- }
237
-
238
- if (moveBlend > 0.0001 && player?.skin) {
239
- const legAmp = mix(1, 0.85, crouchBlend)
240
- const armAmp = mix(1, 0.7, crouchBlend)
241
-
242
- const walkLegL = Math.sin(t) * 0.5
243
- const walkLegR = Math.sin(t + Math.PI) * 0.5
244
- const runLegL = Math.cos(t + Math.PI) * 1.3
245
- const runLegR = Math.cos(t) * 1.3
246
-
247
- player.skin.leftLeg.rotation.x += mix(walkLegL, runLegL, runBlend) * moveBlend * legAmp
248
- player.skin.rightLeg.rotation.x += mix(walkLegR, runLegR, runBlend) * moveBlend * legAmp
249
-
250
- const walkArmL = Math.sin(t + Math.PI) * 0.5
251
- const walkArmR = Math.sin(t) * 0.5
252
- const runArmL = Math.cos(t) * 1.5
253
- const runArmR = Math.cos(t + Math.PI) * 1.5
254
-
255
- player.skin.leftArm.rotation.x += mix(walkArmL, runArmL, runBlend) * moveBlend * armAmp
256
- player.skin.rightArm.rotation.x += mix(walkArmR, runArmR, runBlend) * moveBlend * armAmp
257
-
258
- const walkArmZBase = Math.PI * 0.02
259
- const runArmZBase = Math.PI * 0.1
260
- const armZBase = mix(walkArmZBase, runArmZBase, runBlend)
157
+ if (this.isRunning) {
158
+ player.skin.leftArm.rotation.x = Math.cos(t) * 1.5
159
+ player.skin.rightArm.rotation.x = Math.cos(t + Math.PI) * 1.5
261
160
 
262
- const walkArmZL = Math.cos(t) * 0.03 + walkArmZBase
263
- const walkArmZR = Math.cos(t + Math.PI) * 0.03 - walkArmZBase
264
- const runArmZL = Math.cos(t) * 0.1 + runArmZBase
265
- const runArmZR = Math.cos(t + Math.PI) * 0.1 - runArmZBase
161
+ const basicArmRotationZ = Math.PI * 0.1
162
+ player.skin.leftArm.rotation.z = Math.cos(t) * 0.1 + basicArmRotationZ
163
+ player.skin.rightArm.rotation.z = Math.cos(t + Math.PI) * 0.1 - basicArmRotationZ
164
+ } else {
165
+ player.skin.leftArm.rotation.x = Math.sin(t + Math.PI) * 0.5
166
+ player.skin.rightArm.rotation.x = Math.sin(t) * 0.5
266
167
 
267
- player.skin.leftArm.rotation.z += (mix(walkArmZL, runArmZL, runBlend) * moveBlend + armZBase * 0.15 * moveBlend) * armAmp
268
- player.skin.rightArm.rotation.z += (mix(walkArmZR, runArmZR, runBlend) * moveBlend - armZBase * 0.15 * moveBlend) * armAmp
269
-
270
- if (this._defaults?.playerRot) {
271
- player.rotation.z = this._defaults.playerRot.z + Math.cos(t + Math.PI) * 0.01 * runBlend * moveBlend
272
- }
273
-
274
- const capeBase = mix(Math.PI * 0.06, Math.PI * 0.3, runBlend)
275
- const capeWave = mix(Math.sin(t / 1.5) * 0.06, Math.sin(t * 2) * 0.1, runBlend)
276
- if (player?.cape?.rotation) player.cape.rotation.x += (capeBase + capeWave) * moveBlend
168
+ const basicArmRotationZ = Math.PI * 0.02
169
+ player.skin.leftArm.rotation.z = Math.cos(t) * 0.03 + basicArmRotationZ
170
+ player.skin.rightArm.rotation.z = Math.cos(t + Math.PI) * 0.03 - basicArmRotationZ
277
171
  }
278
172
 
279
173
  if (this._swingTime !== null) {
280
174
  this._swingTime += dt
281
175
  const p = Math.min(this._swingTime / this._swingDuration, 1)
282
- HitAnimation.animate(p, player, moveBlend > 0.2)
176
+ HitAnimation.animate(p, player, this.isMoving)
283
177
  if (p >= 1) this._swingTime = null
284
178
  }
179
+
180
+ if (this.isRunning) {
181
+ player.rotation.z = Math.cos(t + Math.PI) * 0.01
182
+ }
183
+
184
+ if (this.isRunning) {
185
+ const basicCapeRotationX = Math.PI * 0.3
186
+ player.cape.rotation.x = Math.sin(t * 2) * 0.1 + basicCapeRotationX
187
+ } else {
188
+ const basicCapeRotationX = Math.PI * 0.06
189
+ player.cape.rotation.x = Math.sin(t / 1.5) * 0.06 + basicCapeRotationX
190
+ }
191
+
192
+ if (reset) {
193
+ const cb = this.switchAnimationCallback
194
+ this.switchAnimationCallback = null
195
+ cb?.()
196
+ }
285
197
  }
286
198
  }
287
199
 
@@ -289,11 +201,6 @@ const HitAnimation = {
289
201
  animate(progress, player, isMovingOrRunning) {
290
202
  if (!player?.skin?.rightArm?.rotation) return
291
203
 
292
- // One swing = one arc. `swing` rises to its peak at the middle of the swing
293
- // (progress 0.5) and returns to rest at both ends, matching vanilla's
294
- // `sin(swingProgress * PI)` and the first-person hand. Driving the trig with
295
- // `progress * 18` previously ran ~3 sine cycles per click, which made other
296
- // players' arms look like they were swinging several times per hit.
297
204
  const swing = Math.sin(progress * Math.PI)
298
205
  player.skin.rightArm.rotation.x = -0.4537860552 * 2 - 2 * swing * 0.3
299
206
 
@@ -354,4 +261,4 @@ function applyCrouchPose(player, crouchBlend) {
354
261
 
355
262
  skin.rightLeg.position.z += -3.4500310377 * s
356
263
  skin.leftLeg.position.z += -3.4500310377 * s
357
- }
264
+ }
@@ -1,7 +1,7 @@
1
1
  //@ts-nocheck
2
2
  import * as THREE from 'three'
3
3
 
4
- /** Contract for a main-menu background implementation (classic cubemap, futuristic scene, etc.). */
4
+ /** Contract for a main-menu background implementation (classic cubemap, v2 scene, etc.). */
5
5
  export interface MenuBackgroundView {
6
6
  readonly scene: THREE.Scene
7
7
  readonly camera: THREE.PerspectiveCamera
@@ -1,23 +1,23 @@
1
1
  //@ts-nocheck
2
2
  import type { MenuBackgroundMode } from './types'
3
- import type { FuturisticCameraId, FuturisticSceneId, MinecraftBlockGroupId } from './futuristic'
3
+ import type { V2CameraId, V2SceneId, MinecraftBlockGroupId } from './v2'
4
4
 
5
5
  /** Single source of truth for menu-background defaults (settings + runtime fallbacks). */
6
6
  export const MENU_BACKGROUND_OPTION_DEFAULTS = {
7
- mode: 'futuristic' as MenuBackgroundMode,
7
+ mode: 'v2' as MenuBackgroundMode,
8
8
  minecraftTextures: true as boolean,
9
- futuristicScene: 'light' as FuturisticSceneId,
10
- futuristicCamera: 'dive' as FuturisticCameraId,
11
- futuristicBlockGroup: 'stainedGlass' as MinecraftBlockGroupId,
9
+ v2Scene: 'light' as V2SceneId,
10
+ v2Camera: 'dive' as V2CameraId,
11
+ v2BlockGroup: 'stainedGlass' as MinecraftBlockGroupId,
12
12
  /** 0–200 (%). 100 = 1× motion. */
13
- futuristicCameraSpeedPercent: 80,
14
- futuristicBlockSpeedPercent: 40
13
+ v2CameraSpeedPercent: 80,
14
+ v2BlockSpeedPercent: 40
15
15
  } as const
16
16
 
17
17
  export const menuBackgroundSpeedToMultiplier = (percent: number) => percent / 100
18
18
 
19
19
  /** Default camera / block motion multipliers (1 = 100%). */
20
20
  export const MENU_BACKGROUND_MOTION_DEFAULTS = {
21
- camera: menuBackgroundSpeedToMultiplier(MENU_BACKGROUND_OPTION_DEFAULTS.futuristicCameraSpeedPercent),
22
- block: menuBackgroundSpeedToMultiplier(MENU_BACKGROUND_OPTION_DEFAULTS.futuristicBlockSpeedPercent)
21
+ camera: menuBackgroundSpeedToMultiplier(MENU_BACKGROUND_OPTION_DEFAULTS.v2CameraSpeedPercent),
22
+ block: menuBackgroundSpeedToMultiplier(MENU_BACKGROUND_OPTION_DEFAULTS.v2BlockSpeedPercent)
23
23
  } as const
@@ -6,21 +6,21 @@ export type { MenuBackgroundMode, MenuBackgroundOptions } from './types'
6
6
  export { resolveMenuBackgroundMode } from './types'
7
7
  export { ClassicMenuBackground } from './classic'
8
8
  export type {
9
- FuturisticSceneId,
10
- FuturisticCameraId,
11
- FuturisticMenuBackgroundOptions,
9
+ V2SceneId,
10
+ V2CameraId,
11
+ V2MenuBackgroundOptions,
12
12
  MinecraftBlockGroupId
13
- } from './futuristic'
13
+ } from './v2'
14
14
  export {
15
- FuturisticMenuBackground,
16
- FUTURISTIC_SCENE_IDS,
17
- FUTURISTIC_CAMERA_IDS,
18
- FUTURISTIC_SCENE_LABELS,
19
- FUTURISTIC_CAMERA_LABELS,
15
+ V2MenuBackground,
16
+ V2_SCENE_IDS,
17
+ V2_CAMERA_IDS,
18
+ V2_SCENE_LABELS,
19
+ V2_CAMERA_LABELS,
20
20
  MINECRAFT_BLOCK_GROUPS,
21
21
  MINECRAFT_BLOCK_GROUP_IDS,
22
22
  MINECRAFT_BLOCK_GROUP_LABELS
23
- } from './futuristic'
23
+ } from './v2'
24
24
  export { WorldBlocksMenuBackground } from './worldBlocks'
25
25
  export { MenuBackgroundRenderer } from './renderer'
26
26
  export {
@@ -3,14 +3,14 @@ import * as THREE from 'three'
3
3
  import type { GraphicsInitOptions } from '../../graphicsBackend/types'
4
4
  import type { DocumentRenderer } from '../documentRenderer'
5
5
  import { ClassicMenuBackground } from './classic'
6
- import { FuturisticMenuBackground } from './futuristic'
6
+ import { V2MenuBackground } from './v2'
7
7
  import { WorldBlocksMenuBackground } from './worldBlocks'
8
8
  import type { MenuBackgroundView } from './activeView'
9
9
  import type { MenuBackgroundOptions } from './types'
10
10
  import { resolveMenuBackgroundMode } from './types'
11
11
 
12
12
  /**
13
- * Orchestrates main-menu background rendering (dispatches to classic / futuristic / world-blocks).
13
+ * Orchestrates main-menu background rendering (dispatches to classic / v2 / world-blocks).
14
14
  */
15
15
  export class MenuBackgroundRenderer {
16
16
  private active?: MenuBackgroundView
@@ -27,9 +27,9 @@ export class MenuBackgroundRenderer {
27
27
  this.mode = resolveMenuBackgroundMode(menuBackgroundOptions, singleFileBuild)
28
28
  }
29
29
 
30
- /** Active futuristic instance when that style is running. */
31
- get futuristic(): FuturisticMenuBackground | undefined {
32
- return this.active instanceof FuturisticMenuBackground ? this.active : undefined
30
+ /** Active v2 instance when that style is running. */
31
+ get v2(): V2MenuBackground | undefined {
32
+ return this.active instanceof V2MenuBackground ? this.active : undefined
33
33
  }
34
34
 
35
35
  get scene(): THREE.Scene | undefined {
@@ -64,16 +64,16 @@ export class MenuBackgroundRenderer {
64
64
 
65
65
  private createImplementation(options: MenuBackgroundOptions): MenuBackgroundView {
66
66
  switch (this.mode) {
67
- case 'futuristic':
68
- return new FuturisticMenuBackground(
67
+ case 'v2':
68
+ return new V2MenuBackground(
69
69
  this.documentRenderer,
70
70
  {
71
71
  useMinecraftTextures: options.useMinecraftTextures,
72
- initialScene: options.futuristicScene,
73
- initialCamera: options.futuristicCamera,
74
- initialBlockGroup: options.futuristicBlockGroup,
75
- initialCameraSpeed: options.futuristicCameraSpeed,
76
- initialBlockSpeed: options.futuristicBlockSpeed,
72
+ initialScene: options.v2Scene,
73
+ initialCamera: options.v2Camera,
74
+ initialBlockGroup: options.v2BlockGroup,
75
+ initialCameraSpeed: options.v2CameraSpeed,
76
+ initialBlockSpeed: options.v2BlockSpeed,
77
77
  resourcesManager: options.resourcesManager
78
78
  },
79
79
  this.abortController.signal
@@ -1,25 +1,25 @@
1
1
  //@ts-nocheck
2
2
  import type { ResourcesManager } from '../../resourcesManager/resourcesManager'
3
- import type { FuturisticCameraId, FuturisticSceneId, MinecraftBlockGroupId } from './futuristic'
3
+ import type { V2CameraId, V2SceneId, MinecraftBlockGroupId } from './v2'
4
4
  import { MENU_BACKGROUND_OPTION_DEFAULTS } from './config'
5
5
 
6
- export type { FuturisticCameraId, FuturisticSceneId, MinecraftBlockGroupId } from './futuristic'
6
+ export type { V2CameraId, V2SceneId, MinecraftBlockGroupId } from './v2'
7
7
 
8
- export type MenuBackgroundMode = 'classic' | 'futuristic' | 'worldBlocks'
8
+ export type MenuBackgroundMode = 'classic' | 'v2' | 'worldBlocks'
9
9
 
10
10
  export interface MenuBackgroundOptions {
11
11
  /** Visual style. Defaults to {@link MENU_BACKGROUND_OPTION_DEFAULTS.mode}, or `worldBlocks` in single-file build. */
12
12
  mode?: MenuBackgroundMode
13
- /** Futuristic style: load block atlas and render textured cubes (requires assets / mcData). */
13
+ /** V2 style: load block atlas and render textured cubes (requires assets / mcData). */
14
14
  useMinecraftTextures?: boolean
15
- futuristicScene?: FuturisticSceneId
16
- futuristicCamera?: FuturisticCameraId
15
+ v2Scene?: V2SceneId
16
+ v2Camera?: V2CameraId
17
17
  /** Block pool when {@link useMinecraftTextures} is enabled. */
18
- futuristicBlockGroup?: MinecraftBlockGroupId
18
+ v2BlockGroup?: MinecraftBlockGroupId
19
19
  /** Camera path speed (1 = 100%). */
20
- futuristicCameraSpeed?: number
20
+ v2CameraSpeed?: number
21
21
  /** Block fly-through + sky drift speed (1 = 100%). */
22
- futuristicBlockSpeed?: number
22
+ v2BlockSpeed?: number
23
23
  /**
24
24
  * Optional shared resource manager (e.g. appViewer.resourcesManager).
25
25
  * Caller should run `updateAssetsData` after mcData is loaded when using textured cubes.