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.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Vector3, PixelFormat, BoxGeometry, Material, ColorRepresentation, MeshBasicMaterial, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Box2, Scene, Object3DEventMap, ShaderMaterial, Texture, Camera, MOUSE, TOUCH, Controls, WebGLRenderer, EventDispatcher, Raycaster, Intersection, Group, DataTexture, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
|
|
2
|
+
import { Vector3, PixelFormat, BoxGeometry, Material, ColorRepresentation, MeshBasicMaterial, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Quaternion, Box2, Scene, Object3DEventMap, ShaderMaterial, Texture, Camera, MOUSE, TOUCH, Controls, WebGLRenderer, EventDispatcher, Raycaster, Intersection, Group, DataTexture, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
|
|
3
3
|
import * as nodeCanvas from 'canvas';
|
|
4
4
|
import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
|
|
5
5
|
import { Buffer } from 'buffer';
|
|
@@ -1424,6 +1424,12 @@ declare class DisplayTransforms {
|
|
|
1424
1424
|
static withHandFallbacks(display: Model["display"]): Model["display"];
|
|
1425
1425
|
/** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1426
1426
|
static getMatrix(display: Model["display"], position: DisplayPosition): Matrix4;
|
|
1427
|
+
/** Position, rotation, and scale of a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1428
|
+
static getTransform(display: Model["display"], position: DisplayPosition): {
|
|
1429
|
+
position: Vector3;
|
|
1430
|
+
quaternion: Quaternion;
|
|
1431
|
+
scale: Vector3;
|
|
1432
|
+
};
|
|
1427
1433
|
/** Transforms geometry in place and reverses triangle winding when the matrix reflects it. */
|
|
1428
1434
|
static apply(geometry: BufferGeometry, matrix: Matrix4): void;
|
|
1429
1435
|
}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Vector3, PixelFormat, BoxGeometry, Material, ColorRepresentation, MeshBasicMaterial, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Box2, Scene, Object3DEventMap, ShaderMaterial, Texture, Camera, MOUSE, TOUCH, Controls, WebGLRenderer, EventDispatcher, Raycaster, Intersection, Group, DataTexture, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
|
|
2
|
+
import { Vector3, PixelFormat, BoxGeometry, Material, ColorRepresentation, MeshBasicMaterial, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Quaternion, Box2, Scene, Object3DEventMap, ShaderMaterial, Texture, Camera, MOUSE, TOUCH, Controls, WebGLRenderer, EventDispatcher, Raycaster, Intersection, Group, DataTexture, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
|
|
3
3
|
import * as nodeCanvas from 'canvas';
|
|
4
4
|
import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
|
|
5
5
|
import { Buffer } from 'buffer';
|
|
@@ -1424,6 +1424,12 @@ declare class DisplayTransforms {
|
|
|
1424
1424
|
static withHandFallbacks(display: Model["display"]): Model["display"];
|
|
1425
1425
|
/** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1426
1426
|
static getMatrix(display: Model["display"], position: DisplayPosition): Matrix4;
|
|
1427
|
+
/** Position, rotation, and scale of a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1428
|
+
static getTransform(display: Model["display"], position: DisplayPosition): {
|
|
1429
|
+
position: Vector3;
|
|
1430
|
+
quaternion: Quaternion;
|
|
1431
|
+
scale: Vector3;
|
|
1432
|
+
};
|
|
1427
1433
|
/** Transforms geometry in place and reverses triangle winding when the matrix reflects it. */
|
|
1428
1434
|
static apply(geometry: BufferGeometry, matrix: Matrix4): void;
|
|
1429
1435
|
}
|
package/dist/node/index.js
CHANGED
|
@@ -1535,6 +1535,11 @@ var init_DisplayTransforms = __esm({
|
|
|
1535
1535
|
}
|
|
1536
1536
|
/** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1537
1537
|
static getMatrix(display, position) {
|
|
1538
|
+
const transform = this.getTransform(display, position);
|
|
1539
|
+
return new import_three7.Matrix4().compose(transform.position, transform.quaternion, transform.scale);
|
|
1540
|
+
}
|
|
1541
|
+
/** Position, rotation, and scale of a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
1542
|
+
static getTransform(display, position) {
|
|
1538
1543
|
const transform = this.withHandFallbacks(display)?.[position] ?? {};
|
|
1539
1544
|
const left = position === "firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */ || position === "thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */;
|
|
1540
1545
|
const sign = left ? -1 : 1;
|
|
@@ -1543,7 +1548,7 @@ var init_DisplayTransforms = __esm({
|
|
|
1543
1548
|
const translation = new import_three7.Vector3(...transform.translation ?? [0, 0, 0]).clampScalar(-80, 80);
|
|
1544
1549
|
translation.x *= sign;
|
|
1545
1550
|
const scale = new import_three7.Vector3(...transform.scale ?? [1, 1, 1]).clampScalar(-4, 4);
|
|
1546
|
-
return
|
|
1551
|
+
return { position: translation, quaternion: rotation, scale };
|
|
1547
1552
|
}
|
|
1548
1553
|
/** Transforms geometry in place and reverses triangle winding when the matrix reflects it. */
|
|
1549
1554
|
static apply(geometry, matrix) {
|
|
@@ -7109,16 +7114,21 @@ var init_ModelObject = __esm({
|
|
|
7109
7114
|
const special = this.originalModel.special;
|
|
7110
7115
|
if (special) {
|
|
7111
7116
|
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
7112
|
-
const
|
|
7113
|
-
|
|
7117
|
+
const display = new SceneObject();
|
|
7118
|
+
if (this.options.displayPosition) {
|
|
7119
|
+
const transform = DisplayTransforms.getTransform(this.originalModel.display, this.options.displayPosition);
|
|
7120
|
+
display.position.copy(transform.position);
|
|
7121
|
+
display.quaternion.copy(transform.quaternion);
|
|
7122
|
+
display.scale.copy(transform.scale);
|
|
7123
|
+
}
|
|
7124
|
+
this.add(display);
|
|
7125
|
+
const offset = new import_three27.Matrix4().makeTranslation(-8, -8, -8);
|
|
7114
7126
|
try {
|
|
7115
7127
|
const targets = [];
|
|
7116
7128
|
for (const part of parts2) {
|
|
7117
7129
|
const object4 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe, tints: part.tints, faces: part.faces });
|
|
7118
|
-
object4.matrix.
|
|
7119
|
-
object4
|
|
7120
|
-
object4.matrixAutoUpdate = false;
|
|
7121
|
-
this.add(object4);
|
|
7130
|
+
object4.matrix.multiplyMatrices(offset, part.transform).decompose(object4.position, object4.quaternion, object4.scale);
|
|
7131
|
+
display.add(object4);
|
|
7122
7132
|
await object4.init(part.material);
|
|
7123
7133
|
object4.iterateAllMeshes((mesh) => {
|
|
7124
7134
|
const source = mesh.material;
|