minerender 2.1.0-alpha.61 → 2.1.0-alpha.62

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.
@@ -3324,11 +3324,11 @@ var init_Entities = __esm({
3324
3324
  return { ...layers[names[0]], id: model.id, layers, ...model.transform && { transform: model.transform } };
3325
3325
  }
3326
3326
  /**
3327
- * Vanilla's keyframe animations of a model by name, or undefined when the model or the selected version has none.
3327
+ * Native and sampled vanilla clips by name, or undefined when the model or selected version has none.
3328
3328
  */
3329
3329
  static async getAnimations(modelKey) {
3330
3330
  const path = isAssetKey(modelKey) ? modelKey.getFullPath() : modelKey.path;
3331
- const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models/animations", ".json");
3331
+ const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models/animations", ".json", isAssetKey(modelKey) ? modelKey.root : void 0);
3332
3332
  const file = await Caching.entityAnimationCache.get(key.serialize(), () => AssetLoader.get(key, "json" /* JSON */));
3333
3333
  return file?.animations;
3334
3334
  }
@@ -3378,7 +3378,7 @@ function sampleEntityKeyframes(keyframes, time) {
3378
3378
  let low = 0, high = keyframes.length;
3379
3379
  while (low < high) {
3380
3380
  const middle = low + high >>> 1;
3381
- if (time <= keyframes[middle].time) high = middle;
3381
+ if (time < keyframes[middle].time) high = middle;
3382
3382
  else low = middle + 1;
3383
3383
  }
3384
3384
  const a = Math.max(0, low - 1);
@@ -3417,9 +3417,10 @@ var init_EntityAnimation = __esm({
3417
3417
  });
3418
3418
 
3419
3419
  // src/entity/scene/EntityAnimationPlayer.ts
3420
- var ZERO, EntityAnimationPlayer;
3420
+ var import_three11, ZERO, EntityAnimationPlayer;
3421
3421
  var init_EntityAnimationPlayer = __esm({
3422
3422
  "src/entity/scene/EntityAnimationPlayer.ts"() {
3423
+ import_three11 = require("three");
3423
3424
  init_EntityAnimation();
3424
3425
  ZERO = [0, 0, 0];
3425
3426
  EntityAnimationPlayer = class {
@@ -3436,25 +3437,45 @@ var init_EntityAnimationPlayer = __esm({
3436
3437
  return this._time;
3437
3438
  }
3438
3439
  /**
3439
- * Starts an animation on the named parts below each layer root. The current pose of a part becomes its default;
3440
- * bones without a matching part are skipped.
3440
+ * Starts an animation on matching named parts. Supplied baked poses are the baseline for offsets;
3441
+ * without them, the current pose is used. Stopping restores the pose from before playback.
3441
3442
  */
3442
- play(layers, animation, options = {}) {
3443
+ play(layers, animation, options = {}, poses) {
3443
3444
  this.stop();
3444
3445
  this._animation = animation;
3445
3446
  this._time = options.time ?? 0;
3446
3447
  this.loop = options.loop ?? animation.loop;
3447
3448
  this.speed = options.speed ?? 1;
3448
3449
  for (const layer of layers) {
3449
- for (const bone of Object.keys(animation.bones)) {
3450
- const object = layer.getObjectByName(`group:${bone}`);
3451
- if (!object) continue;
3452
- this.parts.push({ bone, object, position: object.position.clone(), rotation: object.rotation.clone(), scale: object.scale.clone() });
3450
+ const objects = [];
3451
+ if (poses) {
3452
+ layer.traverse((object) => {
3453
+ if (poses.has(object)) objects.push(object);
3454
+ });
3455
+ } else {
3456
+ for (const bone of Object.keys(animation.bones)) {
3457
+ const object = layer.getObjectByName(`group:${bone}`);
3458
+ if (object) objects.push(object);
3459
+ }
3460
+ }
3461
+ for (const object of objects) {
3462
+ const bone = object.name.slice("group:".length);
3463
+ const pose = poses?.get(object);
3464
+ this.parts.push({
3465
+ bone,
3466
+ object,
3467
+ position: object.position.clone(),
3468
+ rotation: object.rotation.clone(),
3469
+ scale: object.scale.clone(),
3470
+ basePosition: pose ? new import_three11.Vector3(...pose.offset) : object.position.clone(),
3471
+ baseRotation: pose ? new import_three11.Euler(...pose.rotation, "ZYX") : object.rotation.clone(),
3472
+ baseScale: pose ? new import_three11.Vector3(...pose.scale ?? [1, 1, 1]) : object.scale.clone()
3473
+ });
3453
3474
  }
3454
3475
  }
3455
3476
  this.apply();
3456
3477
  }
3457
- /** Restores the default poses. Returns whether an animation was active. */
3478
+ /** Restores the poses from before playback. Returns whether an animation was active. */
3458
3479
  stop() {
3459
3480
  if (!this._animation) return false;
3460
3481
  for (const part of this.parts) {
@@ -3483,10 +3504,10 @@ var init_EntityAnimationPlayer = __esm({
3483
3504
  apply() {
3484
3505
  const pose = sampleEntityAnimation(this._animation, this._time, this.loop);
3485
3506
  for (const part of this.parts) {
3486
- const { position = ZERO, rotation = ZERO, scale = ZERO } = pose[part.bone];
3487
- part.object.position.set(part.position.x + position[0], part.position.y + position[1], part.position.z + position[2]);
3488
- part.object.rotation.set(part.rotation.x + rotation[0], part.rotation.y + rotation[1], part.rotation.z + rotation[2], part.rotation.order);
3489
- part.object.scale.set(part.scale.x + scale[0], part.scale.y + scale[1], part.scale.z + scale[2]);
3507
+ const { position = ZERO, rotation = ZERO, scale = ZERO } = pose[part.bone] ?? {};
3508
+ part.object.position.set(part.basePosition.x + position[0], part.basePosition.y + position[1], part.basePosition.z + position[2]);
3509
+ part.object.rotation.set(part.baseRotation.x + rotation[0], part.baseRotation.y + rotation[1], part.baseRotation.z + rotation[2], part.baseRotation.order);
3510
+ part.object.scale.set(part.baseScale.x + scale[0], part.baseScale.y + scale[1], part.baseScale.z + scale[2]);
3490
3511
  }
3491
3512
  }
3492
3513
  };
@@ -3556,10 +3577,10 @@ var init_InstanceReference = __esm({
3556
3577
  function isSceneObject(obj) {
3557
3578
  return obj.isSceneObject;
3558
3579
  }
3559
- var import_three11, import_ts_deepmerge3, p6, SceneObject;
3580
+ var import_three12, import_ts_deepmerge3, p6, SceneObject;
3560
3581
  var init_SceneObject = __esm({
3561
3582
  "src/renderer/SceneObject.ts"() {
3562
- import_three11 = require("three");
3583
+ import_three12 = require("three");
3563
3584
  init_Geometries();
3564
3585
  init_UVMapper();
3565
3586
  init_Axis();
@@ -3571,7 +3592,7 @@ var init_SceneObject = __esm({
3571
3592
  import_ts_deepmerge3 = __toESM(require_dist());
3572
3593
  init_log();
3573
3594
  p6 = prefix("SceneObject");
3574
- SceneObject = class _SceneObject extends import_three11.Object3D {
3595
+ SceneObject = class _SceneObject extends import_three12.Object3D {
3575
3596
  constructor(options) {
3576
3597
  super();
3577
3598
  this.isSceneObject = true;
@@ -3623,7 +3644,7 @@ var init_SceneObject = __esm({
3623
3644
  return group;
3624
3645
  }
3625
3646
  createGroup(name, x = 0, y = 0, z = 0, offsetAxis, offset = 0) {
3626
- const obj = new import_three11.Object3D();
3647
+ const obj = new import_three12.Object3D();
3627
3648
  if (name) {
3628
3649
  obj.name = `group:${name}`;
3629
3650
  }
@@ -3673,7 +3694,7 @@ var init_SceneObject = __esm({
3673
3694
  return mesh;
3674
3695
  }
3675
3696
  createMesh(name, geometry, material, offsetAxis, offset = 0) {
3676
- const mesh = new import_three11.Mesh(geometry, material);
3697
+ const mesh = new import_three12.Mesh(geometry, material);
3677
3698
  if (name) {
3678
3699
  mesh.name = `mesh:${name}`;
3679
3700
  }
@@ -3685,7 +3706,7 @@ var init_SceneObject = __esm({
3685
3706
  return mesh;
3686
3707
  }
3687
3708
  createInstancedMesh(name, geometry, material, count) {
3688
- const mesh = new import_three11.InstancedMesh(geometry, material, count);
3709
+ const mesh = new import_three12.InstancedMesh(geometry, material, count);
3689
3710
  mesh.count = 0;
3690
3711
  this.instanceMesh = mesh;
3691
3712
  this._isInstanced = true;
@@ -3765,11 +3786,11 @@ var init_SceneObject = __esm({
3765
3786
  this._instanceCounter = this.instanceReferences.size;
3766
3787
  mesh.count = Math.max(mesh.count, index + 1);
3767
3788
  if (mesh.instanceColor) {
3768
- mesh.setColorAt(index, new import_three11.Color(16777215));
3789
+ mesh.setColorAt(index, new import_three12.Color(16777215));
3769
3790
  mesh.instanceColor.needsUpdate = true;
3770
3791
  }
3771
3792
  if (this._scene) this._scene.stats.instanceCount++;
3772
- this.setMatrixAt(index, new import_three11.Matrix4());
3793
+ this.setMatrixAt(index, new import_three12.Matrix4());
3773
3794
  return reference;
3774
3795
  }
3775
3796
  /** Returns the live reference for a raycast hit on this object's instance mesh. */
@@ -3782,7 +3803,7 @@ var init_SceneObject = __esm({
3782
3803
  removeInstanceAt(index) {
3783
3804
  if (!this.instanceReferences.has(index)) return;
3784
3805
  const mesh = this.instanceMesh;
3785
- this.setMatrixAt(index, new import_three11.Matrix4().makeScale(0, 0, 0));
3806
+ this.setMatrixAt(index, new import_three12.Matrix4().makeScale(0, 0, 0));
3786
3807
  this.instanceReferences.delete(index);
3787
3808
  this.freeInstanceIndices.push(index);
3788
3809
  this._instanceCounter = this.instanceReferences.size;
@@ -3795,7 +3816,7 @@ var init_SceneObject = __esm({
3795
3816
  const grow = (attribute, fill) => {
3796
3817
  const array = new Float32Array(capacity * attribute.itemSize).fill(fill);
3797
3818
  array.set(attribute.array);
3798
- return new import_three11.InstancedBufferAttribute(array, attribute.itemSize, attribute.normalized, attribute.meshPerAttribute).setUsage(attribute.usage);
3819
+ return new import_three12.InstancedBufferAttribute(array, attribute.itemSize, attribute.normalized, attribute.meshPerAttribute).setUsage(attribute.usage);
3799
3820
  };
3800
3821
  const matrix = grow(mesh.instanceMatrix, 0);
3801
3822
  const color = mesh.instanceColor ? grow(mesh.instanceColor, 1) : null;
@@ -3812,7 +3833,7 @@ var init_SceneObject = __esm({
3812
3833
  }
3813
3834
  //</editor-fold>
3814
3835
  //<editor-fold desc="TRANSFORMATION">
3815
- getMatrixAt(index, matrix = new import_three11.Matrix4()) {
3836
+ getMatrixAt(index, matrix = new import_three12.Matrix4()) {
3816
3837
  if (!this.instanceReferences.has(index)) throw new MineRenderError("Instance is not active");
3817
3838
  this.instanceMesh.getMatrixAt(index, matrix);
3818
3839
  return matrix;
@@ -3828,16 +3849,16 @@ var init_SceneObject = __esm({
3828
3849
  }
3829
3850
  setPositionRotationScaleAt(index, position, rotation, scale) {
3830
3851
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3831
- const oldPosition = new import_three11.Vector3();
3832
- const oldRotation = new import_three11.Quaternion();
3833
- const oldScale = new import_three11.Vector3();
3834
- const matrix = new import_three11.Matrix4();
3852
+ const oldPosition = new import_three12.Vector3();
3853
+ const oldRotation = new import_three12.Quaternion();
3854
+ const oldScale = new import_three12.Vector3();
3855
+ const matrix = new import_three12.Matrix4();
3835
3856
  if (!scale || !rotation || !position) {
3836
3857
  this.getMatrixAt(index, matrix).decompose(oldPosition, oldRotation, oldScale);
3837
3858
  }
3838
3859
  matrix.compose(
3839
3860
  position ? position : oldPosition,
3840
- rotation ? new import_three11.Quaternion().setFromEuler(rotation) : oldRotation,
3861
+ rotation ? new import_three12.Quaternion().setFromEuler(rotation) : oldRotation,
3841
3862
  scale ? scale : oldScale
3842
3863
  );
3843
3864
  this.setMatrixAt(index, matrix);
@@ -3846,7 +3867,7 @@ var init_SceneObject = __esm({
3846
3867
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3847
3868
  this.setPositionRotationScaleAt(index, position);
3848
3869
  }
3849
- getPositionAt(index, vector = new import_three11.Vector3()) {
3870
+ getPositionAt(index, vector = new import_three12.Vector3()) {
3850
3871
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3851
3872
  const matrix = this.getMatrixAt(index);
3852
3873
  vector.setFromMatrixPosition(matrix);
@@ -3856,17 +3877,17 @@ var init_SceneObject = __esm({
3856
3877
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3857
3878
  this.setPositionRotationScaleAt(index, void 0, rotation, void 0);
3858
3879
  }
3859
- getRotationAt(index, euler = new import_three11.Euler()) {
3880
+ getRotationAt(index, euler = new import_three12.Euler()) {
3860
3881
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3861
- const rotation = new import_three11.Quaternion();
3862
- this.getMatrixAt(index).decompose(new import_three11.Vector3(), rotation, new import_three11.Vector3());
3882
+ const rotation = new import_three12.Quaternion();
3883
+ this.getMatrixAt(index).decompose(new import_three12.Vector3(), rotation, new import_three12.Vector3());
3863
3884
  return euler.setFromQuaternion(rotation);
3864
3885
  }
3865
3886
  setScaleAt(index, scale) {
3866
3887
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3867
3888
  this.setPositionRotationScaleAt(index, void 0, void 0, scale);
3868
3889
  }
3869
- getScaleAt(index, vector = new import_three11.Vector3()) {
3890
+ getScaleAt(index, vector = new import_three12.Vector3()) {
3870
3891
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3871
3892
  const matrix = this.getMatrixAt(index);
3872
3893
  vector.setFromMatrixScale(matrix);
@@ -3994,13 +4015,13 @@ var init_SceneObject = __esm({
3994
4015
  function isEntityObject(obj) {
3995
4016
  return obj.isEntityObject;
3996
4017
  }
3997
- var import_ts_deepmerge4, import_three13, EntityObject;
4018
+ var import_ts_deepmerge4, import_three14, EntityObject;
3998
4019
  var init_EntityObject = __esm({
3999
4020
  "src/entity/scene/EntityObject.ts"() {
4000
4021
  init_SceneObject();
4001
4022
  init_Caching();
4002
4023
  import_ts_deepmerge4 = __toESM(require_dist());
4003
- import_three13 = require("three");
4024
+ import_three14 = require("three");
4004
4025
  init_Ticker();
4005
4026
  init_model();
4006
4027
  init_ModelTextures();
@@ -4021,7 +4042,8 @@ var init_EntityObject = __esm({
4021
4042
  this.scrollMaterials = [];
4022
4043
  /** Entity age in ticks, as vanilla's `ageInTicks`; drives the scrolling render modes. */
4023
4044
  this.age = 0;
4024
- this.animationPlayer = new EntityAnimationPlayer();
4045
+ this.animationPlayers = [];
4046
+ this.partPoses = /* @__PURE__ */ new Map();
4025
4047
  this.options = (0, import_ts_deepmerge4.default)({}, _EntityObject.DEFAULT_OPTIONS, options ?? {});
4026
4048
  this.addEventListener("added", () => this.updateScrollSubscription());
4027
4049
  this.addEventListener("removed", () => this.updateScrollSubscription());
@@ -4041,7 +4063,8 @@ var init_EntityObject = __esm({
4041
4063
  for (const geometry of this.geometries) geometry.dispose();
4042
4064
  this.geometries.clear();
4043
4065
  for (const dispose of this.disposeWireframes.splice(0)) dispose();
4044
- this.animationPlayer.clear();
4066
+ for (const player of this.animationPlayers.splice(0)) player.clear();
4067
+ this.partPoses.clear();
4045
4068
  super.disposeAndRemoveAllChildren();
4046
4069
  }
4047
4070
  clearScrollMaterials() {
@@ -4073,36 +4096,61 @@ var init_EntityObject = __esm({
4073
4096
  this.notifyDirty();
4074
4097
  }
4075
4098
  //<editor-fold desc="ANIMATION">
4076
- /** The animation started by {@link playAnimation}, until {@link stopAnimation} or disposal. */
4099
+ /** The first active clip, until playback is stopped or the object is disposed. */
4077
4100
  get animation() {
4078
- return this.animationPlayer.animation;
4101
+ return this.animationPlayers[0]?.animation;
4102
+ }
4103
+ /** Clips playing together, each targeting a separate geometry layer. */
4104
+ get activeAnimations() {
4105
+ return this.animationPlayers.map((player) => player.animation);
4079
4106
  }
4080
4107
  /** Seconds since the animation started, before looping. */
4081
4108
  get animationTime() {
4082
- return this.animationPlayer.time;
4109
+ return this.animationPlayers[0]?.time ?? 0;
4083
4110
  }
4084
4111
  /**
4085
- * Poses the object from a keyframe animation of {@link Entities.getAnimations}, replacing the current one.
4086
- * Parts of every layer are matched by name and their current pose is the default the offsets add to.
4112
+ * Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
4113
+ * Offsets apply to the baked pose in the clip's layer (`main` by default), including repeated draws of that layer.
4087
4114
  * The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
4088
4115
  */
4089
4116
  playAnimation(animation, options) {
4117
+ this.playAnimations([animation], options);
4118
+ }
4119
+ /** Plays one clip per selected geometry layer, with a shared clock and no blending between clips. */
4120
+ playAnimations(animations, options) {
4121
+ const targets = /* @__PURE__ */ new Set();
4122
+ const selections = animations.map((animation) => {
4123
+ const layer = animation.layer ?? "main";
4124
+ if (targets.has(layer)) throw new Error(`Multiple animations target layer "${layer}"`);
4125
+ targets.add(layer);
4126
+ const names = Object.keys(this.entityLayers).filter((name) => name.split("#")[0] === layer);
4127
+ if (!names.length) throw new Error(`Entity ${this.entity.id} has no selected animation layer "${layer}"`);
4128
+ return { animation, names };
4129
+ });
4090
4130
  this.createMeshes();
4091
- const layers = Object.keys(this.entityLayers).map((name) => this.getLayerGroup(name)).filter((layer) => !!layer);
4092
- this.animationPlayer.play(layers, animation, options);
4131
+ this.stopAnimation();
4132
+ for (const { animation, names } of selections) {
4133
+ const player = new EntityAnimationPlayer();
4134
+ player.play(names.map((name) => this.getLayerGroup(name)), animation, options, this.partPoses);
4135
+ this.animationPlayers.push(player);
4136
+ }
4093
4137
  this.notifyDirty();
4094
4138
  }
4095
- /** Stops the animation and restores the default pose. */
4139
+ /** Stops all clips and restores the poses from before playback. */
4096
4140
  stopAnimation() {
4097
- if (this.animationPlayer.stop()) this.notifyDirty();
4141
+ const players = this.animationPlayers.splice(0);
4142
+ for (const player of players) player.stop();
4143
+ if (players.length) this.notifyDirty();
4098
4144
  }
4099
4145
  /** Poses the object at an explicit time in seconds. Has no effect without an animation. */
4100
4146
  setAnimationTime(seconds) {
4101
- if (this.animationPlayer.setTime(seconds)) this.notifyDirty();
4147
+ for (const player of this.animationPlayers) player.setTime(seconds);
4148
+ if (this.animationPlayers.length) this.notifyDirty();
4102
4149
  }
4103
4150
  /** Advances the animation by a frame delta in seconds, scaled by its speed. Has no effect without an animation. */
4104
4151
  advanceAnimation(deltaSeconds) {
4105
- if (this.animationPlayer.advance(deltaSeconds)) this.notifyDirty();
4152
+ for (const player of this.animationPlayers) player.advance(deltaSeconds);
4153
+ if (this.animationPlayers.length) this.notifyDirty();
4106
4154
  }
4107
4155
  //</editor-fold>
4108
4156
  getLayerGroup(name) {
@@ -4134,14 +4182,14 @@ var init_EntityObject = __esm({
4134
4182
  }
4135
4183
  createMeshes(force = false) {
4136
4184
  if (this.meshesCreated && !force) return;
4137
- const modelRoot = new import_three13.Object3D();
4185
+ const modelRoot = new import_three14.Object3D();
4138
4186
  const transform = this.options.flip === void 0 ? this.entity.transform : void 0;
4139
4187
  if (transform) {
4140
4188
  for (const op of transform) {
4141
- const matrix = new import_three13.Matrix4();
4189
+ const matrix = new import_three14.Matrix4();
4142
4190
  if ("scale" in op) matrix.makeScale(...op.scale);
4143
4191
  else if ("translate" in op) matrix.makeTranslation(...op.translate);
4144
- else matrix.makeRotationFromEuler(new import_three13.Euler(...op.rotate, "ZYX"));
4192
+ else matrix.makeRotationFromEuler(new import_three14.Euler(...op.rotate, "ZYX"));
4145
4193
  modelRoot.matrix.multiply(matrix);
4146
4194
  }
4147
4195
  modelRoot.matrixAutoUpdate = false;
@@ -4162,6 +4210,7 @@ var init_EntityObject = __esm({
4162
4210
  anchor.position.fromArray(part.pose.offset);
4163
4211
  anchor.rotation.set(...part.pose.rotation, "ZYX");
4164
4212
  anchor.scale.fromArray(part.pose.scale ?? [1, 1, 1]);
4213
+ this.partPoses.set(anchor, part.pose);
4165
4214
  parent.add(anchor);
4166
4215
  const size = part.texture ?? textureSize;
4167
4216
  for (const cube of part.cubes) {
@@ -4197,7 +4246,7 @@ var init_EntityObject = __esm({
4197
4246
  const tint = layer.tint === void 0 ? void 0 : this.options.tints?.[layer.tint];
4198
4247
  const scroll = Materials.entityModeScroll(mode);
4199
4248
  const assetKeyStr = this.getTextureKey(layer).serialize();
4200
- const keyStr = `entity:${mode}:${tint === void 0 ? "" : new import_three13.Color(tint).getHexString()}:${assetKeyStr}`;
4249
+ const keyStr = `entity:${mode}:${tint === void 0 ? "" : new import_three14.Color(tint).getHexString()}:${assetKeyStr}`;
4201
4250
  let mat = scroll ? void 0 : Caching.materialCache.getIfPresent(keyStr);
4202
4251
  if (!mat) {
4203
4252
  const cachedAsset = Caching.textureAssetCache.getIfPresent(assetKeyStr);
@@ -4238,7 +4287,7 @@ function mergeBufferGeometries(geometries, useGroups = false) {
4238
4287
  const attributes = {};
4239
4288
  const morphAttributes = {};
4240
4289
  const morphTargetsRelative = geometries[0].morphTargetsRelative;
4241
- const mergedGeometry = new import_three20.BufferGeometry();
4290
+ const mergedGeometry = new import_three21.BufferGeometry();
4242
4291
  let offset = 0;
4243
4292
  for (let i = 0; i < geometries.length; ++i) {
4244
4293
  const geometry = geometries[i];
@@ -4362,7 +4411,7 @@ function mergeBufferAttributes(attributes) {
4362
4411
  array.set(attributes[i].array, offset);
4363
4412
  offset += attributes[i].array.length;
4364
4413
  }
4365
- return new import_three20.BufferAttribute(array, itemSize, normalized);
4414
+ return new import_three21.BufferAttribute(array, itemSize, normalized);
4366
4415
  }
4367
4416
  function interleaveAttributes(attributes) {
4368
4417
  let TypedArray;
@@ -4378,7 +4427,7 @@ function interleaveAttributes(attributes) {
4378
4427
  arrayLength += attribute.array.length;
4379
4428
  stride += attribute.itemSize;
4380
4429
  }
4381
- const interleavedBuffer = new import_three20.InterleavedBuffer(new TypedArray(arrayLength), stride);
4430
+ const interleavedBuffer = new import_three21.InterleavedBuffer(new TypedArray(arrayLength), stride);
4382
4431
  let offset = 0;
4383
4432
  const res = [];
4384
4433
  const getters = ["getX", "getY", "getZ", "getW"];
@@ -4387,7 +4436,7 @@ function interleaveAttributes(attributes) {
4387
4436
  const attribute = attributes[j];
4388
4437
  const itemSize = attribute.itemSize;
4389
4438
  const count = attribute.count;
4390
- const iba = new import_three20.InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized);
4439
+ const iba = new import_three21.InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized);
4391
4440
  res.push(iba);
4392
4441
  offset += itemSize;
4393
4442
  for (let c = 0; c < count; c++) {
@@ -4471,13 +4520,13 @@ function mergeVertices(geometry, tolerance = 1e-4) {
4471
4520
  const name = attributeNames[i];
4472
4521
  const oldAttribute = geometry.getAttribute(name);
4473
4522
  const buffer = new oldAttribute.array.constructor(attrArrays[name]);
4474
- const attribute = new import_three20.BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized);
4523
+ const attribute = new import_three21.BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized);
4475
4524
  result.setAttribute(name, attribute);
4476
4525
  if (name in morphAttrsArrays) {
4477
4526
  for (let j = 0; j < morphAttrsArrays[name].length; j++) {
4478
4527
  const oldMorphAttribute = geometry.morphAttributes[name][j];
4479
4528
  const buffer2 = new oldMorphAttribute.array.constructor(morphAttrsArrays[name][j]);
4480
- const morphAttribute = new import_three20.BufferAttribute(buffer2, oldMorphAttribute.itemSize, oldMorphAttribute.normalized);
4529
+ const morphAttribute = new import_three21.BufferAttribute(buffer2, oldMorphAttribute.itemSize, oldMorphAttribute.normalized);
4481
4530
  result.morphAttributes[name][j] = morphAttribute;
4482
4531
  }
4483
4532
  }
@@ -4486,11 +4535,11 @@ function mergeVertices(geometry, tolerance = 1e-4) {
4486
4535
  return result;
4487
4536
  }
4488
4537
  function toTrianglesDrawMode(geometry, drawMode) {
4489
- if (drawMode === import_three20.TrianglesDrawMode) {
4538
+ if (drawMode === import_three21.TrianglesDrawMode) {
4490
4539
  console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.");
4491
4540
  return geometry;
4492
4541
  }
4493
- if (drawMode === import_three20.TriangleFanDrawMode || drawMode === import_three20.TriangleStripDrawMode) {
4542
+ if (drawMode === import_three21.TriangleFanDrawMode || drawMode === import_three21.TriangleStripDrawMode) {
4494
4543
  let index = geometry.getIndex();
4495
4544
  if (index === null) {
4496
4545
  const indices = [];
@@ -4508,7 +4557,7 @@ function toTrianglesDrawMode(geometry, drawMode) {
4508
4557
  }
4509
4558
  const numberOfTriangles = index.count - 2;
4510
4559
  const newIndices = [];
4511
- if (drawMode === import_three20.TriangleFanDrawMode) {
4560
+ if (drawMode === import_three21.TriangleFanDrawMode) {
4512
4561
  for (let i = 1; i <= numberOfTriangles; i++) {
4513
4562
  newIndices.push(index.getX(0));
4514
4563
  newIndices.push(index.getX(i));
@@ -4544,15 +4593,15 @@ function computeMorphedAttributes(object) {
4544
4593
  console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
4545
4594
  return null;
4546
4595
  }
4547
- const _vA = new import_three20.Vector3();
4548
- const _vB = new import_three20.Vector3();
4549
- const _vC = new import_three20.Vector3();
4550
- const _tempA = new import_three20.Vector3();
4551
- const _tempB = new import_three20.Vector3();
4552
- const _tempC = new import_three20.Vector3();
4553
- const _morphA = new import_three20.Vector3();
4554
- const _morphB = new import_three20.Vector3();
4555
- const _morphC = new import_three20.Vector3();
4596
+ const _vA = new import_three21.Vector3();
4597
+ const _vB = new import_three21.Vector3();
4598
+ const _vC = new import_three21.Vector3();
4599
+ const _tempA = new import_three21.Vector3();
4600
+ const _tempB = new import_three21.Vector3();
4601
+ const _tempC = new import_three21.Vector3();
4602
+ const _morphA = new import_three21.Vector3();
4603
+ const _morphB = new import_three21.Vector3();
4604
+ const _morphC = new import_three21.Vector3();
4556
4605
  function _calculateMorphedAttributeData(object2, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
4557
4606
  _vA.fromBufferAttribute(attribute, a2);
4558
4607
  _vB.fromBufferAttribute(attribute, b2);
@@ -4747,8 +4796,8 @@ function computeMorphedAttributes(object) {
4747
4796
  }
4748
4797
  }
4749
4798
  }
4750
- const morphedPositionAttribute = new import_three20.Float32BufferAttribute(modifiedPosition, 3);
4751
- const morphedNormalAttribute = new import_three20.Float32BufferAttribute(modifiedNormal, 3);
4799
+ const morphedPositionAttribute = new import_three21.Float32BufferAttribute(modifiedPosition, 3);
4800
+ const morphedNormalAttribute = new import_three21.Float32BufferAttribute(modifiedNormal, 3);
4752
4801
  return {
4753
4802
  positionAttribute,
4754
4803
  normalAttribute,
@@ -4756,24 +4805,24 @@ function computeMorphedAttributes(object) {
4756
4805
  morphedNormalAttribute
4757
4806
  };
4758
4807
  }
4759
- var import_three20;
4808
+ var import_three21;
4760
4809
  var init_BufferGeometryUtils = __esm({
4761
4810
  "src/three/BufferGeometryUtils.js"() {
4762
- import_three20 = require("three");
4811
+ import_three21 = require("three");
4763
4812
  }
4764
4813
  });
4765
4814
 
4766
4815
  // src/model/ModelCulling.ts
4767
- var import_three21, ModelCulling;
4816
+ var import_three22, ModelCulling;
4768
4817
  var init_ModelCulling = __esm({
4769
4818
  "src/model/ModelCulling.ts"() {
4770
- import_three21 = require("three");
4819
+ import_three22 = require("three");
4771
4820
  init_CubeFace();
4772
4821
  ModelCulling = class {
4773
4822
  static toLocalMask(worldMask, rotation) {
4774
4823
  let localMask = 0;
4775
4824
  for (const [localFace, offset] of CUBE_FACE_OFFSETS.entries()) {
4776
- const normal = new import_three21.Vector3(...offset).applyEuler(rotation);
4825
+ const normal = new import_three22.Vector3(...offset).applyEuler(rotation);
4777
4826
  const worldFace = CUBE_FACE_OFFSETS.findIndex(([x, y, z]) => Math.abs(normal.x - x) < 1e-6 && Math.abs(normal.y - y) < 1e-6 && Math.abs(normal.z - z) < 1e-6);
4778
4827
  if (worldFace < 0) return 0;
4779
4828
  if (worldMask & 1 << worldFace) localMask |= 1 << localFace;
@@ -4806,10 +4855,10 @@ var init_ModelCulling = __esm({
4806
4855
  });
4807
4856
 
4808
4857
  // src/model/SpecialItems.ts
4809
- var import_three22, SpecialItems;
4858
+ var import_three23, SpecialItems;
4810
4859
  var init_SpecialItems = __esm({
4811
4860
  "src/model/SpecialItems.ts"() {
4812
- import_three22 = require("three");
4861
+ import_three23 = require("three");
4813
4862
  init_AssetKey();
4814
4863
  init_Entities();
4815
4864
  SpecialItems = class {
@@ -4837,7 +4886,7 @@ var init_SpecialItems = __esm({
4837
4886
  case "minecraft:chest":
4838
4887
  case "chest": {
4839
4888
  const angle = -(special.openness ?? 0) * Math.PI / 2;
4840
- const chest = await load("chest", texture(special.texture, "chest"), new import_three22.Matrix4(), {
4889
+ const chest = await load("chest", texture(special.texture, "chest"), new import_three23.Matrix4(), {
4841
4890
  lid: [angle, 0, 0],
4842
4891
  lock: [angle, 0, 0]
4843
4892
  });
@@ -4846,11 +4895,11 @@ var init_SpecialItems = __esm({
4846
4895
  }
4847
4896
  case "minecraft:bed":
4848
4897
  case "bed": {
4849
- const transform = new import_three22.Matrix4().makeTranslation(0, 9, 0).multiply(new import_three22.Matrix4().makeRotationX(Math.PI / 2)).multiply(new import_three22.Matrix4().makeTranslation(8, 8, 8)).multiply(new import_three22.Matrix4().makeRotationZ(Math.PI)).multiply(new import_three22.Matrix4().makeTranslation(-8, -8, -8));
4898
+ const transform = new import_three23.Matrix4().makeTranslation(0, 9, 0).multiply(new import_three23.Matrix4().makeRotationX(Math.PI / 2)).multiply(new import_three23.Matrix4().makeTranslation(8, 8, 8)).multiply(new import_three23.Matrix4().makeRotationZ(Math.PI)).multiply(new import_three23.Matrix4().makeTranslation(-8, -8, -8));
4850
4899
  const key = texture(special.texture, "bed");
4851
4900
  return Promise.all([
4852
4901
  load("bed_head", key, transform),
4853
- load("bed_foot", key, new import_three22.Matrix4().makeTranslation(0, 0, -16).multiply(transform))
4902
+ load("bed_foot", key, new import_three23.Matrix4().makeTranslation(0, 0, -16).multiply(transform))
4854
4903
  ]);
4855
4904
  }
4856
4905
  case "minecraft:head":
@@ -4875,7 +4924,7 @@ var init_SpecialItems = __esm({
4875
4924
  return [await load(
4876
4925
  id,
4877
4926
  special.texture ? texture(special.texture, "") : void 0,
4878
- new import_three22.Matrix4().makeTranslation(8, 0, 8).multiply(new import_three22.Matrix4().makeScale(-1, -1, 1)),
4927
+ new import_three23.Matrix4().makeTranslation(8, 0, 8).multiply(new import_three23.Matrix4().makeScale(-1, -1, 1)),
4879
4928
  rotations
4880
4929
  )];
4881
4930
  }
@@ -5003,13 +5052,13 @@ var init_ItemTints = __esm({
5003
5052
  function isModelObject(obj) {
5004
5053
  return obj.isModelObject;
5005
5054
  }
5006
- var import_three23, import_ts_deepmerge5, p7, ModelObject;
5055
+ var import_three24, import_ts_deepmerge5, p7, ModelObject;
5007
5056
  var init_ModelObject = __esm({
5008
5057
  "src/model/scene/ModelObject.ts"() {
5009
5058
  init_SceneObject();
5010
5059
  init_Materials();
5011
5060
  init_UVMapper();
5012
- import_three23 = require("three");
5061
+ import_three24 = require("three");
5013
5062
  init_BufferGeometryUtils();
5014
5063
  init_model();
5015
5064
  import_ts_deepmerge5 = __toESM(require_dist());
@@ -5044,8 +5093,8 @@ var init_ModelObject = __esm({
5044
5093
  const special = this.originalModel.special;
5045
5094
  if (special) {
5046
5095
  const parts = await SpecialItems.getParts(special, this.originalModel.key?.root);
5047
- const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new import_three23.Matrix4();
5048
- transform.multiply(new import_three23.Matrix4().makeTranslation(-8, -8, -8));
5096
+ const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new import_three24.Matrix4();
5097
+ transform.multiply(new import_three24.Matrix4().makeTranslation(-8, -8, -8));
5049
5098
  try {
5050
5099
  for (const part of parts) {
5051
5100
  const object = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe });
@@ -5107,7 +5156,7 @@ var init_ModelObject = __esm({
5107
5156
  elGeo.clearGroups();
5108
5157
  }
5109
5158
  if (this.options.uvLockRotation) {
5110
- UVMapper.lockUvs(elGeo, el.faces, this.atlas, new import_three23.Euler(...this.options.uvLockRotation));
5159
+ UVMapper.lockUvs(elGeo, el.faces, this.atlas, new import_three24.Euler(...this.options.uvLockRotation));
5111
5160
  }
5112
5161
  if (this.options.tints) {
5113
5162
  const colors = new Float32Array(elGeo.getAttribute("position").count * 3).fill(1);
@@ -5116,19 +5165,19 @@ var init_ModelObject = __esm({
5116
5165
  if (tintIndex === void 0 || tintIndex < 0) continue;
5117
5166
  const tint = this.options.tints[tintIndex];
5118
5167
  if (tint === void 0) continue;
5119
- const color = new import_three23.Color(tint);
5168
+ const color = new import_three24.Color(tint);
5120
5169
  for (let vertex = 0; vertex < 4; vertex++) {
5121
5170
  color.toArray(colors, (faceIndex * 4 + vertex) * 3);
5122
5171
  }
5123
5172
  }
5124
- elGeo.setAttribute("color", new import_three23.BufferAttribute(colors, 3));
5173
+ elGeo.setAttribute("color", new import_three24.BufferAttribute(colors, 3));
5125
5174
  }
5126
- elGeo.applyMatrix4(new import_three23.Matrix4().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
5127
- elGeo.applyMatrix4(new import_three23.Matrix4().makeTranslation(el.from[0], el.from[1], el.from[2]));
5175
+ elGeo.applyMatrix4(new import_three24.Matrix4().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
5176
+ elGeo.applyMatrix4(new import_three24.Matrix4().makeTranslation(el.from[0], el.from[1], el.from[2]));
5128
5177
  if (el.rotation) {
5129
5178
  applyElementRotation(el.rotation, elGeo);
5130
5179
  }
5131
- elGeo.applyMatrix4(new import_three23.Matrix4().makeTranslation(-8, -8, -8));
5180
+ elGeo.applyMatrix4(new import_three24.Matrix4().makeTranslation(-8, -8, -8));
5132
5181
  if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
5133
5182
  if (this.options.mergeMeshes) {
5134
5183
  allGeos.push(elGeo);
@@ -5150,7 +5199,7 @@ var init_ModelObject = __esm({
5150
5199
  if (allGeos.length > 0) {
5151
5200
  combinedGeo = mergeBufferGeometries(allGeos);
5152
5201
  } else {
5153
- combinedGeo = new import_three23.BoxGeometry(16, 16, 16);
5202
+ combinedGeo = new import_three24.BoxGeometry(16, 16, 16);
5154
5203
  if (displayTransform) DisplayTransforms.apply(combinedGeo, displayTransform);
5155
5204
  }
5156
5205
  combinedGeo.computeBoundingBox();
@@ -5260,7 +5309,7 @@ function ownHeight(sample) {
5260
5309
  return (level === 0 || level >= 8 ? 8 : 8 - level) / 9;
5261
5310
  }
5262
5311
  function createFluidGeometry(kind, sample) {
5263
- const geometry = new import_three28.BufferGeometry();
5312
+ const geometry = new import_three29.BufferGeometry();
5264
5313
  const positions = [], normals = [], uvs = [], indices = [];
5265
5314
  const self = sample(0, 0, 0);
5266
5315
  const height = (x, z) => {
@@ -5359,16 +5408,16 @@ function createFluidGeometry(kind, sample) {
5359
5408
  1
5360
5409
  );
5361
5410
  }
5362
- geometry.setAttribute("position", new import_three28.Float32BufferAttribute(positions, 3));
5363
- geometry.setAttribute("normal", new import_three28.Float32BufferAttribute(normals, 3));
5364
- geometry.setAttribute("uv", new import_three28.Float32BufferAttribute(uvs, 2));
5411
+ geometry.setAttribute("position", new import_three29.Float32BufferAttribute(positions, 3));
5412
+ geometry.setAttribute("normal", new import_three29.Float32BufferAttribute(normals, 3));
5413
+ geometry.setAttribute("uv", new import_three29.Float32BufferAttribute(uvs, 2));
5365
5414
  geometry.setIndex(indices);
5366
5415
  return geometry;
5367
5416
  }
5368
- var import_three28, fluidRules, HORIZONTAL, EPSILON;
5417
+ var import_three29, fluidRules, HORIZONTAL, EPSILON;
5369
5418
  var init_FluidGeometry = __esm({
5370
5419
  "src/model/fluid/FluidGeometry.ts"() {
5371
- import_three28 = require("three");
5420
+ import_three29 = require("three");
5372
5421
  init_fluidBlocks();
5373
5422
  fluidRules = fluidBlocks_default;
5374
5423
  HORIZONTAL = [[0, -1], [0, 1], [-1, 0], [1, 0]];
@@ -5397,10 +5446,10 @@ function sampleFluid(kind, sample) {
5397
5446
  }
5398
5447
  return { key: key.join(""), sample: (x, y, z) => cells[(y + 1) * 9 + (z + 1) * 3 + x + 1] };
5399
5448
  }
5400
- var import_three29, FluidModelObject;
5449
+ var import_three30, FluidModelObject;
5401
5450
  var init_FluidModelObject = __esm({
5402
5451
  "src/model/fluid/FluidModelObject.ts"() {
5403
- import_three29 = require("three");
5452
+ import_three30 = require("three");
5404
5453
  init_AssetKey();
5405
5454
  init_Materials();
5406
5455
  init_ModelObject();
@@ -5433,10 +5482,10 @@ var init_FluidModelObject = __esm({
5433
5482
  }
5434
5483
  }
5435
5484
  geometry.clearGroups();
5436
- const color = new import_three29.Color(this.options.tints?.[0] ?? (this.kind === "water" ? 4159204 : 16777215));
5485
+ const color = new import_three30.Color(this.options.tints?.[0] ?? (this.kind === "water" ? 4159204 : 16777215));
5437
5486
  const colors = new Float32Array(geometry.getAttribute("position").count * 3);
5438
5487
  for (let i = 0; i < colors.length; i += 3) color.toArray(colors, i);
5439
- geometry.setAttribute("color", new import_three29.BufferAttribute(colors, 3));
5488
+ geometry.setAttribute("color", new import_three30.BufferAttribute(colors, 3));
5440
5489
  geometry.computeBoundingBox();
5441
5490
  geometry.computeBoundingSphere();
5442
5491
  if (this.options.instanceMeshes) {
@@ -5450,7 +5499,7 @@ var init_FluidModelObject = __esm({
5450
5499
  super.applyTextures();
5451
5500
  this.iterateAllMeshes((mesh) => {
5452
5501
  const material = mesh.material;
5453
- material.side = import_three29.DoubleSide;
5502
+ material.side = import_three30.DoubleSide;
5454
5503
  material.forceSinglePass = true;
5455
5504
  material.depthWrite = !material.transparent;
5456
5505
  });
@@ -5898,27 +5947,27 @@ init_EntityObject();
5898
5947
  init_MineRenderError();
5899
5948
 
5900
5949
  // src/export/SceneExporter.ts
5901
- var import_three19 = require("three");
5950
+ var import_three20 = require("three");
5902
5951
 
5903
5952
  // ../../node_modules/three/examples/jsm/exporters/OBJExporter.js
5904
- var import_three15 = require("three");
5953
+ var import_three16 = require("three");
5905
5954
  var OBJExporter = class {
5906
5955
  parse(object) {
5907
5956
  let output = "";
5908
5957
  let indexVertex = 0;
5909
5958
  let indexVertexUvs = 0;
5910
5959
  let indexNormals = 0;
5911
- const vertex = new import_three15.Vector3();
5912
- const color = new import_three15.Color();
5913
- const normal = new import_three15.Vector3();
5914
- const uv = new import_three15.Vector2();
5960
+ const vertex = new import_three16.Vector3();
5961
+ const color = new import_three16.Color();
5962
+ const normal = new import_three16.Vector3();
5963
+ const uv = new import_three16.Vector2();
5915
5964
  const face = [];
5916
5965
  function parseMesh(mesh) {
5917
5966
  let nbVertex = 0;
5918
5967
  let nbNormals = 0;
5919
5968
  let nbVertexUvs = 0;
5920
5969
  const geometry = mesh.geometry;
5921
- const normalMatrixWorld = new import_three15.Matrix3();
5970
+ const normalMatrixWorld = new import_three16.Matrix3();
5922
5971
  const vertices = geometry.getAttribute("position");
5923
5972
  const normals = geometry.getAttribute("normal");
5924
5973
  const uvs = geometry.getAttribute("uv");
@@ -6037,7 +6086,7 @@ var OBJExporter = class {
6037
6086
  };
6038
6087
 
6039
6088
  // ../../node_modules/three/examples/jsm/exporters/PLYExporter.js
6040
- var import_three16 = require("three");
6089
+ var import_three17 = require("three");
6041
6090
  var PLYExporter = class {
6042
6091
  parse(object, onDone, options = {}) {
6043
6092
  function traverseMeshes(cb) {
@@ -6094,7 +6143,7 @@ var PLYExporter = class {
6094
6143
  includeIndices = false;
6095
6144
  }
6096
6145
  });
6097
- const tempColor = new import_three16.Color();
6146
+ const tempColor = new import_three17.Color();
6098
6147
  includeIndices = includeIndices && excludeAttributes.indexOf("index") === -1;
6099
6148
  includeNormals = includeNormals && excludeAttributes.indexOf("normal") === -1;
6100
6149
  includeColors = includeColors && excludeAttributes.indexOf("color") === -1;
@@ -6128,8 +6177,8 @@ property list uchar int vertex_index
6128
6177
  `;
6129
6178
  }
6130
6179
  header += "end_header\n";
6131
- const vertex = new import_three16.Vector3();
6132
- const normalMatrixWorld = new import_three16.Matrix3();
6180
+ const vertex = new import_three17.Vector3();
6181
+ const normalMatrixWorld = new import_three17.Matrix3();
6133
6182
  let result = null;
6134
6183
  if (options.binary === true) {
6135
6184
  const headerBin = new TextEncoder().encode(header);
@@ -6303,18 +6352,18 @@ property list uchar int vertex_index
6303
6352
  };
6304
6353
 
6305
6354
  // ../../node_modules/three/examples/jsm/exporters/GLTFExporter.js
6306
- var import_three18 = require("three");
6355
+ var import_three19 = require("three");
6307
6356
 
6308
6357
  // ../../node_modules/three/examples/jsm/utils/TextureUtils.js
6309
- var import_three17 = require("three");
6358
+ var import_three18 = require("three");
6310
6359
  var _renderer;
6311
6360
  var fullscreenQuadGeometry;
6312
6361
  var fullscreenQuadMaterial;
6313
6362
  var fullscreenQuad;
6314
6363
  function decompress(texture, maxTextureSize = Infinity, renderer = null) {
6315
- if (!fullscreenQuadGeometry) fullscreenQuadGeometry = new import_three17.PlaneGeometry(2, 2, 1, 1);
6316
- if (!fullscreenQuadMaterial) fullscreenQuadMaterial = new import_three17.ShaderMaterial({
6317
- uniforms: { blitTexture: new import_three17.Uniform(texture) },
6364
+ if (!fullscreenQuadGeometry) fullscreenQuadGeometry = new import_three18.PlaneGeometry(2, 2, 1, 1);
6365
+ if (!fullscreenQuadMaterial) fullscreenQuadMaterial = new import_three18.ShaderMaterial({
6366
+ uniforms: { blitTexture: new import_three18.Uniform(texture) },
6318
6367
  vertexShader: `
6319
6368
  varying vec2 vUv;
6320
6369
  void main(){
@@ -6336,22 +6385,22 @@ function decompress(texture, maxTextureSize = Infinity, renderer = null) {
6336
6385
  }`
6337
6386
  });
6338
6387
  fullscreenQuadMaterial.uniforms.blitTexture.value = texture;
6339
- fullscreenQuadMaterial.defines.IS_SRGB = texture.colorSpace == import_three17.SRGBColorSpace;
6388
+ fullscreenQuadMaterial.defines.IS_SRGB = texture.colorSpace == import_three18.SRGBColorSpace;
6340
6389
  fullscreenQuadMaterial.needsUpdate = true;
6341
6390
  if (!fullscreenQuad) {
6342
- fullscreenQuad = new import_three17.Mesh(fullscreenQuadGeometry, fullscreenQuadMaterial);
6391
+ fullscreenQuad = new import_three18.Mesh(fullscreenQuadGeometry, fullscreenQuadMaterial);
6343
6392
  fullscreenQuad.frustrumCulled = false;
6344
6393
  }
6345
- const _camera = new import_three17.PerspectiveCamera();
6346
- const _scene = new import_three17.Scene();
6394
+ const _camera = new import_three18.PerspectiveCamera();
6395
+ const _scene = new import_three18.Scene();
6347
6396
  _scene.add(fullscreenQuad);
6348
6397
  if (!renderer) {
6349
- renderer = _renderer = new import_three17.WebGLRenderer({ antialias: false });
6398
+ renderer = _renderer = new import_three18.WebGLRenderer({ antialias: false });
6350
6399
  }
6351
6400
  renderer.setSize(Math.min(texture.image.width, maxTextureSize), Math.min(texture.image.height, maxTextureSize));
6352
6401
  renderer.clear();
6353
6402
  renderer.render(_scene, _camera);
6354
- const readableTexture = new import_three17.Texture(renderer.domElement);
6403
+ const readableTexture = new import_three18.Texture(renderer.domElement);
6355
6404
  readableTexture.minFilter = texture.minFilter;
6356
6405
  readableTexture.magFilter = texture.magFilter;
6357
6406
  readableTexture.wrapS = texture.wrapS;
@@ -6497,22 +6546,22 @@ var WEBGL_CONSTANTS = {
6497
6546
  };
6498
6547
  var KHR_MESH_QUANTIZATION = "KHR_mesh_quantization";
6499
6548
  var THREE_TO_WEBGL = {};
6500
- THREE_TO_WEBGL[import_three18.NearestFilter] = WEBGL_CONSTANTS.NEAREST;
6501
- THREE_TO_WEBGL[import_three18.NearestMipmapNearestFilter] = WEBGL_CONSTANTS.NEAREST_MIPMAP_NEAREST;
6502
- THREE_TO_WEBGL[import_three18.NearestMipmapLinearFilter] = WEBGL_CONSTANTS.NEAREST_MIPMAP_LINEAR;
6503
- THREE_TO_WEBGL[import_three18.LinearFilter] = WEBGL_CONSTANTS.LINEAR;
6504
- THREE_TO_WEBGL[import_three18.LinearMipmapNearestFilter] = WEBGL_CONSTANTS.LINEAR_MIPMAP_NEAREST;
6505
- THREE_TO_WEBGL[import_three18.LinearMipmapLinearFilter] = WEBGL_CONSTANTS.LINEAR_MIPMAP_LINEAR;
6506
- THREE_TO_WEBGL[import_three18.ClampToEdgeWrapping] = WEBGL_CONSTANTS.CLAMP_TO_EDGE;
6507
- THREE_TO_WEBGL[import_three18.RepeatWrapping] = WEBGL_CONSTANTS.REPEAT;
6508
- THREE_TO_WEBGL[import_three18.MirroredRepeatWrapping] = WEBGL_CONSTANTS.MIRRORED_REPEAT;
6549
+ THREE_TO_WEBGL[import_three19.NearestFilter] = WEBGL_CONSTANTS.NEAREST;
6550
+ THREE_TO_WEBGL[import_three19.NearestMipmapNearestFilter] = WEBGL_CONSTANTS.NEAREST_MIPMAP_NEAREST;
6551
+ THREE_TO_WEBGL[import_three19.NearestMipmapLinearFilter] = WEBGL_CONSTANTS.NEAREST_MIPMAP_LINEAR;
6552
+ THREE_TO_WEBGL[import_three19.LinearFilter] = WEBGL_CONSTANTS.LINEAR;
6553
+ THREE_TO_WEBGL[import_three19.LinearMipmapNearestFilter] = WEBGL_CONSTANTS.LINEAR_MIPMAP_NEAREST;
6554
+ THREE_TO_WEBGL[import_three19.LinearMipmapLinearFilter] = WEBGL_CONSTANTS.LINEAR_MIPMAP_LINEAR;
6555
+ THREE_TO_WEBGL[import_three19.ClampToEdgeWrapping] = WEBGL_CONSTANTS.CLAMP_TO_EDGE;
6556
+ THREE_TO_WEBGL[import_three19.RepeatWrapping] = WEBGL_CONSTANTS.REPEAT;
6557
+ THREE_TO_WEBGL[import_three19.MirroredRepeatWrapping] = WEBGL_CONSTANTS.MIRRORED_REPEAT;
6509
6558
  var PATH_PROPERTIES = {
6510
6559
  scale: "scale",
6511
6560
  position: "translation",
6512
6561
  quaternion: "rotation",
6513
6562
  morphTargetInfluences: "weights"
6514
6563
  };
6515
- var DEFAULT_SPECULAR_COLOR = new import_three18.Color();
6564
+ var DEFAULT_SPECULAR_COLOR = new import_three19.Color();
6516
6565
  var GLB_HEADER_BYTES = 12;
6517
6566
  var GLB_HEADER_MAGIC = 1179937895;
6518
6567
  var GLB_VERSION = 2;
@@ -6546,7 +6595,7 @@ function getMinMax(attribute, start, count) {
6546
6595
  else if (a === 2) value = attribute.getZ(i);
6547
6596
  else if (a === 3) value = attribute.getW(i);
6548
6597
  if (attribute.normalized === true) {
6549
- value = import_three18.MathUtils.normalize(value, attribute.array);
6598
+ value = import_three19.MathUtils.normalize(value, attribute.array);
6550
6599
  }
6551
6600
  }
6552
6601
  output.min[a] = Math.min(output.min[a], value);
@@ -6752,7 +6801,7 @@ var GLTFWriter = class {
6752
6801
  isNormalizedNormalAttribute(normal) {
6753
6802
  const cache = this.cache;
6754
6803
  if (cache.attributesNormalized.has(normal)) return false;
6755
- const v = new import_three18.Vector3();
6804
+ const v = new import_three19.Vector3();
6756
6805
  for (let i = 0, il = normal.count; i < il; i++) {
6757
6806
  if (Math.abs(v.fromBufferAttribute(normal, i).length() - 1) > 5e-4) return false;
6758
6807
  }
@@ -6769,7 +6818,7 @@ var GLTFWriter = class {
6769
6818
  const cache = this.cache;
6770
6819
  if (cache.attributesNormalized.has(normal)) return cache.attributesNormalized.get(normal);
6771
6820
  const attribute = normal.clone();
6772
- const v = new import_three18.Vector3();
6821
+ const v = new import_three19.Vector3();
6773
6822
  for (let i = 0, il = attribute.count; i < il; i++) {
6774
6823
  v.fromBufferAttribute(attribute, i);
6775
6824
  if (v.x === 0 && v.y === 0 && v.z === 0) {
@@ -6813,7 +6862,7 @@ var GLTFWriter = class {
6813
6862
  buildMetalRoughTexture(metalnessMap, roughnessMap) {
6814
6863
  if (metalnessMap === roughnessMap) return metalnessMap;
6815
6864
  function getEncodingConversion(map) {
6816
- if (map.colorSpace === import_three18.SRGBColorSpace) {
6865
+ if (map.colorSpace === import_three19.SRGBColorSpace) {
6817
6866
  return function SRGBToLinear(c) {
6818
6867
  return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
6819
6868
  };
@@ -6823,10 +6872,10 @@ var GLTFWriter = class {
6823
6872
  };
6824
6873
  }
6825
6874
  console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");
6826
- if (metalnessMap instanceof import_three18.CompressedTexture) {
6875
+ if (metalnessMap instanceof import_three19.CompressedTexture) {
6827
6876
  metalnessMap = decompress(metalnessMap);
6828
6877
  }
6829
- if (roughnessMap instanceof import_three18.CompressedTexture) {
6878
+ if (roughnessMap instanceof import_three19.CompressedTexture) {
6830
6879
  roughnessMap = decompress(roughnessMap);
6831
6880
  }
6832
6881
  const metalness = metalnessMap ? metalnessMap.image : null;
@@ -6859,8 +6908,8 @@ var GLTFWriter = class {
6859
6908
  context.putImageData(composite, 0, 0);
6860
6909
  const reference = metalnessMap || roughnessMap;
6861
6910
  const texture = reference.clone();
6862
- texture.source = new import_three18.Source(canvas);
6863
- texture.colorSpace = import_three18.NoColorSpace;
6911
+ texture.source = new import_three19.Source(canvas);
6912
+ texture.colorSpace = import_three19.NoColorSpace;
6864
6913
  texture.channel = (metalnessMap || roughnessMap).channel;
6865
6914
  if (metalnessMap && roughnessMap && metalnessMap.channel !== roughnessMap.channel) {
6866
6915
  console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match.");
@@ -6918,7 +6967,7 @@ var GLTFWriter = class {
6918
6967
  else if (a === 2) value = attribute.getZ(i);
6919
6968
  else if (a === 3) value = attribute.getW(i);
6920
6969
  if (attribute.normalized === true) {
6921
- value = import_three18.MathUtils.normalize(value, attribute.array);
6970
+ value = import_three19.MathUtils.normalize(value, attribute.array);
6922
6971
  }
6923
6972
  }
6924
6973
  if (componentType === WEBGL_CONSTANTS.FLOAT) {
@@ -7068,7 +7117,7 @@ var GLTFWriter = class {
7068
7117
  ctx.scale(1, -1);
7069
7118
  }
7070
7119
  if (image.data !== void 0) {
7071
- if (format !== import_three18.RGBAFormat) {
7120
+ if (format !== import_three19.RGBAFormat) {
7072
7121
  console.error("GLTFExporter: Only RGBAFormat is supported.", format);
7073
7122
  }
7074
7123
  if (image.width > options.maxTextureSize || image.height > options.maxTextureSize) {
@@ -7137,7 +7186,7 @@ var GLTFWriter = class {
7137
7186
  const json = this.json;
7138
7187
  if (cache.textures.has(map)) return cache.textures.get(map);
7139
7188
  if (!json.textures) json.textures = [];
7140
- if (map instanceof import_three18.CompressedTexture) {
7189
+ if (map instanceof import_three19.CompressedTexture) {
7141
7190
  map = decompress(map, options.maxTextureSize);
7142
7191
  }
7143
7192
  let mimeType = map.userData.mimeType;
@@ -7245,7 +7294,7 @@ var GLTFWriter = class {
7245
7294
  materialDef.alphaCutoff = material.alphaTest;
7246
7295
  }
7247
7296
  }
7248
- if (material.side === import_three18.DoubleSide) materialDef.doubleSided = true;
7297
+ if (material.side === import_three19.DoubleSide) materialDef.doubleSided = true;
7249
7298
  if (material.name !== "") materialDef.name = material.name;
7250
7299
  this.serializeUserData(material, materialDef);
7251
7300
  this._invokeAll(function(ext) {
@@ -7319,7 +7368,7 @@ var GLTFWriter = class {
7319
7368
  const array = attribute.array;
7320
7369
  if (attributeName === "JOINTS_0" && !(array instanceof Uint16Array) && !(array instanceof Uint8Array)) {
7321
7370
  console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.');
7322
- modifiedAttribute = new import_three18.BufferAttribute(new Uint16Array(array), attribute.itemSize, attribute.normalized);
7371
+ modifiedAttribute = new import_three19.BufferAttribute(new Uint16Array(array), attribute.itemSize, attribute.normalized);
7323
7372
  }
7324
7373
  const accessor = this.processAccessor(modifiedAttribute || attribute, geometry);
7325
7374
  if (accessor !== null) {
@@ -7479,7 +7528,7 @@ var GLTFWriter = class {
7479
7528
  } else {
7480
7529
  cameraDef.perspective = {
7481
7530
  aspectRatio: camera.aspect,
7482
- yfov: import_three18.MathUtils.degToRad(camera.fov),
7531
+ yfov: import_three19.MathUtils.degToRad(camera.fov),
7483
7532
  zfar: camera.far <= 0 ? 1e-3 : camera.far,
7484
7533
  znear: camera.near < 0 ? 0 : camera.near
7485
7534
  };
@@ -7507,8 +7556,8 @@ var GLTFWriter = class {
7507
7556
  const samplers = [];
7508
7557
  for (let i = 0; i < tracks.length; ++i) {
7509
7558
  const track = tracks[i];
7510
- const trackBinding = import_three18.PropertyBinding.parseTrackName(track.name);
7511
- let trackNode = import_three18.PropertyBinding.findNode(root, trackBinding.nodeName);
7559
+ const trackBinding = import_three19.PropertyBinding.parseTrackName(track.name);
7560
+ let trackNode = import_three19.PropertyBinding.findNode(root, trackBinding.nodeName);
7512
7561
  const trackProperty = PATH_PROPERTIES[trackBinding.propertyName];
7513
7562
  if (trackBinding.objectName === "bones") {
7514
7563
  if (trackNode.isSkinnedMesh === true) {
@@ -7530,14 +7579,14 @@ var GLTFWriter = class {
7530
7579
  if (track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === true) {
7531
7580
  interpolation = "CUBICSPLINE";
7532
7581
  outputItemSize /= 3;
7533
- } else if (track.getInterpolation() === import_three18.InterpolateDiscrete) {
7582
+ } else if (track.getInterpolation() === import_three19.InterpolateDiscrete) {
7534
7583
  interpolation = "STEP";
7535
7584
  } else {
7536
7585
  interpolation = "LINEAR";
7537
7586
  }
7538
7587
  samplers.push({
7539
- input: this.processAccessor(new import_three18.BufferAttribute(track.times, inputItemSize)),
7540
- output: this.processAccessor(new import_three18.BufferAttribute(track.values, outputItemSize)),
7588
+ input: this.processAccessor(new import_three19.BufferAttribute(track.times, inputItemSize)),
7589
+ output: this.processAccessor(new import_three19.BufferAttribute(track.values, outputItemSize)),
7541
7590
  interpolation
7542
7591
  });
7543
7592
  channels.push({
@@ -7569,7 +7618,7 @@ var GLTFWriter = class {
7569
7618
  if (rootJoint === void 0) return null;
7570
7619
  const joints = [];
7571
7620
  const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16);
7572
- const temporaryBoneInverse = new import_three18.Matrix4();
7621
+ const temporaryBoneInverse = new import_three19.Matrix4();
7573
7622
  for (let i = 0; i < skeleton.bones.length; ++i) {
7574
7623
  joints.push(nodeMap.get(skeleton.bones[i]));
7575
7624
  temporaryBoneInverse.copy(skeleton.boneInverses[i]);
@@ -7577,7 +7626,7 @@ var GLTFWriter = class {
7577
7626
  }
7578
7627
  if (json.skins === void 0) json.skins = [];
7579
7628
  json.skins.push({
7580
- inverseBindMatrices: this.processAccessor(new import_three18.BufferAttribute(inverseBindMatrices, 16)),
7629
+ inverseBindMatrices: this.processAccessor(new import_three19.BufferAttribute(inverseBindMatrices, 16)),
7581
7630
  joints,
7582
7631
  skeleton: nodeMap.get(rootJoint)
7583
7632
  });
@@ -7673,7 +7722,7 @@ var GLTFWriter = class {
7673
7722
  * @param {Array} objects List of objects to process
7674
7723
  */
7675
7724
  processObjects(objects) {
7676
- const scene = new import_three18.Scene();
7725
+ const scene = new import_three19.Scene();
7677
7726
  scene.name = "AuxScene";
7678
7727
  for (let i = 0; i < objects.length; i++) {
7679
7728
  scene.children.push(objects[i]);
@@ -7691,7 +7740,7 @@ var GLTFWriter = class {
7691
7740
  });
7692
7741
  const objectsWithoutScene = [];
7693
7742
  for (let i = 0; i < input.length; i++) {
7694
- if (input[i] instanceof import_three18.Scene) {
7743
+ if (input[i] instanceof import_three19.Scene) {
7695
7744
  this.processScene(input[i]);
7696
7745
  } else {
7697
7746
  objectsWithoutScene.push(input[i]);
@@ -8035,10 +8084,10 @@ var GLTFMeshGpuInstancing = class {
8035
8084
  const translationAttr = new Float32Array(mesh.count * 3);
8036
8085
  const rotationAttr = new Float32Array(mesh.count * 4);
8037
8086
  const scaleAttr = new Float32Array(mesh.count * 3);
8038
- const matrix = new import_three18.Matrix4();
8039
- const position = new import_three18.Vector3();
8040
- const quaternion = new import_three18.Quaternion();
8041
- const scale = new import_three18.Vector3();
8087
+ const matrix = new import_three19.Matrix4();
8088
+ const position = new import_three19.Vector3();
8089
+ const quaternion = new import_three19.Quaternion();
8090
+ const scale = new import_three19.Vector3();
8042
8091
  for (let i = 0; i < mesh.count; i++) {
8043
8092
  mesh.getMatrixAt(i, matrix);
8044
8093
  matrix.decompose(position, quaternion, scale);
@@ -8047,9 +8096,9 @@ var GLTFMeshGpuInstancing = class {
8047
8096
  scale.toArray(scaleAttr, i * 3);
8048
8097
  }
8049
8098
  const attributes = {
8050
- TRANSLATION: writer.processAccessor(new import_three18.BufferAttribute(translationAttr, 3)),
8051
- ROTATION: writer.processAccessor(new import_three18.BufferAttribute(rotationAttr, 4)),
8052
- SCALE: writer.processAccessor(new import_three18.BufferAttribute(scaleAttr, 3))
8099
+ TRANSLATION: writer.processAccessor(new import_three19.BufferAttribute(translationAttr, 3)),
8100
+ ROTATION: writer.processAccessor(new import_three19.BufferAttribute(rotationAttr, 4)),
8101
+ SCALE: writer.processAccessor(new import_three19.BufferAttribute(scaleAttr, 3))
8053
8102
  };
8054
8103
  if (mesh.instanceColor)
8055
8104
  attributes._COLOR_0 = writer.processAccessor(mesh.instanceColor);
@@ -8114,8 +8163,8 @@ GLTFExporter.Utils = {
8114
8163
  const sourceTracks = clip.tracks;
8115
8164
  for (let i = 0; i < sourceTracks.length; ++i) {
8116
8165
  let sourceTrack = sourceTracks[i];
8117
- const sourceTrackBinding = import_three18.PropertyBinding.parseTrackName(sourceTrack.name);
8118
- const sourceTrackNode = import_three18.PropertyBinding.findNode(root, sourceTrackBinding.nodeName);
8166
+ const sourceTrackBinding = import_three19.PropertyBinding.parseTrackName(sourceTrack.name);
8167
+ const sourceTrackNode = import_three19.PropertyBinding.findNode(root, sourceTrackBinding.nodeName);
8119
8168
  if (sourceTrackBinding.propertyName !== "morphTargetInfluences" || sourceTrackBinding.propertyIndex === void 0) {
8120
8169
  tracks.push(sourceTrack);
8121
8170
  continue;
@@ -8126,7 +8175,7 @@ GLTFExporter.Utils = {
8126
8175
  }
8127
8176
  console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.");
8128
8177
  sourceTrack = sourceTrack.clone();
8129
- sourceTrack.setInterpolation(import_three18.InterpolateLinear);
8178
+ sourceTrack.setInterpolation(import_three19.InterpolateLinear);
8130
8179
  }
8131
8180
  const targetCount = sourceTrackNode.morphTargetInfluences.length;
8132
8181
  const targetIndex = sourceTrackNode.morphTargetDictionary[sourceTrackBinding.propertyIndex];
@@ -8209,10 +8258,10 @@ var SceneExporter = class {
8209
8258
  }
8210
8259
  };
8211
8260
  function localMatrix(object) {
8212
- return object.matrixAutoUpdate ? new import_three19.Matrix4().compose(object.position, object.quaternion, object.scale) : object.matrix.clone();
8261
+ return object.matrixAutoUpdate ? new import_three20.Matrix4().compose(object.position, object.quaternion, object.scale) : object.matrix.clone();
8213
8262
  }
8214
8263
  function createSnapshot(root, gltf, bakeColors = false) {
8215
- const scene = new import_three19.Scene();
8264
+ const scene = new import_three20.Scene();
8216
8265
  const geometries = [];
8217
8266
  const materials = [];
8218
8267
  const textures = [];
@@ -8230,7 +8279,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
8230
8279
  if (!uniforms.map?.value?.isTexture || !uniforms.SHADE || !uniforms.BRIGHTNESS || !uniforms.EMISSIVE) {
8231
8280
  throw new MineRenderError("glTF export does not support this custom ShaderMaterial");
8232
8281
  }
8233
- material = new import_three19.MeshBasicMaterial({
8282
+ material = new import_three20.MeshBasicMaterial({
8234
8283
  map: uniforms.map.value,
8235
8284
  vertexColors: source.vertexColors,
8236
8285
  transparent: source.transparent,
@@ -8240,7 +8289,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
8240
8289
  });
8241
8290
  material.name = source.name;
8242
8291
  } else if (shader.isShaderMaterial) {
8243
- material = new import_three19.MeshBasicMaterial({ vertexColors: source.vertexColors });
8292
+ material = new import_three20.MeshBasicMaterial({ vertexColors: source.vertexColors });
8244
8293
  material.name = source.name;
8245
8294
  } else {
8246
8295
  const copySource = Object.create(source);
@@ -8294,11 +8343,11 @@ function createSnapshot(root, gltf, bakeColors = false) {
8294
8343
  const material = copyMaterial(sourceMaterial, geometry);
8295
8344
  if (!sourceMaterial.vertexColors) geometry.deleteAttribute("color");
8296
8345
  if (bakeColors || instanceColor) {
8297
- const tint = (material.color ?? new import_three19.Color()).clone();
8346
+ const tint = (material.color ?? new import_three20.Color()).clone();
8298
8347
  if (instanceColor) tint.multiply(instanceColor);
8299
8348
  if (bakeColors) {
8300
8349
  const original = geometry.getAttribute("color");
8301
- const colors = new import_three19.Float32BufferAttribute(new Float32Array(geometry.getAttribute("position").count * 3), 3);
8350
+ const colors = new import_three20.Float32BufferAttribute(new Float32Array(geometry.getAttribute("position").count * 3), 3);
8302
8351
  for (let i = 0; i < colors.count; i++) {
8303
8352
  colors.setXYZ(i, (original?.getX(i) ?? 1) * tint.r, (original?.getY(i) ?? 1) * tint.g, (original?.getZ(i) ?? 1) * tint.b);
8304
8353
  }
@@ -8307,7 +8356,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
8307
8356
  material.color.copy(tint);
8308
8357
  }
8309
8358
  }
8310
- const copy = new import_three19.Mesh(geometry, material);
8359
+ const copy = new import_three20.Mesh(geometry, material);
8311
8360
  copy.name = mesh.name;
8312
8361
  copy.renderOrder = mesh.renderOrder;
8313
8362
  scene.add(copy);
@@ -8321,9 +8370,9 @@ function createSnapshot(root, gltf, bakeColors = false) {
8321
8370
  const instanced = mesh;
8322
8371
  if (instanced.isInstancedMesh) {
8323
8372
  for (let i = 0; i < instanced.count; i++) {
8324
- const matrix = new import_three19.Matrix4();
8373
+ const matrix = new import_three20.Matrix4();
8325
8374
  instanced.getMatrixAt(i, matrix);
8326
- const color = instanced.instanceColor ? new import_three19.Color().fromBufferAttribute(instanced.instanceColor, i) : void 0;
8375
+ const color = instanced.instanceColor ? new import_three20.Color().fromBufferAttribute(instanced.instanceColor, i) : void 0;
8327
8376
  addMesh(mesh, world.clone().multiply(matrix), color);
8328
8377
  }
8329
8378
  } else {
@@ -8335,7 +8384,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
8335
8384
  try {
8336
8385
  const ancestors = [];
8337
8386
  for (let parent = root.parent; parent; parent = parent.parent) ancestors.unshift(parent);
8338
- const world = new import_three19.Matrix4();
8387
+ const world = new import_three20.Matrix4();
8339
8388
  for (const ancestor of ancestors) {
8340
8389
  if (!ancestor.visible) return { scene, dispose };
8341
8390
  world.multiply(localMatrix(ancestor));
@@ -8349,7 +8398,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
8349
8398
  }
8350
8399
  function selectAlphaMode(material, geometry) {
8351
8400
  const texture = material.map;
8352
- if (material.type !== "MeshBasicMaterial" || !material.transparent || !material.depthWrite || material.opacity !== 1 || material.alphaMap || !texture?.isDataTexture || texture.format !== import_three19.RGBAFormat || texture.type !== import_three19.UnsignedByteType || texture.wrapS !== import_three19.ClampToEdgeWrapping || texture.wrapT !== import_three19.ClampToEdgeWrapping || texture.magFilter !== import_three19.NearestFilter || texture.minFilter !== import_three19.NearestFilter || texture.anisotropy > 1 || texture.offset.x !== 0 || texture.offset.y !== 0 || texture.repeat.x !== 1 || texture.repeat.y !== 1 || texture.rotation !== 0 || !texture.matrixAutoUpdate && !texture.matrix.elements.every((value, i) => value === (i % 4 === 0 ? 1 : 0))) return;
8401
+ if (material.type !== "MeshBasicMaterial" || !material.transparent || !material.depthWrite || material.opacity !== 1 || material.alphaMap || !texture?.isDataTexture || texture.format !== import_three20.RGBAFormat || texture.type !== import_three20.UnsignedByteType || texture.wrapS !== import_three20.ClampToEdgeWrapping || texture.wrapT !== import_three20.ClampToEdgeWrapping || texture.magFilter !== import_three20.NearestFilter || texture.minFilter !== import_three20.NearestFilter || texture.anisotropy > 1 || texture.offset.x !== 0 || texture.offset.y !== 0 || texture.repeat.x !== 1 || texture.repeat.y !== 1 || texture.rotation !== 0 || !texture.matrixAutoUpdate && !texture.matrix.elements.every((value, i) => value === (i % 4 === 0 ? 1 : 0))) return;
8353
8402
  const uv = geometry.getAttribute(texture.channel === 0 ? "uv" : `uv${texture.channel}`);
8354
8403
  const colors = geometry.getAttribute("color");
8355
8404
  if (!uv || material.vertexColors && colors?.itemSize === 4) return;
@@ -8386,7 +8435,7 @@ function selectAlphaMode(material, geometry) {
8386
8435
  }
8387
8436
  function copyDataTexture(source) {
8388
8437
  const image = source.image;
8389
- if (source.format !== import_three19.RGBAFormat || source.type !== import_three19.UnsignedByteType) {
8438
+ if (source.format !== import_three20.RGBAFormat || source.type !== import_three20.UnsignedByteType) {
8390
8439
  throw new MineRenderError("glTF export requires RGBA unsigned-byte data textures");
8391
8440
  }
8392
8441
  const canvas = createCanvas2(image.width, image.height);
@@ -8397,8 +8446,8 @@ function copyDataTexture(source) {
8397
8446
  context.putImageData(pixels, 0, 0);
8398
8447
  const copySource = Object.create(source);
8399
8448
  copySource.userData = {};
8400
- copySource.source = new import_three19.Source(canvas);
8401
- return new import_three19.Texture().copy(copySource);
8449
+ copySource.source = new import_three20.Source(canvas);
8450
+ return new import_three20.Texture().copy(copySource);
8402
8451
  }
8403
8452
 
8404
8453
  // src/gui/GuiHelper.ts
@@ -8468,7 +8517,7 @@ var GuiHelper = class {
8468
8517
  };
8469
8518
 
8470
8519
  // src/gui/scene/GuiObject.ts
8471
- var import_three24 = require("three");
8520
+ var import_three25 = require("three");
8472
8521
  init_AssetKey();
8473
8522
  init_ModelTextures();
8474
8523
  init_Models();
@@ -8484,7 +8533,7 @@ var GuiObject = class extends SceneObject {
8484
8533
  this.textureLayers = textureLayers;
8485
8534
  this.isGuiObject = true;
8486
8535
  /** Local bounds in GUI pixels, with y growing down from the origin. */
8487
- this.bounds = new import_three24.Box2();
8536
+ this.bounds = new import_three25.Box2();
8488
8537
  this.geometries = /* @__PURE__ */ new Set();
8489
8538
  this.ownedMaterials = /* @__PURE__ */ new Set();
8490
8539
  this.initialized = false;
@@ -8502,17 +8551,17 @@ var GuiObject = class extends SceneObject {
8502
8551
  item.scale.set(width2 / 16, height2 / 16, width2 / 16);
8503
8552
  item.updateWorldMatrix(true, true);
8504
8553
  const inverse = this.matrixWorld.clone().invert();
8505
- const bounds = new import_three24.Box3();
8554
+ const bounds = new import_three25.Box3();
8506
8555
  item.iterateAllMeshes((mesh2) => {
8507
8556
  mesh2.geometry.computeBoundingBox();
8508
- bounds.union(mesh2.geometry.boundingBox.clone().applyMatrix4(new import_three24.Matrix4().multiplyMatrices(inverse, mesh2.matrixWorld)));
8557
+ bounds.union(mesh2.geometry.boundingBox.clone().applyMatrix4(new import_three25.Matrix4().multiplyMatrices(inverse, mesh2.matrixWorld)));
8509
8558
  });
8510
8559
  item.position.z = depth - bounds.min.z;
8511
8560
  depth += bounds.max.z - bounds.min.z + 0.01;
8512
- this.bounds.expandByPoint(new import_three24.Vector2(x, y));
8513
- this.bounds.expandByPoint(new import_three24.Vector2(x + width2, y + height2));
8514
- this.bounds.expandByPoint(new import_three24.Vector2(bounds.min.x, -bounds.max.y));
8515
- this.bounds.expandByPoint(new import_three24.Vector2(bounds.max.x, -bounds.min.y));
8561
+ this.bounds.expandByPoint(new import_three25.Vector2(x, y));
8562
+ this.bounds.expandByPoint(new import_three25.Vector2(x + width2, y + height2));
8563
+ this.bounds.expandByPoint(new import_three25.Vector2(bounds.min.x, -bounds.max.y));
8564
+ this.bounds.expandByPoint(new import_three25.Vector2(bounds.max.x, -bounds.min.y));
8516
8565
  continue;
8517
8566
  }
8518
8567
  const key = typeof layer.texture === "string" ? AssetKey.parse("textures", layer.texture) : layer.texture;
@@ -8520,7 +8569,7 @@ var GuiObject = class extends SceneObject {
8520
8569
  const image = material.map.image;
8521
8570
  const [cropX, cropY, cropWidth, cropHeight] = layer.crop ?? [0, 0, image.width, image.height];
8522
8571
  const [width, height] = layer.size ?? [cropWidth, cropHeight];
8523
- const geometry = new import_three24.PlaneGeometry(width, height);
8572
+ const geometry = new import_three25.PlaneGeometry(width, height);
8524
8573
  this.geometries.add(geometry);
8525
8574
  const uv = geometry.getAttribute("uv");
8526
8575
  for (let i = 0; i < uv.count; i++) {
@@ -8530,13 +8579,13 @@ var GuiObject = class extends SceneObject {
8530
8579
  1 - (cropY + (1 - uv.getY(i)) * cropHeight) / image.height
8531
8580
  );
8532
8581
  }
8533
- const mesh = new import_three24.Mesh(geometry, material);
8582
+ const mesh = new import_three25.Mesh(geometry, material);
8534
8583
  mesh.name = `mesh:${layer.name ?? index}`;
8535
8584
  mesh.position.set(x + width / 2, -y - height / 2, depth);
8536
8585
  mesh.renderOrder = index;
8537
8586
  this.add(mesh);
8538
- this.bounds.expandByPoint(new import_three24.Vector2(x, y));
8539
- this.bounds.expandByPoint(new import_three24.Vector2(x + width, y + height));
8587
+ this.bounds.expandByPoint(new import_three25.Vector2(x, y));
8588
+ this.bounds.expandByPoint(new import_three25.Vector2(x + width, y + height));
8540
8589
  depth += 0.01;
8541
8590
  }
8542
8591
  for (const child of this.children) child.position.z -= depth - 0.01;
@@ -8611,7 +8660,7 @@ function isGuiObject(obj) {
8611
8660
  init_image();
8612
8661
 
8613
8662
  // src/inspector/SceneInspector.ts
8614
- var import_three25 = require("three");
8663
+ var import_three26 = require("three");
8615
8664
  init_SceneObject();
8616
8665
  init_util();
8617
8666
  init_log();
@@ -8621,11 +8670,11 @@ var help = "<span>Ctrl/Cmd+Click to Select<br/></span><br/>";
8621
8670
  var SceneInspector = class {
8622
8671
  constructor(renderer) {
8623
8672
  this.renderer = renderer;
8624
- this.mouse = new import_three25.Vector2();
8673
+ this.mouse = new import_three26.Vector2();
8625
8674
  this.listeners = new AbortController();
8626
8675
  this.objectInfoContainer = document.createElement("div");
8627
8676
  this.objectControlsContainer = document.createElement("div");
8628
- this.raycaster = new import_three25.Raycaster();
8677
+ this.raycaster = new import_three26.Raycaster();
8629
8678
  this.init();
8630
8679
  }
8631
8680
  init() {
@@ -9028,7 +9077,7 @@ init_ModelMerger();
9028
9077
  init_SpecialItems();
9029
9078
 
9030
9079
  // src/model/block/BlockStateResolver.ts
9031
- var import_three27 = require("three");
9080
+ var import_three28 = require("three");
9032
9081
  init_BlockStates();
9033
9082
  init_MineRenderError();
9034
9083
  init_util();
@@ -9106,7 +9155,7 @@ var BlockStateResolver = class {
9106
9155
  return variants[variants.length - 1];
9107
9156
  }
9108
9157
  static rotation(variant) {
9109
- const rotation = new import_three27.Euler();
9158
+ const rotation = new import_three28.Euler();
9110
9159
  if (typeof variant.x !== "undefined") {
9111
9160
  rotation.x = toRadians(clampRotationDegrees(variant.x));
9112
9161
  }
@@ -9198,7 +9247,7 @@ init_SceneObject();
9198
9247
  init_ModelObject();
9199
9248
  init_Models();
9200
9249
  var import_ts_deepmerge6 = __toESM(require_dist());
9201
- var import_three30 = require("three");
9250
+ var import_three31 = require("three");
9202
9251
  init_MineRenderError();
9203
9252
  init_InstanceReference();
9204
9253
  init_AssetKey();
@@ -9220,7 +9269,7 @@ var BlockObject = class _BlockObject extends SceneObject {
9220
9269
  this._models = [];
9221
9270
  this._cullMask = 0;
9222
9271
  this._entities = [];
9223
- this._entityPlacement = new import_three30.Matrix4();
9272
+ this._entityPlacement = new import_three31.Matrix4();
9224
9273
  this._entityGeneration = 0;
9225
9274
  this.options = (0, import_ts_deepmerge6.default)({}, _BlockObject.DEFAULT_OPTIONS, options ?? {});
9226
9275
  }
@@ -9305,7 +9354,7 @@ var BlockObject = class _BlockObject extends SceneObject {
9305
9354
  return true;
9306
9355
  }
9307
9356
  placeEntities() {
9308
- const matrix = new import_three30.Matrix4().makeTranslation(this.position.x - 8, this.position.y - 8, this.position.z - 8).multiply(this._entityPlacement);
9357
+ const matrix = new import_three31.Matrix4().makeTranslation(this.position.x - 8, this.position.y - 8, this.position.z - 8).multiply(this._entityPlacement);
9309
9358
  for (const entity of this._entities) {
9310
9359
  matrix.decompose(entity.position, entity.quaternion, entity.scale);
9311
9360
  }
@@ -9324,12 +9373,12 @@ var BlockObject = class _BlockObject extends SceneObject {
9324
9373
  getModelCullMask(model, worldMask) {
9325
9374
  const object = isInstanceReference(model) ? model.instanceable : model;
9326
9375
  if (object.options.displayPosition) return 0;
9327
- const position = new import_three30.Vector3();
9328
- const rotation = new import_three30.Quaternion();
9329
- const scale = new import_three30.Vector3();
9376
+ const position = new import_three31.Vector3();
9377
+ const rotation = new import_three31.Quaternion();
9378
+ const scale = new import_three31.Vector3();
9330
9379
  this.getModelMatrix(model).decompose(position, rotation, scale);
9331
- if (position.distanceToSquared(this.position) > 1e-10 || scale.distanceToSquared(new import_three30.Vector3(1, 1, 1)) > 1e-10) return 0;
9332
- return ModelCulling.toLocalMask(worldMask, new import_three30.Euler().setFromQuaternion(rotation));
9380
+ if (position.distanceToSquared(this.position) > 1e-10 || scale.distanceToSquared(new import_three31.Vector3(1, 1, 1)) > 1e-10) return 0;
9381
+ return ModelCulling.toLocalMask(worldMask, new import_three31.Euler().setFromQuaternion(rotation));
9333
9382
  }
9334
9383
  async setCullMask(worldMask) {
9335
9384
  worldMask &= 63;
@@ -9391,7 +9440,7 @@ var BlockObject = class _BlockObject extends SceneObject {
9391
9440
  () => new FluidModelObject2(kind, surface.sample, this.blockState.key, this.options)
9392
9441
  );
9393
9442
  const previous = this._fluidModel;
9394
- const matrix = previous ? this.getModelMatrix(previous) : new import_three30.Matrix4().makeTranslation(...this.position.toArray());
9443
+ const matrix = previous ? this.getModelMatrix(previous) : new import_three31.Matrix4().makeTranslation(...this.position.toArray());
9395
9444
  if (isInstanceReference(replacement)) replacement.setMatrix(matrix);
9396
9445
  else matrix.decompose(replacement.position, replacement.quaternion, replacement.scale);
9397
9446
  this._models = this._models.filter((model) => model !== previous);
@@ -9529,7 +9578,7 @@ var BlockObject = class _BlockObject extends SceneObject {
9529
9578
  setPositionRotationScaleAt(index, position, rotation, scale) {
9530
9579
  super.setPositionRotationScaleAt(index, position, rotation, scale);
9531
9580
  }
9532
- getMatrixAt(index, matrix = new import_three30.Matrix4()) {
9581
+ getMatrixAt(index, matrix = new import_three31.Matrix4()) {
9533
9582
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
9534
9583
  const child = this._models[0];
9535
9584
  if (child && isModelObject(child)) {
@@ -11396,7 +11445,7 @@ init_ModelObject();
11396
11445
  init_nbt();
11397
11446
 
11398
11447
  // src/renderer/MineRenderScene.ts
11399
- var import_three32 = require("three");
11448
+ var import_three33 = require("three");
11400
11449
  init_SceneObject();
11401
11450
  var import_ts_deepmerge8 = __toESM(require_dist());
11402
11451
  init_ModelObject();
@@ -12129,7 +12178,7 @@ var import_ts_deepmerge7 = __toESM(require_dist());
12129
12178
  init_util();
12130
12179
 
12131
12180
  // src/skin/SkinTextures.ts
12132
- var import_three31 = require("three");
12181
+ var import_three32 = require("three");
12133
12182
  init_Caching();
12134
12183
  init_CacheKey();
12135
12184
  init_MineRenderError();
@@ -12213,11 +12262,11 @@ var SkinTextures = class {
12213
12262
  });
12214
12263
  }
12215
12264
  static createMaterial(pixels, width, height, transparent = true) {
12216
- const texture = Textures.initTextureProps(new import_three31.DataTexture(pixels, width, height));
12217
- texture.colorSpace = import_three31.SRGBColorSpace;
12265
+ const texture = Textures.initTextureProps(new import_three32.DataTexture(pixels, width, height));
12266
+ texture.colorSpace = import_three32.SRGBColorSpace;
12218
12267
  texture.flipY = true;
12219
12268
  texture.needsUpdate = true;
12220
- return new import_three31.MeshBasicMaterial({ map: texture, transparent, side: transparent ? import_three31.DoubleSide : import_three31.FrontSide, alphaTest: transparent ? 0.1 : 0 });
12269
+ return new import_three32.MeshBasicMaterial({ map: texture, transparent, side: transparent ? import_three32.DoubleSide : import_three32.FrontSide, alphaTest: transparent ? 0.1 : 0 });
12221
12270
  }
12222
12271
  static isSlim(image, scale) {
12223
12272
  for (const [x, y] of [[46, 52], [54, 20]]) {
@@ -12447,7 +12496,7 @@ var SkinObject = class extends SceneObject {
12447
12496
  // src/renderer/MineRenderScene.ts
12448
12497
  init_EntityObject();
12449
12498
  init_ItemTints();
12450
- var MineRenderScene = class _MineRenderScene extends import_three32.Scene {
12499
+ var MineRenderScene = class _MineRenderScene extends import_three33.Scene {
12451
12500
  constructor(options) {
12452
12501
  super();
12453
12502
  this.isMineRenderScene = true;
@@ -12576,7 +12625,7 @@ function isMineRenderScene(obj) {
12576
12625
  }
12577
12626
 
12578
12627
  // src/renderer/Renderer.ts
12579
- var import_three34 = require("three");
12628
+ var import_three35 = require("three");
12580
12629
  var import_ts_deepmerge9 = __toESM(require_dist());
12581
12630
  var import_stats = __toESM(require("stats.js"));
12582
12631
  var import_postprocessing = require("postprocessing");
@@ -12585,11 +12634,11 @@ init_Model();
12585
12634
  init_three();
12586
12635
 
12587
12636
  // src/three/OrbitControls.js
12588
- var import_three33 = require("three");
12637
+ var import_three34 = require("three");
12589
12638
  var _changeEvent = { type: "change" };
12590
12639
  var _startEvent = { type: "start" };
12591
12640
  var _endEvent = { type: "end" };
12592
- var OrbitControls = class extends import_three33.EventDispatcher {
12641
+ var OrbitControls = class extends import_three34.EventDispatcher {
12593
12642
  constructor(object, domElement) {
12594
12643
  super();
12595
12644
  if (domElement === void 0) console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.');
@@ -12598,7 +12647,7 @@ var OrbitControls = class extends import_three33.EventDispatcher {
12598
12647
  this.domElement = domElement;
12599
12648
  this.domElement.style.touchAction = "none";
12600
12649
  this.enabled = true;
12601
- this.target = new import_three33.Vector3();
12650
+ this.target = new import_three34.Vector3();
12602
12651
  this.minDistance = 0;
12603
12652
  this.maxDistance = Infinity;
12604
12653
  this.minZoom = 0;
@@ -12620,8 +12669,8 @@ var OrbitControls = class extends import_three33.EventDispatcher {
12620
12669
  this.autoRotate = false;
12621
12670
  this.autoRotateSpeed = 2;
12622
12671
  this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" };
12623
- this.mouseButtons = { LEFT: import_three33.MOUSE.ROTATE, MIDDLE: import_three33.MOUSE.DOLLY, RIGHT: import_three33.MOUSE.PAN };
12624
- this.touches = { ONE: import_three33.TOUCH.ROTATE, TWO: import_three33.TOUCH.DOLLY_PAN };
12672
+ this.mouseButtons = { LEFT: import_three34.MOUSE.ROTATE, MIDDLE: import_three34.MOUSE.DOLLY, RIGHT: import_three34.MOUSE.PAN };
12673
+ this.touches = { ONE: import_three34.TOUCH.ROTATE, TWO: import_three34.TOUCH.DOLLY_PAN };
12625
12674
  this.target0 = this.target.clone();
12626
12675
  this.position0 = this.object.position.clone();
12627
12676
  this.zoom0 = this.object.zoom;
@@ -12650,11 +12699,11 @@ var OrbitControls = class extends import_three33.EventDispatcher {
12650
12699
  state = STATE.NONE;
12651
12700
  };
12652
12701
  this.update = function() {
12653
- const offset = new import_three33.Vector3();
12654
- const quat = new import_three33.Quaternion().setFromUnitVectors(object.up, new import_three33.Vector3(0, 1, 0));
12702
+ const offset = new import_three34.Vector3();
12703
+ const quat = new import_three34.Quaternion().setFromUnitVectors(object.up, new import_three34.Vector3(0, 1, 0));
12655
12704
  const quatInverse = quat.clone().invert();
12656
- const lastPosition = new import_three33.Vector3();
12657
- const lastQuaternion = new import_three33.Quaternion();
12705
+ const lastPosition = new import_three34.Vector3();
12706
+ const lastQuaternion = new import_three34.Quaternion();
12658
12707
  const twoPI = 2 * Math.PI;
12659
12708
  return function update() {
12660
12709
  const position = scope.object.position;
@@ -12740,20 +12789,20 @@ var OrbitControls = class extends import_three33.EventDispatcher {
12740
12789
  };
12741
12790
  let state = STATE.NONE;
12742
12791
  const EPS = 1e-6;
12743
- const spherical = new import_three33.Spherical();
12744
- const sphericalDelta = new import_three33.Spherical();
12792
+ const spherical = new import_three34.Spherical();
12793
+ const sphericalDelta = new import_three34.Spherical();
12745
12794
  let scale = 1;
12746
- const panOffset = new import_three33.Vector3();
12795
+ const panOffset = new import_three34.Vector3();
12747
12796
  let zoomChanged = false;
12748
- const rotateStart = new import_three33.Vector2();
12749
- const rotateEnd = new import_three33.Vector2();
12750
- const rotateDelta = new import_three33.Vector2();
12751
- const panStart = new import_three33.Vector2();
12752
- const panEnd = new import_three33.Vector2();
12753
- const panDelta = new import_three33.Vector2();
12754
- const dollyStart = new import_three33.Vector2();
12755
- const dollyEnd = new import_three33.Vector2();
12756
- const dollyDelta = new import_three33.Vector2();
12797
+ const rotateStart = new import_three34.Vector2();
12798
+ const rotateEnd = new import_three34.Vector2();
12799
+ const rotateDelta = new import_three34.Vector2();
12800
+ const panStart = new import_three34.Vector2();
12801
+ const panEnd = new import_three34.Vector2();
12802
+ const panDelta = new import_three34.Vector2();
12803
+ const dollyStart = new import_three34.Vector2();
12804
+ const dollyEnd = new import_three34.Vector2();
12805
+ const dollyDelta = new import_three34.Vector2();
12757
12806
  const pointers = [];
12758
12807
  const pointerPositions = {};
12759
12808
  function getAutoRotationAngle() {
@@ -12769,7 +12818,7 @@ var OrbitControls = class extends import_three33.EventDispatcher {
12769
12818
  sphericalDelta.phi -= angle;
12770
12819
  }
12771
12820
  const panLeft = function() {
12772
- const v = new import_three33.Vector3();
12821
+ const v = new import_three34.Vector3();
12773
12822
  return function panLeft2(distance, objectMatrix) {
12774
12823
  v.setFromMatrixColumn(objectMatrix, 0);
12775
12824
  v.multiplyScalar(-distance);
@@ -12777,7 +12826,7 @@ var OrbitControls = class extends import_three33.EventDispatcher {
12777
12826
  };
12778
12827
  }();
12779
12828
  const panUp = function() {
12780
- const v = new import_three33.Vector3();
12829
+ const v = new import_three34.Vector3();
12781
12830
  return function panUp2(distance, objectMatrix) {
12782
12831
  if (scope.screenSpacePanning === true) {
12783
12832
  v.setFromMatrixColumn(objectMatrix, 1);
@@ -12790,7 +12839,7 @@ var OrbitControls = class extends import_three33.EventDispatcher {
12790
12839
  };
12791
12840
  }();
12792
12841
  const pan = function() {
12793
- const offset = new import_three33.Vector3();
12842
+ const offset = new import_three34.Vector3();
12794
12843
  return function pan2(deltaX, deltaY) {
12795
12844
  const element = scope.domElement;
12796
12845
  if (scope.object.isPerspectiveCamera) {
@@ -13039,12 +13088,12 @@ var OrbitControls = class extends import_three33.EventDispatcher {
13039
13088
  mouseAction = -1;
13040
13089
  }
13041
13090
  switch (mouseAction) {
13042
- case import_three33.MOUSE.DOLLY:
13091
+ case import_three34.MOUSE.DOLLY:
13043
13092
  if (scope.enableZoom === false) return;
13044
13093
  handleMouseDownDolly(event);
13045
13094
  state = STATE.DOLLY;
13046
13095
  break;
13047
- case import_three33.MOUSE.ROTATE:
13096
+ case import_three34.MOUSE.ROTATE:
13048
13097
  if (event.ctrlKey || event.metaKey || event.shiftKey) {
13049
13098
  if (scope.enablePan === false) return;
13050
13099
  handleMouseDownPan(event);
@@ -13055,7 +13104,7 @@ var OrbitControls = class extends import_three33.EventDispatcher {
13055
13104
  state = STATE.ROTATE;
13056
13105
  }
13057
13106
  break;
13058
- case import_three33.MOUSE.PAN:
13107
+ case import_three34.MOUSE.PAN:
13059
13108
  if (event.ctrlKey || event.metaKey || event.shiftKey) {
13060
13109
  if (scope.enableRotate === false) return;
13061
13110
  handleMouseDownRotate(event);
@@ -13111,12 +13160,12 @@ var OrbitControls = class extends import_three33.EventDispatcher {
13111
13160
  switch (pointers.length) {
13112
13161
  case 1:
13113
13162
  switch (scope.touches.ONE) {
13114
- case import_three33.TOUCH.ROTATE:
13163
+ case import_three34.TOUCH.ROTATE:
13115
13164
  if (scope.enableRotate === false) return;
13116
13165
  handleTouchStartRotate();
13117
13166
  state = STATE.TOUCH_ROTATE;
13118
13167
  break;
13119
- case import_three33.TOUCH.PAN:
13168
+ case import_three34.TOUCH.PAN:
13120
13169
  if (scope.enablePan === false) return;
13121
13170
  handleTouchStartPan();
13122
13171
  state = STATE.TOUCH_PAN;
@@ -13127,12 +13176,12 @@ var OrbitControls = class extends import_three33.EventDispatcher {
13127
13176
  break;
13128
13177
  case 2:
13129
13178
  switch (scope.touches.TWO) {
13130
- case import_three33.TOUCH.DOLLY_PAN:
13179
+ case import_three34.TOUCH.DOLLY_PAN:
13131
13180
  if (scope.enableZoom === false && scope.enablePan === false) return;
13132
13181
  handleTouchStartDollyPan();
13133
13182
  state = STATE.TOUCH_DOLLY_PAN;
13134
13183
  break;
13135
- case import_three33.TOUCH.DOLLY_ROTATE:
13184
+ case import_three34.TOUCH.DOLLY_ROTATE:
13136
13185
  if (scope.enableZoom === false && scope.enableRotate === false) return;
13137
13186
  handleTouchStartDollyRotate();
13138
13187
  state = STATE.TOUCH_DOLLY_ROTATE;
@@ -13199,7 +13248,7 @@ var OrbitControls = class extends import_three33.EventDispatcher {
13199
13248
  function trackPointer(event) {
13200
13249
  let position = pointerPositions[event.pointerId];
13201
13250
  if (position === void 0) {
13202
- position = new import_three33.Vector2();
13251
+ position = new import_three34.Vector2();
13203
13252
  pointerPositions[event.pointerId] = position;
13204
13253
  }
13205
13254
  position.set(event.pageX, event.pageY);
@@ -13219,10 +13268,10 @@ var MapControls = class extends OrbitControls {
13219
13268
  constructor(object, domElement) {
13220
13269
  super(object, domElement);
13221
13270
  this.screenSpacePanning = false;
13222
- this.mouseButtons.LEFT = import_three33.MOUSE.PAN;
13223
- this.mouseButtons.RIGHT = import_three33.MOUSE.ROTATE;
13224
- this.touches.ONE = import_three33.TOUCH.PAN;
13225
- this.touches.TWO = import_three33.TOUCH.DOLLY_ROTATE;
13271
+ this.mouseButtons.LEFT = import_three34.MOUSE.PAN;
13272
+ this.mouseButtons.RIGHT = import_three34.MOUSE.ROTATE;
13273
+ this.touches.ONE = import_three34.TOUCH.PAN;
13274
+ this.touches.TWO = import_three34.TOUCH.DOLLY_ROTATE;
13226
13275
  }
13227
13276
  };
13228
13277
 
@@ -13281,8 +13330,8 @@ var Renderer = class _Renderer {
13281
13330
  top: void 0,
13282
13331
  bottom: void 0
13283
13332
  },
13284
- position: new import_three34.Vector3(50, 50, 50),
13285
- lookingAt: new import_three34.Vector3(0, 0, 0)
13333
+ position: new import_three35.Vector3(50, 50, 50),
13334
+ lookingAt: new import_three35.Vector3(0, 0, 0)
13286
13335
  },
13287
13336
  render: {
13288
13337
  fpsLimit: 60,
@@ -13313,14 +13362,14 @@ var Renderer = class _Renderer {
13313
13362
  switch (this.options.camera.type) {
13314
13363
  case "perspective":
13315
13364
  default:
13316
- return new import_three34.PerspectiveCamera(
13365
+ return new import_three35.PerspectiveCamera(
13317
13366
  this.options.camera.perspective.fov,
13318
13367
  this.options.camera.perspective.aspect ?? this.viewWidth / this.viewHeight,
13319
13368
  this.options.camera.near,
13320
13369
  this.options.camera.far
13321
13370
  );
13322
13371
  case "orthographic":
13323
- return new import_three34.OrthographicCamera(
13372
+ return new import_three35.OrthographicCamera(
13324
13373
  this.options.camera.orthographic.left ?? this.viewWidth / -2,
13325
13374
  this.options.camera.orthographic.right ?? this.viewWidth / 2,
13326
13375
  this.options.camera.orthographic.top ?? this.viewHeight / 2,
@@ -13331,7 +13380,7 @@ var Renderer = class _Renderer {
13331
13380
  }
13332
13381
  }
13333
13382
  createRenderer() {
13334
- const renderer = new import_three34.WebGLRenderer({
13383
+ const renderer = new import_three35.WebGLRenderer({
13335
13384
  antialias: this.options.render.antialias,
13336
13385
  alpha: true,
13337
13386
  powerPreference: "high-performance",
@@ -13339,8 +13388,8 @@ var Renderer = class _Renderer {
13339
13388
  });
13340
13389
  renderer.setClearColor(0, 0);
13341
13390
  renderer.shadowMap.enabled = true;
13342
- renderer.shadowMap.type = import_three34.PCFSoftShadowMap;
13343
- renderer.outputColorSpace = import_three34.SRGBColorSpace;
13391
+ renderer.shadowMap.type = import_three35.PCFSoftShadowMap;
13392
+ renderer.outputColorSpace = import_three35.SRGBColorSpace;
13344
13393
  renderer.setPixelRatio(this.options.render.pixelRatio ?? 1);
13345
13394
  renderer.setSize(this.viewWidth, this.viewHeight);
13346
13395
  return renderer;
@@ -13375,20 +13424,20 @@ var Renderer = class _Renderer {
13375
13424
  window["__THREE_DEVTOOLS__"].dispatchEvent(new CustomEvent("observe", { detail: this.scene }));
13376
13425
  }
13377
13426
  if (this.options.debug.grid) {
13378
- const gridHelper = new import_three34.GridHelper(128, 16);
13427
+ const gridHelper = new import_three35.GridHelper(128, 16);
13379
13428
  this._debugHelpers.push(gridHelper);
13380
13429
  this.scene.add(gridHelper);
13381
- const gridHelper2 = new import_three34.GridHelper(128, 16);
13430
+ const gridHelper2 = new import_three35.GridHelper(128, 16);
13382
13431
  this._debugHelpers.push(gridHelper2);
13383
13432
  gridHelper2.rotation.x = 90 * (Math.PI / 180);
13384
13433
  this.scene.add(gridHelper2);
13385
- const gridHelper3 = new import_three34.GridHelper(128, 16);
13434
+ const gridHelper3 = new import_three35.GridHelper(128, 16);
13386
13435
  this._debugHelpers.push(gridHelper3);
13387
13436
  gridHelper3.rotation.z = 90 * (Math.PI / 180);
13388
13437
  this.scene.add(gridHelper3);
13389
13438
  }
13390
13439
  if (this.options.debug.axes) {
13391
- const axesHelper = new import_three34.AxesHelper(64);
13440
+ const axesHelper = new import_three35.AxesHelper(64);
13392
13441
  this._debugHelpers.push(axesHelper);
13393
13442
  this.scene.add(axesHelper);
13394
13443
  }
@@ -14074,12 +14123,12 @@ var AnvilParser = class {
14074
14123
  };
14075
14124
 
14076
14125
  // src/world/Chunk.ts
14077
- var import_three39 = require("three");
14126
+ var import_three40 = require("three");
14078
14127
  init_BlockStates();
14079
14128
  init_AssetKey();
14080
14129
 
14081
14130
  // src/world/MineRenderWorld.ts
14082
- var import_three37 = require("three");
14131
+ var import_three38 = require("three");
14083
14132
  init_Model();
14084
14133
  init_BatchedExecutor();
14085
14134
  init_AssetKey();
@@ -14087,7 +14136,7 @@ init_BlockStates();
14087
14136
  init_CubeFace();
14088
14137
 
14089
14138
  // src/world/SectionModels.ts
14090
- var import_three36 = require("three");
14139
+ var import_three37 = require("three");
14091
14140
  init_AssetKey();
14092
14141
  init_Models();
14093
14142
  init_CubeFace();
@@ -14153,12 +14202,12 @@ var SectionModels = class {
14153
14202
  });
14154
14203
  await object.init();
14155
14204
  const geometry = object.children[0].geometry;
14156
- geometry.applyMatrix4(new import_three36.Matrix4().makeRotationFromEuler(rotation));
14205
+ geometry.applyMatrix4(new import_three37.Matrix4().makeRotationFromEuler(rotation));
14157
14206
  object.clear();
14158
14207
  const cullFaces = CUBE_FACES.map((face) => {
14159
14208
  const local = CUBE_FACES.findIndex((name) => name === atlas.model.elements[0].faces[face]?.cullface);
14160
14209
  if (local < 0) return 0;
14161
- const normal = new import_three36.Vector3(...CUBE_FACE_OFFSETS[local]).applyEuler(rotation);
14210
+ const normal = new import_three37.Vector3(...CUBE_FACE_OFFSETS[local]).applyEuler(rotation);
14162
14211
  const world = CUBE_FACE_OFFSETS.findIndex(([x, y, z]) => Math.abs(normal.x - x) < 1e-6 && Math.abs(normal.y - y) < 1e-6 && Math.abs(normal.z - z) < 1e-6);
14163
14212
  return 1 << world;
14164
14213
  });
@@ -14188,20 +14237,20 @@ var MineRenderWorld = class {
14188
14237
  }
14189
14238
  getBlockAt(posOrX, y, z) {
14190
14239
  if (typeof posOrX == "number") {
14191
- return this.getBlockAt(new import_three37.Vector3(posOrX, y, z));
14240
+ return this.getBlockAt(new import_three38.Vector3(posOrX, y, z));
14192
14241
  }
14193
14242
  if (isTripleArray(posOrX)) {
14194
- return this.getBlockAt(new import_three37.Vector3(posOrX[0], posOrX[1], posOrX[2]));
14243
+ return this.getBlockAt(new import_three38.Vector3(posOrX[0], posOrX[1], posOrX[2]));
14195
14244
  }
14196
14245
  this.validatePosBounds(posOrX);
14197
14246
  return this.getChunkAt(posOrX)?.getBlockAt(posOrX);
14198
14247
  }
14199
14248
  async setBlockAt(posOrX, yOrBlock, z, block) {
14200
14249
  if (typeof posOrX == "number") {
14201
- return this.setBlockAt(new import_three37.Vector3(posOrX, yOrBlock, z), block);
14250
+ return this.setBlockAt(new import_three38.Vector3(posOrX, yOrBlock, z), block);
14202
14251
  }
14203
14252
  if (isTripleArray(posOrX)) {
14204
- return this.setBlockAt(new import_three37.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
14253
+ return this.setBlockAt(new import_three38.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
14205
14254
  }
14206
14255
  return this.placeBlock(posOrX, yOrBlock);
14207
14256
  }
@@ -14222,7 +14271,7 @@ var MineRenderWorld = class {
14222
14271
  const collect = async (positions2) => {
14223
14272
  for (const pos of positions2) changes.set(pos.toArray().join(","), pos);
14224
14273
  };
14225
- const place = (block) => this.placeBlock(new import_three37.Vector3(...block.position), block, collect);
14274
+ const place = (block) => this.placeBlock(new import_three38.Vector3(...block.position), block, collect);
14226
14275
  const keys = /* @__PURE__ */ new Map();
14227
14276
  for (const block of multiblock.blocks) {
14228
14277
  if (Chunk.isAir(block)) continue;
@@ -14300,13 +14349,13 @@ var MineRenderWorld = class {
14300
14349
  for (const pos of positions) {
14301
14350
  this.pendingCulling.set(pos.toArray().join(","), pos.clone());
14302
14351
  for (const offset of CUBE_FACE_OFFSETS) {
14303
- const neighbor = pos.clone().add(new import_three37.Vector3(...offset));
14352
+ const neighbor = pos.clone().add(new import_three38.Vector3(...offset));
14304
14353
  this.pendingCulling.set(neighbor.toArray().join(","), neighbor);
14305
14354
  }
14306
14355
  for (let y = -1; y <= 1; y++) {
14307
14356
  for (let z = -1; z <= 1; z++) {
14308
14357
  for (let x = -1; x <= 1; x++) {
14309
- const neighbor = pos.clone().add(new import_three37.Vector3(x, y, z));
14358
+ const neighbor = pos.clone().add(new import_three38.Vector3(x, y, z));
14310
14359
  if (this.getBlockAt(neighbor)?.object?.fluidKind) {
14311
14360
  this.pendingCulling.set(neighbor.toArray().join(","), neighbor);
14312
14361
  }
@@ -14328,7 +14377,7 @@ var MineRenderWorld = class {
14328
14377
  if (!block) continue;
14329
14378
  if (block.object?.fluidKind) {
14330
14379
  await block.object.updateFluid((x, y, z) => {
14331
- const neighbor = pos.clone().add(new import_three37.Vector3(x, y, z));
14380
+ const neighbor = pos.clone().add(new import_three38.Vector3(x, y, z));
14332
14381
  const section = this.getChunkAt(neighbor);
14333
14382
  const object = section?.getBlockAt(neighbor)?.object;
14334
14383
  return {
@@ -14340,7 +14389,7 @@ var MineRenderWorld = class {
14340
14389
  }
14341
14390
  let mask = 0;
14342
14391
  for (const [face, offset] of CUBE_FACE_OFFSETS.entries()) {
14343
- const neighbor = pos.clone().add(new import_three37.Vector3(...offset));
14392
+ const neighbor = pos.clone().add(new import_three38.Vector3(...offset));
14344
14393
  if (this.getChunkAt(neighbor)?.isOccludingAt(neighbor)) {
14345
14394
  mask |= 1 << face;
14346
14395
  }
@@ -14374,14 +14423,14 @@ var MineRenderWorld = class {
14374
14423
  return this._chunks.get(this.worldPosToChunkKey(pos));
14375
14424
  }
14376
14425
  static worldToScenePosition(pos) {
14377
- return new import_three37.Vector3(
14426
+ return new import_three38.Vector3(
14378
14427
  pos.x * 16,
14379
14428
  pos.y * 16,
14380
14429
  pos.z * 16
14381
14430
  );
14382
14431
  }
14383
14432
  static sceneToWorldPosition(pos) {
14384
- return new import_three37.Vector3(
14433
+ return new import_three38.Vector3(
14385
14434
  pos.x / 16,
14386
14435
  pos.y / 16,
14387
14436
  pos.z / 16
@@ -14404,10 +14453,10 @@ var MineRenderWorld = class {
14404
14453
  init_Model();
14405
14454
 
14406
14455
  // src/world/SectionMesh.ts
14407
- var import_three38 = require("three");
14456
+ var import_three39 = require("three");
14408
14457
  init_CanvasCompat();
14409
14458
  init_Materials();
14410
- var SectionMesh = class _SectionMesh extends import_three38.Group {
14459
+ var SectionMesh = class _SectionMesh extends import_three39.Group {
14411
14460
  constructor() {
14412
14461
  super(...arguments);
14413
14462
  this.ownedMeshes = [];
@@ -14480,18 +14529,18 @@ var SectionMesh = class _SectionMesh extends import_three38.Group {
14480
14529
  for (let corner = 0; corner < 6; corner++) indices.push(start + sourceIndices.getX(face * 6 + corner) - face * 4);
14481
14530
  }
14482
14531
  }
14483
- const geometry = new import_three38.BufferGeometry();
14484
- geometry.setAttribute("position", new import_three38.Float32BufferAttribute(positions, 3));
14485
- geometry.setAttribute("normal", new import_three38.Float32BufferAttribute(normals, 3));
14486
- geometry.setAttribute("uv", new import_three38.Float32BufferAttribute(uvs, 2));
14487
- geometry.setAttribute("color", new import_three38.Float32BufferAttribute(colors, 3));
14532
+ const geometry = new import_three39.BufferGeometry();
14533
+ geometry.setAttribute("position", new import_three39.Float32BufferAttribute(positions, 3));
14534
+ geometry.setAttribute("normal", new import_three39.Float32BufferAttribute(normals, 3));
14535
+ geometry.setAttribute("uv", new import_three39.Float32BufferAttribute(uvs, 2));
14536
+ geometry.setAttribute("color", new import_three39.Float32BufferAttribute(colors, 3));
14488
14537
  geometry.setIndex(indices);
14489
14538
  geometry.computeBoundingBox();
14490
14539
  geometry.computeBoundingSphere();
14491
14540
  const material = Materials.createShadedCanvasMaterial(canvas, false);
14492
14541
  material.vertexColors = true;
14493
14542
  const texture = material.uniforms?.map?.value ?? material.map;
14494
- const mesh = new import_three38.Mesh(geometry, material);
14543
+ const mesh = new import_three39.Mesh(geometry, material);
14495
14544
  section.add(mesh);
14496
14545
  section.ownedMeshes.push({ mesh, texture });
14497
14546
  }
@@ -14525,10 +14574,10 @@ var Chunk = class _Chunk {
14525
14574
  }
14526
14575
  getBlockAt(posOrX, y, z) {
14527
14576
  if (typeof posOrX == "number") {
14528
- return this.getBlockAt(new import_three39.Vector3(posOrX, y, z));
14577
+ return this.getBlockAt(new import_three40.Vector3(posOrX, y, z));
14529
14578
  }
14530
14579
  if (isTripleArray(posOrX)) {
14531
- return this.getBlockAt(new import_three39.Vector3(posOrX[0], posOrX[1], posOrX[2]));
14580
+ return this.getBlockAt(new import_three40.Vector3(posOrX[0], posOrX[1], posOrX[2]));
14532
14581
  }
14533
14582
  const pos = this.worldPosToChunkPos(posOrX);
14534
14583
  const index = _Chunk.chunkPosToBlockIndex(pos);
@@ -14536,10 +14585,10 @@ var Chunk = class _Chunk {
14536
14585
  }
14537
14586
  async setBlockAt(posOrX, yOrBlock, z, block) {
14538
14587
  if (typeof posOrX == "number") {
14539
- return this.setBlockAt(new import_three39.Vector3(posOrX, yOrBlock, z), block);
14588
+ return this.setBlockAt(new import_three40.Vector3(posOrX, yOrBlock, z), block);
14540
14589
  }
14541
14590
  if (isTripleArray(posOrX)) {
14542
- return this.setBlockAt(new import_three39.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
14591
+ return this.setBlockAt(new import_three40.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
14543
14592
  }
14544
14593
  const worldPos = posOrX;
14545
14594
  const pos = this.worldPosToChunkPos(worldPos);
@@ -14625,7 +14674,7 @@ var Chunk = class _Chunk {
14625
14674
  }
14626
14675
  async clear(onBlocksChanged = this.onBlocksChanged) {
14627
14676
  const positions = [...this.renderedBlocks.keys()].map((index) => this.chunkPosToWorldPos(
14628
- new import_three39.Vector3(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
14677
+ new import_three40.Vector3(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
14629
14678
  ));
14630
14679
  for (const info of this.renderedBlocks.values()) info.object?.removeFromScene();
14631
14680
  this.sectionBlocks.clear();
@@ -14649,14 +14698,14 @@ var Chunk = class _Chunk {
14649
14698
  return pos.y * 16 * 16 + pos.z * 16 + pos.x;
14650
14699
  }
14651
14700
  worldPosToChunkPos(pos) {
14652
- return new import_three39.Vector3(
14701
+ return new import_three40.Vector3(
14653
14702
  pos.x - this.x * 16,
14654
14703
  pos.y - this.y * 16,
14655
14704
  pos.z - this.z * 16
14656
14705
  );
14657
14706
  }
14658
14707
  chunkPosToWorldPos(pos) {
14659
- return new import_three39.Vector3(
14708
+ return new import_three40.Vector3(
14660
14709
  this.x * 16 + pos.x,
14661
14710
  this.y * 16 + pos.y,
14662
14711
  this.z * 16 + pos.z