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/node/index.mjs
CHANGED
|
@@ -1534,6 +1534,11 @@ var init_DisplayTransforms = __esm({
|
|
|
1534
1534
|
}
|
|
1535
1535
|
/** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1536
1536
|
static getMatrix(display, position) {
|
|
1537
|
+
const transform = this.getTransform(display, position);
|
|
1538
|
+
return new Matrix4().compose(transform.position, transform.quaternion, transform.scale);
|
|
1539
|
+
}
|
|
1540
|
+
/** Position, rotation, and scale of a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1541
|
+
static getTransform(display, position) {
|
|
1537
1542
|
const transform = this.withHandFallbacks(display)?.[position] ?? {};
|
|
1538
1543
|
const left = position === "firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */ || position === "thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */;
|
|
1539
1544
|
const sign = left ? -1 : 1;
|
|
@@ -1542,7 +1547,7 @@ var init_DisplayTransforms = __esm({
|
|
|
1542
1547
|
const translation = new Vector32(...transform.translation ?? [0, 0, 0]).clampScalar(-80, 80);
|
|
1543
1548
|
translation.x *= sign;
|
|
1544
1549
|
const scale = new Vector32(...transform.scale ?? [1, 1, 1]).clampScalar(-4, 4);
|
|
1545
|
-
return
|
|
1550
|
+
return { position: translation, quaternion: rotation, scale };
|
|
1546
1551
|
}
|
|
1547
1552
|
/** Transforms geometry in place and reverses triangle winding when the matrix reflects it. */
|
|
1548
1553
|
static apply(geometry, matrix) {
|
|
@@ -7116,16 +7121,21 @@ var init_ModelObject = __esm({
|
|
|
7116
7121
|
const special = this.originalModel.special;
|
|
7117
7122
|
if (special) {
|
|
7118
7123
|
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
7119
|
-
const
|
|
7120
|
-
|
|
7124
|
+
const display = new SceneObject();
|
|
7125
|
+
if (this.options.displayPosition) {
|
|
7126
|
+
const transform = DisplayTransforms.getTransform(this.originalModel.display, this.options.displayPosition);
|
|
7127
|
+
display.position.copy(transform.position);
|
|
7128
|
+
display.quaternion.copy(transform.quaternion);
|
|
7129
|
+
display.scale.copy(transform.scale);
|
|
7130
|
+
}
|
|
7131
|
+
this.add(display);
|
|
7132
|
+
const offset = new Matrix48().makeTranslation(-8, -8, -8);
|
|
7121
7133
|
try {
|
|
7122
7134
|
const targets = [];
|
|
7123
7135
|
for (const part of parts2) {
|
|
7124
7136
|
const object4 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe, tints: part.tints, faces: part.faces });
|
|
7125
|
-
object4.matrix.
|
|
7126
|
-
object4
|
|
7127
|
-
object4.matrixAutoUpdate = false;
|
|
7128
|
-
this.add(object4);
|
|
7137
|
+
object4.matrix.multiplyMatrices(offset, part.transform).decompose(object4.position, object4.quaternion, object4.scale);
|
|
7138
|
+
display.add(object4);
|
|
7129
7139
|
await object4.init(part.material);
|
|
7130
7140
|
object4.iterateAllMeshes((mesh) => {
|
|
7131
7141
|
const source = mesh.material;
|