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