minerender 2.1.0-alpha.125 → 2.1.0-alpha.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -43098,6 +43098,11 @@ void main() {
43098
43098
  }
43099
43099
  /** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
43100
43100
  static getMatrix(display, position) {
43101
+ const transform = this.getTransform(display, position);
43102
+ return new Matrix4().compose(transform.position, transform.quaternion, transform.scale);
43103
+ }
43104
+ /** Position, rotation, and scale of a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
43105
+ static getTransform(display, position) {
43101
43106
  const transform = this.withHandFallbacks(display)?.[position] ?? {};
43102
43107
  const left = position === "firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */ || position === "thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */;
43103
43108
  const sign = left ? -1 : 1;
@@ -43106,7 +43111,7 @@ void main() {
43106
43111
  const translation = new Vector3(...transform.translation ?? [0, 0, 0]).clampScalar(-80, 80);
43107
43112
  translation.x *= sign;
43108
43113
  const scale = new Vector3(...transform.scale ?? [1, 1, 1]).clampScalar(-4, 4);
43109
- return new Matrix4().compose(translation, rotation, scale);
43114
+ return { position: translation, quaternion: rotation, scale };
43110
43115
  }
43111
43116
  /** Transforms geometry in place and reverses triangle winding when the matrix reflects it. */
43112
43117
  static apply(geometry, matrix) {
@@ -94784,16 +94789,21 @@ ${shader.fragmentShader}`.replace(
94784
94789
  const special = this.originalModel.special;
94785
94790
  if (special) {
94786
94791
  const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
94787
- const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new Matrix4();
94788
- transform.multiply(new Matrix4().makeTranslation(-8, -8, -8));
94792
+ const display = new SceneObject();
94793
+ if (this.options.displayPosition) {
94794
+ const transform = DisplayTransforms.getTransform(this.originalModel.display, this.options.displayPosition);
94795
+ display.position.copy(transform.position);
94796
+ display.quaternion.copy(transform.quaternion);
94797
+ display.scale.copy(transform.scale);
94798
+ }
94799
+ this.add(display);
94800
+ const offset = new Matrix4().makeTranslation(-8, -8, -8);
94789
94801
  try {
94790
94802
  const targets = [];
94791
94803
  for (const part of parts2) {
94792
94804
  const object4 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe, tints: part.tints, faces: part.faces });
94793
- object4.matrix.copy(transform).multiply(part.transform);
94794
- object4.matrixWorldNeedsUpdate = true;
94795
- object4.matrixAutoUpdate = false;
94796
- this.add(object4);
94805
+ object4.matrix.multiplyMatrices(offset, part.transform).decompose(object4.position, object4.quaternion, object4.scale);
94806
+ display.add(object4);
94797
94807
  await object4.init(part.material);
94798
94808
  object4.iterateAllMeshes((mesh) => {
94799
94809
  const source = mesh.material;