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/node/index.mjs
CHANGED
|
@@ -3964,11 +3964,14 @@ var init_UVMapper = __esm({
|
|
|
3964
3964
|
});
|
|
3965
3965
|
}
|
|
3966
3966
|
static fillMissingTextureKeys(textures, target) {
|
|
3967
|
-
for (
|
|
3968
|
-
let
|
|
3969
|
-
|
|
3970
|
-
|
|
3967
|
+
for (const key in textures) {
|
|
3968
|
+
let name = key;
|
|
3969
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3970
|
+
while (textures[name]?.startsWith("#") && !seen.has(name)) {
|
|
3971
|
+
seen.add(name);
|
|
3972
|
+
name = textures[name].substr(1);
|
|
3971
3973
|
}
|
|
3974
|
+
if (name !== key) target[key] = target[name];
|
|
3972
3975
|
}
|
|
3973
3976
|
return target;
|
|
3974
3977
|
}
|
|
@@ -5247,7 +5250,7 @@ var init_SceneObject = __esm({
|
|
|
5247
5250
|
});
|
|
5248
5251
|
|
|
5249
5252
|
// src/entity/scene/EntityObject.ts
|
|
5250
|
-
import { Color as Color3,
|
|
5253
|
+
import { Color as Color3, Object3D as Object3D3 } from "three";
|
|
5251
5254
|
function isEntityObject(obj) {
|
|
5252
5255
|
return obj.isEntityObject;
|
|
5253
5256
|
}
|
|
@@ -5353,13 +5356,14 @@ var init_EntityObject = __esm({
|
|
|
5353
5356
|
}
|
|
5354
5357
|
/**
|
|
5355
5358
|
* Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
|
|
5356
|
-
* Offsets apply to the baked pose in the clip's layer (`main` by default)
|
|
5359
|
+
* Offsets apply to the baked pose in the clip's layer (`main` by default) and its repeated draws.
|
|
5360
|
+
* A `main` clip also poses every selected layer without a clip of its own.
|
|
5357
5361
|
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
5358
5362
|
*/
|
|
5359
5363
|
playAnimation(animation, options) {
|
|
5360
5364
|
this.playAnimations([animation], options);
|
|
5361
5365
|
}
|
|
5362
|
-
/** Plays
|
|
5366
|
+
/** Plays clips with a shared clock and no blending. Selected layers without their own clip follow `main`. */
|
|
5363
5367
|
playAnimations(animations, options) {
|
|
5364
5368
|
const targets = /* @__PURE__ */ new Set();
|
|
5365
5369
|
const selections = animations.map((animation) => {
|
|
@@ -5370,6 +5374,8 @@ var init_EntityObject = __esm({
|
|
|
5370
5374
|
if (!names.length) throw new Error(`Entity ${this.entity.id} has no selected animation layer "${layer}"`);
|
|
5371
5375
|
return { animation, names };
|
|
5372
5376
|
});
|
|
5377
|
+
const main = selections.find(({ animation }) => (animation.layer ?? "main") === "main");
|
|
5378
|
+
if (main) main.names.push(...Object.keys(this.entityLayers).filter((name) => !targets.has(name.split("#")[0])));
|
|
5373
5379
|
this.createMeshes();
|
|
5374
5380
|
this.stopAnimation();
|
|
5375
5381
|
for (const { animation, names } of selections) {
|
|
@@ -5429,24 +5435,26 @@ var init_EntityObject = __esm({
|
|
|
5429
5435
|
createMeshes(force = false) {
|
|
5430
5436
|
if (this.meshesCreated && !force) return;
|
|
5431
5437
|
const modelRoot = new Object3D3();
|
|
5438
|
+
let transformNode = modelRoot;
|
|
5432
5439
|
const transform = this.options.flip === void 0 ? this.entity.transform : void 0;
|
|
5433
5440
|
if (transform) {
|
|
5434
|
-
for (const op of transform) {
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5441
|
+
for (const [index, op] of transform.entries()) {
|
|
5442
|
+
if (index > 0) {
|
|
5443
|
+
const child = new Object3D3();
|
|
5444
|
+
transformNode.add(child);
|
|
5445
|
+
transformNode = child;
|
|
5446
|
+
}
|
|
5447
|
+
if ("scale" in op) transformNode.scale.set(...op.scale);
|
|
5448
|
+
else if ("translate" in op) transformNode.position.set(...op.translate);
|
|
5449
|
+
else transformNode.rotation.set(...op.rotate, "ZYX");
|
|
5440
5450
|
}
|
|
5441
|
-
modelRoot.matrixWorldNeedsUpdate = true;
|
|
5442
|
-
modelRoot.matrixAutoUpdate = false;
|
|
5443
5451
|
} else if (this.options.flip ?? true) {
|
|
5444
5452
|
modelRoot.scale.set(-1, -1, 1);
|
|
5445
5453
|
}
|
|
5446
5454
|
this.add(modelRoot);
|
|
5447
5455
|
Object.entries(this.entityLayers).forEach(([name, layer], index) => {
|
|
5448
5456
|
const group = this.createGroup(`layer:${name}`);
|
|
5449
|
-
|
|
5457
|
+
transformNode.add(group);
|
|
5450
5458
|
const inward = !Materials.entityModeCulls(layer.render ?? layer.layer.render);
|
|
5451
5459
|
this.createPart("root", layer.layer.root, group, layer.layer.texture, Materials.MISSING_TEXTURE, index, inward, this.options.faces?.[name]);
|
|
5452
5460
|
});
|
|
@@ -6570,7 +6578,7 @@ var init_PlayerHeadTextures = __esm({
|
|
|
6570
6578
|
});
|
|
6571
6579
|
|
|
6572
6580
|
// src/model/SpecialItems.ts
|
|
6573
|
-
import { Euler as
|
|
6581
|
+
import { Euler as Euler6, Matrix4 as Matrix47 } from "three";
|
|
6574
6582
|
var SpecialItems;
|
|
6575
6583
|
var init_SpecialItems = __esm({
|
|
6576
6584
|
"src/model/SpecialItems.ts"() {
|
|
@@ -6611,8 +6619,8 @@ var init_SpecialItems = __esm({
|
|
|
6611
6619
|
const sideTextures = DecoratedPots.getSideTextures(components["minecraft:pot_decorations"], root);
|
|
6612
6620
|
const baseTexture = texture("decorated_pot_base", "decorated_pot");
|
|
6613
6621
|
const [base, sides] = await Promise.all([
|
|
6614
|
-
load("decorated_pot_base", baseTexture, new
|
|
6615
|
-
load("decorated_pot_sides", texture("decorated_pot_side", "decorated_pot"), new
|
|
6622
|
+
load("decorated_pot_base", baseTexture, new Matrix47()),
|
|
6623
|
+
load("decorated_pot_sides", texture("decorated_pot_side", "decorated_pot"), new Matrix47())
|
|
6616
6624
|
]);
|
|
6617
6625
|
const layers = {
|
|
6618
6626
|
base: { key: base.model.key, texture: baseTexture, layer: base.model.layer, render: "solid" }
|
|
@@ -6640,7 +6648,7 @@ var init_SpecialItems = __esm({
|
|
|
6640
6648
|
const part = await load(
|
|
6641
6649
|
"player_head",
|
|
6642
6650
|
skin.texture,
|
|
6643
|
-
new
|
|
6651
|
+
new Matrix47().makeTranslation(8, 0, 8).multiply(new Matrix47().makeScale(-1, -1, 1)),
|
|
6644
6652
|
{ head: [0, Math.PI, 0] }
|
|
6645
6653
|
);
|
|
6646
6654
|
const main = { ...part.model, texture: skin.texture, render: "translucent" };
|
|
@@ -6657,7 +6665,7 @@ var init_SpecialItems = __esm({
|
|
|
6657
6665
|
const statue = await load(
|
|
6658
6666
|
special.pose === "standing" ? "copper_golem" : `copper_golem_${special.pose}`,
|
|
6659
6667
|
key,
|
|
6660
|
-
new
|
|
6668
|
+
new Matrix47().makeTranslation(8, 24, 8).multiply(new Matrix47().makeScale(-1, -1, 1))
|
|
6661
6669
|
);
|
|
6662
6670
|
const pose = statue.model.layer.root.pose;
|
|
6663
6671
|
statue.rotations.root = [pose.rotation[0], Math.PI, Math.PI];
|
|
@@ -6673,7 +6681,7 @@ var init_SpecialItems = __esm({
|
|
|
6673
6681
|
const part = await load(
|
|
6674
6682
|
trident ? "trident" : "conduit",
|
|
6675
6683
|
texture(trident ? "trident" : "conduit/base", ""),
|
|
6676
|
-
trident ? new
|
|
6684
|
+
trident ? new Matrix47().makeScale(1, -1, -1) : new Matrix47().makeTranslation(8, 8, 8),
|
|
6677
6685
|
{},
|
|
6678
6686
|
trident ? ["main"] : ["shell"]
|
|
6679
6687
|
);
|
|
@@ -6694,7 +6702,7 @@ var init_SpecialItems = __esm({
|
|
|
6694
6702
|
const patterns = await BannerPatterns.getLayers(components["minecraft:banner_patterns"], banner ? "banner" : "shield", root);
|
|
6695
6703
|
const patterned = banner || color2 !== void 0 || patterns.length > 0;
|
|
6696
6704
|
const baseTexture = texture(banner ? "banner_base" : patterned ? "shield_base" : "shield_base_nopattern", "");
|
|
6697
|
-
const transform = banner ? new
|
|
6705
|
+
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);
|
|
6698
6706
|
const part = await load(banner ? "standing_banner" : "shield", baseTexture, transform, {}, banner ? ["main", "flag"] : ["main"]);
|
|
6699
6707
|
const layers = Object.fromEntries(Object.entries(part.model.layers ?? { main: part.model }).map(([name, layer]) => [name, { ...layer, render: "solid" }]));
|
|
6700
6708
|
let overlay2;
|
|
@@ -6732,7 +6740,7 @@ var init_SpecialItems = __esm({
|
|
|
6732
6740
|
case "minecraft:chest":
|
|
6733
6741
|
case "chest": {
|
|
6734
6742
|
const angle = -(special.openness ?? 0) * Math.PI / 2;
|
|
6735
|
-
const chest = await load("chest", texture(special.texture, "chest"), new
|
|
6743
|
+
const chest = await load("chest", texture(special.texture, "chest"), new Matrix47(), {
|
|
6736
6744
|
lid: [angle, 0, 0],
|
|
6737
6745
|
lock: [angle, 0, 0]
|
|
6738
6746
|
});
|
|
@@ -6754,18 +6762,18 @@ var init_SpecialItems = __esm({
|
|
|
6754
6762
|
if (!Object.prototype.hasOwnProperty.call(directions, orientation)) throw new Error(`Unsupported shulker-box orientation ${orientation}`);
|
|
6755
6763
|
if (typeof openness !== "number" || !Number.isFinite(openness)) throw new Error("Shulker-box openness must be finite");
|
|
6756
6764
|
if (typeof special.texture !== "string" || !special.texture) throw new Error("Shulker-box texture is required");
|
|
6757
|
-
const transform = new
|
|
6765
|
+
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));
|
|
6758
6766
|
const box = await load("shulker_box", texture(special.texture, "shulker"), transform, { lid: [0, openness * Math.PI * 1.5, 0] });
|
|
6759
6767
|
box.positions = { lid: [0, 24 - openness * 8, 0] };
|
|
6760
6768
|
return [box];
|
|
6761
6769
|
}
|
|
6762
6770
|
case "minecraft:bed":
|
|
6763
6771
|
case "bed": {
|
|
6764
|
-
const transform = new
|
|
6772
|
+
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));
|
|
6765
6773
|
const key = texture(special.texture, "bed");
|
|
6766
6774
|
return Promise.all([
|
|
6767
6775
|
load("bed_head", key, transform),
|
|
6768
|
-
load("bed_foot", key, new
|
|
6776
|
+
load("bed_foot", key, new Matrix47().makeTranslation(0, 0, -16).multiply(transform))
|
|
6769
6777
|
]);
|
|
6770
6778
|
}
|
|
6771
6779
|
case "minecraft:head":
|
|
@@ -6790,7 +6798,7 @@ var init_SpecialItems = __esm({
|
|
|
6790
6798
|
return [await load(
|
|
6791
6799
|
id,
|
|
6792
6800
|
special.texture ? texture(special.texture, "") : void 0,
|
|
6793
|
-
new
|
|
6801
|
+
new Matrix47().makeTranslation(8, 0, 8).multiply(new Matrix47().makeScale(-1, -1, 1)),
|
|
6794
6802
|
rotations
|
|
6795
6803
|
)];
|
|
6796
6804
|
}
|
|
@@ -7037,7 +7045,7 @@ var init_ItemGlint = __esm({
|
|
|
7037
7045
|
});
|
|
7038
7046
|
|
|
7039
7047
|
// src/model/scene/ModelObject.ts
|
|
7040
|
-
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, DoubleSide as DoubleSide5, Euler as
|
|
7048
|
+
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, DoubleSide as DoubleSide5, Euler as Euler7, FrontSide as FrontSide3, Matrix4 as Matrix48 } from "three";
|
|
7041
7049
|
function isModelObject(obj) {
|
|
7042
7050
|
return obj.isModelObject;
|
|
7043
7051
|
}
|
|
@@ -7108,8 +7116,8 @@ var init_ModelObject = __esm({
|
|
|
7108
7116
|
const special = this.originalModel.special;
|
|
7109
7117
|
if (special) {
|
|
7110
7118
|
const parts2 = await SpecialItems.getParts(special, this.originalModel.key?.root, this.originalModel.components);
|
|
7111
|
-
const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new
|
|
7112
|
-
transform.multiply(new
|
|
7119
|
+
const transform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : new Matrix48();
|
|
7120
|
+
transform.multiply(new Matrix48().makeTranslation(-8, -8, -8));
|
|
7113
7121
|
try {
|
|
7114
7122
|
const targets = [];
|
|
7115
7123
|
for (const part of parts2) {
|
|
@@ -7201,7 +7209,7 @@ var init_ModelObject = __esm({
|
|
|
7201
7209
|
elGeo.clearGroups();
|
|
7202
7210
|
}
|
|
7203
7211
|
if (this.options.uvLockRotation) {
|
|
7204
|
-
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new
|
|
7212
|
+
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler7(...this.options.uvLockRotation));
|
|
7205
7213
|
}
|
|
7206
7214
|
UVMapper.setAtlasUvBounds(elGeo, el.faces, this.atlas);
|
|
7207
7215
|
if (this.options.tints) {
|
|
@@ -7218,13 +7226,13 @@ var init_ModelObject = __esm({
|
|
|
7218
7226
|
}
|
|
7219
7227
|
elGeo.setAttribute("color", new BufferAttribute5(colors, 3));
|
|
7220
7228
|
}
|
|
7221
|
-
elGeo.applyMatrix4(new
|
|
7222
|
-
elGeo.applyMatrix4(new
|
|
7229
|
+
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));
|
|
7230
|
+
elGeo.applyMatrix4(new Matrix48().makeTranslation(el.from[0], el.from[1], el.from[2]));
|
|
7223
7231
|
if (el.rotation) {
|
|
7224
7232
|
applyElementRotation(el.rotation, elGeo);
|
|
7225
7233
|
}
|
|
7226
7234
|
if (this.hasGlint) ItemGlint.mapUvs(elGeo, el.faces, this.atlas, this.originalModel.itemId, this.options.displayPosition);
|
|
7227
|
-
elGeo.applyMatrix4(new
|
|
7235
|
+
elGeo.applyMatrix4(new Matrix48().makeTranslation(-8, -8, -8));
|
|
7228
7236
|
if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
|
|
7229
7237
|
if (this.options.mergeMeshes) {
|
|
7230
7238
|
allGeos.push(elGeo);
|
|
@@ -8051,7 +8059,7 @@ init_EntityObject();
|
|
|
8051
8059
|
init_MineRenderError();
|
|
8052
8060
|
|
|
8053
8061
|
// src/export/SceneExporter.ts
|
|
8054
|
-
import { ClampToEdgeWrapping as ClampToEdgeWrapping2, Color as Color7, Float32BufferAttribute as Float32BufferAttribute3, Matrix4 as
|
|
8062
|
+
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";
|
|
8055
8063
|
|
|
8056
8064
|
// ../../node_modules/three/examples/jsm/exporters/OBJExporter.js
|
|
8057
8065
|
import {
|
|
@@ -8659,7 +8667,7 @@ import {
|
|
|
8659
8667
|
LinearMipmapLinearFilter,
|
|
8660
8668
|
LinearMipmapNearestFilter,
|
|
8661
8669
|
MathUtils,
|
|
8662
|
-
Matrix4 as
|
|
8670
|
+
Matrix4 as Matrix45,
|
|
8663
8671
|
MirroredRepeatWrapping,
|
|
8664
8672
|
NearestFilter as NearestFilter2,
|
|
8665
8673
|
NearestMipmapLinearFilter,
|
|
@@ -10027,7 +10035,7 @@ var GLTFWriter = class {
|
|
|
10027
10035
|
if (rootJoint === void 0) return null;
|
|
10028
10036
|
const joints = [];
|
|
10029
10037
|
const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16);
|
|
10030
|
-
const temporaryBoneInverse = new
|
|
10038
|
+
const temporaryBoneInverse = new Matrix45();
|
|
10031
10039
|
for (let i = 0; i < skeleton.bones.length; ++i) {
|
|
10032
10040
|
joints.push(nodeMap.get(skeleton.bones[i]));
|
|
10033
10041
|
temporaryBoneInverse.copy(skeleton.boneInverses[i]);
|
|
@@ -10613,7 +10621,7 @@ var GLTFMeshGpuInstancing = class {
|
|
|
10613
10621
|
const translationAttr = new Float32Array(mesh.count * 3);
|
|
10614
10622
|
const rotationAttr = new Float32Array(mesh.count * 4);
|
|
10615
10623
|
const scaleAttr = new Float32Array(mesh.count * 3);
|
|
10616
|
-
const matrix = new
|
|
10624
|
+
const matrix = new Matrix45();
|
|
10617
10625
|
const position = new Vector39();
|
|
10618
10626
|
const quaternion = new Quaternion4();
|
|
10619
10627
|
const scale = new Vector39();
|
|
@@ -10800,7 +10808,7 @@ var SceneExporter = class {
|
|
|
10800
10808
|
}
|
|
10801
10809
|
};
|
|
10802
10810
|
function localMatrix(object4) {
|
|
10803
|
-
return object4.matrixAutoUpdate ? new
|
|
10811
|
+
return object4.matrixAutoUpdate ? new Matrix46().compose(object4.position, object4.quaternion, object4.scale) : object4.matrix.clone();
|
|
10804
10812
|
}
|
|
10805
10813
|
function createSnapshot(root, gltf, bakeColors = false) {
|
|
10806
10814
|
const scene = new Scene3();
|
|
@@ -10912,7 +10920,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
|
|
|
10912
10920
|
const instanced = mesh;
|
|
10913
10921
|
if (instanced.isInstancedMesh) {
|
|
10914
10922
|
for (let i = 0; i < instanced.count; i++) {
|
|
10915
|
-
const matrix = new
|
|
10923
|
+
const matrix = new Matrix46();
|
|
10916
10924
|
instanced.getMatrixAt(i, matrix);
|
|
10917
10925
|
const color2 = instanced.instanceColor ? new Color7().fromBufferAttribute(instanced.instanceColor, i) : void 0;
|
|
10918
10926
|
addMesh(mesh, world.clone().multiply(matrix), color2);
|
|
@@ -10926,7 +10934,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
|
|
|
10926
10934
|
try {
|
|
10927
10935
|
const ancestors = [];
|
|
10928
10936
|
for (let parent = root.parent; parent; parent = parent.parent) ancestors.unshift(parent);
|
|
10929
|
-
const world = new
|
|
10937
|
+
const world = new Matrix46();
|
|
10930
10938
|
for (const ancestor of ancestors) {
|
|
10931
10939
|
if (!ancestor.visible) return { scene, dispose };
|
|
10932
10940
|
world.multiply(localMatrix(ancestor));
|
|
@@ -11532,7 +11540,7 @@ init_SceneObject();
|
|
|
11532
11540
|
init_Materials();
|
|
11533
11541
|
init_ModelObject();
|
|
11534
11542
|
init_DisplayPosition();
|
|
11535
|
-
import { Box2, Box3 as Box32, Color as Color10, DoubleSide as DoubleSide6, Float32BufferAttribute as Float32BufferAttribute8, Group, Matrix4 as
|
|
11543
|
+
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";
|
|
11536
11544
|
init_ItemDefaults();
|
|
11537
11545
|
var GuiObject = class extends SceneObject {
|
|
11538
11546
|
constructor(textureLayers, options) {
|
|
@@ -11592,7 +11600,7 @@ var GuiObject = class extends SceneObject {
|
|
|
11592
11600
|
const bounds = new Box32();
|
|
11593
11601
|
item.iterateAllMeshes((mesh2) => {
|
|
11594
11602
|
mesh2.geometry.computeBoundingBox();
|
|
11595
|
-
bounds.union(mesh2.geometry.boundingBox.clone().applyMatrix4(new
|
|
11603
|
+
bounds.union(mesh2.geometry.boundingBox.clone().applyMatrix4(new Matrix49().multiplyMatrices(inverse, mesh2.matrixWorld)));
|
|
11596
11604
|
});
|
|
11597
11605
|
item.position.z = depth;
|
|
11598
11606
|
if (!bounds.isEmpty()) {
|
|
@@ -12212,7 +12220,7 @@ init_SpecialItems();
|
|
|
12212
12220
|
init_BlockStates();
|
|
12213
12221
|
init_MineRenderError();
|
|
12214
12222
|
init_util();
|
|
12215
|
-
import { Euler as
|
|
12223
|
+
import { Euler as Euler8 } from "three";
|
|
12216
12224
|
function matchesCondition(condition, state) {
|
|
12217
12225
|
return Object.entries(condition).every(([key, value]) => {
|
|
12218
12226
|
if (Array.isArray(value)) {
|
|
@@ -12308,7 +12316,7 @@ var BlockStateResolver = class _BlockStateResolver {
|
|
|
12308
12316
|
}
|
|
12309
12317
|
/** Converts blockstate rotations in degrees into the Euler rotation used by model rendering. */
|
|
12310
12318
|
static rotation(variant) {
|
|
12311
|
-
const rotation = new
|
|
12319
|
+
const rotation = new Euler8();
|
|
12312
12320
|
if (typeof variant.x !== "undefined") {
|
|
12313
12321
|
rotation.x = toRadians(clampRotationDegrees(variant.x));
|
|
12314
12322
|
}
|
|
@@ -12390,7 +12398,7 @@ var import_ts_deepmerge6 = __toESM(require_dist());
|
|
|
12390
12398
|
init_MineRenderError();
|
|
12391
12399
|
init_InstanceReference();
|
|
12392
12400
|
init_AssetKey();
|
|
12393
|
-
import { Euler as
|
|
12401
|
+
import { Euler as Euler9, Matrix4 as Matrix410, Quaternion as Quaternion5, Vector3 as Vector312 } from "three";
|
|
12394
12402
|
init_ModelCulling();
|
|
12395
12403
|
init_FluidGeometry();
|
|
12396
12404
|
init_MineRenderData();
|
|
@@ -12411,7 +12419,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
12411
12419
|
this._cullMask = 0;
|
|
12412
12420
|
this._fluidRules = {};
|
|
12413
12421
|
this._entities = [];
|
|
12414
|
-
this._entityPlacement = new
|
|
12422
|
+
this._entityPlacement = new Matrix410();
|
|
12415
12423
|
this._entityGeneration = 0;
|
|
12416
12424
|
this.options = (0, import_ts_deepmerge6.default)({}, _BlockObject.DEFAULT_OPTIONS, options ?? {});
|
|
12417
12425
|
this.variantPosition = options?.variantPosition ? [...options.variantPosition] : void 0;
|
|
@@ -12519,7 +12527,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
12519
12527
|
return true;
|
|
12520
12528
|
}
|
|
12521
12529
|
placeEntities() {
|
|
12522
|
-
const matrix = new
|
|
12530
|
+
const matrix = new Matrix410().makeTranslation(this.position.x - 8, this.position.y - 8, this.position.z - 8).multiply(this._entityPlacement);
|
|
12523
12531
|
for (const entity of this._entities) {
|
|
12524
12532
|
matrix.decompose(entity.position, entity.quaternion, entity.scale);
|
|
12525
12533
|
}
|
|
@@ -12546,7 +12554,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
12546
12554
|
const scale = new Vector312();
|
|
12547
12555
|
this.getModelMatrix(model).decompose(position, rotation, scale);
|
|
12548
12556
|
if (position.distanceToSquared(this.position) > 1e-10 || scale.distanceToSquared(new Vector312(1, 1, 1)) > 1e-10) return 0;
|
|
12549
|
-
return ModelCulling.toLocalMask(worldMask, new
|
|
12557
|
+
return ModelCulling.toLocalMask(worldMask, new Euler9().setFromQuaternion(rotation));
|
|
12550
12558
|
}
|
|
12551
12559
|
/** World-space face mask currently applied to this block. */
|
|
12552
12560
|
get cullMask() {
|
|
@@ -12622,7 +12630,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
12622
12630
|
})
|
|
12623
12631
|
);
|
|
12624
12632
|
const previous = this._fluidModel;
|
|
12625
|
-
const matrix = previous ? this.getModelMatrix(previous) : new
|
|
12633
|
+
const matrix = previous ? this.getModelMatrix(previous) : new Matrix410().makeTranslation(...this.position.toArray());
|
|
12626
12634
|
if (isInstanceReference(replacement)) replacement.setMatrix(matrix);
|
|
12627
12635
|
else matrix.decompose(replacement.position, replacement.quaternion, replacement.scale);
|
|
12628
12636
|
this._models = this._models.filter((model) => model !== previous);
|
|
@@ -12772,7 +12780,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
12772
12780
|
setPositionRotationScaleAt(index, position, rotation, scale) {
|
|
12773
12781
|
super.setPositionRotationScaleAt(index, position, rotation, scale);
|
|
12774
12782
|
}
|
|
12775
|
-
getMatrixAt(index, matrix = new
|
|
12783
|
+
getMatrixAt(index, matrix = new Matrix410()) {
|
|
12776
12784
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
12777
12785
|
const child = this._models[0];
|
|
12778
12786
|
if (child && isModelObject(child)) {
|
|
@@ -13276,13 +13284,13 @@ init_ModelObject();
|
|
|
13276
13284
|
init_nbt();
|
|
13277
13285
|
|
|
13278
13286
|
// src/renderer/FlyControls.ts
|
|
13279
|
-
import { Controls, Euler as
|
|
13287
|
+
import { Controls, Euler as Euler10, MathUtils as MathUtils2, Quaternion as Quaternion6, Vector3 as Vector313 } from "three";
|
|
13280
13288
|
var VANILLA_FLY_SPEED = 10.89;
|
|
13281
13289
|
var PITCH_LIMIT = Math.PI / 2;
|
|
13282
13290
|
var MOVE_EPSILON = 1e-6;
|
|
13283
13291
|
var MAX_STEP_SECONDS = 0.1;
|
|
13284
13292
|
var CLICK_SLOP_PIXELS = 4;
|
|
13285
|
-
var _euler = new
|
|
13293
|
+
var _euler = new Euler10(0, 0, 0, "YXZ");
|
|
13286
13294
|
var _forward = new Vector313();
|
|
13287
13295
|
var _right = new Vector313();
|
|
13288
13296
|
var _targetVelocity = new Vector313();
|
|
@@ -17244,7 +17252,7 @@ init_CubeFace();
|
|
|
17244
17252
|
init_AssetKey();
|
|
17245
17253
|
init_Models();
|
|
17246
17254
|
init_CubeFace();
|
|
17247
|
-
import { BufferAttribute as BufferAttribute7, BufferGeometry as BufferGeometry8, Matrix4 as
|
|
17255
|
+
import { BufferAttribute as BufferAttribute7, BufferGeometry as BufferGeometry8, Matrix4 as Matrix411, Vector3 as Vector316 } from "three";
|
|
17248
17256
|
init_ModelCulling();
|
|
17249
17257
|
init_ModelObject();
|
|
17250
17258
|
init_UVMapper();
|
|
@@ -17382,7 +17390,7 @@ var SectionModels = class {
|
|
|
17382
17390
|
});
|
|
17383
17391
|
await object4.init();
|
|
17384
17392
|
let geometry = object4.children[0].geometry;
|
|
17385
|
-
geometry.applyMatrix4(new
|
|
17393
|
+
geometry.applyMatrix4(new Matrix411().makeRotationFromEuler(rotation));
|
|
17386
17394
|
object4.clear();
|
|
17387
17395
|
const keep = [];
|
|
17388
17396
|
const cullFaces = [];
|
|
@@ -17502,7 +17510,7 @@ import { Vector3 as Vector318 } from "three";
|
|
|
17502
17510
|
|
|
17503
17511
|
// src/world/_picking/Picking.ts
|
|
17504
17512
|
init_three();
|
|
17505
|
-
import { Matrix3 as Matrix33, Matrix4 as
|
|
17513
|
+
import { Matrix3 as Matrix33, Matrix4 as Matrix412 } from "three";
|
|
17506
17514
|
function pickableMeshes(root, scene, raycaster) {
|
|
17507
17515
|
const result = [];
|
|
17508
17516
|
let attached = false;
|
|
@@ -17529,7 +17537,7 @@ function hitNormal(hit) {
|
|
|
17529
17537
|
const mesh = hit.object;
|
|
17530
17538
|
const matrix = mesh.matrixWorld.clone();
|
|
17531
17539
|
if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
|
|
17532
|
-
const instance = new
|
|
17540
|
+
const instance = new Matrix412();
|
|
17533
17541
|
mesh.getMatrixAt(hit.instanceId, instance);
|
|
17534
17542
|
matrix.multiply(instance);
|
|
17535
17543
|
}
|