minerender 2.1.0-alpha.124 → 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 +11 -4
- package/dist/browser/index.d.ts +11 -4
- package/dist/browser/index.js +33 -18
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +74 -59
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +34 -19
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +11 -4
- package/dist/node/index.d.ts +11 -4
- package/dist/node/index.js +33 -18
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +74 -59
- 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) {
|
|
@@ -5250,7 +5255,7 @@ var init_SceneObject = __esm({
|
|
|
5250
5255
|
});
|
|
5251
5256
|
|
|
5252
5257
|
// src/entity/scene/EntityObject.ts
|
|
5253
|
-
import { Color as Color3,
|
|
5258
|
+
import { Color as Color3, Object3D as Object3D3 } from "three";
|
|
5254
5259
|
function isEntityObject(obj) {
|
|
5255
5260
|
return obj.isEntityObject;
|
|
5256
5261
|
}
|
|
@@ -5356,13 +5361,14 @@ var init_EntityObject = __esm({
|
|
|
5356
5361
|
}
|
|
5357
5362
|
/**
|
|
5358
5363
|
* Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
|
|
5359
|
-
* Offsets apply to the baked pose in the clip's layer (`main` by default)
|
|
5364
|
+
* Offsets apply to the baked pose in the clip's layer (`main` by default) and its repeated draws.
|
|
5365
|
+
* A `main` clip also poses every selected layer without a clip of its own.
|
|
5360
5366
|
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
5361
5367
|
*/
|
|
5362
5368
|
playAnimation(animation, options) {
|
|
5363
5369
|
this.playAnimations([animation], options);
|
|
5364
5370
|
}
|
|
5365
|
-
/** Plays
|
|
5371
|
+
/** Plays clips with a shared clock and no blending. Selected layers without their own clip follow `main`. */
|
|
5366
5372
|
playAnimations(animations, options) {
|
|
5367
5373
|
const targets = /* @__PURE__ */ new Set();
|
|
5368
5374
|
const selections = animations.map((animation) => {
|
|
@@ -5373,6 +5379,8 @@ var init_EntityObject = __esm({
|
|
|
5373
5379
|
if (!names.length) throw new Error(`Entity ${this.entity.id} has no selected animation layer "${layer}"`);
|
|
5374
5380
|
return { animation, names };
|
|
5375
5381
|
});
|
|
5382
|
+
const main = selections.find(({ animation }) => (animation.layer ?? "main") === "main");
|
|
5383
|
+
if (main) main.names.push(...Object.keys(this.entityLayers).filter((name) => !targets.has(name.split("#")[0])));
|
|
5376
5384
|
this.createMeshes();
|
|
5377
5385
|
this.stopAnimation();
|
|
5378
5386
|
for (const { animation, names } of selections) {
|
|
@@ -5432,24 +5440,26 @@ var init_EntityObject = __esm({
|
|
|
5432
5440
|
createMeshes(force = false) {
|
|
5433
5441
|
if (this.meshesCreated && !force) return;
|
|
5434
5442
|
const modelRoot = new Object3D3();
|
|
5443
|
+
let transformNode = modelRoot;
|
|
5435
5444
|
const transform = this.options.flip === void 0 ? this.entity.transform : void 0;
|
|
5436
5445
|
if (transform) {
|
|
5437
|
-
for (const op of transform) {
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5446
|
+
for (const [index, op] of transform.entries()) {
|
|
5447
|
+
if (index > 0) {
|
|
5448
|
+
const child = new Object3D3();
|
|
5449
|
+
transformNode.add(child);
|
|
5450
|
+
transformNode = child;
|
|
5451
|
+
}
|
|
5452
|
+
if ("scale" in op) transformNode.scale.set(...op.scale);
|
|
5453
|
+
else if ("translate" in op) transformNode.position.set(...op.translate);
|
|
5454
|
+
else transformNode.rotation.set(...op.rotate, "ZYX");
|
|
5443
5455
|
}
|
|
5444
|
-
modelRoot.matrixWorldNeedsUpdate = true;
|
|
5445
|
-
modelRoot.matrixAutoUpdate = false;
|
|
5446
5456
|
} else if (this.options.flip ?? true) {
|
|
5447
5457
|
modelRoot.scale.set(-1, -1, 1);
|
|
5448
5458
|
}
|
|
5449
5459
|
this.add(modelRoot);
|
|
5450
5460
|
Object.entries(this.entityLayers).forEach(([name, layer], index) => {
|
|
5451
5461
|
const group = this.createGroup(`layer:${name}`);
|
|
5452
|
-
|
|
5462
|
+
transformNode.add(group);
|
|
5453
5463
|
const inward = !Materials.entityModeCulls(layer.render ?? layer.layer.render);
|
|
5454
5464
|
this.createPart("root", layer.layer.root, group, layer.layer.texture, Materials.MISSING_TEXTURE, index, inward, this.options.faces?.[name]);
|
|
5455
5465
|
});
|
|
@@ -6573,7 +6583,7 @@ var init_PlayerHeadTextures = __esm({
|
|
|
6573
6583
|
});
|
|
6574
6584
|
|
|
6575
6585
|
// src/model/SpecialItems.ts
|
|
6576
|
-
import { Euler as
|
|
6586
|
+
import { Euler as Euler6, Matrix4 as Matrix47 } from "three";
|
|
6577
6587
|
var SpecialItems;
|
|
6578
6588
|
var init_SpecialItems = __esm({
|
|
6579
6589
|
"src/model/SpecialItems.ts"() {
|
|
@@ -6614,8 +6624,8 @@ var init_SpecialItems = __esm({
|
|
|
6614
6624
|
const sideTextures = DecoratedPots.getSideTextures(components["minecraft:pot_decorations"], root);
|
|
6615
6625
|
const baseTexture = texture("decorated_pot_base", "decorated_pot");
|
|
6616
6626
|
const [base, sides] = await Promise.all([
|
|
6617
|
-
load("decorated_pot_base", baseTexture, new
|
|
6618
|
-
load("decorated_pot_sides", texture("decorated_pot_side", "decorated_pot"), new
|
|
6627
|
+
load("decorated_pot_base", baseTexture, new Matrix47()),
|
|
6628
|
+
load("decorated_pot_sides", texture("decorated_pot_side", "decorated_pot"), new Matrix47())
|
|
6619
6629
|
]);
|
|
6620
6630
|
const layers = {
|
|
6621
6631
|
base: { key: base.model.key, texture: baseTexture, layer: base.model.layer, render: "solid" }
|
|
@@ -6643,7 +6653,7 @@ var init_SpecialItems = __esm({
|
|
|
6643
6653
|
const part = await load(
|
|
6644
6654
|
"player_head",
|
|
6645
6655
|
skin.texture,
|
|
6646
|
-
new
|
|
6656
|
+
new Matrix47().makeTranslation(8, 0, 8).multiply(new Matrix47().makeScale(-1, -1, 1)),
|
|
6647
6657
|
{ head: [0, Math.PI, 0] }
|
|
6648
6658
|
);
|
|
6649
6659
|
const main = { ...part.model, texture: skin.texture, render: "translucent" };
|
|
@@ -6660,7 +6670,7 @@ var init_SpecialItems = __esm({
|
|
|
6660
6670
|
const statue = await load(
|
|
6661
6671
|
special.pose === "standing" ? "copper_golem" : `copper_golem_${special.pose}`,
|
|
6662
6672
|
key,
|
|
6663
|
-
new
|
|
6673
|
+
new Matrix47().makeTranslation(8, 24, 8).multiply(new Matrix47().makeScale(-1, -1, 1))
|
|
6664
6674
|
);
|
|
6665
6675
|
const pose = statue.model.layer.root.pose;
|
|
6666
6676
|
statue.rotations.root = [pose.rotation[0], Math.PI, Math.PI];
|
|
@@ -6676,7 +6686,7 @@ var init_SpecialItems = __esm({
|
|
|
6676
6686
|
const part = await load(
|
|
6677
6687
|
trident ? "trident" : "conduit",
|
|
6678
6688
|
texture(trident ? "trident" : "conduit/base", ""),
|
|
6679
|
-
trident ? new
|
|
6689
|
+
trident ? new Matrix47().makeScale(1, -1, -1) : new Matrix47().makeTranslation(8, 8, 8),
|
|
6680
6690
|
{},
|
|
6681
6691
|
trident ? ["main"] : ["shell"]
|
|
6682
6692
|
);
|
|
@@ -6697,7 +6707,7 @@ var init_SpecialItems = __esm({
|
|
|
6697
6707
|
const patterns = await BannerPatterns.getLayers(components["minecraft:banner_patterns"], banner ? "banner" : "shield", root);
|
|
6698
6708
|
const patterned = banner || color2 !== void 0 || patterns.length > 0;
|
|
6699
6709
|
const baseTexture = texture(banner ? "banner_base" : patterned ? "shield_base" : "shield_base_nopattern", "");
|
|
6700
|
-
const transform = banner ? new
|
|
6710
|
+
const transform = banner ? new Matrix47().makeTranslation(8, 0, 8).multiply(new Matrix47().makeScale(2 / 3, -2 / 3, -2 / 3)) : new Matrix47().makeScale(1, -1, -1);
|
|
6701
6711
|
const part = await load(banner ? "standing_banner" : "shield", baseTexture, transform, {}, banner ? ["main", "flag"] : ["main"]);
|
|
6702
6712
|
const layers = Object.fromEntries(Object.entries(part.model.layers ?? { main: part.model }).map(([name, layer]) => [name, { ...layer, render: "solid" }]));
|
|
6703
6713
|
let overlay2;
|
|
@@ -6735,7 +6745,7 @@ var init_SpecialItems = __esm({
|
|
|
6735
6745
|
case "minecraft:chest":
|
|
6736
6746
|
case "chest": {
|
|
6737
6747
|
const angle = -(special.openness ?? 0) * Math.PI / 2;
|
|
6738
|
-
const chest = await load("chest", texture(special.texture, "chest"), new
|
|
6748
|
+
const chest = await load("chest", texture(special.texture, "chest"), new Matrix47(), {
|
|
6739
6749
|
lid: [angle, 0, 0],
|
|
6740
6750
|
lock: [angle, 0, 0]
|
|
6741
6751
|
});
|
|
@@ -6757,18 +6767,18 @@ var init_SpecialItems = __esm({
|
|
|
6757
6767
|
if (!Object.prototype.hasOwnProperty.call(directions, orientation)) throw new Error(`Unsupported shulker-box orientation ${orientation}`);
|
|
6758
6768
|
if (typeof openness !== "number" || !Number.isFinite(openness)) throw new Error("Shulker-box openness must be finite");
|
|
6759
6769
|
if (typeof special.texture !== "string" || !special.texture) throw new Error("Shulker-box texture is required");
|
|
6760
|
-
const transform = new
|
|
6770
|
+
const transform = new Matrix47().makeTranslation(8, 8, 8).multiply(new Matrix47().makeScale(0.9995, 0.9995, 0.9995)).multiply(new Matrix47().makeRotationFromEuler(new Euler6(...directions[orientation], "XYZ"))).multiply(new Matrix47().makeScale(1, -1, -1)).multiply(new Matrix47().makeTranslation(0, -16, 0));
|
|
6761
6771
|
const box = await load("shulker_box", texture(special.texture, "shulker"), transform, { lid: [0, openness * Math.PI * 1.5, 0] });
|
|
6762
6772
|
box.positions = { lid: [0, 24 - openness * 8, 0] };
|
|
6763
6773
|
return [box];
|
|
6764
6774
|
}
|
|
6765
6775
|
case "minecraft:bed":
|
|
6766
6776
|
case "bed": {
|
|
6767
|
-
const transform = new
|
|
6777
|
+
const transform = new Matrix47().makeTranslation(0, 9, 0).multiply(new Matrix47().makeRotationX(Math.PI / 2)).multiply(new Matrix47().makeTranslation(8, 8, 8)).multiply(new Matrix47().makeRotationZ(Math.PI)).multiply(new Matrix47().makeTranslation(-8, -8, -8));
|
|
6768
6778
|
const key = texture(special.texture, "bed");
|
|
6769
6779
|
return Promise.all([
|
|
6770
6780
|
load("bed_head", key, transform),
|
|
6771
|
-
load("bed_foot", key, new
|
|
6781
|
+
load("bed_foot", key, new Matrix47().makeTranslation(0, 0, -16).multiply(transform))
|
|
6772
6782
|
]);
|
|
6773
6783
|
}
|
|
6774
6784
|
case "minecraft:head":
|
|
@@ -6793,7 +6803,7 @@ var init_SpecialItems = __esm({
|
|
|
6793
6803
|
return [await load(
|
|
6794
6804
|
id,
|
|
6795
6805
|
special.texture ? texture(special.texture, "") : void 0,
|
|
6796
|
-
new
|
|
6806
|
+
new Matrix47().makeTranslation(8, 0, 8).multiply(new Matrix47().makeScale(-1, -1, 1)),
|
|
6797
6807
|
rotations
|
|
6798
6808
|
)];
|
|
6799
6809
|
}
|
|
@@ -7040,7 +7050,7 @@ var init_ItemGlint = __esm({
|
|
|
7040
7050
|
});
|
|
7041
7051
|
|
|
7042
7052
|
// src/model/scene/ModelObject.ts
|
|
7043
|
-
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, DoubleSide as DoubleSide5, Euler as
|
|
7053
|
+
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, DoubleSide as DoubleSide5, Euler as Euler7, FrontSide as FrontSide3, Matrix4 as Matrix48 } from "three";
|
|
7044
7054
|
function isModelObject(obj) {
|
|
7045
7055
|
return obj.isModelObject;
|
|
7046
7056
|
}
|
|
@@ -7111,16 +7121,21 @@ var init_ModelObject = __esm({
|
|
|
7111
7121
|
const special = this.originalModel.special;
|
|
7112
7122
|
if (special) {
|
|
7113
7123
|
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
7114
|
-
const
|
|
7115
|
-
|
|
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);
|
|
7116
7133
|
try {
|
|
7117
7134
|
const targets = [];
|
|
7118
7135
|
for (const part of parts2) {
|
|
7119
7136
|
const object4 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe, tints: part.tints, faces: part.faces });
|
|
7120
|
-
object4.matrix.
|
|
7121
|
-
object4
|
|
7122
|
-
object4.matrixAutoUpdate = false;
|
|
7123
|
-
this.add(object4);
|
|
7137
|
+
object4.matrix.multiplyMatrices(offset, part.transform).decompose(object4.position, object4.quaternion, object4.scale);
|
|
7138
|
+
display.add(object4);
|
|
7124
7139
|
await object4.init(part.material);
|
|
7125
7140
|
object4.iterateAllMeshes((mesh) => {
|
|
7126
7141
|
const source = mesh.material;
|
|
@@ -7204,7 +7219,7 @@ var init_ModelObject = __esm({
|
|
|
7204
7219
|
elGeo.clearGroups();
|
|
7205
7220
|
}
|
|
7206
7221
|
if (this.options.uvLockRotation) {
|
|
7207
|
-
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new
|
|
7222
|
+
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler7(...this.options.uvLockRotation));
|
|
7208
7223
|
}
|
|
7209
7224
|
UVMapper.setAtlasUvBounds(elGeo, el.faces, this.atlas);
|
|
7210
7225
|
if (this.options.tints) {
|
|
@@ -7221,13 +7236,13 @@ var init_ModelObject = __esm({
|
|
|
7221
7236
|
}
|
|
7222
7237
|
elGeo.setAttribute("color", new BufferAttribute5(colors, 3));
|
|
7223
7238
|
}
|
|
7224
|
-
elGeo.applyMatrix4(new
|
|
7225
|
-
elGeo.applyMatrix4(new
|
|
7239
|
+
elGeo.applyMatrix4(new Matrix48().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
|
|
7240
|
+
elGeo.applyMatrix4(new Matrix48().makeTranslation(el.from[0], el.from[1], el.from[2]));
|
|
7226
7241
|
if (el.rotation) {
|
|
7227
7242
|
applyElementRotation(el.rotation, elGeo);
|
|
7228
7243
|
}
|
|
7229
7244
|
if (this.hasGlint) ItemGlint.mapUvs(elGeo, el.faces, this.atlas, this.originalModel.itemId, this.options.displayPosition);
|
|
7230
|
-
elGeo.applyMatrix4(new
|
|
7245
|
+
elGeo.applyMatrix4(new Matrix48().makeTranslation(-8, -8, -8));
|
|
7231
7246
|
if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
|
|
7232
7247
|
if (this.options.mergeMeshes) {
|
|
7233
7248
|
allGeos.push(elGeo);
|
|
@@ -8054,7 +8069,7 @@ init_EntityObject();
|
|
|
8054
8069
|
init_MineRenderError();
|
|
8055
8070
|
|
|
8056
8071
|
// src/export/SceneExporter.ts
|
|
8057
|
-
import { ClampToEdgeWrapping as ClampToEdgeWrapping2, Color as Color7, Float32BufferAttribute as Float32BufferAttribute3, Matrix4 as
|
|
8072
|
+
import { ClampToEdgeWrapping as ClampToEdgeWrapping2, Color as Color7, Float32BufferAttribute as Float32BufferAttribute3, Matrix4 as Matrix46, Mesh as Mesh4, MeshBasicMaterial as MeshBasicMaterial2, NearestFilter as NearestFilter3, RGBAFormat as RGBAFormat3, Scene as Scene3, TextureSource as TextureSource2, Texture as Texture3, UnsignedByteType } from "three";
|
|
8058
8073
|
|
|
8059
8074
|
// ../../node_modules/three/examples/jsm/exporters/OBJExporter.js
|
|
8060
8075
|
import {
|
|
@@ -8662,7 +8677,7 @@ import {
|
|
|
8662
8677
|
LinearMipmapLinearFilter,
|
|
8663
8678
|
LinearMipmapNearestFilter,
|
|
8664
8679
|
MathUtils,
|
|
8665
|
-
Matrix4 as
|
|
8680
|
+
Matrix4 as Matrix45,
|
|
8666
8681
|
MirroredRepeatWrapping,
|
|
8667
8682
|
NearestFilter as NearestFilter2,
|
|
8668
8683
|
NearestMipmapLinearFilter,
|
|
@@ -10030,7 +10045,7 @@ var GLTFWriter = class {
|
|
|
10030
10045
|
if (rootJoint === void 0) return null;
|
|
10031
10046
|
const joints = [];
|
|
10032
10047
|
const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16);
|
|
10033
|
-
const temporaryBoneInverse = new
|
|
10048
|
+
const temporaryBoneInverse = new Matrix45();
|
|
10034
10049
|
for (let i = 0; i < skeleton.bones.length; ++i) {
|
|
10035
10050
|
joints.push(nodeMap.get(skeleton.bones[i]));
|
|
10036
10051
|
temporaryBoneInverse.copy(skeleton.boneInverses[i]);
|
|
@@ -10616,7 +10631,7 @@ var GLTFMeshGpuInstancing = class {
|
|
|
10616
10631
|
const translationAttr = new Float32Array(mesh.count * 3);
|
|
10617
10632
|
const rotationAttr = new Float32Array(mesh.count * 4);
|
|
10618
10633
|
const scaleAttr = new Float32Array(mesh.count * 3);
|
|
10619
|
-
const matrix = new
|
|
10634
|
+
const matrix = new Matrix45();
|
|
10620
10635
|
const position = new Vector39();
|
|
10621
10636
|
const quaternion = new Quaternion4();
|
|
10622
10637
|
const scale = new Vector39();
|
|
@@ -10803,7 +10818,7 @@ var SceneExporter = class {
|
|
|
10803
10818
|
}
|
|
10804
10819
|
};
|
|
10805
10820
|
function localMatrix(object4) {
|
|
10806
|
-
return object4.matrixAutoUpdate ? new
|
|
10821
|
+
return object4.matrixAutoUpdate ? new Matrix46().compose(object4.position, object4.quaternion, object4.scale) : object4.matrix.clone();
|
|
10807
10822
|
}
|
|
10808
10823
|
function createSnapshot(root, gltf, bakeColors = false) {
|
|
10809
10824
|
const scene = new Scene3();
|
|
@@ -10915,7 +10930,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
|
|
|
10915
10930
|
const instanced = mesh;
|
|
10916
10931
|
if (instanced.isInstancedMesh) {
|
|
10917
10932
|
for (let i = 0; i < instanced.count; i++) {
|
|
10918
|
-
const matrix = new
|
|
10933
|
+
const matrix = new Matrix46();
|
|
10919
10934
|
instanced.getMatrixAt(i, matrix);
|
|
10920
10935
|
const color2 = instanced.instanceColor ? new Color7().fromBufferAttribute(instanced.instanceColor, i) : void 0;
|
|
10921
10936
|
addMesh(mesh, world.clone().multiply(matrix), color2);
|
|
@@ -10929,7 +10944,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
|
|
|
10929
10944
|
try {
|
|
10930
10945
|
const ancestors = [];
|
|
10931
10946
|
for (let parent = root.parent; parent; parent = parent.parent) ancestors.unshift(parent);
|
|
10932
|
-
const world = new
|
|
10947
|
+
const world = new Matrix46();
|
|
10933
10948
|
for (const ancestor of ancestors) {
|
|
10934
10949
|
if (!ancestor.visible) return { scene, dispose };
|
|
10935
10950
|
world.multiply(localMatrix(ancestor));
|
|
@@ -11535,7 +11550,7 @@ init_SceneObject();
|
|
|
11535
11550
|
init_Materials();
|
|
11536
11551
|
init_ModelObject();
|
|
11537
11552
|
init_DisplayPosition();
|
|
11538
|
-
import { Box2, Box3 as Box32, Color as Color10, DoubleSide as DoubleSide6, Float32BufferAttribute as Float32BufferAttribute8, Group, Matrix4 as
|
|
11553
|
+
import { Box2, Box3 as Box32, Color as Color10, DoubleSide as DoubleSide6, Float32BufferAttribute as Float32BufferAttribute8, Group, Matrix4 as Matrix49, Mesh as Mesh7, MeshBasicMaterial as MeshBasicMaterial6, PlaneGeometry as PlaneGeometry2, Vector2 as Vector24 } from "three";
|
|
11539
11554
|
init_ItemDefaults();
|
|
11540
11555
|
var GuiObject = class extends SceneObject {
|
|
11541
11556
|
constructor(textureLayers, options) {
|
|
@@ -11595,7 +11610,7 @@ var GuiObject = class extends SceneObject {
|
|
|
11595
11610
|
const bounds = new Box32();
|
|
11596
11611
|
item.iterateAllMeshes((mesh2) => {
|
|
11597
11612
|
mesh2.geometry.computeBoundingBox();
|
|
11598
|
-
bounds.union(mesh2.geometry.boundingBox.clone().applyMatrix4(new
|
|
11613
|
+
bounds.union(mesh2.geometry.boundingBox.clone().applyMatrix4(new Matrix49().multiplyMatrices(inverse, mesh2.matrixWorld)));
|
|
11599
11614
|
});
|
|
11600
11615
|
item.position.z = depth;
|
|
11601
11616
|
if (!bounds.isEmpty()) {
|
|
@@ -12215,7 +12230,7 @@ init_SpecialItems();
|
|
|
12215
12230
|
init_BlockStates();
|
|
12216
12231
|
init_MineRenderError();
|
|
12217
12232
|
init_util();
|
|
12218
|
-
import { Euler as
|
|
12233
|
+
import { Euler as Euler8 } from "three";
|
|
12219
12234
|
function matchesCondition(condition, state) {
|
|
12220
12235
|
return Object.entries(condition).every(([key, value]) => {
|
|
12221
12236
|
if (Array.isArray(value)) {
|
|
@@ -12311,7 +12326,7 @@ var BlockStateResolver = class _BlockStateResolver {
|
|
|
12311
12326
|
}
|
|
12312
12327
|
/** Converts blockstate rotations in degrees into the Euler rotation used by model rendering. */
|
|
12313
12328
|
static rotation(variant) {
|
|
12314
|
-
const rotation = new
|
|
12329
|
+
const rotation = new Euler8();
|
|
12315
12330
|
if (typeof variant.x !== "undefined") {
|
|
12316
12331
|
rotation.x = toRadians(clampRotationDegrees(variant.x));
|
|
12317
12332
|
}
|
|
@@ -12393,7 +12408,7 @@ var import_ts_deepmerge6 = __toESM(require_dist());
|
|
|
12393
12408
|
init_MineRenderError();
|
|
12394
12409
|
init_InstanceReference();
|
|
12395
12410
|
init_AssetKey();
|
|
12396
|
-
import { Euler as
|
|
12411
|
+
import { Euler as Euler9, Matrix4 as Matrix410, Quaternion as Quaternion5, Vector3 as Vector312 } from "three";
|
|
12397
12412
|
init_ModelCulling();
|
|
12398
12413
|
init_FluidGeometry();
|
|
12399
12414
|
init_MineRenderData();
|
|
@@ -12414,7 +12429,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
12414
12429
|
this._cullMask = 0;
|
|
12415
12430
|
this._fluidRules = {};
|
|
12416
12431
|
this._entities = [];
|
|
12417
|
-
this._entityPlacement = new
|
|
12432
|
+
this._entityPlacement = new Matrix410();
|
|
12418
12433
|
this._entityGeneration = 0;
|
|
12419
12434
|
this.options = (0, import_ts_deepmerge6.default)({}, _BlockObject.DEFAULT_OPTIONS, options ?? {});
|
|
12420
12435
|
this.variantPosition = options?.variantPosition ? [...options.variantPosition] : void 0;
|
|
@@ -12522,7 +12537,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
12522
12537
|
return true;
|
|
12523
12538
|
}
|
|
12524
12539
|
placeEntities() {
|
|
12525
|
-
const matrix = new
|
|
12540
|
+
const matrix = new Matrix410().makeTranslation(this.position.x - 8, this.position.y - 8, this.position.z - 8).multiply(this._entityPlacement);
|
|
12526
12541
|
for (const entity of this._entities) {
|
|
12527
12542
|
matrix.decompose(entity.position, entity.quaternion, entity.scale);
|
|
12528
12543
|
}
|
|
@@ -12549,7 +12564,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
12549
12564
|
const scale = new Vector312();
|
|
12550
12565
|
this.getModelMatrix(model).decompose(position, rotation, scale);
|
|
12551
12566
|
if (position.distanceToSquared(this.position) > 1e-10 || scale.distanceToSquared(new Vector312(1, 1, 1)) > 1e-10) return 0;
|
|
12552
|
-
return ModelCulling.toLocalMask(worldMask, new
|
|
12567
|
+
return ModelCulling.toLocalMask(worldMask, new Euler9().setFromQuaternion(rotation));
|
|
12553
12568
|
}
|
|
12554
12569
|
/** World-space face mask currently applied to this block. */
|
|
12555
12570
|
get cullMask() {
|
|
@@ -12625,7 +12640,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
12625
12640
|
})
|
|
12626
12641
|
);
|
|
12627
12642
|
const previous = this._fluidModel;
|
|
12628
|
-
const matrix = previous ? this.getModelMatrix(previous) : new
|
|
12643
|
+
const matrix = previous ? this.getModelMatrix(previous) : new Matrix410().makeTranslation(...this.position.toArray());
|
|
12629
12644
|
if (isInstanceReference(replacement)) replacement.setMatrix(matrix);
|
|
12630
12645
|
else matrix.decompose(replacement.position, replacement.quaternion, replacement.scale);
|
|
12631
12646
|
this._models = this._models.filter((model) => model !== previous);
|
|
@@ -12775,7 +12790,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
12775
12790
|
setPositionRotationScaleAt(index, position, rotation, scale) {
|
|
12776
12791
|
super.setPositionRotationScaleAt(index, position, rotation, scale);
|
|
12777
12792
|
}
|
|
12778
|
-
getMatrixAt(index, matrix = new
|
|
12793
|
+
getMatrixAt(index, matrix = new Matrix410()) {
|
|
12779
12794
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
12780
12795
|
const child = this._models[0];
|
|
12781
12796
|
if (child && isModelObject(child)) {
|
|
@@ -13279,13 +13294,13 @@ init_ModelObject();
|
|
|
13279
13294
|
init_nbt();
|
|
13280
13295
|
|
|
13281
13296
|
// src/renderer/FlyControls.ts
|
|
13282
|
-
import { Controls, Euler as
|
|
13297
|
+
import { Controls, Euler as Euler10, MathUtils as MathUtils2, Quaternion as Quaternion6, Vector3 as Vector313 } from "three";
|
|
13283
13298
|
var VANILLA_FLY_SPEED = 10.89;
|
|
13284
13299
|
var PITCH_LIMIT = Math.PI / 2;
|
|
13285
13300
|
var MOVE_EPSILON = 1e-6;
|
|
13286
13301
|
var MAX_STEP_SECONDS = 0.1;
|
|
13287
13302
|
var CLICK_SLOP_PIXELS = 4;
|
|
13288
|
-
var _euler = new
|
|
13303
|
+
var _euler = new Euler10(0, 0, 0, "YXZ");
|
|
13289
13304
|
var _forward = new Vector313();
|
|
13290
13305
|
var _right = new Vector313();
|
|
13291
13306
|
var _targetVelocity = new Vector313();
|
|
@@ -17247,7 +17262,7 @@ init_CubeFace();
|
|
|
17247
17262
|
init_AssetKey();
|
|
17248
17263
|
init_Models();
|
|
17249
17264
|
init_CubeFace();
|
|
17250
|
-
import { BufferAttribute as BufferAttribute7, BufferGeometry as BufferGeometry8, Matrix4 as
|
|
17265
|
+
import { BufferAttribute as BufferAttribute7, BufferGeometry as BufferGeometry8, Matrix4 as Matrix411, Vector3 as Vector316 } from "three";
|
|
17251
17266
|
init_ModelCulling();
|
|
17252
17267
|
init_ModelObject();
|
|
17253
17268
|
init_UVMapper();
|
|
@@ -17385,7 +17400,7 @@ var SectionModels = class {
|
|
|
17385
17400
|
});
|
|
17386
17401
|
await object4.init();
|
|
17387
17402
|
let geometry = object4.children[0].geometry;
|
|
17388
|
-
geometry.applyMatrix4(new
|
|
17403
|
+
geometry.applyMatrix4(new Matrix411().makeRotationFromEuler(rotation));
|
|
17389
17404
|
object4.clear();
|
|
17390
17405
|
const keep = [];
|
|
17391
17406
|
const cullFaces = [];
|
|
@@ -17505,7 +17520,7 @@ import { Vector3 as Vector318 } from "three";
|
|
|
17505
17520
|
|
|
17506
17521
|
// src/world/_picking/Picking.ts
|
|
17507
17522
|
init_three();
|
|
17508
|
-
import { Matrix3 as Matrix33, Matrix4 as
|
|
17523
|
+
import { Matrix3 as Matrix33, Matrix4 as Matrix412 } from "three";
|
|
17509
17524
|
function pickableMeshes(root, scene, raycaster) {
|
|
17510
17525
|
const result = [];
|
|
17511
17526
|
let attached = false;
|
|
@@ -17532,7 +17547,7 @@ function hitNormal(hit) {
|
|
|
17532
17547
|
const mesh = hit.object;
|
|
17533
17548
|
const matrix = mesh.matrixWorld.clone();
|
|
17534
17549
|
if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
|
|
17535
|
-
const instance = new
|
|
17550
|
+
const instance = new Matrix412();
|
|
17536
17551
|
mesh.getMatrixAt(hit.instanceId, instance);
|
|
17537
17552
|
matrix.multiply(instance);
|
|
17538
17553
|
}
|