minerender 2.1.0-alpha.21 → 2.1.0-alpha.22

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.
@@ -1098,7 +1098,7 @@ var Meshes = class _Meshes {
1098
1098
  };
1099
1099
 
1100
1100
  // src/UVMapper.ts
1101
- import { Float32BufferAttribute as Float32BufferAttribute2, Vector2, Vector3 as Vector33 } from "three";
1101
+ import { Float32BufferAttribute as Float32BufferAttribute2, Vector2, Vector3 as Vector34 } from "three";
1102
1102
 
1103
1103
  // src/model/ModelMerger.ts
1104
1104
  var import_ts_deepmerge = __toESM(require_dist());
@@ -1189,15 +1189,77 @@ function isAssetKey(obj) {
1189
1189
  return isBasicAssetKey(obj) && obj.isAssetKey === true;
1190
1190
  }
1191
1191
 
1192
+ // src/model/DisplayTransforms.ts
1193
+ import { Euler, Matrix4, Quaternion, Vector3 as Vector32 } from "three";
1194
+
1195
+ // src/model/DisplayPosition.ts
1196
+ var DisplayPosition = /* @__PURE__ */ ((DisplayPosition2) => {
1197
+ DisplayPosition2["THIRDPERSON_RIGHTHAND"] = "thirdperson_righthand";
1198
+ DisplayPosition2["THIRDPERSON_LEFTHAND"] = "thirdperson_lefthand";
1199
+ DisplayPosition2["FIRSTPERSON_RIGHTHAND"] = "firstperson_righthand";
1200
+ DisplayPosition2["FIRSTPERSON_LEFTHAND"] = "firstperson_lefthand";
1201
+ DisplayPosition2["GUI"] = "gui";
1202
+ DisplayPosition2["HEAD"] = "head";
1203
+ DisplayPosition2["GROUND"] = "ground";
1204
+ DisplayPosition2["FIXED"] = "fixed";
1205
+ DisplayPosition2["ON_SHELF"] = "on_shelf";
1206
+ return DisplayPosition2;
1207
+ })(DisplayPosition || {});
1208
+ var DISPLAY_POSITIONS = Object.values(DisplayPosition);
1209
+
1210
+ // src/model/DisplayTransforms.ts
1211
+ var DisplayTransforms = class {
1212
+ /** Resolve hand fallbacks within one model, before inheriting parent display entries. */
1213
+ static withHandFallbacks(display) {
1214
+ if (!display) return void 0;
1215
+ const resolved = { ...display };
1216
+ for (const [left, right] of [
1217
+ ["thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */, "thirdperson_righthand" /* THIRDPERSON_RIGHTHAND */],
1218
+ ["firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */, "firstperson_righthand" /* FIRSTPERSON_RIGHTHAND */]
1219
+ ]) {
1220
+ if (resolved[left] === void 0 && resolved[right] !== void 0) resolved[left] = resolved[right];
1221
+ }
1222
+ return resolved;
1223
+ }
1224
+ /** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
1225
+ static getMatrix(display, position) {
1226
+ const transform = this.withHandFallbacks(display)?.[position] ?? {};
1227
+ const left = position === "firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */ || position === "thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */;
1228
+ const sign = left ? -1 : 1;
1229
+ const [x, y, z] = transform.rotation ?? [0, 0, 0];
1230
+ const rotation = new Quaternion().setFromEuler(new Euler(toRadians(x), sign * toRadians(y), sign * toRadians(z), "XYZ"));
1231
+ const translation = new Vector32(...transform.translation ?? [0, 0, 0]).clampScalar(-80, 80);
1232
+ translation.x *= sign;
1233
+ const scale = new Vector32(...transform.scale ?? [1, 1, 1]).clampScalar(-4, 4);
1234
+ return new Matrix4().compose(translation, rotation, scale);
1235
+ }
1236
+ static apply(geometry, matrix) {
1237
+ geometry.applyMatrix4(matrix);
1238
+ if (matrix.determinant() < 0) {
1239
+ if (!geometry.index) geometry.setIndex(Array.from({ length: geometry.getAttribute("position").count }, (_, i) => i));
1240
+ const index = geometry.index;
1241
+ for (let i = 0; i < index.count; i += 3) {
1242
+ const second = index.getX(i + 1);
1243
+ index.setX(i + 1, index.getX(i + 2));
1244
+ index.setX(i + 2, second);
1245
+ }
1246
+ index.needsUpdate = true;
1247
+ }
1248
+ }
1249
+ };
1250
+
1192
1251
  // src/model/ModelMerger.ts
1193
1252
  var ModelMerger = class {
1194
1253
  static async mergeWithParents(model) {
1195
1254
  const models = await this.collectAllParents(model);
1196
1255
  let merged = {};
1197
- for (let parentModel of models) {
1198
- merged = import_ts_deepmerge.default.withOptions({ mergeArrays: false }, merged, parentModel);
1256
+ for (const source of [...models, model]) {
1257
+ const inheritedDisplay = merged.display;
1258
+ merged = import_ts_deepmerge.default.withOptions({ mergeArrays: false }, merged, source);
1259
+ if (source.display) {
1260
+ merged.display = { ...inheritedDisplay, ...DisplayTransforms.withHandFallbacks(source.display) };
1261
+ }
1199
1262
  }
1200
- merged = import_ts_deepmerge.default.withOptions({ mergeArrays: false }, merged, model);
1201
1263
  merged.hierarchy = models.map((m) => m.parent).filter((p12) => `${p12}`);
1202
1264
  merged.hierarchy.push(`${merged.parent}`);
1203
1265
  return merged;
@@ -1452,9 +1514,9 @@ var BatchedExecutor = class {
1452
1514
  };
1453
1515
 
1454
1516
  // src/util/model.ts
1455
- import { AxesHelper, BoxGeometry as BoxGeometry2, EdgesGeometry, LineBasicMaterial, LineSegments, Vector3 as Vector32 } from "three";
1517
+ import { AxesHelper, BoxGeometry as BoxGeometry2, EdgesGeometry, LineBasicMaterial, LineSegments, Vector3 as Vector33 } from "three";
1456
1518
  function applyElementRotation(rotation, geometry) {
1457
- const origin = new Vector32(rotation.origin[0], rotation.origin[1], rotation.origin[2]);
1519
+ const origin = new Vector33(rotation.origin[0], rotation.origin[1], rotation.origin[2]);
1458
1520
  geometry.translate(-origin.x, -origin.y, -origin.z);
1459
1521
  switch (rotation.axis) {
1460
1522
  case "x" /* X */:
@@ -1479,7 +1541,7 @@ function applyElementRotation(rotation, geometry) {
1479
1541
  geometry.translate(origin.x, origin.y, origin.z);
1480
1542
  }
1481
1543
  function applyModelPartRotation(modelPart, geometry) {
1482
- const origin = new Vector32(modelPart.pivotX, modelPart.pivotY, modelPart.pivotZ);
1544
+ const origin = new Vector33(modelPart.pivotX, modelPart.pivotY, modelPart.pivotZ);
1483
1545
  geometry.translate(-origin.x, -origin.y, -origin.z);
1484
1546
  geometry.rotateX(toRadians(modelPart.pitch));
1485
1547
  geometry.rotateY(toRadians(modelPart.yaw));
@@ -1489,18 +1551,18 @@ function applyModelPartRotation(modelPart, geometry) {
1489
1551
  function applyGenericRotation(axis, rotation, obj) {
1490
1552
  switch (axis) {
1491
1553
  case "x" /* X */:
1492
- obj.rotateOnAxis(new Vector32(1, 0, 0), toRadians(rotation));
1554
+ obj.rotateOnAxis(new Vector33(1, 0, 0), toRadians(rotation));
1493
1555
  break;
1494
1556
  case "y" /* Y */:
1495
- obj.rotateOnAxis(new Vector32(0, 1, 0), toRadians(rotation));
1557
+ obj.rotateOnAxis(new Vector33(0, 1, 0), toRadians(rotation));
1496
1558
  break;
1497
1559
  case "z" /* Z */:
1498
- obj.rotateOnAxis(new Vector32(0, 0, 1), toRadians(rotation));
1560
+ obj.rotateOnAxis(new Vector33(0, 0, 1), toRadians(rotation));
1499
1561
  break;
1500
1562
  }
1501
1563
  }
1502
1564
  function addBox3WireframeToObject(box, obj, color = 16777215, w = 2) {
1503
- let size = new Vector32();
1565
+ let size = new Vector33();
1504
1566
  box.getSize(size);
1505
1567
  let boxGeo = new BoxGeometry2(size.x, size.y, size.z, 1, 1, 1);
1506
1568
  let wireGeo = new EdgesGeometry(boxGeo);
@@ -2103,12 +2165,12 @@ var X = 0;
2103
2165
  var Y = 1;
2104
2166
  var Z = 2;
2105
2167
  var FACE_UV_AXES = {
2106
- east: [new Vector33(0, 0, -1), new Vector33(0, -1, 0)],
2107
- west: [new Vector33(0, 0, 1), new Vector33(0, -1, 0)],
2108
- up: [new Vector33(1, 0, 0), new Vector33(0, 0, 1)],
2109
- down: [new Vector33(1, 0, 0), new Vector33(0, 0, -1)],
2110
- south: [new Vector33(1, 0, 0), new Vector33(0, -1, 0)],
2111
- north: [new Vector33(-1, 0, 0), new Vector33(0, -1, 0)]
2168
+ east: [new Vector34(0, 0, -1), new Vector34(0, -1, 0)],
2169
+ west: [new Vector34(0, 0, 1), new Vector34(0, -1, 0)],
2170
+ up: [new Vector34(1, 0, 0), new Vector34(0, 0, 1)],
2171
+ down: [new Vector34(1, 0, 0), new Vector34(0, 0, -1)],
2172
+ south: [new Vector34(1, 0, 0), new Vector34(0, -1, 0)],
2173
+ north: [new Vector34(-1, 0, 0), new Vector34(0, -1, 0)]
2112
2174
  };
2113
2175
  var UVMapper = class {
2114
2176
  static makeUv(uvCoord, originalTextureSize, actualTextureSize) {
@@ -2689,7 +2751,7 @@ var BlockEntityModels = class {
2689
2751
  };
2690
2752
 
2691
2753
  // src/renderer/SceneObject.ts
2692
- import { Euler as Euler2, InstancedMesh, MathUtils, Matrix4 as Matrix42, Mesh as Mesh3, Object3D as Object3D2, Quaternion as Quaternion2, Vector3 as Vector34 } from "three";
2754
+ import { Euler as Euler3, InstancedMesh, MathUtils, Matrix4 as Matrix43, Mesh as Mesh3, Object3D as Object3D2, Quaternion as Quaternion3, Vector3 as Vector35 } from "three";
2693
2755
 
2694
2756
  // src/instance/InstanceReference.ts
2695
2757
  var InstanceReference = class {
@@ -2934,7 +2996,7 @@ var SceneObject = class _SceneObject extends Object3D2 {
2934
2996
  nextInstance() {
2935
2997
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
2936
2998
  const i = this._instanceCounter++;
2937
- this.setMatrixAt(i, new Matrix42());
2999
+ this.setMatrixAt(i, new Matrix43());
2938
3000
  const mesh = this.children[0];
2939
3001
  if (mesh && isInstancedMesh(mesh)) {
2940
3002
  mesh.count = Math.min(this._instanceCounter, mesh.instanceMatrix.count);
@@ -2951,7 +3013,7 @@ var SceneObject = class _SceneObject extends Object3D2 {
2951
3013
  }
2952
3014
  //</editor-fold>
2953
3015
  //<editor-fold desc="TRANSFORMATION">
2954
- getMatrixAt(index, matrix = new Matrix42()) {
3016
+ getMatrixAt(index, matrix = new Matrix43()) {
2955
3017
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
2956
3018
  const child = this.children[0];
2957
3019
  if (child && isInstancedMesh(child)) {
@@ -2970,16 +3032,16 @@ var SceneObject = class _SceneObject extends Object3D2 {
2970
3032
  }
2971
3033
  setPositionRotationScaleAt(index, position, rotation, scale) {
2972
3034
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
2973
- const oldPosition = new Vector34();
2974
- const oldRotation = new Quaternion2();
2975
- const oldScale = new Vector34();
2976
- const matrix = new Matrix42();
3035
+ const oldPosition = new Vector35();
3036
+ const oldRotation = new Quaternion3();
3037
+ const oldScale = new Vector35();
3038
+ const matrix = new Matrix43();
2977
3039
  if (!scale || !rotation || !position) {
2978
3040
  this.getMatrixAt(index, matrix).decompose(oldPosition, oldRotation, oldScale);
2979
3041
  }
2980
3042
  matrix.compose(
2981
3043
  position ? position : oldPosition,
2982
- rotation ? new Quaternion2().setFromEuler(rotation) : oldRotation,
3044
+ rotation ? new Quaternion3().setFromEuler(rotation) : oldRotation,
2983
3045
  scale ? scale : oldScale
2984
3046
  );
2985
3047
  this.setMatrixAt(index, matrix);
@@ -2988,7 +3050,7 @@ var SceneObject = class _SceneObject extends Object3D2 {
2988
3050
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
2989
3051
  this.setPositionRotationScaleAt(index, position);
2990
3052
  }
2991
- getPositionAt(index, vector = new Vector34()) {
3053
+ getPositionAt(index, vector = new Vector35()) {
2992
3054
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
2993
3055
  const matrix = this.getMatrixAt(index);
2994
3056
  vector.setFromMatrixPosition(matrix);
@@ -2998,7 +3060,7 @@ var SceneObject = class _SceneObject extends Object3D2 {
2998
3060
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
2999
3061
  this.setPositionRotationScaleAt(index, void 0, rotation, void 0);
3000
3062
  }
3001
- getRotationAt(index, euler = new Euler2()) {
3063
+ getRotationAt(index, euler = new Euler3()) {
3002
3064
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3003
3065
  const matrix = this.getMatrixAt(index);
3004
3066
  euler.setFromRotationMatrix(matrix);
@@ -3008,7 +3070,7 @@ var SceneObject = class _SceneObject extends Object3D2 {
3008
3070
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3009
3071
  this.setPositionRotationScaleAt(index, void 0, void 0, scale);
3010
3072
  }
3011
- getScaleAt(index, vector = new Vector34()) {
3073
+ getScaleAt(index, vector = new Vector35()) {
3012
3074
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3013
3075
  const matrix = this.getMatrixAt(index);
3014
3076
  vector.setFromMatrixScale(matrix);
@@ -3629,20 +3691,6 @@ function isInstanceable(obj) {
3629
3691
  return "nextInstance" in obj;
3630
3692
  }
3631
3693
 
3632
- // src/model/DisplayPosition.ts
3633
- var DisplayPosition = /* @__PURE__ */ ((DisplayPosition2) => {
3634
- DisplayPosition2["THIRDPERSON_RIGHTHAND"] = "thirdperson_righthand";
3635
- DisplayPosition2["THIRDPERSON_LEFTHAND"] = "thirdperson_lefthand";
3636
- DisplayPosition2["FIRSTPERSON_RIGHTHAND"] = "firstperson_righthand";
3637
- DisplayPosition2["FIRSTPERSON_LEFTHAND"] = "firstperson_lefthand";
3638
- DisplayPosition2["GUI"] = "gui";
3639
- DisplayPosition2["HEAD"] = "head";
3640
- DisplayPosition2["GROUND"] = "ground";
3641
- DisplayPosition2["FIXED"] = "fixed";
3642
- return DisplayPosition2;
3643
- })(DisplayPosition || {});
3644
- var DISPLAY_POSITIONS = Object.values(DisplayPosition);
3645
-
3646
3694
  // src/model/GuiLight.ts
3647
3695
  var GuiLight = /* @__PURE__ */ ((GuiLight2) => {
3648
3696
  GuiLight2["FRONT"] = "front";
@@ -3751,7 +3799,7 @@ var BlockTints = class {
3751
3799
  };
3752
3800
 
3753
3801
  // src/model/scene/ModelObject.ts
3754
- import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute4, Color as Color3, Euler as Euler4, Matrix4 as Matrix45 } from "three";
3802
+ import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute4, Color as Color3, Euler as Euler5, Matrix4 as Matrix46 } from "three";
3755
3803
 
3756
3804
  // src/three/BufferGeometryUtils.js
3757
3805
  import {
@@ -3763,7 +3811,7 @@ import {
3763
3811
  TriangleFanDrawMode,
3764
3812
  TriangleStripDrawMode,
3765
3813
  TrianglesDrawMode,
3766
- Vector3 as Vector36
3814
+ Vector3 as Vector37
3767
3815
  } from "three";
3768
3816
  function computeTangents(geometry) {
3769
3817
  geometry.computeTangents();
@@ -4082,15 +4130,15 @@ function computeMorphedAttributes(object) {
4082
4130
  console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
4083
4131
  return null;
4084
4132
  }
4085
- const _vA = new Vector36();
4086
- const _vB = new Vector36();
4087
- const _vC = new Vector36();
4088
- const _tempA = new Vector36();
4089
- const _tempB = new Vector36();
4090
- const _tempC = new Vector36();
4091
- const _morphA = new Vector36();
4092
- const _morphB = new Vector36();
4093
- const _morphC = new Vector36();
4133
+ const _vA = new Vector37();
4134
+ const _vB = new Vector37();
4135
+ const _vC = new Vector37();
4136
+ const _tempA = new Vector37();
4137
+ const _tempB = new Vector37();
4138
+ const _tempC = new Vector37();
4139
+ const _morphA = new Vector37();
4140
+ const _morphB = new Vector37();
4141
+ const _morphC = new Vector37();
4094
4142
  function _calculateMorphedAttributeData(object2, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
4095
4143
  _vA.fromBufferAttribute(attribute, a2);
4096
4144
  _vB.fromBufferAttribute(attribute, b2);
@@ -4330,13 +4378,14 @@ var ModelObject = class _ModelObject extends SceneObject {
4330
4378
  createMeshes(force = false) {
4331
4379
  if (this.meshesCreated && !force) return;
4332
4380
  const mat = Materials.MISSING_TEXTURE;
4381
+ const displayTransform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : void 0;
4333
4382
  let allGeos = [];
4334
4383
  if (this.atlas) {
4335
4384
  if (this.atlas.model.elements) {
4336
4385
  this.atlas.model.elements?.forEach((el) => {
4337
4386
  const elGeo = this._getBoxGeometryFromElement(el).clone();
4338
4387
  if (this.options.uvLockRotation) {
4339
- UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler4(...this.options.uvLockRotation));
4388
+ UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler5(...this.options.uvLockRotation));
4340
4389
  }
4341
4390
  if (this.options.tints) {
4342
4391
  const colors = new Float32Array(elGeo.getAttribute("position").count * 3).fill(1);
@@ -4352,12 +4401,13 @@ var ModelObject = class _ModelObject extends SceneObject {
4352
4401
  }
4353
4402
  elGeo.setAttribute("color", new BufferAttribute4(colors, 3));
4354
4403
  }
4355
- elGeo.applyMatrix4(new Matrix45().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
4356
- elGeo.applyMatrix4(new Matrix45().makeTranslation(el.from[0], el.from[1], el.from[2]));
4404
+ elGeo.applyMatrix4(new Matrix46().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
4405
+ elGeo.applyMatrix4(new Matrix46().makeTranslation(el.from[0], el.from[1], el.from[2]));
4357
4406
  if (el.rotation) {
4358
4407
  applyElementRotation(el.rotation, elGeo);
4359
4408
  }
4360
- elGeo.applyMatrix4(new Matrix45().makeTranslation(-8, -8, -8));
4409
+ elGeo.applyMatrix4(new Matrix46().makeTranslation(-8, -8, -8));
4410
+ if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
4361
4411
  if (this.options.mergeMeshes) {
4362
4412
  allGeos.push(elGeo);
4363
4413
  } else {
@@ -4379,6 +4429,7 @@ var ModelObject = class _ModelObject extends SceneObject {
4379
4429
  combinedGeo = mergeBufferGeometries(allGeos);
4380
4430
  } else {
4381
4431
  combinedGeo = new BoxGeometry5(16, 16, 16);
4432
+ if (displayTransform) DisplayTransforms.apply(combinedGeo, displayTransform);
4382
4433
  }
4383
4434
  combinedGeo.computeBoundingBox();
4384
4435
  let mesh;
@@ -4430,7 +4481,7 @@ function isModelObject(obj) {
4430
4481
 
4431
4482
  // src/model/block/scene/BlockObject.ts
4432
4483
  var import_ts_deepmerge6 = __toESM(require_dist());
4433
- import { Euler as Euler5, Matrix4 as Matrix46, Vector3 as Vector37 } from "three";
4484
+ import { Euler as Euler6, Matrix4 as Matrix47, Vector3 as Vector38 } from "three";
4434
4485
  var p10 = prefix("BlockObject");
4435
4486
  function matchesCondition(condition, state) {
4436
4487
  return Object.entries(condition).every(([key, value]) => {
@@ -4492,7 +4543,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4492
4543
  if (isModelObject(model)) {
4493
4544
  model.removeFromScene();
4494
4545
  } else if (isInstanceReference(model)) {
4495
- model.setScale(new Vector37(0, 0, 0));
4546
+ model.setScale(new Vector38(0, 0, 0));
4496
4547
  }
4497
4548
  }
4498
4549
  super.removeFromScene();
@@ -4553,7 +4604,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4553
4604
  }
4554
4605
  for (let model of this._models) {
4555
4606
  if (isInstanceReference(model)) {
4556
- model.setScale(new Vector37(0, 0, 0));
4607
+ model.setScale(new Vector38(0, 0, 0));
4557
4608
  } else {
4558
4609
  model.dispose();
4559
4610
  }
@@ -4590,7 +4641,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4590
4641
  await this.createVariant(variant);
4591
4642
  }
4592
4643
  async createVariant(variant) {
4593
- const rotation = new Euler5();
4644
+ const rotation = new Euler6();
4594
4645
  if (typeof variant.x !== "undefined") {
4595
4646
  rotation.x = toRadians(clampRotationDegrees(variant.x));
4596
4647
  }
@@ -4677,7 +4728,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4677
4728
  setPositionRotationScaleAt(index, position, rotation, scale) {
4678
4729
  super.setPositionRotationScaleAt(index, position, rotation, scale);
4679
4730
  }
4680
- getMatrixAt(index, matrix = new Matrix46()) {
4731
+ getMatrixAt(index, matrix = new Matrix47()) {
4681
4732
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
4682
4733
  const child = this._models[0];
4683
4734
  if (child && isModelObject(child)) {
@@ -5672,7 +5723,8 @@ var MineRenderScene = class _MineRenderScene extends Scene2 {
5672
5723
  console.log("instanceMeshes + key");
5673
5724
  let key = asset.key.serialize();
5674
5725
  if (isModelObject(obj)) {
5675
- const { uvLockRotation, tints } = obj.options;
5726
+ const { displayPosition, uvLockRotation, tints } = obj.options;
5727
+ if (displayPosition) key += `|display:${displayPosition}`;
5676
5728
  if (uvLockRotation) key += `|uvlock:${uvLockRotation.join(",")}`;
5677
5729
  const palette = Object.entries(tints ?? {}).sort(([a], [b]) => Number(a) - Number(b));
5678
5730
  if (palette.length) key += `|tints:${JSON.stringify(palette)}`;
@@ -5719,7 +5771,7 @@ function isMineRenderScene(obj) {
5719
5771
  }
5720
5772
 
5721
5773
  // src/renderer/Renderer.ts
5722
- import { AxesHelper as AxesHelper3, GridHelper, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, SRGBColorSpace as SRGBColorSpace3, Vector3 as Vector39, WebGLRenderer } from "three";
5774
+ import { AxesHelper as AxesHelper3, GridHelper, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, SRGBColorSpace as SRGBColorSpace3, Vector3 as Vector310, WebGLRenderer } from "three";
5723
5775
  var import_ts_deepmerge9 = __toESM(require_dist());
5724
5776
  import Stats from "stats.js";
5725
5777
  import { EffectComposer, RenderPass } from "postprocessing";
@@ -5728,11 +5780,11 @@ import { EffectComposer, RenderPass } from "postprocessing";
5728
5780
  import {
5729
5781
  EventDispatcher,
5730
5782
  MOUSE,
5731
- Quaternion as Quaternion3,
5783
+ Quaternion as Quaternion4,
5732
5784
  Spherical,
5733
5785
  TOUCH,
5734
5786
  Vector2 as Vector23,
5735
- Vector3 as Vector38
5787
+ Vector3 as Vector39
5736
5788
  } from "three";
5737
5789
  var _changeEvent = { type: "change" };
5738
5790
  var _startEvent = { type: "start" };
@@ -5746,7 +5798,7 @@ var OrbitControls = class extends EventDispatcher {
5746
5798
  this.domElement = domElement;
5747
5799
  this.domElement.style.touchAction = "none";
5748
5800
  this.enabled = true;
5749
- this.target = new Vector38();
5801
+ this.target = new Vector39();
5750
5802
  this.minDistance = 0;
5751
5803
  this.maxDistance = Infinity;
5752
5804
  this.minZoom = 0;
@@ -5798,11 +5850,11 @@ var OrbitControls = class extends EventDispatcher {
5798
5850
  state = STATE.NONE;
5799
5851
  };
5800
5852
  this.update = function() {
5801
- const offset = new Vector38();
5802
- const quat = new Quaternion3().setFromUnitVectors(object.up, new Vector38(0, 1, 0));
5853
+ const offset = new Vector39();
5854
+ const quat = new Quaternion4().setFromUnitVectors(object.up, new Vector39(0, 1, 0));
5803
5855
  const quatInverse = quat.clone().invert();
5804
- const lastPosition = new Vector38();
5805
- const lastQuaternion = new Quaternion3();
5856
+ const lastPosition = new Vector39();
5857
+ const lastQuaternion = new Quaternion4();
5806
5858
  const twoPI = 2 * Math.PI;
5807
5859
  return function update() {
5808
5860
  const position = scope.object.position;
@@ -5891,7 +5943,7 @@ var OrbitControls = class extends EventDispatcher {
5891
5943
  const spherical = new Spherical();
5892
5944
  const sphericalDelta = new Spherical();
5893
5945
  let scale = 1;
5894
- const panOffset = new Vector38();
5946
+ const panOffset = new Vector39();
5895
5947
  let zoomChanged = false;
5896
5948
  const rotateStart = new Vector23();
5897
5949
  const rotateEnd = new Vector23();
@@ -5917,7 +5969,7 @@ var OrbitControls = class extends EventDispatcher {
5917
5969
  sphericalDelta.phi -= angle;
5918
5970
  }
5919
5971
  const panLeft = function() {
5920
- const v = new Vector38();
5972
+ const v = new Vector39();
5921
5973
  return function panLeft2(distance, objectMatrix) {
5922
5974
  v.setFromMatrixColumn(objectMatrix, 0);
5923
5975
  v.multiplyScalar(-distance);
@@ -5925,7 +5977,7 @@ var OrbitControls = class extends EventDispatcher {
5925
5977
  };
5926
5978
  }();
5927
5979
  const panUp = function() {
5928
- const v = new Vector38();
5980
+ const v = new Vector39();
5929
5981
  return function panUp2(distance, objectMatrix) {
5930
5982
  if (scope.screenSpacePanning === true) {
5931
5983
  v.setFromMatrixColumn(objectMatrix, 1);
@@ -5938,7 +5990,7 @@ var OrbitControls = class extends EventDispatcher {
5938
5990
  };
5939
5991
  }();
5940
5992
  const pan = function() {
5941
- const offset = new Vector38();
5993
+ const offset = new Vector39();
5942
5994
  return function pan2(deltaX, deltaY) {
5943
5995
  const element = scope.domElement;
5944
5996
  if (scope.object.isPerspectiveCamera) {
@@ -6415,8 +6467,8 @@ var Renderer = class _Renderer {
6415
6467
  top: void 0,
6416
6468
  bottom: void 0
6417
6469
  },
6418
- position: new Vector39(50, 50, 50),
6419
- lookingAt: new Vector39(0, 0, 0)
6470
+ position: new Vector310(50, 50, 50),
6471
+ lookingAt: new Vector310(0, 0, 0)
6420
6472
  },
6421
6473
  render: {
6422
6474
  fpsLimit: 60,
@@ -6881,10 +6933,10 @@ var Skins = class {
6881
6933
  };
6882
6934
 
6883
6935
  // src/world/Chunk.ts
6884
- import { Box3 as Box32, Object3D as Object3D6, Vector3 as Vector311 } from "three";
6936
+ import { Box3 as Box32, Object3D as Object3D6, Vector3 as Vector312 } from "three";
6885
6937
 
6886
6938
  // src/world/MineRenderWorld.ts
6887
- import { Vector3 as Vector310 } from "three";
6939
+ import { Vector3 as Vector311 } from "three";
6888
6940
  var MineRenderWorld = class {
6889
6941
  constructor(scene) {
6890
6942
  this._size = 4;
@@ -6895,10 +6947,10 @@ var MineRenderWorld = class {
6895
6947
  }
6896
6948
  getBlockAt(posOrX, y, z) {
6897
6949
  if (typeof posOrX == "number") {
6898
- return this.getBlockAt(new Vector310(posOrX, y, z));
6950
+ return this.getBlockAt(new Vector311(posOrX, y, z));
6899
6951
  }
6900
6952
  if (isTripleArray(posOrX)) {
6901
- return this.getBlockAt(new Vector310(posOrX[0], posOrX[1], posOrX[2]));
6953
+ return this.getBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]));
6902
6954
  }
6903
6955
  const chunk = this.getChunkAt(posOrX);
6904
6956
  if (typeof chunk === "undefined") {
@@ -6909,10 +6961,10 @@ var MineRenderWorld = class {
6909
6961
  }
6910
6962
  async setBlockAt(posOrX, yOrBlock, z, block) {
6911
6963
  if (typeof posOrX == "number") {
6912
- return this.setBlockAt(new Vector310(posOrX, yOrBlock, z), block);
6964
+ return this.setBlockAt(new Vector311(posOrX, yOrBlock, z), block);
6913
6965
  }
6914
6966
  if (isTripleArray(posOrX)) {
6915
- return this.setBlockAt(new Vector310(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
6967
+ return this.setBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
6916
6968
  }
6917
6969
  this.validatePosBounds(posOrX);
6918
6970
  const chunk = this.getOrCreateChunkAt(posOrX);
@@ -6958,14 +7010,14 @@ var MineRenderWorld = class {
6958
7010
  return this._chunks[index];
6959
7011
  }
6960
7012
  static worldToScenePosition(pos) {
6961
- return new Vector310(
7013
+ return new Vector311(
6962
7014
  pos.x * 16,
6963
7015
  pos.y * 16,
6964
7016
  pos.z * 16
6965
7017
  );
6966
7018
  }
6967
7019
  static sceneToWorldPosition(pos) {
6968
- return new Vector310(
7020
+ return new Vector311(
6969
7021
  pos.x / 16,
6970
7022
  pos.y / 16,
6971
7023
  pos.z / 16
@@ -7007,7 +7059,7 @@ var Chunk = class _Chunk {
7007
7059
  scene.add(anchor);
7008
7060
  anchor.position.set(this.x * 256 + 128 - 8, this.y * 256 + 128 - 8, this.z * 256 + 128 - 8);
7009
7061
  addBox3WireframeToObject(
7010
- new Box32(new Vector311(0, 0, 0), new Vector311(256, 256, 256)),
7062
+ new Box32(new Vector312(0, 0, 0), new Vector312(256, 256, 256)),
7011
7063
  anchor,
7012
7064
  16776960,
7013
7065
  4
@@ -7015,10 +7067,10 @@ var Chunk = class _Chunk {
7015
7067
  }
7016
7068
  getBlockAt(posOrX, y, z) {
7017
7069
  if (typeof posOrX == "number") {
7018
- return this.getBlockAt(new Vector311(posOrX, y, z));
7070
+ return this.getBlockAt(new Vector312(posOrX, y, z));
7019
7071
  }
7020
7072
  if (isTripleArray(posOrX)) {
7021
- return this.getBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]));
7073
+ return this.getBlockAt(new Vector312(posOrX[0], posOrX[1], posOrX[2]));
7022
7074
  }
7023
7075
  const pos = this.worldPosToChunkPos(posOrX);
7024
7076
  const index = _Chunk.chunkPosToBlockIndex(pos);
@@ -7026,10 +7078,10 @@ var Chunk = class _Chunk {
7026
7078
  }
7027
7079
  async setBlockAt(posOrX, yOrBlock, z, block) {
7028
7080
  if (typeof posOrX == "number") {
7029
- return this.setBlockAt(new Vector311(posOrX, yOrBlock, z), block);
7081
+ return this.setBlockAt(new Vector312(posOrX, yOrBlock, z), block);
7030
7082
  }
7031
7083
  if (isTripleArray(posOrX)) {
7032
- return this.setBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7084
+ return this.setBlockAt(new Vector312(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7033
7085
  }
7034
7086
  const worldPos = posOrX;
7035
7087
  const pos = this.worldPosToChunkPos(worldPos);
@@ -7075,7 +7127,7 @@ var Chunk = class _Chunk {
7075
7127
  }
7076
7128
  async clear() {
7077
7129
  let promises = [];
7078
- let pos = new Vector311();
7130
+ let pos = new Vector312();
7079
7131
  for (let x = 0; x < 16; x++) {
7080
7132
  for (let z = 0; z < 16; z++) {
7081
7133
  for (let y = 0; y < 16; y++) {
@@ -7094,14 +7146,14 @@ var Chunk = class _Chunk {
7094
7146
  return pos.y * 16 * 16 + pos.z * 16 + pos.x;
7095
7147
  }
7096
7148
  worldPosToChunkPos(pos) {
7097
- return new Vector311(
7149
+ return new Vector312(
7098
7150
  pos.x - this.x * 16,
7099
7151
  pos.y - this.y * 16,
7100
7152
  pos.z - this.z * 16
7101
7153
  );
7102
7154
  }
7103
7155
  chunkPosToWorldPos(pos) {
7104
- return new Vector311(
7156
+ return new Vector312(
7105
7157
  this.x * 16 + pos.x,
7106
7158
  this.y * 16 + pos.y,
7107
7159
  this.z * 16 + pos.z
@@ -7140,6 +7192,7 @@ export {
7140
7192
  DISPLAY_POSITIONS,
7141
7193
  DefaultBlockStates,
7142
7194
  DisplayPosition,
7195
+ DisplayTransforms,
7143
7196
  Entities,
7144
7197
  EntityModels,
7145
7198
  EntityObject,