minerender 2.1.0-alpha.123 → 2.1.0-alpha.125
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 +4 -3
- package/dist/browser/index.d.ts +4 -3
- package/dist/browser/index.js +23 -15
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +66 -58
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +24 -16
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +4 -3
- package/dist/node/index.d.ts +4 -3
- package/dist/node/index.js +23 -15
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +66 -58
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -3867,11 +3867,14 @@ var init_UVMapper = __esm({
|
|
|
3867
3867
|
});
|
|
3868
3868
|
}
|
|
3869
3869
|
static fillMissingTextureKeys(textures, target) {
|
|
3870
|
-
for (
|
|
3871
|
-
let
|
|
3872
|
-
|
|
3873
|
-
|
|
3870
|
+
for (const key in textures) {
|
|
3871
|
+
let name = key;
|
|
3872
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3873
|
+
while (textures[name]?.startsWith("#") && !seen.has(name)) {
|
|
3874
|
+
seen.add(name);
|
|
3875
|
+
name = textures[name].substr(1);
|
|
3874
3876
|
}
|
|
3877
|
+
if (name !== key) target[key] = target[name];
|
|
3875
3878
|
}
|
|
3876
3879
|
return target;
|
|
3877
3880
|
}
|
|
@@ -5149,7 +5152,7 @@ var init_SceneObject = __esm({
|
|
|
5149
5152
|
});
|
|
5150
5153
|
|
|
5151
5154
|
// src/entity/scene/EntityObject.ts
|
|
5152
|
-
import { Color as Color3,
|
|
5155
|
+
import { Color as Color3, Object3D as Object3D3 } from "three";
|
|
5153
5156
|
function isEntityObject(obj) {
|
|
5154
5157
|
return obj.isEntityObject;
|
|
5155
5158
|
}
|
|
@@ -5252,13 +5255,14 @@ var init_EntityObject = __esm({
|
|
|
5252
5255
|
}
|
|
5253
5256
|
/**
|
|
5254
5257
|
* Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
|
|
5255
|
-
* Offsets apply to the baked pose in the clip's layer (`main` by default)
|
|
5258
|
+
* Offsets apply to the baked pose in the clip's layer (`main` by default) and its repeated draws.
|
|
5259
|
+
* A `main` clip also poses every selected layer without a clip of its own.
|
|
5256
5260
|
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
5257
5261
|
*/
|
|
5258
5262
|
playAnimation(animation, options) {
|
|
5259
5263
|
this.playAnimations([animation], options);
|
|
5260
5264
|
}
|
|
5261
|
-
/** Plays
|
|
5265
|
+
/** Plays clips with a shared clock and no blending. Selected layers without their own clip follow `main`. */
|
|
5262
5266
|
playAnimations(animations, options) {
|
|
5263
5267
|
const targets = /* @__PURE__ */ new Set();
|
|
5264
5268
|
const selections = animations.map((animation) => {
|
|
@@ -5269,6 +5273,8 @@ var init_EntityObject = __esm({
|
|
|
5269
5273
|
if (!names.length) throw new Error(`Entity ${this.entity.id} has no selected animation layer "${layer}"`);
|
|
5270
5274
|
return { animation, names };
|
|
5271
5275
|
});
|
|
5276
|
+
const main = selections.find(({ animation }) => (animation.layer ?? "main") === "main");
|
|
5277
|
+
if (main) main.names.push(...Object.keys(this.entityLayers).filter((name) => !targets.has(name.split("#")[0])));
|
|
5272
5278
|
this.createMeshes();
|
|
5273
5279
|
this.stopAnimation();
|
|
5274
5280
|
for (const { animation, names } of selections) {
|
|
@@ -5328,24 +5334,26 @@ var init_EntityObject = __esm({
|
|
|
5328
5334
|
createMeshes(force = false) {
|
|
5329
5335
|
if (this.meshesCreated && !force) return;
|
|
5330
5336
|
const modelRoot = new Object3D3();
|
|
5337
|
+
let transformNode = modelRoot;
|
|
5331
5338
|
const transform = this.options.flip === void 0 ? this.entity.transform : void 0;
|
|
5332
5339
|
if (transform) {
|
|
5333
|
-
for (const op of transform) {
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5340
|
+
for (const [index, op] of transform.entries()) {
|
|
5341
|
+
if (index > 0) {
|
|
5342
|
+
const child = new Object3D3();
|
|
5343
|
+
transformNode.add(child);
|
|
5344
|
+
transformNode = child;
|
|
5345
|
+
}
|
|
5346
|
+
if ("scale" in op) transformNode.scale.set(...op.scale);
|
|
5347
|
+
else if ("translate" in op) transformNode.position.set(...op.translate);
|
|
5348
|
+
else transformNode.rotation.set(...op.rotate, "ZYX");
|
|
5339
5349
|
}
|
|
5340
|
-
modelRoot.matrixWorldNeedsUpdate = true;
|
|
5341
|
-
modelRoot.matrixAutoUpdate = false;
|
|
5342
5350
|
} else if (this.options.flip ?? true) {
|
|
5343
5351
|
modelRoot.scale.set(-1, -1, 1);
|
|
5344
5352
|
}
|
|
5345
5353
|
this.add(modelRoot);
|
|
5346
5354
|
Object.entries(this.entityLayers).forEach(([name, layer], index) => {
|
|
5347
5355
|
const group = this.createGroup(`layer:${name}`);
|
|
5348
|
-
|
|
5356
|
+
transformNode.add(group);
|
|
5349
5357
|
const inward = !Materials.entityModeCulls(layer.render ?? layer.layer.render);
|
|
5350
5358
|
this.createPart("root", layer.layer.root, group, layer.layer.texture, Materials.MISSING_TEXTURE, index, inward, this.options.faces?.[name]);
|
|
5351
5359
|
});
|
|
@@ -6471,7 +6479,7 @@ var init_PlayerHeadTextures = __esm({
|
|
|
6471
6479
|
});
|
|
6472
6480
|
|
|
6473
6481
|
// src/model/SpecialItems.ts
|
|
6474
|
-
import { Euler as
|
|
6482
|
+
import { Euler as Euler6, Matrix4 as Matrix47 } from "three";
|
|
6475
6483
|
var SpecialItems;
|
|
6476
6484
|
var init_SpecialItems = __esm({
|
|
6477
6485
|
"src/model/SpecialItems.ts"() {
|
|
@@ -6512,8 +6520,8 @@ var init_SpecialItems = __esm({
|
|
|
6512
6520
|
const sideTextures = DecoratedPots.getSideTextures(components["minecraft:pot_decorations"], root);
|
|
6513
6521
|
const baseTexture = texture("decorated_pot_base", "decorated_pot");
|
|
6514
6522
|
const [base, sides] = await Promise.all([
|
|
6515
|
-
load("decorated_pot_base", baseTexture, new
|
|
6516
|
-
load("decorated_pot_sides", texture("decorated_pot_side", "decorated_pot"), new
|
|
6523
|
+
load("decorated_pot_base", baseTexture, new Matrix47()),
|
|
6524
|
+
load("decorated_pot_sides", texture("decorated_pot_side", "decorated_pot"), new Matrix47())
|
|
6517
6525
|
]);
|
|
6518
6526
|
const layers = {
|
|
6519
6527
|
base: { key: base.model.key, texture: baseTexture, layer: base.model.layer, render: "solid" }
|
|
@@ -6541,7 +6549,7 @@ var init_SpecialItems = __esm({
|
|
|
6541
6549
|
const part = await load(
|
|
6542
6550
|
"player_head",
|
|
6543
6551
|
skin.texture,
|
|
6544
|
-
new
|
|
6552
|
+
new Matrix47().makeTranslation(8, 0, 8).multiply(new Matrix47().makeScale(-1, -1, 1)),
|
|
6545
6553
|
{ head: [0, Math.PI, 0] }
|
|
6546
6554
|
);
|
|
6547
6555
|
const main = { ...part.model, texture: skin.texture, render: "translucent" };
|
|
@@ -6558,7 +6566,7 @@ var init_SpecialItems = __esm({
|
|
|
6558
6566
|
const statue = await load(
|
|
6559
6567
|
special.pose === "standing" ? "copper_golem" : `copper_golem_${special.pose}`,
|
|
6560
6568
|
key,
|
|
6561
|
-
new
|
|
6569
|
+
new Matrix47().makeTranslation(8, 24, 8).multiply(new Matrix47().makeScale(-1, -1, 1))
|
|
6562
6570
|
);
|
|
6563
6571
|
const pose = statue.model.layer.root.pose;
|
|
6564
6572
|
statue.rotations.root = [pose.rotation[0], Math.PI, Math.PI];
|
|
@@ -6574,7 +6582,7 @@ var init_SpecialItems = __esm({
|
|
|
6574
6582
|
const part = await load(
|
|
6575
6583
|
trident ? "trident" : "conduit",
|
|
6576
6584
|
texture(trident ? "trident" : "conduit/base", ""),
|
|
6577
|
-
trident ? new
|
|
6585
|
+
trident ? new Matrix47().makeScale(1, -1, -1) : new Matrix47().makeTranslation(8, 8, 8),
|
|
6578
6586
|
{},
|
|
6579
6587
|
trident ? ["main"] : ["shell"]
|
|
6580
6588
|
);
|
|
@@ -6595,7 +6603,7 @@ var init_SpecialItems = __esm({
|
|
|
6595
6603
|
const patterns = await BannerPatterns.getLayers(components["minecraft:banner_patterns"], banner ? "banner" : "shield", root);
|
|
6596
6604
|
const patterned = banner || color2 !== void 0 || patterns.length > 0;
|
|
6597
6605
|
const baseTexture = texture(banner ? "banner_base" : patterned ? "shield_base" : "shield_base_nopattern", "");
|
|
6598
|
-
const transform = banner ? new
|
|
6606
|
+
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);
|
|
6599
6607
|
const part = await load(banner ? "standing_banner" : "shield", baseTexture, transform, {}, banner ? ["main", "flag"] : ["main"]);
|
|
6600
6608
|
const layers = Object.fromEntries(Object.entries(part.model.layers ?? { main: part.model }).map(([name, layer]) => [name, { ...layer, render: "solid" }]));
|
|
6601
6609
|
let overlay2;
|
|
@@ -6633,7 +6641,7 @@ var init_SpecialItems = __esm({
|
|
|
6633
6641
|
case "minecraft:chest":
|
|
6634
6642
|
case "chest": {
|
|
6635
6643
|
const angle = -(special.openness ?? 0) * Math.PI / 2;
|
|
6636
|
-
const chest = await load("chest", texture(special.texture, "chest"), new
|
|
6644
|
+
const chest = await load("chest", texture(special.texture, "chest"), new Matrix47(), {
|
|
6637
6645
|
lid: [angle, 0, 0],
|
|
6638
6646
|
lock: [angle, 0, 0]
|
|
6639
6647
|
});
|
|
@@ -6655,18 +6663,18 @@ var init_SpecialItems = __esm({
|
|
|
6655
6663
|
if (!Object.prototype.hasOwnProperty.call(directions, orientation)) throw new Error(`Unsupported shulker-box orientation ${orientation}`);
|
|
6656
6664
|
if (typeof openness !== "number" || !Number.isFinite(openness)) throw new Error("Shulker-box openness must be finite");
|
|
6657
6665
|
if (typeof special.texture !== "string" || !special.texture) throw new Error("Shulker-box texture is required");
|
|
6658
|
-
const transform = new
|
|
6666
|
+
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));
|
|
6659
6667
|
const box = await load("shulker_box", texture(special.texture, "shulker"), transform, { lid: [0, openness * Math.PI * 1.5, 0] });
|
|
6660
6668
|
box.positions = { lid: [0, 24 - openness * 8, 0] };
|
|
6661
6669
|
return [box];
|
|
6662
6670
|
}
|
|
6663
6671
|
case "minecraft:bed":
|
|
6664
6672
|
case "bed": {
|
|
6665
|
-
const transform = new
|
|
6673
|
+
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));
|
|
6666
6674
|
const key = texture(special.texture, "bed");
|
|
6667
6675
|
return Promise.all([
|
|
6668
6676
|
load("bed_head", key, transform),
|
|
6669
|
-
load("bed_foot", key, new
|
|
6677
|
+
load("bed_foot", key, new Matrix47().makeTranslation(0, 0, -16).multiply(transform))
|
|
6670
6678
|
]);
|
|
6671
6679
|
}
|
|
6672
6680
|
case "minecraft:head":
|
|
@@ -6691,7 +6699,7 @@ var init_SpecialItems = __esm({
|
|
|
6691
6699
|
return [await load(
|
|
6692
6700
|
id,
|
|
6693
6701
|
special.texture ? texture(special.texture, "") : void 0,
|
|
6694
|
-
new
|
|
6702
|
+
new Matrix47().makeTranslation(8, 0, 8).multiply(new Matrix47().makeScale(-1, -1, 1)),
|
|
6695
6703
|
rotations
|
|
6696
6704
|
)];
|
|
6697
6705
|
}
|
|
@@ -6938,7 +6946,7 @@ var init_ItemGlint = __esm({
|
|
|
6938
6946
|
});
|
|
6939
6947
|
|
|
6940
6948
|
// src/model/scene/ModelObject.ts
|
|
6941
|
-
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, DoubleSide as DoubleSide5, Euler as
|
|
6949
|
+
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, DoubleSide as DoubleSide5, Euler as Euler7, FrontSide as FrontSide3, Matrix4 as Matrix48 } from "three";
|
|
6942
6950
|
function isModelObject(obj) {
|
|
6943
6951
|
return obj.isModelObject;
|
|
6944
6952
|
}
|
|
@@ -7006,8 +7014,8 @@ var init_ModelObject = __esm({
|
|
|
7006
7014
|
const special = this.originalModel.special;
|
|
7007
7015
|
if (special) {
|
|
7008
7016
|
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
7009
|
-
const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new
|
|
7010
|
-
transform.multiply(new
|
|
7017
|
+
const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new Matrix48();
|
|
7018
|
+
transform.multiply(new Matrix48().makeTranslation(-8, -8, -8));
|
|
7011
7019
|
try {
|
|
7012
7020
|
const targets = [];
|
|
7013
7021
|
for (const part of parts2) {
|
|
@@ -7099,7 +7107,7 @@ var init_ModelObject = __esm({
|
|
|
7099
7107
|
elGeo.clearGroups();
|
|
7100
7108
|
}
|
|
7101
7109
|
if (this.options.uvLockRotation) {
|
|
7102
|
-
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new
|
|
7110
|
+
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler7(...this.options.uvLockRotation));
|
|
7103
7111
|
}
|
|
7104
7112
|
UVMapper.setAtlasUvBounds(elGeo, el.faces, this.atlas);
|
|
7105
7113
|
if (this.options.tints) {
|
|
@@ -7116,13 +7124,13 @@ var init_ModelObject = __esm({
|
|
|
7116
7124
|
}
|
|
7117
7125
|
elGeo.setAttribute("color", new BufferAttribute5(colors, 3));
|
|
7118
7126
|
}
|
|
7119
|
-
elGeo.applyMatrix4(new
|
|
7120
|
-
elGeo.applyMatrix4(new
|
|
7127
|
+
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));
|
|
7128
|
+
elGeo.applyMatrix4(new Matrix48().makeTranslation(el.from[0], el.from[1], el.from[2]));
|
|
7121
7129
|
if (el.rotation) {
|
|
7122
7130
|
applyElementRotation(el.rotation, elGeo);
|
|
7123
7131
|
}
|
|
7124
7132
|
if (this.hasGlint) ItemGlint.mapUvs(elGeo, el.faces, this.atlas, this.originalModel.itemId, this.options.displayPosition);
|
|
7125
|
-
elGeo.applyMatrix4(new
|
|
7133
|
+
elGeo.applyMatrix4(new Matrix48().makeTranslation(-8, -8, -8));
|
|
7126
7134
|
if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
|
|
7127
7135
|
if (this.options.mergeMeshes) {
|
|
7128
7136
|
allGeos.push(elGeo);
|
|
@@ -8018,7 +8026,7 @@ init_EntityObject();
|
|
|
8018
8026
|
init_MineRenderError();
|
|
8019
8027
|
|
|
8020
8028
|
// src/export/SceneExporter.ts
|
|
8021
|
-
import { ClampToEdgeWrapping as ClampToEdgeWrapping2, Color as Color7, Float32BufferAttribute as Float32BufferAttribute3, Matrix4 as
|
|
8029
|
+
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";
|
|
8022
8030
|
|
|
8023
8031
|
// ../../node_modules/three/examples/jsm/exporters/OBJExporter.js
|
|
8024
8032
|
import {
|
|
@@ -8626,7 +8634,7 @@ import {
|
|
|
8626
8634
|
LinearMipmapLinearFilter,
|
|
8627
8635
|
LinearMipmapNearestFilter,
|
|
8628
8636
|
MathUtils,
|
|
8629
|
-
Matrix4 as
|
|
8637
|
+
Matrix4 as Matrix45,
|
|
8630
8638
|
MirroredRepeatWrapping,
|
|
8631
8639
|
NearestFilter as NearestFilter2,
|
|
8632
8640
|
NearestMipmapLinearFilter,
|
|
@@ -9994,7 +10002,7 @@ var GLTFWriter = class {
|
|
|
9994
10002
|
if (rootJoint === void 0) return null;
|
|
9995
10003
|
const joints = [];
|
|
9996
10004
|
const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16);
|
|
9997
|
-
const temporaryBoneInverse = new
|
|
10005
|
+
const temporaryBoneInverse = new Matrix45();
|
|
9998
10006
|
for (let i = 0; i < skeleton.bones.length; ++i) {
|
|
9999
10007
|
joints.push(nodeMap.get(skeleton.bones[i]));
|
|
10000
10008
|
temporaryBoneInverse.copy(skeleton.boneInverses[i]);
|
|
@@ -10580,7 +10588,7 @@ var GLTFMeshGpuInstancing = class {
|
|
|
10580
10588
|
const translationAttr = new Float32Array(mesh.count * 3);
|
|
10581
10589
|
const rotationAttr = new Float32Array(mesh.count * 4);
|
|
10582
10590
|
const scaleAttr = new Float32Array(mesh.count * 3);
|
|
10583
|
-
const matrix = new
|
|
10591
|
+
const matrix = new Matrix45();
|
|
10584
10592
|
const position = new Vector39();
|
|
10585
10593
|
const quaternion = new Quaternion4();
|
|
10586
10594
|
const scale = new Vector39();
|
|
@@ -10767,7 +10775,7 @@ var SceneExporter = class {
|
|
|
10767
10775
|
}
|
|
10768
10776
|
};
|
|
10769
10777
|
function localMatrix(object4) {
|
|
10770
|
-
return object4.matrixAutoUpdate ? new
|
|
10778
|
+
return object4.matrixAutoUpdate ? new Matrix46().compose(object4.position, object4.quaternion, object4.scale) : object4.matrix.clone();
|
|
10771
10779
|
}
|
|
10772
10780
|
function createSnapshot(root, gltf, bakeColors = false) {
|
|
10773
10781
|
const scene = new Scene3();
|
|
@@ -10879,7 +10887,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
|
|
|
10879
10887
|
const instanced = mesh;
|
|
10880
10888
|
if (instanced.isInstancedMesh) {
|
|
10881
10889
|
for (let i = 0; i < instanced.count; i++) {
|
|
10882
|
-
const matrix = new
|
|
10890
|
+
const matrix = new Matrix46();
|
|
10883
10891
|
instanced.getMatrixAt(i, matrix);
|
|
10884
10892
|
const color2 = instanced.instanceColor ? new Color7().fromBufferAttribute(instanced.instanceColor, i) : void 0;
|
|
10885
10893
|
addMesh(mesh, world.clone().multiply(matrix), color2);
|
|
@@ -10893,7 +10901,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
|
|
|
10893
10901
|
try {
|
|
10894
10902
|
const ancestors = [];
|
|
10895
10903
|
for (let parent = root.parent; parent; parent = parent.parent) ancestors.unshift(parent);
|
|
10896
|
-
const world = new
|
|
10904
|
+
const world = new Matrix46();
|
|
10897
10905
|
for (const ancestor of ancestors) {
|
|
10898
10906
|
if (!ancestor.visible) return { scene, dispose };
|
|
10899
10907
|
world.multiply(localMatrix(ancestor));
|
|
@@ -11499,7 +11507,7 @@ init_SceneObject();
|
|
|
11499
11507
|
init_Materials();
|
|
11500
11508
|
init_ModelObject();
|
|
11501
11509
|
init_DisplayPosition();
|
|
11502
|
-
import { Box2, Box3 as Box32, Color as Color10, DoubleSide as DoubleSide6, Float32BufferAttribute as Float32BufferAttribute8, Group, Matrix4 as
|
|
11510
|
+
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";
|
|
11503
11511
|
init_ItemDefaults();
|
|
11504
11512
|
var GuiObject = class extends SceneObject {
|
|
11505
11513
|
constructor(textureLayers, options) {
|
|
@@ -11559,7 +11567,7 @@ var GuiObject = class extends SceneObject {
|
|
|
11559
11567
|
const bounds = new Box32();
|
|
11560
11568
|
item.iterateAllMeshes((mesh2) => {
|
|
11561
11569
|
mesh2.geometry.computeBoundingBox();
|
|
11562
|
-
bounds.union(mesh2.geometry.boundingBox.clone().applyMatrix4(new
|
|
11570
|
+
bounds.union(mesh2.geometry.boundingBox.clone().applyMatrix4(new Matrix49().multiplyMatrices(inverse, mesh2.matrixWorld)));
|
|
11563
11571
|
});
|
|
11564
11572
|
item.position.z = depth;
|
|
11565
11573
|
if (!bounds.isEmpty()) {
|
|
@@ -12179,7 +12187,7 @@ init_SpecialItems();
|
|
|
12179
12187
|
init_BlockStates();
|
|
12180
12188
|
init_MineRenderError();
|
|
12181
12189
|
init_util();
|
|
12182
|
-
import { Euler as
|
|
12190
|
+
import { Euler as Euler8 } from "three";
|
|
12183
12191
|
function matchesCondition(condition, state) {
|
|
12184
12192
|
return Object.entries(condition).every(([key, value]) => {
|
|
12185
12193
|
if (Array.isArray(value)) {
|
|
@@ -12275,7 +12283,7 @@ var BlockStateResolver = class _BlockStateResolver {
|
|
|
12275
12283
|
}
|
|
12276
12284
|
/** Converts blockstate rotations in degrees into the Euler rotation used by model rendering. */
|
|
12277
12285
|
static rotation(variant) {
|
|
12278
|
-
const rotation = new
|
|
12286
|
+
const rotation = new Euler8();
|
|
12279
12287
|
if (typeof variant.x !== "undefined") {
|
|
12280
12288
|
rotation.x = toRadians(clampRotationDegrees(variant.x));
|
|
12281
12289
|
}
|
|
@@ -12357,7 +12365,7 @@ var import_ts_deepmerge6 = __toESM(require_dist());
|
|
|
12357
12365
|
init_MineRenderError();
|
|
12358
12366
|
init_InstanceReference();
|
|
12359
12367
|
init_AssetKey();
|
|
12360
|
-
import { Euler as
|
|
12368
|
+
import { Euler as Euler9, Matrix4 as Matrix410, Quaternion as Quaternion5, Vector3 as Vector312 } from "three";
|
|
12361
12369
|
init_ModelCulling();
|
|
12362
12370
|
init_FluidGeometry();
|
|
12363
12371
|
init_MineRenderData();
|
|
@@ -12378,7 +12386,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12378
12386
|
this._cullMask = 0;
|
|
12379
12387
|
this._fluidRules = {};
|
|
12380
12388
|
this._entities = [];
|
|
12381
|
-
this._entityPlacement = new
|
|
12389
|
+
this._entityPlacement = new Matrix410();
|
|
12382
12390
|
this._entityGeneration = 0;
|
|
12383
12391
|
this.options = (0, import_ts_deepmerge6.default)({}, _BlockObject.DEFAULT_OPTIONS, options ?? {});
|
|
12384
12392
|
this.variantPosition = options?.variantPosition ? [...options.variantPosition] : void 0;
|
|
@@ -12481,7 +12489,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12481
12489
|
return true;
|
|
12482
12490
|
}
|
|
12483
12491
|
placeEntities() {
|
|
12484
|
-
const matrix = new
|
|
12492
|
+
const matrix = new Matrix410().makeTranslation(this.position.x - 8, this.position.y - 8, this.position.z - 8).multiply(this._entityPlacement);
|
|
12485
12493
|
for (const entity of this._entities) {
|
|
12486
12494
|
matrix.decompose(entity.position, entity.quaternion, entity.scale);
|
|
12487
12495
|
}
|
|
@@ -12508,7 +12516,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12508
12516
|
const scale = new Vector312();
|
|
12509
12517
|
this.getModelMatrix(model).decompose(position, rotation, scale);
|
|
12510
12518
|
if (position.distanceToSquared(this.position) > 1e-10 || scale.distanceToSquared(new Vector312(1, 1, 1)) > 1e-10) return 0;
|
|
12511
|
-
return ModelCulling.toLocalMask(worldMask, new
|
|
12519
|
+
return ModelCulling.toLocalMask(worldMask, new Euler9().setFromQuaternion(rotation));
|
|
12512
12520
|
}
|
|
12513
12521
|
/** World-space face mask currently applied to this block. */
|
|
12514
12522
|
get cullMask() {
|
|
@@ -12584,7 +12592,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12584
12592
|
})
|
|
12585
12593
|
);
|
|
12586
12594
|
const previous = this._fluidModel;
|
|
12587
|
-
const matrix = previous ? this.getModelMatrix(previous) : new
|
|
12595
|
+
const matrix = previous ? this.getModelMatrix(previous) : new Matrix410().makeTranslation(...this.position.toArray());
|
|
12588
12596
|
if (isInstanceReference(replacement)) replacement.setMatrix(matrix);
|
|
12589
12597
|
else matrix.decompose(replacement.position, replacement.quaternion, replacement.scale);
|
|
12590
12598
|
this._models = this._models.filter((model) => model !== previous);
|
|
@@ -12734,7 +12742,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12734
12742
|
setPositionRotationScaleAt(index, position, rotation, scale) {
|
|
12735
12743
|
super.setPositionRotationScaleAt(index, position, rotation, scale);
|
|
12736
12744
|
}
|
|
12737
|
-
getMatrixAt(index, matrix = new
|
|
12745
|
+
getMatrixAt(index, matrix = new Matrix410()) {
|
|
12738
12746
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
12739
12747
|
const child = this._models[0];
|
|
12740
12748
|
if (child && isModelObject(child)) {
|
|
@@ -13242,13 +13250,13 @@ init_ModelObject();
|
|
|
13242
13250
|
init_nbt();
|
|
13243
13251
|
|
|
13244
13252
|
// src/renderer/FlyControls.ts
|
|
13245
|
-
import { Controls, Euler as
|
|
13253
|
+
import { Controls, Euler as Euler10, MathUtils as MathUtils2, Quaternion as Quaternion6, Vector3 as Vector313 } from "three";
|
|
13246
13254
|
var VANILLA_FLY_SPEED = 10.89;
|
|
13247
13255
|
var PITCH_LIMIT = Math.PI / 2;
|
|
13248
13256
|
var MOVE_EPSILON = 1e-6;
|
|
13249
13257
|
var MAX_STEP_SECONDS = 0.1;
|
|
13250
13258
|
var CLICK_SLOP_PIXELS = 4;
|
|
13251
|
-
var _euler = new
|
|
13259
|
+
var _euler = new Euler10(0, 0, 0, "YXZ");
|
|
13252
13260
|
var _forward = new Vector313();
|
|
13253
13261
|
var _right = new Vector313();
|
|
13254
13262
|
var _targetVelocity = new Vector313();
|
|
@@ -17208,7 +17216,7 @@ init_CubeFace();
|
|
|
17208
17216
|
init_AssetKey();
|
|
17209
17217
|
init_Models();
|
|
17210
17218
|
init_CubeFace();
|
|
17211
|
-
import { BufferAttribute as BufferAttribute7, BufferGeometry as BufferGeometry8, Matrix4 as
|
|
17219
|
+
import { BufferAttribute as BufferAttribute7, BufferGeometry as BufferGeometry8, Matrix4 as Matrix411, Vector3 as Vector316 } from "three";
|
|
17212
17220
|
init_ModelCulling();
|
|
17213
17221
|
init_ModelObject();
|
|
17214
17222
|
init_UVMapper();
|
|
@@ -17346,7 +17354,7 @@ var SectionModels = class {
|
|
|
17346
17354
|
});
|
|
17347
17355
|
await object4.init();
|
|
17348
17356
|
let geometry = object4.children[0].geometry;
|
|
17349
|
-
geometry.applyMatrix4(new
|
|
17357
|
+
geometry.applyMatrix4(new Matrix411().makeRotationFromEuler(rotation));
|
|
17350
17358
|
object4.clear();
|
|
17351
17359
|
const keep = [];
|
|
17352
17360
|
const cullFaces = [];
|
|
@@ -17466,7 +17474,7 @@ import { Vector3 as Vector318 } from "three";
|
|
|
17466
17474
|
|
|
17467
17475
|
// src/world/_picking/Picking.ts
|
|
17468
17476
|
init_three();
|
|
17469
|
-
import { Matrix3 as Matrix33, Matrix4 as
|
|
17477
|
+
import { Matrix3 as Matrix33, Matrix4 as Matrix412 } from "three";
|
|
17470
17478
|
function pickableMeshes(root, scene, raycaster) {
|
|
17471
17479
|
const result = [];
|
|
17472
17480
|
let attached = false;
|
|
@@ -17493,7 +17501,7 @@ function hitNormal(hit) {
|
|
|
17493
17501
|
const mesh = hit.object;
|
|
17494
17502
|
const matrix = mesh.matrixWorld.clone();
|
|
17495
17503
|
if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
|
|
17496
|
-
const instance = new
|
|
17504
|
+
const instance = new Matrix412();
|
|
17497
17505
|
mesh.getMatrixAt(hit.instanceId, instance);
|
|
17498
17506
|
matrix.multiply(instance);
|
|
17499
17507
|
}
|