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/browser/index.d.mts +7 -1
- package/dist/browser/index.d.ts +7 -1
- package/dist/browser/index.js +17 -7
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +17 -7
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +17 -7
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +7 -1
- package/dist/node/index.d.ts +7 -1
- package/dist/node/index.js +17 -7
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +17 -7
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -1478,6 +1478,11 @@ var init_DisplayTransforms = __esm({
|
|
|
1478
1478
|
}
|
|
1479
1479
|
/** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1480
1480
|
static getMatrix(display, position) {
|
|
1481
|
+
const transform = this.getTransform(display, position);
|
|
1482
|
+
return new Matrix4().compose(transform.position, transform.quaternion, transform.scale);
|
|
1483
|
+
}
|
|
1484
|
+
/** Position, rotation, and scale of a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1485
|
+
static getTransform(display, position) {
|
|
1481
1486
|
const transform = this.withHandFallbacks(display)?.[position] ?? {};
|
|
1482
1487
|
const left = position === "firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */ || position === "thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */;
|
|
1483
1488
|
const sign = left ? -1 : 1;
|
|
@@ -1486,7 +1491,7 @@ var init_DisplayTransforms = __esm({
|
|
|
1486
1491
|
const translation = new Vector32(...transform.translation ?? [0, 0, 0]).clampScalar(-80, 80);
|
|
1487
1492
|
translation.x *= sign;
|
|
1488
1493
|
const scale = new Vector32(...transform.scale ?? [1, 1, 1]).clampScalar(-4, 4);
|
|
1489
|
-
return
|
|
1494
|
+
return { position: translation, quaternion: rotation, scale };
|
|
1490
1495
|
}
|
|
1491
1496
|
/** Transforms geometry in place and reverses triangle winding when the matrix reflects it. */
|
|
1492
1497
|
static apply(geometry, matrix) {
|
|
@@ -7014,16 +7019,21 @@ var init_ModelObject = __esm({
|
|
|
7014
7019
|
const special = this.originalModel.special;
|
|
7015
7020
|
if (special) {
|
|
7016
7021
|
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
7017
|
-
const
|
|
7018
|
-
|
|
7022
|
+
const display = new SceneObject();
|
|
7023
|
+
if (this.options.displayPosition) {
|
|
7024
|
+
const transform = DisplayTransforms.getTransform(this.originalModel.display, this.options.displayPosition);
|
|
7025
|
+
display.position.copy(transform.position);
|
|
7026
|
+
display.quaternion.copy(transform.quaternion);
|
|
7027
|
+
display.scale.copy(transform.scale);
|
|
7028
|
+
}
|
|
7029
|
+
this.add(display);
|
|
7030
|
+
const offset = new Matrix48().makeTranslation(-8, -8, -8);
|
|
7019
7031
|
try {
|
|
7020
7032
|
const targets = [];
|
|
7021
7033
|
for (const part of parts2) {
|
|
7022
7034
|
const object4 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe, tints: part.tints, faces: part.faces });
|
|
7023
|
-
object4.matrix.
|
|
7024
|
-
object4
|
|
7025
|
-
object4.matrixAutoUpdate = false;
|
|
7026
|
-
this.add(object4);
|
|
7035
|
+
object4.matrix.multiplyMatrices(offset, part.transform).decompose(object4.position, object4.quaternion, object4.scale);
|
|
7036
|
+
display.add(object4);
|
|
7027
7037
|
await object4.init(part.material);
|
|
7028
7038
|
object4.iterateAllMeshes((mesh) => {
|
|
7029
7039
|
const source = mesh.material;
|