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/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) {
|
|
@@ -5152,7 +5157,7 @@ var init_SceneObject = __esm({
|
|
|
5152
5157
|
});
|
|
5153
5158
|
|
|
5154
5159
|
// src/entity/scene/EntityObject.ts
|
|
5155
|
-
import { Color as Color3,
|
|
5160
|
+
import { Color as Color3, Object3D as Object3D3 } from "three";
|
|
5156
5161
|
function isEntityObject(obj) {
|
|
5157
5162
|
return obj.isEntityObject;
|
|
5158
5163
|
}
|
|
@@ -5255,13 +5260,14 @@ var init_EntityObject = __esm({
|
|
|
5255
5260
|
}
|
|
5256
5261
|
/**
|
|
5257
5262
|
* Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
|
|
5258
|
-
* Offsets apply to the baked pose in the clip's layer (`main` by default)
|
|
5263
|
+
* Offsets apply to the baked pose in the clip's layer (`main` by default) and its repeated draws.
|
|
5264
|
+
* A `main` clip also poses every selected layer without a clip of its own.
|
|
5259
5265
|
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
5260
5266
|
*/
|
|
5261
5267
|
playAnimation(animation, options) {
|
|
5262
5268
|
this.playAnimations([animation], options);
|
|
5263
5269
|
}
|
|
5264
|
-
/** Plays
|
|
5270
|
+
/** Plays clips with a shared clock and no blending. Selected layers without their own clip follow `main`. */
|
|
5265
5271
|
playAnimations(animations, options) {
|
|
5266
5272
|
const targets = /* @__PURE__ */ new Set();
|
|
5267
5273
|
const selections = animations.map((animation) => {
|
|
@@ -5272,6 +5278,8 @@ var init_EntityObject = __esm({
|
|
|
5272
5278
|
if (!names.length) throw new Error(`Entity ${this.entity.id} has no selected animation layer "${layer}"`);
|
|
5273
5279
|
return { animation, names };
|
|
5274
5280
|
});
|
|
5281
|
+
const main = selections.find(({ animation }) => (animation.layer ?? "main") === "main");
|
|
5282
|
+
if (main) main.names.push(...Object.keys(this.entityLayers).filter((name) => !targets.has(name.split("#")[0])));
|
|
5275
5283
|
this.createMeshes();
|
|
5276
5284
|
this.stopAnimation();
|
|
5277
5285
|
for (const { animation, names } of selections) {
|
|
@@ -5331,24 +5339,26 @@ var init_EntityObject = __esm({
|
|
|
5331
5339
|
createMeshes(force = false) {
|
|
5332
5340
|
if (this.meshesCreated && !force) return;
|
|
5333
5341
|
const modelRoot = new Object3D3();
|
|
5342
|
+
let transformNode = modelRoot;
|
|
5334
5343
|
const transform = this.options.flip === void 0 ? this.entity.transform : void 0;
|
|
5335
5344
|
if (transform) {
|
|
5336
|
-
for (const op of transform) {
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5345
|
+
for (const [index, op] of transform.entries()) {
|
|
5346
|
+
if (index > 0) {
|
|
5347
|
+
const child = new Object3D3();
|
|
5348
|
+
transformNode.add(child);
|
|
5349
|
+
transformNode = child;
|
|
5350
|
+
}
|
|
5351
|
+
if ("scale" in op) transformNode.scale.set(...op.scale);
|
|
5352
|
+
else if ("translate" in op) transformNode.position.set(...op.translate);
|
|
5353
|
+
else transformNode.rotation.set(...op.rotate, "ZYX");
|
|
5342
5354
|
}
|
|
5343
|
-
modelRoot.matrixWorldNeedsUpdate = true;
|
|
5344
|
-
modelRoot.matrixAutoUpdate = false;
|
|
5345
5355
|
} else if (this.options.flip ?? true) {
|
|
5346
5356
|
modelRoot.scale.set(-1, -1, 1);
|
|
5347
5357
|
}
|
|
5348
5358
|
this.add(modelRoot);
|
|
5349
5359
|
Object.entries(this.entityLayers).forEach(([name, layer], index) => {
|
|
5350
5360
|
const group = this.createGroup(`layer:${name}`);
|
|
5351
|
-
|
|
5361
|
+
transformNode.add(group);
|
|
5352
5362
|
const inward = !Materials.entityModeCulls(layer.render ?? layer.layer.render);
|
|
5353
5363
|
this.createPart("root", layer.layer.root, group, layer.layer.texture, Materials.MISSING_TEXTURE, index, inward, this.options.faces?.[name]);
|
|
5354
5364
|
});
|
|
@@ -6474,7 +6484,7 @@ var init_PlayerHeadTextures = __esm({
|
|
|
6474
6484
|
});
|
|
6475
6485
|
|
|
6476
6486
|
// src/model/SpecialItems.ts
|
|
6477
|
-
import { Euler as
|
|
6487
|
+
import { Euler as Euler6, Matrix4 as Matrix47 } from "three";
|
|
6478
6488
|
var SpecialItems;
|
|
6479
6489
|
var init_SpecialItems = __esm({
|
|
6480
6490
|
"src/model/SpecialItems.ts"() {
|
|
@@ -6515,8 +6525,8 @@ var init_SpecialItems = __esm({
|
|
|
6515
6525
|
const sideTextures = DecoratedPots.getSideTextures(components["minecraft:pot_decorations"], root);
|
|
6516
6526
|
const baseTexture = texture("decorated_pot_base", "decorated_pot");
|
|
6517
6527
|
const [base, sides] = await Promise.all([
|
|
6518
|
-
load("decorated_pot_base", baseTexture, new
|
|
6519
|
-
load("decorated_pot_sides", texture("decorated_pot_side", "decorated_pot"), new
|
|
6528
|
+
load("decorated_pot_base", baseTexture, new Matrix47()),
|
|
6529
|
+
load("decorated_pot_sides", texture("decorated_pot_side", "decorated_pot"), new Matrix47())
|
|
6520
6530
|
]);
|
|
6521
6531
|
const layers = {
|
|
6522
6532
|
base: { key: base.model.key, texture: baseTexture, layer: base.model.layer, render: "solid" }
|
|
@@ -6544,7 +6554,7 @@ var init_SpecialItems = __esm({
|
|
|
6544
6554
|
const part = await load(
|
|
6545
6555
|
"player_head",
|
|
6546
6556
|
skin.texture,
|
|
6547
|
-
new
|
|
6557
|
+
new Matrix47().makeTranslation(8, 0, 8).multiply(new Matrix47().makeScale(-1, -1, 1)),
|
|
6548
6558
|
{ head: [0, Math.PI, 0] }
|
|
6549
6559
|
);
|
|
6550
6560
|
const main = { ...part.model, texture: skin.texture, render: "translucent" };
|
|
@@ -6561,7 +6571,7 @@ var init_SpecialItems = __esm({
|
|
|
6561
6571
|
const statue = await load(
|
|
6562
6572
|
special.pose === "standing" ? "copper_golem" : `copper_golem_${special.pose}`,
|
|
6563
6573
|
key,
|
|
6564
|
-
new
|
|
6574
|
+
new Matrix47().makeTranslation(8, 24, 8).multiply(new Matrix47().makeScale(-1, -1, 1))
|
|
6565
6575
|
);
|
|
6566
6576
|
const pose = statue.model.layer.root.pose;
|
|
6567
6577
|
statue.rotations.root = [pose.rotation[0], Math.PI, Math.PI];
|
|
@@ -6577,7 +6587,7 @@ var init_SpecialItems = __esm({
|
|
|
6577
6587
|
const part = await load(
|
|
6578
6588
|
trident ? "trident" : "conduit",
|
|
6579
6589
|
texture(trident ? "trident" : "conduit/base", ""),
|
|
6580
|
-
trident ? new
|
|
6590
|
+
trident ? new Matrix47().makeScale(1, -1, -1) : new Matrix47().makeTranslation(8, 8, 8),
|
|
6581
6591
|
{},
|
|
6582
6592
|
trident ? ["main"] : ["shell"]
|
|
6583
6593
|
);
|
|
@@ -6598,7 +6608,7 @@ var init_SpecialItems = __esm({
|
|
|
6598
6608
|
const patterns = await BannerPatterns.getLayers(components["minecraft:banner_patterns"], banner ? "banner" : "shield", root);
|
|
6599
6609
|
const patterned = banner || color2 !== void 0 || patterns.length > 0;
|
|
6600
6610
|
const baseTexture = texture(banner ? "banner_base" : patterned ? "shield_base" : "shield_base_nopattern", "");
|
|
6601
|
-
const transform = banner ? new
|
|
6611
|
+
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);
|
|
6602
6612
|
const part = await load(banner ? "standing_banner" : "shield", baseTexture, transform, {}, banner ? ["main", "flag"] : ["main"]);
|
|
6603
6613
|
const layers = Object.fromEntries(Object.entries(part.model.layers ?? { main: part.model }).map(([name, layer]) => [name, { ...layer, render: "solid" }]));
|
|
6604
6614
|
let overlay2;
|
|
@@ -6636,7 +6646,7 @@ var init_SpecialItems = __esm({
|
|
|
6636
6646
|
case "minecraft:chest":
|
|
6637
6647
|
case "chest": {
|
|
6638
6648
|
const angle = -(special.openness ?? 0) * Math.PI / 2;
|
|
6639
|
-
const chest = await load("chest", texture(special.texture, "chest"), new
|
|
6649
|
+
const chest = await load("chest", texture(special.texture, "chest"), new Matrix47(), {
|
|
6640
6650
|
lid: [angle, 0, 0],
|
|
6641
6651
|
lock: [angle, 0, 0]
|
|
6642
6652
|
});
|
|
@@ -6658,18 +6668,18 @@ var init_SpecialItems = __esm({
|
|
|
6658
6668
|
if (!Object.prototype.hasOwnProperty.call(directions, orientation)) throw new Error(`Unsupported shulker-box orientation ${orientation}`);
|
|
6659
6669
|
if (typeof openness !== "number" || !Number.isFinite(openness)) throw new Error("Shulker-box openness must be finite");
|
|
6660
6670
|
if (typeof special.texture !== "string" || !special.texture) throw new Error("Shulker-box texture is required");
|
|
6661
|
-
const transform = new
|
|
6671
|
+
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));
|
|
6662
6672
|
const box = await load("shulker_box", texture(special.texture, "shulker"), transform, { lid: [0, openness * Math.PI * 1.5, 0] });
|
|
6663
6673
|
box.positions = { lid: [0, 24 - openness * 8, 0] };
|
|
6664
6674
|
return [box];
|
|
6665
6675
|
}
|
|
6666
6676
|
case "minecraft:bed":
|
|
6667
6677
|
case "bed": {
|
|
6668
|
-
const transform = new
|
|
6678
|
+
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));
|
|
6669
6679
|
const key = texture(special.texture, "bed");
|
|
6670
6680
|
return Promise.all([
|
|
6671
6681
|
load("bed_head", key, transform),
|
|
6672
|
-
load("bed_foot", key, new
|
|
6682
|
+
load("bed_foot", key, new Matrix47().makeTranslation(0, 0, -16).multiply(transform))
|
|
6673
6683
|
]);
|
|
6674
6684
|
}
|
|
6675
6685
|
case "minecraft:head":
|
|
@@ -6694,7 +6704,7 @@ var init_SpecialItems = __esm({
|
|
|
6694
6704
|
return [await load(
|
|
6695
6705
|
id,
|
|
6696
6706
|
special.texture ? texture(special.texture, "") : void 0,
|
|
6697
|
-
new
|
|
6707
|
+
new Matrix47().makeTranslation(8, 0, 8).multiply(new Matrix47().makeScale(-1, -1, 1)),
|
|
6698
6708
|
rotations
|
|
6699
6709
|
)];
|
|
6700
6710
|
}
|
|
@@ -6941,7 +6951,7 @@ var init_ItemGlint = __esm({
|
|
|
6941
6951
|
});
|
|
6942
6952
|
|
|
6943
6953
|
// src/model/scene/ModelObject.ts
|
|
6944
|
-
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, DoubleSide as DoubleSide5, Euler as
|
|
6954
|
+
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, DoubleSide as DoubleSide5, Euler as Euler7, FrontSide as FrontSide3, Matrix4 as Matrix48 } from "three";
|
|
6945
6955
|
function isModelObject(obj) {
|
|
6946
6956
|
return obj.isModelObject;
|
|
6947
6957
|
}
|
|
@@ -7009,16 +7019,21 @@ var init_ModelObject = __esm({
|
|
|
7009
7019
|
const special = this.originalModel.special;
|
|
7010
7020
|
if (special) {
|
|
7011
7021
|
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
7012
|
-
const
|
|
7013
|
-
|
|
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);
|
|
7014
7031
|
try {
|
|
7015
7032
|
const targets = [];
|
|
7016
7033
|
for (const part of parts2) {
|
|
7017
7034
|
const object4 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe, tints: part.tints, faces: part.faces });
|
|
7018
|
-
object4.matrix.
|
|
7019
|
-
object4
|
|
7020
|
-
object4.matrixAutoUpdate = false;
|
|
7021
|
-
this.add(object4);
|
|
7035
|
+
object4.matrix.multiplyMatrices(offset, part.transform).decompose(object4.position, object4.quaternion, object4.scale);
|
|
7036
|
+
display.add(object4);
|
|
7022
7037
|
await object4.init(part.material);
|
|
7023
7038
|
object4.iterateAllMeshes((mesh) => {
|
|
7024
7039
|
const source = mesh.material;
|
|
@@ -7102,7 +7117,7 @@ var init_ModelObject = __esm({
|
|
|
7102
7117
|
elGeo.clearGroups();
|
|
7103
7118
|
}
|
|
7104
7119
|
if (this.options.uvLockRotation) {
|
|
7105
|
-
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new
|
|
7120
|
+
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler7(...this.options.uvLockRotation));
|
|
7106
7121
|
}
|
|
7107
7122
|
UVMapper.setAtlasUvBounds(elGeo, el.faces, this.atlas);
|
|
7108
7123
|
if (this.options.tints) {
|
|
@@ -7119,13 +7134,13 @@ var init_ModelObject = __esm({
|
|
|
7119
7134
|
}
|
|
7120
7135
|
elGeo.setAttribute("color", new BufferAttribute5(colors, 3));
|
|
7121
7136
|
}
|
|
7122
|
-
elGeo.applyMatrix4(new
|
|
7123
|
-
elGeo.applyMatrix4(new
|
|
7137
|
+
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));
|
|
7138
|
+
elGeo.applyMatrix4(new Matrix48().makeTranslation(el.from[0], el.from[1], el.from[2]));
|
|
7124
7139
|
if (el.rotation) {
|
|
7125
7140
|
applyElementRotation(el.rotation, elGeo);
|
|
7126
7141
|
}
|
|
7127
7142
|
if (this.hasGlint) ItemGlint.mapUvs(elGeo, el.faces, this.atlas, this.originalModel.itemId, this.options.displayPosition);
|
|
7128
|
-
elGeo.applyMatrix4(new
|
|
7143
|
+
elGeo.applyMatrix4(new Matrix48().makeTranslation(-8, -8, -8));
|
|
7129
7144
|
if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
|
|
7130
7145
|
if (this.options.mergeMeshes) {
|
|
7131
7146
|
allGeos.push(elGeo);
|
|
@@ -8021,7 +8036,7 @@ init_EntityObject();
|
|
|
8021
8036
|
init_MineRenderError();
|
|
8022
8037
|
|
|
8023
8038
|
// src/export/SceneExporter.ts
|
|
8024
|
-
import { ClampToEdgeWrapping as ClampToEdgeWrapping2, Color as Color7, Float32BufferAttribute as Float32BufferAttribute3, Matrix4 as
|
|
8039
|
+
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";
|
|
8025
8040
|
|
|
8026
8041
|
// ../../node_modules/three/examples/jsm/exporters/OBJExporter.js
|
|
8027
8042
|
import {
|
|
@@ -8629,7 +8644,7 @@ import {
|
|
|
8629
8644
|
LinearMipmapLinearFilter,
|
|
8630
8645
|
LinearMipmapNearestFilter,
|
|
8631
8646
|
MathUtils,
|
|
8632
|
-
Matrix4 as
|
|
8647
|
+
Matrix4 as Matrix45,
|
|
8633
8648
|
MirroredRepeatWrapping,
|
|
8634
8649
|
NearestFilter as NearestFilter2,
|
|
8635
8650
|
NearestMipmapLinearFilter,
|
|
@@ -9997,7 +10012,7 @@ var GLTFWriter = class {
|
|
|
9997
10012
|
if (rootJoint === void 0) return null;
|
|
9998
10013
|
const joints = [];
|
|
9999
10014
|
const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16);
|
|
10000
|
-
const temporaryBoneInverse = new
|
|
10015
|
+
const temporaryBoneInverse = new Matrix45();
|
|
10001
10016
|
for (let i = 0; i < skeleton.bones.length; ++i) {
|
|
10002
10017
|
joints.push(nodeMap.get(skeleton.bones[i]));
|
|
10003
10018
|
temporaryBoneInverse.copy(skeleton.boneInverses[i]);
|
|
@@ -10583,7 +10598,7 @@ var GLTFMeshGpuInstancing = class {
|
|
|
10583
10598
|
const translationAttr = new Float32Array(mesh.count * 3);
|
|
10584
10599
|
const rotationAttr = new Float32Array(mesh.count * 4);
|
|
10585
10600
|
const scaleAttr = new Float32Array(mesh.count * 3);
|
|
10586
|
-
const matrix = new
|
|
10601
|
+
const matrix = new Matrix45();
|
|
10587
10602
|
const position = new Vector39();
|
|
10588
10603
|
const quaternion = new Quaternion4();
|
|
10589
10604
|
const scale = new Vector39();
|
|
@@ -10770,7 +10785,7 @@ var SceneExporter = class {
|
|
|
10770
10785
|
}
|
|
10771
10786
|
};
|
|
10772
10787
|
function localMatrix(object4) {
|
|
10773
|
-
return object4.matrixAutoUpdate ? new
|
|
10788
|
+
return object4.matrixAutoUpdate ? new Matrix46().compose(object4.position, object4.quaternion, object4.scale) : object4.matrix.clone();
|
|
10774
10789
|
}
|
|
10775
10790
|
function createSnapshot(root, gltf, bakeColors = false) {
|
|
10776
10791
|
const scene = new Scene3();
|
|
@@ -10882,7 +10897,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
|
|
|
10882
10897
|
const instanced = mesh;
|
|
10883
10898
|
if (instanced.isInstancedMesh) {
|
|
10884
10899
|
for (let i = 0; i < instanced.count; i++) {
|
|
10885
|
-
const matrix = new
|
|
10900
|
+
const matrix = new Matrix46();
|
|
10886
10901
|
instanced.getMatrixAt(i, matrix);
|
|
10887
10902
|
const color2 = instanced.instanceColor ? new Color7().fromBufferAttribute(instanced.instanceColor, i) : void 0;
|
|
10888
10903
|
addMesh(mesh, world.clone().multiply(matrix), color2);
|
|
@@ -10896,7 +10911,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
|
|
|
10896
10911
|
try {
|
|
10897
10912
|
const ancestors = [];
|
|
10898
10913
|
for (let parent = root.parent; parent; parent = parent.parent) ancestors.unshift(parent);
|
|
10899
|
-
const world = new
|
|
10914
|
+
const world = new Matrix46();
|
|
10900
10915
|
for (const ancestor of ancestors) {
|
|
10901
10916
|
if (!ancestor.visible) return { scene, dispose };
|
|
10902
10917
|
world.multiply(localMatrix(ancestor));
|
|
@@ -11502,7 +11517,7 @@ init_SceneObject();
|
|
|
11502
11517
|
init_Materials();
|
|
11503
11518
|
init_ModelObject();
|
|
11504
11519
|
init_DisplayPosition();
|
|
11505
|
-
import { Box2, Box3 as Box32, Color as Color10, DoubleSide as DoubleSide6, Float32BufferAttribute as Float32BufferAttribute8, Group, Matrix4 as
|
|
11520
|
+
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";
|
|
11506
11521
|
init_ItemDefaults();
|
|
11507
11522
|
var GuiObject = class extends SceneObject {
|
|
11508
11523
|
constructor(textureLayers, options) {
|
|
@@ -11562,7 +11577,7 @@ var GuiObject = class extends SceneObject {
|
|
|
11562
11577
|
const bounds = new Box32();
|
|
11563
11578
|
item.iterateAllMeshes((mesh2) => {
|
|
11564
11579
|
mesh2.geometry.computeBoundingBox();
|
|
11565
|
-
bounds.union(mesh2.geometry.boundingBox.clone().applyMatrix4(new
|
|
11580
|
+
bounds.union(mesh2.geometry.boundingBox.clone().applyMatrix4(new Matrix49().multiplyMatrices(inverse, mesh2.matrixWorld)));
|
|
11566
11581
|
});
|
|
11567
11582
|
item.position.z = depth;
|
|
11568
11583
|
if (!bounds.isEmpty()) {
|
|
@@ -12182,7 +12197,7 @@ init_SpecialItems();
|
|
|
12182
12197
|
init_BlockStates();
|
|
12183
12198
|
init_MineRenderError();
|
|
12184
12199
|
init_util();
|
|
12185
|
-
import { Euler as
|
|
12200
|
+
import { Euler as Euler8 } from "three";
|
|
12186
12201
|
function matchesCondition(condition, state) {
|
|
12187
12202
|
return Object.entries(condition).every(([key, value]) => {
|
|
12188
12203
|
if (Array.isArray(value)) {
|
|
@@ -12278,7 +12293,7 @@ var BlockStateResolver = class _BlockStateResolver {
|
|
|
12278
12293
|
}
|
|
12279
12294
|
/** Converts blockstate rotations in degrees into the Euler rotation used by model rendering. */
|
|
12280
12295
|
static rotation(variant) {
|
|
12281
|
-
const rotation = new
|
|
12296
|
+
const rotation = new Euler8();
|
|
12282
12297
|
if (typeof variant.x !== "undefined") {
|
|
12283
12298
|
rotation.x = toRadians(clampRotationDegrees(variant.x));
|
|
12284
12299
|
}
|
|
@@ -12360,7 +12375,7 @@ var import_ts_deepmerge6 = __toESM(require_dist());
|
|
|
12360
12375
|
init_MineRenderError();
|
|
12361
12376
|
init_InstanceReference();
|
|
12362
12377
|
init_AssetKey();
|
|
12363
|
-
import { Euler as
|
|
12378
|
+
import { Euler as Euler9, Matrix4 as Matrix410, Quaternion as Quaternion5, Vector3 as Vector312 } from "three";
|
|
12364
12379
|
init_ModelCulling();
|
|
12365
12380
|
init_FluidGeometry();
|
|
12366
12381
|
init_MineRenderData();
|
|
@@ -12381,7 +12396,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12381
12396
|
this._cullMask = 0;
|
|
12382
12397
|
this._fluidRules = {};
|
|
12383
12398
|
this._entities = [];
|
|
12384
|
-
this._entityPlacement = new
|
|
12399
|
+
this._entityPlacement = new Matrix410();
|
|
12385
12400
|
this._entityGeneration = 0;
|
|
12386
12401
|
this.options = (0, import_ts_deepmerge6.default)({}, _BlockObject.DEFAULT_OPTIONS, options ?? {});
|
|
12387
12402
|
this.variantPosition = options?.variantPosition ? [...options.variantPosition] : void 0;
|
|
@@ -12484,7 +12499,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12484
12499
|
return true;
|
|
12485
12500
|
}
|
|
12486
12501
|
placeEntities() {
|
|
12487
|
-
const matrix = new
|
|
12502
|
+
const matrix = new Matrix410().makeTranslation(this.position.x - 8, this.position.y - 8, this.position.z - 8).multiply(this._entityPlacement);
|
|
12488
12503
|
for (const entity of this._entities) {
|
|
12489
12504
|
matrix.decompose(entity.position, entity.quaternion, entity.scale);
|
|
12490
12505
|
}
|
|
@@ -12511,7 +12526,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12511
12526
|
const scale = new Vector312();
|
|
12512
12527
|
this.getModelMatrix(model).decompose(position, rotation, scale);
|
|
12513
12528
|
if (position.distanceToSquared(this.position) > 1e-10 || scale.distanceToSquared(new Vector312(1, 1, 1)) > 1e-10) return 0;
|
|
12514
|
-
return ModelCulling.toLocalMask(worldMask, new
|
|
12529
|
+
return ModelCulling.toLocalMask(worldMask, new Euler9().setFromQuaternion(rotation));
|
|
12515
12530
|
}
|
|
12516
12531
|
/** World-space face mask currently applied to this block. */
|
|
12517
12532
|
get cullMask() {
|
|
@@ -12587,7 +12602,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12587
12602
|
})
|
|
12588
12603
|
);
|
|
12589
12604
|
const previous = this._fluidModel;
|
|
12590
|
-
const matrix = previous ? this.getModelMatrix(previous) : new
|
|
12605
|
+
const matrix = previous ? this.getModelMatrix(previous) : new Matrix410().makeTranslation(...this.position.toArray());
|
|
12591
12606
|
if (isInstanceReference(replacement)) replacement.setMatrix(matrix);
|
|
12592
12607
|
else matrix.decompose(replacement.position, replacement.quaternion, replacement.scale);
|
|
12593
12608
|
this._models = this._models.filter((model) => model !== previous);
|
|
@@ -12737,7 +12752,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12737
12752
|
setPositionRotationScaleAt(index, position, rotation, scale) {
|
|
12738
12753
|
super.setPositionRotationScaleAt(index, position, rotation, scale);
|
|
12739
12754
|
}
|
|
12740
|
-
getMatrixAt(index, matrix = new
|
|
12755
|
+
getMatrixAt(index, matrix = new Matrix410()) {
|
|
12741
12756
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
12742
12757
|
const child = this._models[0];
|
|
12743
12758
|
if (child && isModelObject(child)) {
|
|
@@ -13245,13 +13260,13 @@ init_ModelObject();
|
|
|
13245
13260
|
init_nbt();
|
|
13246
13261
|
|
|
13247
13262
|
// src/renderer/FlyControls.ts
|
|
13248
|
-
import { Controls, Euler as
|
|
13263
|
+
import { Controls, Euler as Euler10, MathUtils as MathUtils2, Quaternion as Quaternion6, Vector3 as Vector313 } from "three";
|
|
13249
13264
|
var VANILLA_FLY_SPEED = 10.89;
|
|
13250
13265
|
var PITCH_LIMIT = Math.PI / 2;
|
|
13251
13266
|
var MOVE_EPSILON = 1e-6;
|
|
13252
13267
|
var MAX_STEP_SECONDS = 0.1;
|
|
13253
13268
|
var CLICK_SLOP_PIXELS = 4;
|
|
13254
|
-
var _euler = new
|
|
13269
|
+
var _euler = new Euler10(0, 0, 0, "YXZ");
|
|
13255
13270
|
var _forward = new Vector313();
|
|
13256
13271
|
var _right = new Vector313();
|
|
13257
13272
|
var _targetVelocity = new Vector313();
|
|
@@ -17211,7 +17226,7 @@ init_CubeFace();
|
|
|
17211
17226
|
init_AssetKey();
|
|
17212
17227
|
init_Models();
|
|
17213
17228
|
init_CubeFace();
|
|
17214
|
-
import { BufferAttribute as BufferAttribute7, BufferGeometry as BufferGeometry8, Matrix4 as
|
|
17229
|
+
import { BufferAttribute as BufferAttribute7, BufferGeometry as BufferGeometry8, Matrix4 as Matrix411, Vector3 as Vector316 } from "three";
|
|
17215
17230
|
init_ModelCulling();
|
|
17216
17231
|
init_ModelObject();
|
|
17217
17232
|
init_UVMapper();
|
|
@@ -17349,7 +17364,7 @@ var SectionModels = class {
|
|
|
17349
17364
|
});
|
|
17350
17365
|
await object4.init();
|
|
17351
17366
|
let geometry = object4.children[0].geometry;
|
|
17352
|
-
geometry.applyMatrix4(new
|
|
17367
|
+
geometry.applyMatrix4(new Matrix411().makeRotationFromEuler(rotation));
|
|
17353
17368
|
object4.clear();
|
|
17354
17369
|
const keep = [];
|
|
17355
17370
|
const cullFaces = [];
|
|
@@ -17469,7 +17484,7 @@ import { Vector3 as Vector318 } from "three";
|
|
|
17469
17484
|
|
|
17470
17485
|
// src/world/_picking/Picking.ts
|
|
17471
17486
|
init_three();
|
|
17472
|
-
import { Matrix3 as Matrix33, Matrix4 as
|
|
17487
|
+
import { Matrix3 as Matrix33, Matrix4 as Matrix412 } from "three";
|
|
17473
17488
|
function pickableMeshes(root, scene, raycaster) {
|
|
17474
17489
|
const result = [];
|
|
17475
17490
|
let attached = false;
|
|
@@ -17496,7 +17511,7 @@ function hitNormal(hit) {
|
|
|
17496
17511
|
const mesh = hit.object;
|
|
17497
17512
|
const matrix = mesh.matrixWorld.clone();
|
|
17498
17513
|
if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
|
|
17499
|
-
const instance = new
|
|
17514
|
+
const instance = new Matrix412();
|
|
17500
17515
|
mesh.getMatrixAt(hit.instanceId, instance);
|
|
17501
17516
|
matrix.multiply(instance);
|
|
17502
17517
|
}
|