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