minerender 2.1.0-alpha.76 → 2.1.0-alpha.77
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/README.md +57 -0
- package/dist/browser/index.d.mts +121 -2
- package/dist/browser/index.d.ts +121 -2
- package/dist/browser/index.js +720 -303
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +688 -271
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +1463 -1035
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +121 -2
- package/dist/node/index.d.ts +121 -2
- package/dist/node/index.js +721 -302
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +687 -270
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.js
CHANGED
|
@@ -864,8 +864,8 @@ var init_Textures = __esm({
|
|
|
864
864
|
for (let y = 0; y < size; y++) {
|
|
865
865
|
for (let x = 0; x < size; x++) {
|
|
866
866
|
const offset = (y * size + x) * 4;
|
|
867
|
-
const
|
|
868
|
-
data[offset] = data[offset + 2] =
|
|
867
|
+
const color2 = (x + y) % 2 === 0 ? 255 : 0;
|
|
868
|
+
data[offset] = data[offset + 2] = color2;
|
|
869
869
|
data[offset + 3] = 255;
|
|
870
870
|
}
|
|
871
871
|
}
|
|
@@ -1450,17 +1450,17 @@ var init_AssetKey = __esm({
|
|
|
1450
1450
|
var DisplayPosition, DISPLAY_POSITIONS;
|
|
1451
1451
|
var init_DisplayPosition = __esm({
|
|
1452
1452
|
"src/model/DisplayPosition.ts"() {
|
|
1453
|
-
DisplayPosition = /* @__PURE__ */ ((
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
return
|
|
1453
|
+
DisplayPosition = /* @__PURE__ */ ((DisplayPosition3) => {
|
|
1454
|
+
DisplayPosition3["THIRDPERSON_RIGHTHAND"] = "thirdperson_righthand";
|
|
1455
|
+
DisplayPosition3["THIRDPERSON_LEFTHAND"] = "thirdperson_lefthand";
|
|
1456
|
+
DisplayPosition3["FIRSTPERSON_RIGHTHAND"] = "firstperson_righthand";
|
|
1457
|
+
DisplayPosition3["FIRSTPERSON_LEFTHAND"] = "firstperson_lefthand";
|
|
1458
|
+
DisplayPosition3["GUI"] = "gui";
|
|
1459
|
+
DisplayPosition3["HEAD"] = "head";
|
|
1460
|
+
DisplayPosition3["GROUND"] = "ground";
|
|
1461
|
+
DisplayPosition3["FIXED"] = "fixed";
|
|
1462
|
+
DisplayPosition3["ON_SHELF"] = "on_shelf";
|
|
1463
|
+
return DisplayPosition3;
|
|
1464
1464
|
})(DisplayPosition || {});
|
|
1465
1465
|
DISPLAY_POSITIONS = Object.values(DisplayPosition);
|
|
1466
1466
|
}
|
|
@@ -1678,11 +1678,11 @@ var init_Models = __esm({
|
|
|
1678
1678
|
return this.PERSISTENT_CACHE.getOrLoad(AssetLoader.persistentKey(keyStr), (k1) => {
|
|
1679
1679
|
return AssetLoader.get(key, "model" /* MODEL */);
|
|
1680
1680
|
});
|
|
1681
|
-
}).then((
|
|
1682
|
-
if (
|
|
1683
|
-
|
|
1681
|
+
}).then((asset2) => {
|
|
1682
|
+
if (asset2) {
|
|
1683
|
+
asset2.key = key;
|
|
1684
1684
|
}
|
|
1685
|
-
return
|
|
1685
|
+
return asset2;
|
|
1686
1686
|
});
|
|
1687
1687
|
}
|
|
1688
1688
|
/**
|
|
@@ -1772,11 +1772,11 @@ var init_BlockStates = __esm({
|
|
|
1772
1772
|
return this.PERSISTENT_CACHE.getOrLoad(AssetLoader.persistentKey(keyStr), (k1) => {
|
|
1773
1773
|
return AssetLoader.get(key, "blockstate" /* BLOCKSTATE */);
|
|
1774
1774
|
});
|
|
1775
|
-
}).then((
|
|
1776
|
-
if (
|
|
1777
|
-
|
|
1775
|
+
}).then((asset2) => {
|
|
1776
|
+
if (asset2) {
|
|
1777
|
+
asset2.key = key;
|
|
1778
1778
|
}
|
|
1779
|
-
return
|
|
1779
|
+
return asset2;
|
|
1780
1780
|
});
|
|
1781
1781
|
}
|
|
1782
1782
|
static getAll(keys) {
|
|
@@ -1925,29 +1925,29 @@ function applyGenericRotation(axis, rotation, obj) {
|
|
|
1925
1925
|
break;
|
|
1926
1926
|
}
|
|
1927
1927
|
}
|
|
1928
|
-
function addBox3WireframeToObject(box, obj,
|
|
1928
|
+
function addBox3WireframeToObject(box, obj, color2 = 16777215, w = 2) {
|
|
1929
1929
|
let size = new import_three8.Vector3();
|
|
1930
1930
|
box.getSize(size);
|
|
1931
1931
|
let boxGeo = new import_three8.BoxGeometry(size.x, size.y, size.z, 1, 1, 1);
|
|
1932
1932
|
let wireGeo = new import_three8.EdgesGeometry(boxGeo);
|
|
1933
|
-
let wireMat = new import_three8.LineBasicMaterial({ color, linewidth: w });
|
|
1933
|
+
let wireMat = new import_three8.LineBasicMaterial({ color: color2, linewidth: w });
|
|
1934
1934
|
let wireframe = new import_three8.LineSegments(wireGeo, wireMat);
|
|
1935
1935
|
obj.add(wireframe);
|
|
1936
1936
|
let axes = new import_three8.AxesHelper(1);
|
|
1937
1937
|
obj.add(axes);
|
|
1938
1938
|
}
|
|
1939
|
-
function addWireframeToObject(obj,
|
|
1939
|
+
function addWireframeToObject(obj, color2 = 16777215, w = 2) {
|
|
1940
1940
|
let boxGeo = new import_three8.BoxGeometry(16, 16, 16, 1, 1, 1);
|
|
1941
1941
|
let wireGeo = new import_three8.EdgesGeometry(boxGeo);
|
|
1942
|
-
let wireMat = new import_three8.LineBasicMaterial({ color, linewidth: w });
|
|
1942
|
+
let wireMat = new import_three8.LineBasicMaterial({ color: color2, linewidth: w });
|
|
1943
1943
|
let wireframe = new import_three8.LineSegments(wireGeo, wireMat);
|
|
1944
1944
|
obj.add(wireframe);
|
|
1945
1945
|
let axes = new import_three8.AxesHelper(1);
|
|
1946
1946
|
obj.add(axes);
|
|
1947
1947
|
}
|
|
1948
|
-
function addWireframeToMesh(geo, mesh,
|
|
1948
|
+
function addWireframeToMesh(geo, mesh, color2 = 16777215, w = 2) {
|
|
1949
1949
|
let wireGeo = new import_three8.EdgesGeometry(geo);
|
|
1950
|
-
let wireMat = new import_three8.LineBasicMaterial({ color, linewidth: w });
|
|
1950
|
+
let wireMat = new import_three8.LineBasicMaterial({ color: color2, linewidth: w });
|
|
1951
1951
|
let wireframe = new import_three8.LineSegments(wireGeo, wireMat);
|
|
1952
1952
|
mesh.add(wireframe);
|
|
1953
1953
|
let axes = new import_three8.AxesHelper(1);
|
|
@@ -2396,27 +2396,27 @@ var init_PackFormats = __esm({
|
|
|
2396
2396
|
this.versions = /* @__PURE__ */ new Map();
|
|
2397
2397
|
}
|
|
2398
2398
|
/** Resolves pack formats from Mojang's client metadata hosted on assets.mcasset.cloud. */
|
|
2399
|
-
static async get(
|
|
2400
|
-
let pending = this.versions.get(
|
|
2399
|
+
static async get(version2, type) {
|
|
2400
|
+
let pending = this.versions.get(version2);
|
|
2401
2401
|
if (!pending || pending.expires <= Date.now()) {
|
|
2402
2402
|
pending = {
|
|
2403
|
-
formats: this.load(
|
|
2404
|
-
expires: ["latest", "release", "snapshot"].includes(
|
|
2403
|
+
formats: this.load(version2),
|
|
2404
|
+
expires: ["latest", "release", "snapshot"].includes(version2) ? Date.now() + 3e5 : Infinity
|
|
2405
2405
|
};
|
|
2406
|
-
this.versions.set(
|
|
2406
|
+
this.versions.set(version2, pending);
|
|
2407
2407
|
}
|
|
2408
2408
|
try {
|
|
2409
2409
|
return (await pending.formats)[type];
|
|
2410
2410
|
} catch (cause) {
|
|
2411
|
-
if (this.versions.get(
|
|
2411
|
+
if (this.versions.get(version2) === pending) this.versions.delete(version2);
|
|
2412
2412
|
const option = type === "assets" ? "resourcePackFormat" : "dataPackFormat";
|
|
2413
2413
|
const reason = cause instanceof Error ? cause.message : String(cause);
|
|
2414
|
-
throw new Error(`Could not resolve the pack format for Minecraft ${
|
|
2414
|
+
throw new Error(`Could not resolve the pack format for Minecraft ${version2}. Set ArchiveAssetSource ${option} explicitly. ${reason}`);
|
|
2415
2415
|
}
|
|
2416
2416
|
}
|
|
2417
|
-
static async load(
|
|
2417
|
+
static async load(version2) {
|
|
2418
2418
|
const response = await Requests.genericRequest({
|
|
2419
|
-
url: `https://assets.mcasset.cloud/${encodeURIComponent(
|
|
2419
|
+
url: `https://assets.mcasset.cloud/${encodeURIComponent(version2)}/game-version.json`,
|
|
2420
2420
|
responseType: "json"
|
|
2421
2421
|
});
|
|
2422
2422
|
const data = response.data;
|
|
@@ -2504,7 +2504,7 @@ var init_ArchiveAssetSource = __esm({
|
|
|
2504
2504
|
}
|
|
2505
2505
|
async load(key, parser) {
|
|
2506
2506
|
const path = `${this.assetBasePath(key)}${key.type !== void 0 ? key.type + "/" : ""}${key.path}${key.extension}`;
|
|
2507
|
-
const
|
|
2507
|
+
const version2 = AssetLoader.version;
|
|
2508
2508
|
let selectedPath = path;
|
|
2509
2509
|
let url;
|
|
2510
2510
|
try {
|
|
@@ -2512,7 +2512,7 @@ var init_ArchiveAssetSource = __esm({
|
|
|
2512
2512
|
if (key.rootType === "assets" || key.rootType === "data") {
|
|
2513
2513
|
const metadata = await this.getMetadata(key);
|
|
2514
2514
|
if (metadata.hasOverlays) {
|
|
2515
|
-
const format2 = (key.rootType === "assets" ? this.options.resourcePackFormat : this.options.dataPackFormat) ?? await PackFormats.get(
|
|
2515
|
+
const format2 = (key.rootType === "assets" ? this.options.resourcePackFormat : this.options.dataPackFormat) ?? await PackFormats.get(version2, key.rootType);
|
|
2516
2516
|
directories = metadata.overlayDirectories(format2);
|
|
2517
2517
|
}
|
|
2518
2518
|
}
|
|
@@ -2610,8 +2610,8 @@ var init_AssetLoader = __esm({
|
|
|
2610
2610
|
return this.ROOT.substring(this.ROOT.lastIndexOf("/") + 1);
|
|
2611
2611
|
}
|
|
2612
2612
|
/** Selects an mcasset.cloud version, updates the vanilla source, and clears in-memory caches. */
|
|
2613
|
-
static setVersion(
|
|
2614
|
-
this.ROOT = `https://assets.mcasset.cloud/${
|
|
2613
|
+
static setVersion(version2) {
|
|
2614
|
+
this.ROOT = `https://assets.mcasset.cloud/${version2}`;
|
|
2615
2615
|
const source = new HostedAssetSource(this.ROOT, { retryDefaults: false });
|
|
2616
2616
|
const index = this._SOURCES.findIndex((s) => s.key === "mcassets");
|
|
2617
2617
|
if (index !== -1) {
|
|
@@ -2680,8 +2680,8 @@ ${key}` : key;
|
|
|
2680
2680
|
const sources = [...this._SOURCES];
|
|
2681
2681
|
const results = [];
|
|
2682
2682
|
for (const { source } of sources) {
|
|
2683
|
-
const
|
|
2684
|
-
if (
|
|
2683
|
+
const asset2 = await source.get(key, parser);
|
|
2684
|
+
if (asset2 != void 0) results.push(asset2);
|
|
2685
2685
|
if (await source.blocks(key)) break;
|
|
2686
2686
|
}
|
|
2687
2687
|
return results;
|
|
@@ -2743,9 +2743,9 @@ var init_ModelTextures = __esm({
|
|
|
2743
2743
|
const pending = this.preload(key);
|
|
2744
2744
|
const cached2 = Caching.textureAssetCache.getIfPresent(keyStr);
|
|
2745
2745
|
try {
|
|
2746
|
-
const
|
|
2747
|
-
if (
|
|
2748
|
-
return await ImageLoader.infoToCanvasData(
|
|
2746
|
+
const asset2 = await pending;
|
|
2747
|
+
if (asset2) {
|
|
2748
|
+
return await ImageLoader.infoToCanvasData(asset2);
|
|
2749
2749
|
}
|
|
2750
2750
|
return void 0;
|
|
2751
2751
|
} catch (err) {
|
|
@@ -2759,10 +2759,10 @@ var init_ModelTextures = __esm({
|
|
|
2759
2759
|
static async preload(key) {
|
|
2760
2760
|
const keyStr = key.serialize();
|
|
2761
2761
|
return Caching.textureAssetCache.get(keyStr, (k) => {
|
|
2762
|
-
return AssetLoader.get(key, "image" /* IMAGE */).then((
|
|
2763
|
-
if (
|
|
2764
|
-
|
|
2765
|
-
return
|
|
2762
|
+
return AssetLoader.get(key, "image" /* IMAGE */).then((asset2) => {
|
|
2763
|
+
if (asset2)
|
|
2764
|
+
asset2.key = key;
|
|
2765
|
+
return asset2;
|
|
2766
2766
|
});
|
|
2767
2767
|
});
|
|
2768
2768
|
}
|
|
@@ -2775,10 +2775,10 @@ var init_ModelTextures = __esm({
|
|
|
2775
2775
|
const keyStr = key.serialize();
|
|
2776
2776
|
return Caching.textureMetaCache.get(keyStr, (k) => {
|
|
2777
2777
|
return this.PERSISTENT_META_CACHE.getOrLoad(AssetLoader.persistentKey(keyStr), (k1) => {
|
|
2778
|
-
return AssetLoader.get(key, "meta" /* META */).then((
|
|
2779
|
-
if (
|
|
2780
|
-
|
|
2781
|
-
return
|
|
2778
|
+
return AssetLoader.get(key, "meta" /* META */).then((asset2) => {
|
|
2779
|
+
if (asset2)
|
|
2780
|
+
asset2.key = key;
|
|
2781
|
+
return asset2;
|
|
2782
2782
|
});
|
|
2783
2783
|
});
|
|
2784
2784
|
});
|
|
@@ -3347,12 +3347,12 @@ var init_UVMapper = __esm({
|
|
|
3347
3347
|
} else {
|
|
3348
3348
|
uniqueTextureNames.push(textureKey);
|
|
3349
3349
|
const assetKey = AssetKey.parse("textures", textureValue, model.key);
|
|
3350
|
-
promises.push(ModelTextures.get(assetKey).then((
|
|
3351
|
-
if (!
|
|
3350
|
+
promises.push(ModelTextures.get(assetKey).then((asset2) => {
|
|
3351
|
+
if (!asset2) {
|
|
3352
3352
|
console.warn(p5, "Missing texture", assetKey);
|
|
3353
3353
|
return;
|
|
3354
3354
|
}
|
|
3355
|
-
textureMap[textureKey] = new WrappedImage(
|
|
3355
|
+
textureMap[textureKey] = new WrappedImage(asset2);
|
|
3356
3356
|
}));
|
|
3357
3357
|
promises.push(ModelTextures.getMeta(assetKey).then((meta) => {
|
|
3358
3358
|
metaMap[textureKey] = meta;
|
|
@@ -3696,10 +3696,10 @@ var init_Entities = __esm({
|
|
|
3696
3696
|
const collect = async (path) => {
|
|
3697
3697
|
const prefix2 = path ? `${path}/` : "";
|
|
3698
3698
|
const key = new AssetKey(DEFAULT_NAMESPACE, `${prefix2}_list`, void 0, void 0, "entity-models", ".json");
|
|
3699
|
-
const
|
|
3700
|
-
if (!
|
|
3701
|
-
const files =
|
|
3702
|
-
const children = await Promise.all(
|
|
3699
|
+
const list2 = await Caching.listAssetCache.get(key.serialize(), () => AssetLoader.get(key, "list" /* LIST */));
|
|
3700
|
+
if (!list2) return [];
|
|
3701
|
+
const files = list2.files.filter((file) => file.endsWith(".json") && file !== "_list.json").map((file) => `${prefix2}${file.slice(0, -5)}`);
|
|
3702
|
+
const children = await Promise.all(list2.directories.map((directory) => collect(`${prefix2}${directory}`)));
|
|
3703
3703
|
return [...files, ...children.flat()];
|
|
3704
3704
|
};
|
|
3705
3705
|
return collect("");
|
|
@@ -3783,8 +3783,8 @@ var init_Entities = __esm({
|
|
|
3783
3783
|
if (await ModelTextures.get(texture2)) return texture2;
|
|
3784
3784
|
}
|
|
3785
3785
|
const listKey = new AssetKey(modelKey.namespace, "_list", `${name}_variant`, void 0, "data", ".json", root);
|
|
3786
|
-
const
|
|
3787
|
-
const files =
|
|
3786
|
+
const list2 = await AssetLoader.get(listKey, "list" /* LIST */);
|
|
3787
|
+
const files = list2?.files.filter((file2) => file2.endsWith(".json") && file2 !== "_list.json");
|
|
3788
3788
|
const file = files?.find((file2) => file2 === "temperate.json") ?? files?.[0];
|
|
3789
3789
|
if (!file) return void 0;
|
|
3790
3790
|
const variantKey = new AssetKey(modelKey.namespace, file.slice(0, -5), `${name}_variant`, void 0, "data", ".json", root);
|
|
@@ -3889,27 +3889,27 @@ var init_EntityAnimationPlayer = __esm({
|
|
|
3889
3889
|
for (const layer of layers) {
|
|
3890
3890
|
const objects = [];
|
|
3891
3891
|
if (poses) {
|
|
3892
|
-
layer.traverse((
|
|
3893
|
-
if (poses.has(
|
|
3892
|
+
layer.traverse((object3) => {
|
|
3893
|
+
if (poses.has(object3)) objects.push(object3);
|
|
3894
3894
|
});
|
|
3895
3895
|
} else {
|
|
3896
3896
|
for (const bone of Object.keys(animation.bones)) {
|
|
3897
|
-
const
|
|
3898
|
-
if (
|
|
3897
|
+
const object3 = layer.getObjectByName(`group:${bone}`);
|
|
3898
|
+
if (object3) objects.push(object3);
|
|
3899
3899
|
}
|
|
3900
3900
|
}
|
|
3901
|
-
for (const
|
|
3902
|
-
const bone =
|
|
3903
|
-
const pose = poses?.get(
|
|
3901
|
+
for (const object3 of objects) {
|
|
3902
|
+
const bone = object3.name.slice("group:".length);
|
|
3903
|
+
const pose = poses?.get(object3);
|
|
3904
3904
|
this.parts.push({
|
|
3905
3905
|
bone,
|
|
3906
|
-
object:
|
|
3907
|
-
position:
|
|
3908
|
-
rotation:
|
|
3909
|
-
scale:
|
|
3910
|
-
basePosition: pose ? new import_three11.Vector3(...pose.offset) :
|
|
3911
|
-
baseRotation: pose ? new import_three11.Euler(...pose.rotation, "ZYX") :
|
|
3912
|
-
baseScale: pose ? new import_three11.Vector3(...pose.scale ?? [1, 1, 1]) :
|
|
3906
|
+
object: object3,
|
|
3907
|
+
position: object3.position.clone(),
|
|
3908
|
+
rotation: object3.rotation.clone(),
|
|
3909
|
+
scale: object3.scale.clone(),
|
|
3910
|
+
basePosition: pose ? new import_three11.Vector3(...pose.offset) : object3.position.clone(),
|
|
3911
|
+
baseRotation: pose ? new import_three11.Euler(...pose.rotation, "ZYX") : object3.rotation.clone(),
|
|
3912
|
+
baseScale: pose ? new import_three11.Vector3(...pose.scale ?? [1, 1, 1]) : object3.scale.clone()
|
|
3913
3913
|
});
|
|
3914
3914
|
}
|
|
3915
3915
|
}
|
|
@@ -4275,10 +4275,10 @@ var init_SceneObject = __esm({
|
|
|
4275
4275
|
return new import_three12.InstancedBufferAttribute(array, attribute.itemSize, attribute.normalized, attribute.meshPerAttribute).setUsage(attribute.usage);
|
|
4276
4276
|
};
|
|
4277
4277
|
const matrix = grow(mesh.instanceMatrix, 0);
|
|
4278
|
-
const
|
|
4278
|
+
const color2 = mesh.instanceColor ? grow(mesh.instanceColor, 1) : null;
|
|
4279
4279
|
mesh.dispose();
|
|
4280
4280
|
mesh.instanceMatrix = matrix;
|
|
4281
|
-
mesh.instanceColor =
|
|
4281
|
+
mesh.instanceColor = color2;
|
|
4282
4282
|
}
|
|
4283
4283
|
*activeInstanceIndices() {
|
|
4284
4284
|
if (this.instanceMesh) {
|
|
@@ -4451,15 +4451,15 @@ var init_SceneObject = __esm({
|
|
|
4451
4451
|
}
|
|
4452
4452
|
}
|
|
4453
4453
|
//</editor-fold>
|
|
4454
|
-
toggleObjectVisibility(
|
|
4455
|
-
if (
|
|
4454
|
+
toggleObjectVisibility(object3, visible) {
|
|
4455
|
+
if (object3) {
|
|
4456
4456
|
if (typeof visible !== "undefined") {
|
|
4457
|
-
|
|
4457
|
+
object3.visible = visible;
|
|
4458
4458
|
} else {
|
|
4459
|
-
|
|
4459
|
+
object3.visible = !object3.visible;
|
|
4460
4460
|
}
|
|
4461
4461
|
this.notifyDirty();
|
|
4462
|
-
return
|
|
4462
|
+
return object3.visible;
|
|
4463
4463
|
}
|
|
4464
4464
|
this.notifyDirty();
|
|
4465
4465
|
return false;
|
|
@@ -4755,8 +4755,8 @@ var init_EntityObject = __esm({
|
|
|
4755
4755
|
this.scrollMaterials.push({ material: mat, offset: mat.map.offset, speed: scroll });
|
|
4756
4756
|
}
|
|
4757
4757
|
}
|
|
4758
|
-
this.getLayerGroup(name)?.traverse((
|
|
4759
|
-
if (isMesh(
|
|
4758
|
+
this.getLayerGroup(name)?.traverse((object3) => {
|
|
4759
|
+
if (isMesh(object3)) object3.material = mat;
|
|
4760
4760
|
});
|
|
4761
4761
|
}));
|
|
4762
4762
|
if (!this.children.length) {
|
|
@@ -5084,8 +5084,8 @@ function toTrianglesDrawMode(geometry, drawMode) {
|
|
|
5084
5084
|
return geometry;
|
|
5085
5085
|
}
|
|
5086
5086
|
}
|
|
5087
|
-
function computeMorphedAttributes(
|
|
5088
|
-
if (
|
|
5087
|
+
function computeMorphedAttributes(object3) {
|
|
5088
|
+
if (object3.geometry.isBufferGeometry !== true) {
|
|
5089
5089
|
console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
|
|
5090
5090
|
return null;
|
|
5091
5091
|
}
|
|
@@ -5098,11 +5098,11 @@ function computeMorphedAttributes(object2) {
|
|
|
5098
5098
|
const _morphA = new import_three22.Vector3();
|
|
5099
5099
|
const _morphB = new import_three22.Vector3();
|
|
5100
5100
|
const _morphC = new import_three22.Vector3();
|
|
5101
|
-
function _calculateMorphedAttributeData(
|
|
5101
|
+
function _calculateMorphedAttributeData(object4, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
|
|
5102
5102
|
_vA.fromBufferAttribute(attribute, a2);
|
|
5103
5103
|
_vB.fromBufferAttribute(attribute, b2);
|
|
5104
5104
|
_vC.fromBufferAttribute(attribute, c2);
|
|
5105
|
-
const morphInfluences =
|
|
5105
|
+
const morphInfluences = object4.morphTargetInfluences;
|
|
5106
5106
|
if (material2.morphTargets && morphAttribute && morphInfluences) {
|
|
5107
5107
|
_morphA.set(0, 0, 0);
|
|
5108
5108
|
_morphB.set(0, 0, 0);
|
|
@@ -5128,10 +5128,10 @@ function computeMorphedAttributes(object2) {
|
|
|
5128
5128
|
_vB.add(_morphB);
|
|
5129
5129
|
_vC.add(_morphC);
|
|
5130
5130
|
}
|
|
5131
|
-
if (
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5131
|
+
if (object4.isSkinnedMesh) {
|
|
5132
|
+
object4.boneTransform(a2, _vA);
|
|
5133
|
+
object4.boneTransform(b2, _vB);
|
|
5134
|
+
object4.boneTransform(c2, _vC);
|
|
5135
5135
|
}
|
|
5136
5136
|
modifiedAttributeArray[a2 * 3 + 0] = _vA.x;
|
|
5137
5137
|
modifiedAttributeArray[a2 * 3 + 1] = _vA.y;
|
|
@@ -5143,8 +5143,8 @@ function computeMorphedAttributes(object2) {
|
|
|
5143
5143
|
modifiedAttributeArray[c2 * 3 + 1] = _vC.y;
|
|
5144
5144
|
modifiedAttributeArray[c2 * 3 + 2] = _vC.z;
|
|
5145
5145
|
}
|
|
5146
|
-
const geometry =
|
|
5147
|
-
const material =
|
|
5146
|
+
const geometry = object3.geometry;
|
|
5147
|
+
const material = object3.material;
|
|
5148
5148
|
let a, b, c;
|
|
5149
5149
|
const index = geometry.index;
|
|
5150
5150
|
const positionAttribute = geometry.attributes.position;
|
|
@@ -5171,7 +5171,7 @@ function computeMorphedAttributes(object2) {
|
|
|
5171
5171
|
b = index.getX(j + 1);
|
|
5172
5172
|
c = index.getX(j + 2);
|
|
5173
5173
|
_calculateMorphedAttributeData(
|
|
5174
|
-
|
|
5174
|
+
object3,
|
|
5175
5175
|
groupMaterial,
|
|
5176
5176
|
positionAttribute,
|
|
5177
5177
|
morphPosition,
|
|
@@ -5182,7 +5182,7 @@ function computeMorphedAttributes(object2) {
|
|
|
5182
5182
|
modifiedPosition
|
|
5183
5183
|
);
|
|
5184
5184
|
_calculateMorphedAttributeData(
|
|
5185
|
-
|
|
5185
|
+
object3,
|
|
5186
5186
|
groupMaterial,
|
|
5187
5187
|
normalAttribute,
|
|
5188
5188
|
morphNormal,
|
|
@@ -5202,7 +5202,7 @@ function computeMorphedAttributes(object2) {
|
|
|
5202
5202
|
b = index.getX(i + 1);
|
|
5203
5203
|
c = index.getX(i + 2);
|
|
5204
5204
|
_calculateMorphedAttributeData(
|
|
5205
|
-
|
|
5205
|
+
object3,
|
|
5206
5206
|
material,
|
|
5207
5207
|
positionAttribute,
|
|
5208
5208
|
morphPosition,
|
|
@@ -5213,7 +5213,7 @@ function computeMorphedAttributes(object2) {
|
|
|
5213
5213
|
modifiedPosition
|
|
5214
5214
|
);
|
|
5215
5215
|
_calculateMorphedAttributeData(
|
|
5216
|
-
|
|
5216
|
+
object3,
|
|
5217
5217
|
material,
|
|
5218
5218
|
normalAttribute,
|
|
5219
5219
|
morphNormal,
|
|
@@ -5237,7 +5237,7 @@ function computeMorphedAttributes(object2) {
|
|
|
5237
5237
|
b = j + 1;
|
|
5238
5238
|
c = j + 2;
|
|
5239
5239
|
_calculateMorphedAttributeData(
|
|
5240
|
-
|
|
5240
|
+
object3,
|
|
5241
5241
|
groupMaterial,
|
|
5242
5242
|
positionAttribute,
|
|
5243
5243
|
morphPosition,
|
|
@@ -5248,7 +5248,7 @@ function computeMorphedAttributes(object2) {
|
|
|
5248
5248
|
modifiedPosition
|
|
5249
5249
|
);
|
|
5250
5250
|
_calculateMorphedAttributeData(
|
|
5251
|
-
|
|
5251
|
+
object3,
|
|
5252
5252
|
groupMaterial,
|
|
5253
5253
|
normalAttribute,
|
|
5254
5254
|
morphNormal,
|
|
@@ -5268,7 +5268,7 @@ function computeMorphedAttributes(object2) {
|
|
|
5268
5268
|
b = i + 1;
|
|
5269
5269
|
c = i + 2;
|
|
5270
5270
|
_calculateMorphedAttributeData(
|
|
5271
|
-
|
|
5271
|
+
object3,
|
|
5272
5272
|
material,
|
|
5273
5273
|
positionAttribute,
|
|
5274
5274
|
morphPosition,
|
|
@@ -5279,7 +5279,7 @@ function computeMorphedAttributes(object2) {
|
|
|
5279
5279
|
modifiedPosition
|
|
5280
5280
|
);
|
|
5281
5281
|
_calculateMorphedAttributeData(
|
|
5282
|
-
|
|
5282
|
+
object3,
|
|
5283
5283
|
material,
|
|
5284
5284
|
normalAttribute,
|
|
5285
5285
|
morphNormal,
|
|
@@ -5537,9 +5537,9 @@ var init_ItemTints = __esm({
|
|
|
5537
5537
|
}));
|
|
5538
5538
|
return colors;
|
|
5539
5539
|
}
|
|
5540
|
-
static rgb(
|
|
5541
|
-
if (!Array.isArray(
|
|
5542
|
-
const [red, green, blue] =
|
|
5540
|
+
static rgb(color2) {
|
|
5541
|
+
if (!Array.isArray(color2)) return color2 & 16777215;
|
|
5542
|
+
const [red, green, blue] = color2.map((channel) => Math.floor(Math.fround(Math.fround(channel) * 255)));
|
|
5543
5543
|
return red << 16 | green << 8 | blue;
|
|
5544
5544
|
}
|
|
5545
5545
|
};
|
|
@@ -5595,13 +5595,13 @@ var init_ModelObject = __esm({
|
|
|
5595
5595
|
transform.multiply(new import_three25.Matrix4().makeTranslation(-8, -8, -8));
|
|
5596
5596
|
try {
|
|
5597
5597
|
for (const part of parts) {
|
|
5598
|
-
const
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
this.add(
|
|
5603
|
-
await
|
|
5604
|
-
|
|
5598
|
+
const object3 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe });
|
|
5599
|
+
object3.matrix.copy(transform).multiply(part.transform);
|
|
5600
|
+
object3.matrixWorldNeedsUpdate = true;
|
|
5601
|
+
object3.matrixAutoUpdate = false;
|
|
5602
|
+
this.add(object3);
|
|
5603
|
+
await object3.init();
|
|
5604
|
+
object3.iterateAllMeshes((mesh) => {
|
|
5605
5605
|
const source = mesh.material;
|
|
5606
5606
|
let material = this.specialMaterials.get(source);
|
|
5607
5607
|
if (!material) {
|
|
@@ -5612,7 +5612,7 @@ var init_ModelObject = __esm({
|
|
|
5612
5612
|
mesh.material = material;
|
|
5613
5613
|
});
|
|
5614
5614
|
for (const [name, rotation] of Object.entries(part.rotations)) {
|
|
5615
|
-
|
|
5615
|
+
object3.getGroupByName(name)?.rotation.set(...rotation, "ZYX");
|
|
5616
5616
|
}
|
|
5617
5617
|
}
|
|
5618
5618
|
} catch (error) {
|
|
@@ -5665,9 +5665,9 @@ var init_ModelObject = __esm({
|
|
|
5665
5665
|
if (tintIndex === void 0 || tintIndex < 0) continue;
|
|
5666
5666
|
const tint = this.options.tints[tintIndex];
|
|
5667
5667
|
if (tint === void 0) continue;
|
|
5668
|
-
const
|
|
5668
|
+
const color2 = new import_three25.Color(tint);
|
|
5669
5669
|
for (let vertex = 0; vertex < 4; vertex++) {
|
|
5670
|
-
|
|
5670
|
+
color2.toArray(colors, (faceIndex * 4 + vertex) * 3);
|
|
5671
5671
|
}
|
|
5672
5672
|
}
|
|
5673
5673
|
elGeo.setAttribute("color", new import_three25.BufferAttribute(colors, 3));
|
|
@@ -5982,9 +5982,9 @@ var init_FluidModelObject = __esm({
|
|
|
5982
5982
|
}
|
|
5983
5983
|
}
|
|
5984
5984
|
geometry.clearGroups();
|
|
5985
|
-
const
|
|
5985
|
+
const color2 = new import_three31.Color(this.options.tints?.[0] ?? (this.kind === "water" ? 4159204 : 16777215));
|
|
5986
5986
|
const colors = new Float32Array(geometry.getAttribute("position").count * 3);
|
|
5987
|
-
for (let i = 0; i < colors.length; i += 3)
|
|
5987
|
+
for (let i = 0; i < colors.length; i += 3) color2.toArray(colors, i);
|
|
5988
5988
|
geometry.setAttribute("color", new import_three31.BufferAttribute(colors, 3));
|
|
5989
5989
|
geometry.computeBoundingBox();
|
|
5990
5990
|
geometry.computeBoundingSphere();
|
|
@@ -6095,6 +6095,7 @@ __export(index_node_exports, {
|
|
|
6095
6095
|
RequestError: () => RequestError,
|
|
6096
6096
|
Requests: () => Requests,
|
|
6097
6097
|
SKIN_PARTS: () => SKIN_PARTS,
|
|
6098
|
+
SceneDocumentLoader: () => SceneDocumentLoader,
|
|
6098
6099
|
SceneExporter: () => SceneExporter,
|
|
6099
6100
|
SceneInspector: () => SceneInspector,
|
|
6100
6101
|
SceneObject: () => SceneObject,
|
|
@@ -6170,6 +6171,7 @@ __export(index_node_exports, {
|
|
|
6170
6171
|
mergeBufferAttributes: () => mergeBufferAttributes,
|
|
6171
6172
|
mergeBufferGeometries: () => mergeBufferGeometries,
|
|
6172
6173
|
mergeVertices: () => mergeVertices,
|
|
6174
|
+
parseSceneDocument: () => parseSceneDocument,
|
|
6173
6175
|
prefix: () => prefix,
|
|
6174
6176
|
registerNodeEnv: () => registerNodeEnv,
|
|
6175
6177
|
sampleEntityAnimation: () => sampleEntityAnimation,
|
|
@@ -6260,9 +6262,9 @@ var NodeEnv = class {
|
|
|
6260
6262
|
imageSize(data) {
|
|
6261
6263
|
return (0, import_image_size.default)(Buffer.isBuffer(data) ? data : Buffer.from(data));
|
|
6262
6264
|
}
|
|
6263
|
-
openCache(name,
|
|
6265
|
+
openCache(name, version2) {
|
|
6264
6266
|
return new NodeCache(import_node_persist.default.create({
|
|
6265
|
-
dir: name +
|
|
6267
|
+
dir: name + version2,
|
|
6266
6268
|
encoding: "utf8"
|
|
6267
6269
|
}));
|
|
6268
6270
|
}
|
|
@@ -6423,8 +6425,8 @@ var Fonts = class {
|
|
|
6423
6425
|
const stack = await AssetLoader.getAll(key, "json" /* JSON */);
|
|
6424
6426
|
if (stack.length === 0) throw new Error(`Could not load font ${key.toNamespacedString()}`);
|
|
6425
6427
|
const glyphs = /* @__PURE__ */ new Map();
|
|
6426
|
-
for (const
|
|
6427
|
-
for (const provider of
|
|
6428
|
+
for (const asset2 of stack) {
|
|
6429
|
+
for (const provider of asset2.providers) {
|
|
6428
6430
|
if (provider.filter?.uniform || provider.filter?.jp) continue;
|
|
6429
6431
|
let provided;
|
|
6430
6432
|
switch (provider.type) {
|
|
@@ -6563,13 +6565,13 @@ var OBJExporter = class {
|
|
|
6563
6565
|
* @param {Object3D} object - The 3D object to export.
|
|
6564
6566
|
* @return {string} The exported OBJ.
|
|
6565
6567
|
*/
|
|
6566
|
-
parse(
|
|
6568
|
+
parse(object3) {
|
|
6567
6569
|
let output = "";
|
|
6568
6570
|
let indexVertex = 0;
|
|
6569
6571
|
let indexVertexUvs = 0;
|
|
6570
6572
|
let indexNormals = 0;
|
|
6571
6573
|
const vertex = new import_three16.Vector3();
|
|
6572
|
-
const
|
|
6574
|
+
const color2 = new import_three16.Color();
|
|
6573
6575
|
const normal = new import_three16.Vector3();
|
|
6574
6576
|
const uv = new import_three16.Vector2();
|
|
6575
6577
|
const face = [];
|
|
@@ -6668,9 +6670,9 @@ var OBJExporter = class {
|
|
|
6668
6670
|
vertex.applyMatrix4(points.matrixWorld);
|
|
6669
6671
|
output += "v " + vertex.x + " " + vertex.y + " " + vertex.z;
|
|
6670
6672
|
if (colors !== void 0) {
|
|
6671
|
-
|
|
6672
|
-
import_three16.ColorManagement.workingToColorSpace(
|
|
6673
|
-
output += " " +
|
|
6673
|
+
color2.fromBufferAttribute(colors, i);
|
|
6674
|
+
import_three16.ColorManagement.workingToColorSpace(color2, import_three16.SRGBColorSpace);
|
|
6675
|
+
output += " " + color2.r + " " + color2.g + " " + color2.b;
|
|
6674
6676
|
}
|
|
6675
6677
|
output += "\n";
|
|
6676
6678
|
}
|
|
@@ -6682,7 +6684,7 @@ var OBJExporter = class {
|
|
|
6682
6684
|
}
|
|
6683
6685
|
indexVertex += nbVertex;
|
|
6684
6686
|
}
|
|
6685
|
-
|
|
6687
|
+
object3.traverse(function(child) {
|
|
6686
6688
|
if (child.isMesh === true) {
|
|
6687
6689
|
parseMesh(child);
|
|
6688
6690
|
}
|
|
@@ -6710,9 +6712,9 @@ var PLYExporter = class {
|
|
|
6710
6712
|
* @param {PLYExporter~Options} options - The export options.
|
|
6711
6713
|
* @return {?(string|ArrayBuffer)} The exported PLY.
|
|
6712
6714
|
*/
|
|
6713
|
-
parse(
|
|
6715
|
+
parse(object3, onDone, options = {}) {
|
|
6714
6716
|
function traverseMeshes(cb) {
|
|
6715
|
-
|
|
6717
|
+
object3.traverse(function(child) {
|
|
6716
6718
|
if (child.isMesh === true || child.isPoints) {
|
|
6717
6719
|
const mesh = child;
|
|
6718
6720
|
const geometry = mesh.geometry;
|
|
@@ -6745,7 +6747,7 @@ var PLYExporter = class {
|
|
|
6745
6747
|
for (const name of customAttributeNames) customTypes[name] = "float";
|
|
6746
6748
|
let vertexCount = 0;
|
|
6747
6749
|
let faceCount = 0;
|
|
6748
|
-
|
|
6750
|
+
object3.traverse(function(child) {
|
|
6749
6751
|
if (child.isMesh === true) {
|
|
6750
6752
|
const mesh = child;
|
|
6751
6753
|
const geometry = mesh.geometry;
|
|
@@ -7339,8 +7341,8 @@ function equalArray(array1, array2) {
|
|
|
7339
7341
|
return element === array2[index];
|
|
7340
7342
|
});
|
|
7341
7343
|
}
|
|
7342
|
-
function stringToArrayBuffer(
|
|
7343
|
-
return new TextEncoder().encode(
|
|
7344
|
+
function stringToArrayBuffer(text2) {
|
|
7345
|
+
return new TextEncoder().encode(text2).buffer;
|
|
7344
7346
|
}
|
|
7345
7347
|
function isIdentityMatrix(matrix) {
|
|
7346
7348
|
return equalArray(matrix.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
@@ -7533,12 +7535,12 @@ var GLTFWriter = class {
|
|
|
7533
7535
|
* @param {THREE.Object3D|THREE.Material|THREE.BufferGeometry|THREE.AnimationClip} object
|
|
7534
7536
|
* @param {Object} objectDef
|
|
7535
7537
|
*/
|
|
7536
|
-
serializeUserData(
|
|
7537
|
-
if (Object.keys(
|
|
7538
|
+
serializeUserData(object3, objectDef) {
|
|
7539
|
+
if (Object.keys(object3.userData).length === 0) return;
|
|
7538
7540
|
const options = this.options;
|
|
7539
7541
|
const extensionsUsed = this.extensionsUsed;
|
|
7540
7542
|
try {
|
|
7541
|
-
const json = JSON.parse(JSON.stringify(
|
|
7543
|
+
const json = JSON.parse(JSON.stringify(object3.userData));
|
|
7542
7544
|
if (options.includeCustomExtensions && json.gltfExtensions) {
|
|
7543
7545
|
if (objectDef.extensions === void 0) objectDef.extensions = {};
|
|
7544
7546
|
for (const extensionName in json.gltfExtensions) {
|
|
@@ -7549,7 +7551,7 @@ var GLTFWriter = class {
|
|
|
7549
7551
|
}
|
|
7550
7552
|
if (Object.keys(json).length > 0) objectDef.extras = json;
|
|
7551
7553
|
} catch (error) {
|
|
7552
|
-
console.warn("THREE.GLTFExporter: userData of '" +
|
|
7554
|
+
console.warn("THREE.GLTFExporter: userData of '" + object3.name + "' won't be serialized because of JSON.stringify error - " + error.message);
|
|
7553
7555
|
}
|
|
7554
7556
|
}
|
|
7555
7557
|
/**
|
|
@@ -8058,9 +8060,9 @@ var GLTFWriter = class {
|
|
|
8058
8060
|
if (material.isMeshStandardMaterial !== true && material.isMeshBasicMaterial !== true) {
|
|
8059
8061
|
console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
|
|
8060
8062
|
}
|
|
8061
|
-
const
|
|
8062
|
-
if (!equalArray(
|
|
8063
|
-
materialDef.pbrMetallicRoughness.baseColorFactor =
|
|
8063
|
+
const color2 = material.color.toArray().concat([material.opacity]);
|
|
8064
|
+
if (!equalArray(color2, [1, 1, 1, 1])) {
|
|
8065
|
+
materialDef.pbrMetallicRoughness.baseColorFactor = color2;
|
|
8064
8066
|
}
|
|
8065
8067
|
if (material.isMeshStandardMaterial) {
|
|
8066
8068
|
materialDef.pbrMetallicRoughness.metallicFactor = material.metalness;
|
|
@@ -8475,13 +8477,13 @@ var GLTFWriter = class {
|
|
|
8475
8477
|
* @param {THREE.Object3D} object
|
|
8476
8478
|
* @return {?number}
|
|
8477
8479
|
*/
|
|
8478
|
-
processSkin(
|
|
8480
|
+
processSkin(object3) {
|
|
8479
8481
|
const json = this.json;
|
|
8480
8482
|
const nodeMap = this.nodeMap;
|
|
8481
|
-
const node = json.nodes[nodeMap.get(
|
|
8482
|
-
const skeleton =
|
|
8483
|
+
const node = json.nodes[nodeMap.get(object3)];
|
|
8484
|
+
const skeleton = object3.skeleton;
|
|
8483
8485
|
if (skeleton === void 0) return null;
|
|
8484
|
-
const rootJoint =
|
|
8486
|
+
const rootJoint = object3.skeleton.bones[0];
|
|
8485
8487
|
if (rootJoint === void 0) return null;
|
|
8486
8488
|
const joints = [];
|
|
8487
8489
|
const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16);
|
|
@@ -8489,7 +8491,7 @@ var GLTFWriter = class {
|
|
|
8489
8491
|
for (let i = 0; i < skeleton.bones.length; ++i) {
|
|
8490
8492
|
joints.push(nodeMap.get(skeleton.bones[i]));
|
|
8491
8493
|
temporaryBoneInverse.copy(skeleton.boneInverses[i]);
|
|
8492
|
-
temporaryBoneInverse.multiply(
|
|
8494
|
+
temporaryBoneInverse.multiply(object3.bindMatrix).toArray(inverseBindMatrices, i * 16);
|
|
8493
8495
|
}
|
|
8494
8496
|
if (json.skins === void 0) json.skins = [];
|
|
8495
8497
|
json.skins.push({
|
|
@@ -8505,19 +8507,19 @@ var GLTFWriter = class {
|
|
|
8505
8507
|
* @param {THREE.Object3D} object Object3D to processNodeAsync
|
|
8506
8508
|
* @return {Promise<number>} Index of the node in the nodes list
|
|
8507
8509
|
*/
|
|
8508
|
-
async processNodeAsync(
|
|
8510
|
+
async processNodeAsync(object3) {
|
|
8509
8511
|
const json = this.json;
|
|
8510
8512
|
const options = this.options;
|
|
8511
8513
|
const nodeMap = this.nodeMap;
|
|
8512
8514
|
if (!json.nodes) json.nodes = [];
|
|
8513
|
-
if (
|
|
8514
|
-
return await this._processNodeWithPivotAsync(
|
|
8515
|
+
if (object3.pivot !== null) {
|
|
8516
|
+
return await this._processNodeWithPivotAsync(object3);
|
|
8515
8517
|
}
|
|
8516
8518
|
const nodeDef = {};
|
|
8517
8519
|
if (options.trs) {
|
|
8518
|
-
const rotation =
|
|
8519
|
-
const position =
|
|
8520
|
-
const scale =
|
|
8520
|
+
const rotation = object3.quaternion.toArray();
|
|
8521
|
+
const position = object3.position.toArray();
|
|
8522
|
+
const scale = object3.scale.toArray();
|
|
8521
8523
|
if (!equalArray(rotation, [0, 0, 0, 1])) {
|
|
8522
8524
|
nodeDef.rotation = rotation;
|
|
8523
8525
|
}
|
|
@@ -8528,28 +8530,28 @@ var GLTFWriter = class {
|
|
|
8528
8530
|
nodeDef.scale = scale;
|
|
8529
8531
|
}
|
|
8530
8532
|
} else {
|
|
8531
|
-
if (
|
|
8532
|
-
|
|
8533
|
+
if (object3.matrixAutoUpdate) {
|
|
8534
|
+
object3.updateMatrix();
|
|
8533
8535
|
}
|
|
8534
|
-
if (isIdentityMatrix(
|
|
8535
|
-
nodeDef.matrix =
|
|
8536
|
+
if (isIdentityMatrix(object3.matrix) === false) {
|
|
8537
|
+
nodeDef.matrix = object3.matrix.elements;
|
|
8536
8538
|
}
|
|
8537
8539
|
}
|
|
8538
|
-
if (
|
|
8539
|
-
this.serializeUserData(
|
|
8540
|
-
if (
|
|
8541
|
-
const meshIndex = await this.processMeshAsync(
|
|
8540
|
+
if (object3.name !== "") nodeDef.name = String(object3.name);
|
|
8541
|
+
this.serializeUserData(object3, nodeDef);
|
|
8542
|
+
if (object3.isMesh || object3.isLine || object3.isPoints) {
|
|
8543
|
+
const meshIndex = await this.processMeshAsync(object3);
|
|
8542
8544
|
if (meshIndex !== null) nodeDef.mesh = meshIndex;
|
|
8543
|
-
} else if (
|
|
8544
|
-
nodeDef.camera = this.processCamera(
|
|
8545
|
+
} else if (object3.isCamera) {
|
|
8546
|
+
nodeDef.camera = this.processCamera(object3);
|
|
8545
8547
|
}
|
|
8546
|
-
if (
|
|
8548
|
+
if (object3.isSkinnedMesh) this.skins.push(object3);
|
|
8547
8549
|
const nodeIndex = json.nodes.push(nodeDef) - 1;
|
|
8548
|
-
nodeMap.set(
|
|
8549
|
-
if (
|
|
8550
|
+
nodeMap.set(object3, nodeIndex);
|
|
8551
|
+
if (object3.children.length > 0) {
|
|
8550
8552
|
const children = [];
|
|
8551
|
-
for (let i = 0, l =
|
|
8552
|
-
const child =
|
|
8553
|
+
for (let i = 0, l = object3.children.length; i < l; i++) {
|
|
8554
|
+
const child = object3.children[i];
|
|
8553
8555
|
if (child.visible || options.onlyVisible === false) {
|
|
8554
8556
|
const childNodeIndex = await this.processNodeAsync(child);
|
|
8555
8557
|
if (childNodeIndex !== null) children.push(childNodeIndex);
|
|
@@ -8558,7 +8560,7 @@ var GLTFWriter = class {
|
|
|
8558
8560
|
if (children.length > 0) nodeDef.children = children;
|
|
8559
8561
|
}
|
|
8560
8562
|
await this._invokeAllAsync(function(ext) {
|
|
8561
|
-
ext.writeNode && ext.writeNode(
|
|
8563
|
+
ext.writeNode && ext.writeNode(object3, nodeDef);
|
|
8562
8564
|
});
|
|
8563
8565
|
return nodeIndex;
|
|
8564
8566
|
}
|
|
@@ -8567,19 +8569,19 @@ var GLTFWriter = class {
|
|
|
8567
8569
|
* @param {THREE.Object3D} object Object3D with pivot
|
|
8568
8570
|
* @return {Promise<number>} Index of the container node
|
|
8569
8571
|
*/
|
|
8570
|
-
async _processNodeWithPivotAsync(
|
|
8572
|
+
async _processNodeWithPivotAsync(object3) {
|
|
8571
8573
|
const json = this.json;
|
|
8572
8574
|
const options = this.options;
|
|
8573
8575
|
const nodeMap = this.nodeMap;
|
|
8574
|
-
const pivot =
|
|
8576
|
+
const pivot = object3.pivot;
|
|
8575
8577
|
const containerDef = {};
|
|
8576
|
-
const rotation =
|
|
8578
|
+
const rotation = object3.quaternion.toArray();
|
|
8577
8579
|
const position = [
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8580
|
+
object3.position.x + pivot.x,
|
|
8581
|
+
object3.position.y + pivot.y,
|
|
8582
|
+
object3.position.z + pivot.z
|
|
8581
8583
|
];
|
|
8582
|
-
const scale =
|
|
8584
|
+
const scale = object3.scale.toArray();
|
|
8583
8585
|
if (!equalArray(rotation, [0, 0, 0, 1])) {
|
|
8584
8586
|
containerDef.rotation = rotation;
|
|
8585
8587
|
}
|
|
@@ -8590,28 +8592,28 @@ var GLTFWriter = class {
|
|
|
8590
8592
|
containerDef.scale = scale;
|
|
8591
8593
|
}
|
|
8592
8594
|
containerDef.extras = { pivot: pivot.toArray() };
|
|
8593
|
-
if (
|
|
8594
|
-
this.serializeUserData(
|
|
8595
|
+
if (object3.name !== "") containerDef.name = String(object3.name);
|
|
8596
|
+
this.serializeUserData(object3, containerDef);
|
|
8595
8597
|
const containerIndex = json.nodes.push(containerDef) - 1;
|
|
8596
|
-
nodeMap.set(
|
|
8598
|
+
nodeMap.set(object3, containerIndex);
|
|
8597
8599
|
const childDef = {};
|
|
8598
8600
|
const childPosition = [-pivot.x, -pivot.y, -pivot.z];
|
|
8599
8601
|
if (!equalArray(childPosition, [0, 0, 0])) {
|
|
8600
8602
|
childDef.translation = childPosition;
|
|
8601
8603
|
}
|
|
8602
|
-
if (
|
|
8603
|
-
const meshIndex = await this.processMeshAsync(
|
|
8604
|
+
if (object3.isMesh || object3.isLine || object3.isPoints) {
|
|
8605
|
+
const meshIndex = await this.processMeshAsync(object3);
|
|
8604
8606
|
if (meshIndex !== null) childDef.mesh = meshIndex;
|
|
8605
|
-
} else if (
|
|
8606
|
-
childDef.camera = this.processCamera(
|
|
8607
|
+
} else if (object3.isCamera) {
|
|
8608
|
+
childDef.camera = this.processCamera(object3);
|
|
8607
8609
|
}
|
|
8608
|
-
if (
|
|
8610
|
+
if (object3.isSkinnedMesh) this.skins.push(object3);
|
|
8609
8611
|
const childIndex = json.nodes.push(childDef) - 1;
|
|
8610
8612
|
const containerChildren = [childIndex];
|
|
8611
|
-
if (
|
|
8613
|
+
if (object3.children.length > 0) {
|
|
8612
8614
|
const grandchildren = [];
|
|
8613
|
-
for (let i = 0, l =
|
|
8614
|
-
const child =
|
|
8615
|
+
for (let i = 0, l = object3.children.length; i < l; i++) {
|
|
8616
|
+
const child = object3.children[i];
|
|
8615
8617
|
if (child.visible || options.onlyVisible === false) {
|
|
8616
8618
|
const childNodeIndex = await this.processNodeAsync(child);
|
|
8617
8619
|
if (childNodeIndex !== null) grandchildren.push(childNodeIndex);
|
|
@@ -8621,7 +8623,7 @@ var GLTFWriter = class {
|
|
|
8621
8623
|
}
|
|
8622
8624
|
containerDef.children = containerChildren;
|
|
8623
8625
|
await this._invokeAllAsync(function(ext) {
|
|
8624
|
-
ext.writeNode && ext.writeNode(
|
|
8626
|
+
ext.writeNode && ext.writeNode(object3, containerDef);
|
|
8625
8627
|
});
|
|
8626
8628
|
return containerIndex;
|
|
8627
8629
|
}
|
|
@@ -9064,10 +9066,10 @@ var GLTFMeshGpuInstancing = class {
|
|
|
9064
9066
|
this.writer = writer;
|
|
9065
9067
|
this.name = "EXT_mesh_gpu_instancing";
|
|
9066
9068
|
}
|
|
9067
|
-
writeNode(
|
|
9068
|
-
if (!
|
|
9069
|
+
writeNode(object3, nodeDef) {
|
|
9070
|
+
if (!object3.isInstancedMesh) return;
|
|
9069
9071
|
const writer = this.writer;
|
|
9070
|
-
const mesh =
|
|
9072
|
+
const mesh = object3;
|
|
9071
9073
|
const translationAttr = new Float32Array(mesh.count * 3);
|
|
9072
9074
|
const rotationAttr = new Float32Array(mesh.count * 4);
|
|
9073
9075
|
const scaleAttr = new Float32Array(mesh.count * 3);
|
|
@@ -9257,8 +9259,8 @@ var SceneExporter = class {
|
|
|
9257
9259
|
}
|
|
9258
9260
|
}
|
|
9259
9261
|
};
|
|
9260
|
-
function localMatrix(
|
|
9261
|
-
return
|
|
9262
|
+
function localMatrix(object3) {
|
|
9263
|
+
return object3.matrixAutoUpdate ? new import_three19.Matrix4().compose(object3.position, object3.quaternion, object3.scale) : object3.matrix.clone();
|
|
9262
9264
|
}
|
|
9263
9265
|
function createSnapshot(root, gltf, bakeColors = false) {
|
|
9264
9266
|
const scene = new import_three19.Scene();
|
|
@@ -9362,24 +9364,24 @@ function createSnapshot(root, gltf, bakeColors = false) {
|
|
|
9362
9364
|
scene.add(copy);
|
|
9363
9365
|
}
|
|
9364
9366
|
};
|
|
9365
|
-
const visit = (
|
|
9366
|
-
if (!
|
|
9367
|
-
const world = parentWorld.clone().multiply(localMatrix(
|
|
9368
|
-
const mesh =
|
|
9367
|
+
const visit = (object3, parentWorld) => {
|
|
9368
|
+
if (!object3.visible) return;
|
|
9369
|
+
const world = parentWorld.clone().multiply(localMatrix(object3));
|
|
9370
|
+
const mesh = object3;
|
|
9369
9371
|
if (mesh.isMesh) {
|
|
9370
9372
|
const instanced = mesh;
|
|
9371
9373
|
if (instanced.isInstancedMesh) {
|
|
9372
9374
|
for (let i = 0; i < instanced.count; i++) {
|
|
9373
9375
|
const matrix = new import_three19.Matrix4();
|
|
9374
9376
|
instanced.getMatrixAt(i, matrix);
|
|
9375
|
-
const
|
|
9376
|
-
addMesh(mesh, world.clone().multiply(matrix),
|
|
9377
|
+
const color2 = instanced.instanceColor ? new import_three19.Color().fromBufferAttribute(instanced.instanceColor, i) : void 0;
|
|
9378
|
+
addMesh(mesh, world.clone().multiply(matrix), color2);
|
|
9377
9379
|
}
|
|
9378
9380
|
} else {
|
|
9379
9381
|
addMesh(mesh, world);
|
|
9380
9382
|
}
|
|
9381
9383
|
}
|
|
9382
|
-
for (const child of
|
|
9384
|
+
for (const child of object3.children) visit(child, world);
|
|
9383
9385
|
};
|
|
9384
9386
|
try {
|
|
9385
9387
|
const ancestors = [];
|
|
@@ -9455,13 +9457,13 @@ init_AssetKey();
|
|
|
9455
9457
|
|
|
9456
9458
|
// src/gui/GuiText.ts
|
|
9457
9459
|
var import_three20 = require("three");
|
|
9458
|
-
async function layoutGuiText(
|
|
9460
|
+
async function layoutGuiText(text2, options = {}) {
|
|
9459
9461
|
const maxWidth = options.maxWidth ?? Infinity, lineHeight = options.lineHeight ?? 9;
|
|
9460
9462
|
if (!(maxWidth > 0) || !Number.isFinite(lineHeight) || lineHeight <= 0) {
|
|
9461
9463
|
throw new Error("Text wrap width and line height must be positive");
|
|
9462
9464
|
}
|
|
9463
9465
|
const font = await Fonts.get(options.font);
|
|
9464
|
-
const runs = typeof
|
|
9466
|
+
const runs = typeof text2 === "string" ? [{ text: text2 }] : text2;
|
|
9465
9467
|
const glyphs = [], lineWidths = [];
|
|
9466
9468
|
let line = [], width = 0;
|
|
9467
9469
|
let trailingNewline = false;
|
|
@@ -9515,7 +9517,7 @@ function createGuiTextGeometry(layout, shadow = true) {
|
|
|
9515
9517
|
batch = { image: glyph?.image, positions: [], uvs: [], colors: [], indices: [] };
|
|
9516
9518
|
batches.push(batch);
|
|
9517
9519
|
}
|
|
9518
|
-
const
|
|
9520
|
+
const color2 = new import_three20.Color(isShadow ? (style.color & 16579836) >> 2 : style.color);
|
|
9519
9521
|
const offset = isShadow ? 1 : 0;
|
|
9520
9522
|
const top = glyph ? 7 - glyph.ascent : 0;
|
|
9521
9523
|
const height = glyph ? glyph.height * glyph.scale : 8;
|
|
@@ -9543,7 +9545,7 @@ function createGuiTextGeometry(layout, shadow = true) {
|
|
|
9543
9545
|
const v0 = glyph ? 1 - glyph.y / glyph.image.height : 1;
|
|
9544
9546
|
const v1 = glyph ? 1 - (glyph.y + glyph.height) / glyph.image.height : 0;
|
|
9545
9547
|
batch.uvs.push(u0, v0, u1, v0, u0, v1, u1, v1);
|
|
9546
|
-
for (let i = 0; i < 4; i++) batch.colors.push(
|
|
9548
|
+
for (let i = 0; i < 4; i++) batch.colors.push(color2.r, color2.g, color2.b);
|
|
9547
9549
|
batch.indices.push(base, base + 2, base + 1, base + 2, base + 3, base + 1);
|
|
9548
9550
|
};
|
|
9549
9551
|
for (const boldOffset of style.bold ? [0, 1] : [0]) {
|
|
@@ -9577,8 +9579,8 @@ var GuiHelper = class {
|
|
|
9577
9579
|
size: [width + 24, height + 24]
|
|
9578
9580
|
}));
|
|
9579
9581
|
let y = position[1];
|
|
9580
|
-
lines.forEach((
|
|
9581
|
-
layers.push({ ...textOptions, name: `tooltip-line-${index}`, text, position: [position[0], y] });
|
|
9582
|
+
lines.forEach((text2, index) => {
|
|
9583
|
+
layers.push({ ...textOptions, name: `tooltip-line-${index}`, text: text2, position: [position[0], y] });
|
|
9582
9584
|
y += layouts[index].height + (index === 0 ? titleGap : 0);
|
|
9583
9585
|
});
|
|
9584
9586
|
return layers;
|
|
@@ -10034,29 +10036,29 @@ var SceneInspector = class {
|
|
|
10034
10036
|
this.objectControlsContainer.innerHTML = "";
|
|
10035
10037
|
this.addControls(targetObject, targetIntersection, instance);
|
|
10036
10038
|
}
|
|
10037
|
-
addControls(
|
|
10039
|
+
addControls(object3, intersection, instance) {
|
|
10038
10040
|
const container = document.createElement("div");
|
|
10039
10041
|
container.append(this.separator("Select Parent/Child"));
|
|
10040
|
-
if (
|
|
10041
|
-
container.append(this.buttonControl("Select Parent " +
|
|
10042
|
-
this.selectObject(
|
|
10042
|
+
if (object3.parent) {
|
|
10043
|
+
container.append(this.buttonControl("Select Parent " + object3.parent.constructor.name + " " + object3.parent.name, "P", () => {
|
|
10044
|
+
this.selectObject(object3.parent, intersection, instance);
|
|
10043
10045
|
}));
|
|
10044
10046
|
}
|
|
10045
|
-
if (
|
|
10047
|
+
if (object3.children.length > 0) {
|
|
10046
10048
|
let i = 1;
|
|
10047
|
-
for (let child of
|
|
10049
|
+
for (let child of object3.children) {
|
|
10048
10050
|
container.append(this.buttonControl("Select Child " + child.constructor.name + " " + child.name, "C" + i++, () => {
|
|
10049
10051
|
this.selectObject(child, intersection, instance);
|
|
10050
10052
|
}));
|
|
10051
10053
|
}
|
|
10052
10054
|
}
|
|
10053
10055
|
container.append(this.separator());
|
|
10054
|
-
const selectedInstance = instance && (
|
|
10056
|
+
const selectedInstance = instance && (object3 === instance.instanceable || object3 === intersection?.object) ? instance : void 0;
|
|
10055
10057
|
if (!selectedInstance) {
|
|
10056
|
-
container.append(this.toggleControl("Visibility", "V",
|
|
10058
|
+
container.append(this.toggleControl("Visibility", "V", object3.visible, (v) => object3.visible = v));
|
|
10057
10059
|
}
|
|
10058
10060
|
container.append(this.separator("Mesh"));
|
|
10059
|
-
this.addObjectControls(
|
|
10061
|
+
this.addObjectControls(object3, intersection, container, selectedInstance);
|
|
10060
10062
|
container.append(this.separator());
|
|
10061
10063
|
this.objectControlsContainer.append(container);
|
|
10062
10064
|
}
|
|
@@ -10472,29 +10474,29 @@ var BlockTints = class {
|
|
|
10472
10474
|
}
|
|
10473
10475
|
}
|
|
10474
10476
|
if (!indices.size) return tints;
|
|
10475
|
-
let
|
|
10477
|
+
let color2;
|
|
10476
10478
|
switch (rule.source) {
|
|
10477
10479
|
case "constant":
|
|
10478
|
-
|
|
10480
|
+
color2 = rule.color;
|
|
10479
10481
|
break;
|
|
10480
10482
|
case "grass":
|
|
10481
|
-
|
|
10483
|
+
color2 = await Colormaps.grassColor(key);
|
|
10482
10484
|
break;
|
|
10483
10485
|
case "redstone": {
|
|
10484
10486
|
const power = Number(state.power ?? 0) / 15;
|
|
10485
10487
|
const red = power * 0.6 + (power > 0 ? 0.4 : 0.3);
|
|
10486
10488
|
const green = Math.max(0, power * power * 0.7 - 0.5);
|
|
10487
10489
|
const blue = Math.max(0, power * power * 0.6 - 0.7);
|
|
10488
|
-
|
|
10490
|
+
color2 = Math.floor(red * 255) << 16 | Math.floor(green * 255) << 8 | Math.floor(blue * 255);
|
|
10489
10491
|
break;
|
|
10490
10492
|
}
|
|
10491
10493
|
case "stem": {
|
|
10492
10494
|
const age = Number(state.age ?? 0);
|
|
10493
|
-
|
|
10495
|
+
color2 = age * 32 << 16 | 255 - age * 8 << 8 | age * 4;
|
|
10494
10496
|
break;
|
|
10495
10497
|
}
|
|
10496
10498
|
}
|
|
10497
|
-
return { ...Object.fromEntries([...indices].map((index) => [index,
|
|
10499
|
+
return { ...Object.fromEntries([...indices].map((index) => [index, color2])), ...tints };
|
|
10498
10500
|
}
|
|
10499
10501
|
};
|
|
10500
10502
|
|
|
@@ -10636,8 +10638,8 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
10636
10638
|
return false;
|
|
10637
10639
|
}
|
|
10638
10640
|
return this._models.some((model) => {
|
|
10639
|
-
const
|
|
10640
|
-
return
|
|
10641
|
+
const object3 = isInstanceReference(model) ? model.instanceable : model;
|
|
10642
|
+
return object3.isOpaqueFullCube && this.getModelCullMask(model, 63) === 63;
|
|
10641
10643
|
});
|
|
10642
10644
|
}
|
|
10643
10645
|
getModelMatrix(model) {
|
|
@@ -10646,8 +10648,8 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
10646
10648
|
return model.matrix.clone();
|
|
10647
10649
|
}
|
|
10648
10650
|
getModelCullMask(model, worldMask) {
|
|
10649
|
-
const
|
|
10650
|
-
if (
|
|
10651
|
+
const object3 = isInstanceReference(model) ? model.instanceable : model;
|
|
10652
|
+
if (object3.options.displayPosition) return 0;
|
|
10651
10653
|
const position = new import_three32.Vector3();
|
|
10652
10654
|
const rotation = new import_three32.Quaternion();
|
|
10653
10655
|
const scale = new import_three32.Vector3();
|
|
@@ -10664,14 +10666,14 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
10664
10666
|
replacements.push(model);
|
|
10665
10667
|
continue;
|
|
10666
10668
|
}
|
|
10667
|
-
const
|
|
10669
|
+
const object3 = isInstanceReference(model) ? model.instanceable : model;
|
|
10668
10670
|
const cullMask = this.getModelCullMask(model, worldMask);
|
|
10669
|
-
if (cullMask === (
|
|
10671
|
+
if (cullMask === (object3.options.cullMask ?? 0)) {
|
|
10670
10672
|
replacements.push(model);
|
|
10671
10673
|
continue;
|
|
10672
10674
|
}
|
|
10673
10675
|
const matrix = this.getModelMatrix(model);
|
|
10674
|
-
const replacement = await this.scene.addModel(
|
|
10676
|
+
const replacement = await this.scene.addModel(object3.originalModel, { ...object3.options, cullMask });
|
|
10675
10677
|
replacements.push(replacement);
|
|
10676
10678
|
if (isInstanceReference(replacement)) {
|
|
10677
10679
|
replacement.setMatrix(matrix);
|
|
@@ -10679,8 +10681,8 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
10679
10681
|
replacement.matrix.copy(matrix);
|
|
10680
10682
|
replacement.matrixWorldNeedsUpdate = true;
|
|
10681
10683
|
matrix.decompose(replacement.position, replacement.quaternion, replacement.scale);
|
|
10682
|
-
replacement.matrixAutoUpdate =
|
|
10683
|
-
replacement.visible =
|
|
10684
|
+
replacement.matrixAutoUpdate = object3.matrixAutoUpdate;
|
|
10685
|
+
replacement.visible = object3.visible;
|
|
10684
10686
|
}
|
|
10685
10687
|
}
|
|
10686
10688
|
} catch (error) {
|
|
@@ -13827,60 +13829,60 @@ var MineRenderScene = class _MineRenderScene extends import_three34.Scene {
|
|
|
13827
13829
|
this.DEFAULT_OPTIONS = (0, import_ts_deepmerge8.default)({}, {});
|
|
13828
13830
|
}
|
|
13829
13831
|
add(...objects) {
|
|
13830
|
-
for (const
|
|
13832
|
+
for (const object3 of objects) {
|
|
13831
13833
|
this.dirty = true;
|
|
13832
13834
|
try {
|
|
13833
|
-
super.add(
|
|
13835
|
+
super.add(object3);
|
|
13834
13836
|
} finally {
|
|
13835
|
-
if (
|
|
13836
|
-
this.updateObjectRegistration(
|
|
13837
|
+
if (object3?.isObject3D && object3 !== this) {
|
|
13838
|
+
this.updateObjectRegistration(object3, object3.parent === this);
|
|
13837
13839
|
}
|
|
13838
13840
|
}
|
|
13839
13841
|
}
|
|
13840
13842
|
return this;
|
|
13841
13843
|
}
|
|
13842
13844
|
remove(...objects) {
|
|
13843
|
-
for (const
|
|
13844
|
-
if (!this.children.includes(
|
|
13845
|
+
for (const object3 of objects) {
|
|
13846
|
+
if (!this.children.includes(object3)) continue;
|
|
13845
13847
|
this.dirty = true;
|
|
13846
|
-
this.updateObjectRegistration(
|
|
13848
|
+
this.updateObjectRegistration(object3, false);
|
|
13847
13849
|
try {
|
|
13848
|
-
super.remove(
|
|
13850
|
+
super.remove(object3);
|
|
13849
13851
|
} finally {
|
|
13850
|
-
this.updateObjectRegistration(
|
|
13852
|
+
this.updateObjectRegistration(object3, object3.parent === this);
|
|
13851
13853
|
}
|
|
13852
13854
|
}
|
|
13853
13855
|
return this;
|
|
13854
13856
|
}
|
|
13855
|
-
updateObjectRegistration(
|
|
13856
|
-
if (this.observedObjects.has(
|
|
13857
|
-
const observable =
|
|
13857
|
+
updateObjectRegistration(object3, attached) {
|
|
13858
|
+
if (this.observedObjects.has(object3) === attached) return;
|
|
13859
|
+
const observable = object3;
|
|
13858
13860
|
if (attached) {
|
|
13859
|
-
this.observedObjects.add(
|
|
13861
|
+
this.observedObjects.add(object3);
|
|
13860
13862
|
observable.addEventListener("change", this.onObjectChange);
|
|
13861
13863
|
} else {
|
|
13862
|
-
this.observedObjects.delete(
|
|
13864
|
+
this.observedObjects.delete(object3);
|
|
13863
13865
|
observable.removeEventListener("change", this.onObjectChange);
|
|
13864
13866
|
}
|
|
13865
13867
|
const change = attached ? 1 : -1;
|
|
13866
13868
|
this.stats.objectCount += change;
|
|
13867
|
-
if (isSceneObject(
|
|
13869
|
+
if (isSceneObject(object3)) {
|
|
13868
13870
|
this.stats.sceneObjectCount += change;
|
|
13869
13871
|
}
|
|
13870
13872
|
}
|
|
13871
13873
|
/** Initializes each object before attaching it to the scene. */
|
|
13872
|
-
async initAndAdd(...
|
|
13874
|
+
async initAndAdd(...object3) {
|
|
13873
13875
|
this.dirty = true;
|
|
13874
|
-
for (let obj of
|
|
13876
|
+
for (let obj of object3) {
|
|
13875
13877
|
await obj.init();
|
|
13876
13878
|
}
|
|
13877
|
-
return this.add(...
|
|
13879
|
+
return this.add(...object3);
|
|
13878
13880
|
}
|
|
13879
|
-
async addSceneObject(
|
|
13881
|
+
async addSceneObject(asset2, objectSupplier, _options, parent = this) {
|
|
13880
13882
|
this.dirty = true;
|
|
13881
13883
|
const obj = await objectSupplier();
|
|
13882
|
-
if (obj?.options?.instanceMeshes &&
|
|
13883
|
-
let key =
|
|
13884
|
+
if (obj?.options?.instanceMeshes && asset2.key && asset2.key?.assetType === "models") {
|
|
13885
|
+
let key = asset2.key.serialize();
|
|
13884
13886
|
if (isModelObject(obj)) {
|
|
13885
13887
|
const { displayPosition, uvLockRotation, tints, cullMask } = obj.options;
|
|
13886
13888
|
if (displayPosition) key += `|display:${displayPosition}`;
|
|
@@ -13978,11 +13980,11 @@ var _changeEvent = { type: "change" };
|
|
|
13978
13980
|
var _startEvent = { type: "start" };
|
|
13979
13981
|
var _endEvent = { type: "end" };
|
|
13980
13982
|
var OrbitControls = class extends import_three35.EventDispatcher {
|
|
13981
|
-
constructor(
|
|
13983
|
+
constructor(object3, domElement) {
|
|
13982
13984
|
super();
|
|
13983
13985
|
if (domElement === void 0) console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.');
|
|
13984
13986
|
if (domElement === document) console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.');
|
|
13985
|
-
this.object =
|
|
13987
|
+
this.object = object3;
|
|
13986
13988
|
this.domElement = domElement;
|
|
13987
13989
|
this.domElement.style.touchAction = "none";
|
|
13988
13990
|
this.enabled = true;
|
|
@@ -14039,7 +14041,7 @@ var OrbitControls = class extends import_three35.EventDispatcher {
|
|
|
14039
14041
|
};
|
|
14040
14042
|
this.update = function() {
|
|
14041
14043
|
const offset = new import_three35.Vector3();
|
|
14042
|
-
const quat = new import_three35.Quaternion().setFromUnitVectors(
|
|
14044
|
+
const quat = new import_three35.Quaternion().setFromUnitVectors(object3.up, new import_three35.Vector3(0, 1, 0));
|
|
14043
14045
|
const quatInverse = quat.clone().invert();
|
|
14044
14046
|
const lastPosition = new import_three35.Vector3();
|
|
14045
14047
|
const lastQuaternion = new import_three35.Quaternion();
|
|
@@ -14604,8 +14606,8 @@ var OrbitControls = class extends import_three35.EventDispatcher {
|
|
|
14604
14606
|
}
|
|
14605
14607
|
};
|
|
14606
14608
|
var MapControls = class extends OrbitControls {
|
|
14607
|
-
constructor(
|
|
14608
|
-
super(
|
|
14609
|
+
constructor(object3, domElement) {
|
|
14610
|
+
super(object3, domElement);
|
|
14609
14611
|
this.screenSpacePanning = false;
|
|
14610
14612
|
this.mouseButtons.LEFT = import_three35.MOUSE.PAN;
|
|
14611
14613
|
this.mouseButtons.RIGHT = import_three35.MOUSE.ROTATE;
|
|
@@ -15034,6 +15036,232 @@ init_SceneObject();
|
|
|
15034
15036
|
// src/index.ts
|
|
15035
15037
|
init_request();
|
|
15036
15038
|
|
|
15039
|
+
// src/scene/SceneDocument.ts
|
|
15040
|
+
init_DisplayPosition();
|
|
15041
|
+
function fail(path, message) {
|
|
15042
|
+
throw new Error(`${path}: ${message}`);
|
|
15043
|
+
}
|
|
15044
|
+
function object2(value, path) {
|
|
15045
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) fail(path, "expected a JSON object");
|
|
15046
|
+
for (const key of Object.keys(value)) {
|
|
15047
|
+
if (["__proto__", "prototype", "constructor"].includes(key)) fail(`${path}.${key}`, "unsupported property");
|
|
15048
|
+
}
|
|
15049
|
+
return value;
|
|
15050
|
+
}
|
|
15051
|
+
function fields(value, path, allowed, required = []) {
|
|
15052
|
+
const input = object2(value, path);
|
|
15053
|
+
for (const key of required) if (input[key] === void 0) fail(`${path}.${key}`, "required");
|
|
15054
|
+
for (const [key, entry] of Object.entries(input)) {
|
|
15055
|
+
if (!Object.prototype.hasOwnProperty.call(allowed, key)) fail(`${path}.${key}`, "unsupported property");
|
|
15056
|
+
if (entry !== void 0) allowed[key](entry, `${path}.${key}`);
|
|
15057
|
+
}
|
|
15058
|
+
return input;
|
|
15059
|
+
}
|
|
15060
|
+
var text = (value, path) => {
|
|
15061
|
+
if (typeof value !== "string" || !value.trim()) fail(path, "expected a nonempty string");
|
|
15062
|
+
};
|
|
15063
|
+
var literalText = (value, path) => {
|
|
15064
|
+
if (typeof value !== "string") fail(path, "expected a string");
|
|
15065
|
+
};
|
|
15066
|
+
var boolean = (value, path) => {
|
|
15067
|
+
if (typeof value !== "boolean") fail(path, "expected a boolean");
|
|
15068
|
+
};
|
|
15069
|
+
var number = (value, path) => {
|
|
15070
|
+
if (typeof value !== "number" || !Number.isFinite(value)) fail(path, "expected a finite number");
|
|
15071
|
+
};
|
|
15072
|
+
var positive = (value, path) => {
|
|
15073
|
+
number(value, path);
|
|
15074
|
+
if (value <= 0) fail(path, "expected a positive number");
|
|
15075
|
+
};
|
|
15076
|
+
var nonnegative = (value, path) => {
|
|
15077
|
+
number(value, path);
|
|
15078
|
+
if (value < 0) fail(path, "expected a nonnegative number");
|
|
15079
|
+
};
|
|
15080
|
+
var color = (value, path) => {
|
|
15081
|
+
number(value, path);
|
|
15082
|
+
if (!Number.isInteger(value) || value < 0 || value > 16777215) {
|
|
15083
|
+
fail(path, "expected an RGB integer from 0 to 16777215");
|
|
15084
|
+
}
|
|
15085
|
+
};
|
|
15086
|
+
var asset = (value, path) => {
|
|
15087
|
+
text(value, path);
|
|
15088
|
+
if (!/^(?:[a-z0-9_.-]+:)?[a-z0-9_./-]+$/.test(value) || value.split(/[:/]/).some((part) => !part || part === "." || part === "..")) {
|
|
15089
|
+
fail(path, "expected a resource ID such as minecraft:stone");
|
|
15090
|
+
}
|
|
15091
|
+
};
|
|
15092
|
+
var version = (value, path) => {
|
|
15093
|
+
text(value, path);
|
|
15094
|
+
if (!/^[a-zA-Z0-9._-]+$/.test(value)) fail(path, "expected a Minecraft version without slashes");
|
|
15095
|
+
};
|
|
15096
|
+
var tuple = (size, item = number) => (value, path) => {
|
|
15097
|
+
if (!Array.isArray(value) || value.length !== size) fail(path, `expected ${size} numbers`);
|
|
15098
|
+
for (let index = 0; index < size; index++) item(value[index], `${path}[${index}]`);
|
|
15099
|
+
};
|
|
15100
|
+
var list = (item) => (value, path) => {
|
|
15101
|
+
if (!Array.isArray(value)) fail(path, "expected an array");
|
|
15102
|
+
for (let index = 0; index < value.length; index++) item(value[index], `${path}[${index}]`);
|
|
15103
|
+
};
|
|
15104
|
+
var dictionary = (item, numericKeys = false) => (value, path) => {
|
|
15105
|
+
for (const [key, entry] of Object.entries(object2(value, path))) {
|
|
15106
|
+
if (numericKeys && !/^\d+$/.test(key)) fail(`${path}.${key}`, "expected a nonnegative tint index");
|
|
15107
|
+
item(entry, `${path}.${key}`);
|
|
15108
|
+
}
|
|
15109
|
+
};
|
|
15110
|
+
var enumeration = (values) => (value, path) => {
|
|
15111
|
+
if (!values.includes(value)) fail(path, `expected one of: ${values.join(", ")}`);
|
|
15112
|
+
};
|
|
15113
|
+
var textStyle = { color, bold: boolean, italic: boolean };
|
|
15114
|
+
function guiLayer(value, path) {
|
|
15115
|
+
const layer = object2(value, path);
|
|
15116
|
+
if (["texture", "item", "text"].filter((key) => layer[key] !== void 0).length !== 1) {
|
|
15117
|
+
fail(path, "expected exactly one of texture, item, or text");
|
|
15118
|
+
}
|
|
15119
|
+
const layout = { name: text, position: tuple(2), size: tuple(2, positive) };
|
|
15120
|
+
if (layer.texture !== void 0) {
|
|
15121
|
+
fields(value, path, { ...layout, texture: asset, crop: (value2, path2) => {
|
|
15122
|
+
tuple(4)(value2, path2);
|
|
15123
|
+
const [x, y, width, height] = value2;
|
|
15124
|
+
nonnegative(x, `${path2}[0]`);
|
|
15125
|
+
nonnegative(y, `${path2}[1]`);
|
|
15126
|
+
positive(width, `${path2}[2]`);
|
|
15127
|
+
positive(height, `${path2}[3]`);
|
|
15128
|
+
} });
|
|
15129
|
+
} else if (layer.item !== void 0) {
|
|
15130
|
+
fields(value, path, { ...layout, item: asset, tints: dictionary(color, true) });
|
|
15131
|
+
} else {
|
|
15132
|
+
fields(value, path, {
|
|
15133
|
+
...layout,
|
|
15134
|
+
...textStyle,
|
|
15135
|
+
font: asset,
|
|
15136
|
+
shadow: boolean,
|
|
15137
|
+
maxWidth: positive,
|
|
15138
|
+
lineHeight: positive,
|
|
15139
|
+
text: (value2, path2) => {
|
|
15140
|
+
if (typeof value2 === "string") return;
|
|
15141
|
+
list((run, path3) => {
|
|
15142
|
+
fields(run, path3, { text: literalText, ...textStyle }, ["text"]);
|
|
15143
|
+
})(value2, path2);
|
|
15144
|
+
}
|
|
15145
|
+
});
|
|
15146
|
+
}
|
|
15147
|
+
}
|
|
15148
|
+
function validateObject(value, path) {
|
|
15149
|
+
const input = object2(value, path);
|
|
15150
|
+
const common = { id: text, name: text, type: text, position: tuple(3), rotation: tuple(3), scale: tuple(3), visible: boolean };
|
|
15151
|
+
const required = ["id", "type"];
|
|
15152
|
+
const renderOptions = { wireframe: boolean };
|
|
15153
|
+
switch (input.type) {
|
|
15154
|
+
case "skin":
|
|
15155
|
+
fields(value, path, {
|
|
15156
|
+
...common,
|
|
15157
|
+
skin: text,
|
|
15158
|
+
cape: (value2, path2) => {
|
|
15159
|
+
fields(value2, path2, { texture: text, layout: enumeration(["minecraft", "optifine", "labymod"]) }, ["texture"]);
|
|
15160
|
+
},
|
|
15161
|
+
hiddenParts: list(enumeration(SKIN_PARTS)),
|
|
15162
|
+
pose: (value2, path2) => {
|
|
15163
|
+
fields(value2, path2, {
|
|
15164
|
+
head: tuple(3),
|
|
15165
|
+
body: tuple(3),
|
|
15166
|
+
rightArm: tuple(3),
|
|
15167
|
+
leftArm: tuple(3),
|
|
15168
|
+
rightLeg: tuple(3),
|
|
15169
|
+
leftLeg: tuple(3),
|
|
15170
|
+
cape: tuple(3)
|
|
15171
|
+
});
|
|
15172
|
+
},
|
|
15173
|
+
options: (value2, path2) => {
|
|
15174
|
+
fields(value2, path2, { slim: boolean, legacy: boolean });
|
|
15175
|
+
}
|
|
15176
|
+
}, required);
|
|
15177
|
+
break;
|
|
15178
|
+
case "block":
|
|
15179
|
+
fields(value, path, {
|
|
15180
|
+
...common,
|
|
15181
|
+
asset,
|
|
15182
|
+
state: dictionary(text),
|
|
15183
|
+
options: (value2, path2) => {
|
|
15184
|
+
fields(value2, path2, { ...renderOptions, tints: dictionary(color, true) });
|
|
15185
|
+
}
|
|
15186
|
+
}, [...required, "asset"]);
|
|
15187
|
+
break;
|
|
15188
|
+
case "item":
|
|
15189
|
+
case "model":
|
|
15190
|
+
fields(value, path, {
|
|
15191
|
+
...common,
|
|
15192
|
+
asset,
|
|
15193
|
+
options: (value2, path2) => {
|
|
15194
|
+
fields(value2, path2, { ...renderOptions, displayPosition: enumeration(DISPLAY_POSITIONS), tints: dictionary(color, true) });
|
|
15195
|
+
}
|
|
15196
|
+
}, [...required, "asset"]);
|
|
15197
|
+
break;
|
|
15198
|
+
case "entity":
|
|
15199
|
+
fields(value, path, {
|
|
15200
|
+
...common,
|
|
15201
|
+
asset,
|
|
15202
|
+
texture: asset,
|
|
15203
|
+
layers: list(text),
|
|
15204
|
+
when: list(text),
|
|
15205
|
+
textures: dictionary(asset),
|
|
15206
|
+
options: (value2, path2) => {
|
|
15207
|
+
fields(value2, path2, {
|
|
15208
|
+
...renderOptions,
|
|
15209
|
+
flip: boolean,
|
|
15210
|
+
tints: dictionary((value3, path3) => {
|
|
15211
|
+
typeof value3 === "string" ? text(value3, path3) : color(value3, path3);
|
|
15212
|
+
})
|
|
15213
|
+
});
|
|
15214
|
+
},
|
|
15215
|
+
animation: (value2, path2) => {
|
|
15216
|
+
fields(value2, path2, { name: text, loop: boolean, speed: nonnegative, time: nonnegative, paused: boolean }, ["name"]);
|
|
15217
|
+
}
|
|
15218
|
+
}, [...required, "asset"]);
|
|
15219
|
+
if (Array.isArray(input.layers) && !input.layers.length) fail(`${path}.layers`, "expected at least one layer");
|
|
15220
|
+
break;
|
|
15221
|
+
case "gui":
|
|
15222
|
+
fields(value, path, { ...common, layers: list(guiLayer) }, [...required, "layers"]);
|
|
15223
|
+
break;
|
|
15224
|
+
default:
|
|
15225
|
+
fail(`${path}.type`, "expected skin, block, item, entity, model, or gui");
|
|
15226
|
+
}
|
|
15227
|
+
}
|
|
15228
|
+
function parseSceneDocument(value) {
|
|
15229
|
+
if (typeof value === "string") {
|
|
15230
|
+
try {
|
|
15231
|
+
value = JSON.parse(value);
|
|
15232
|
+
} catch {
|
|
15233
|
+
fail("scene", "invalid JSON");
|
|
15234
|
+
}
|
|
15235
|
+
}
|
|
15236
|
+
const input = fields(value, "scene", {
|
|
15237
|
+
format: enumeration(["minerender-scene"]),
|
|
15238
|
+
version: (value2, path) => {
|
|
15239
|
+
if (value2 !== 1) fail(path, "only scene document version 1 is supported");
|
|
15240
|
+
},
|
|
15241
|
+
minecraftVersion: version,
|
|
15242
|
+
camera: (value2, path) => {
|
|
15243
|
+
fields(value2, path, { position: tuple(3), target: tuple(3) }, ["position", "target"]);
|
|
15244
|
+
},
|
|
15245
|
+
objects: list(validateObject)
|
|
15246
|
+
}, ["format", "version", "objects"]);
|
|
15247
|
+
const ids = /* @__PURE__ */ new Set();
|
|
15248
|
+
for (const [index, entry] of input.objects.entries()) {
|
|
15249
|
+
if (ids.has(entry.id)) fail(`scene.objects[${index}].id`, `duplicate object ID "${entry.id}"`);
|
|
15250
|
+
ids.add(entry.id);
|
|
15251
|
+
}
|
|
15252
|
+
return JSON.parse(JSON.stringify(input));
|
|
15253
|
+
}
|
|
15254
|
+
|
|
15255
|
+
// src/scene/SceneDocumentLoader.ts
|
|
15256
|
+
var import_three38 = require("three");
|
|
15257
|
+
init_AssetKey();
|
|
15258
|
+
init_AssetLoader();
|
|
15259
|
+
init_BlockStates();
|
|
15260
|
+
init_Entities();
|
|
15261
|
+
init_Models();
|
|
15262
|
+
init_DisplayPosition();
|
|
15263
|
+
init_SceneObject();
|
|
15264
|
+
|
|
15037
15265
|
// src/skin/Skins.ts
|
|
15038
15266
|
init_Requests();
|
|
15039
15267
|
var Skins = class {
|
|
@@ -15204,6 +15432,195 @@ var Skins = class {
|
|
|
15204
15432
|
//</editor-fold>
|
|
15205
15433
|
};
|
|
15206
15434
|
|
|
15435
|
+
// src/scene/SceneDocumentLoader.ts
|
|
15436
|
+
var DocumentObjectScene = class extends MineRenderScene {
|
|
15437
|
+
async addSceneObject(_asset, supplier, _options, parent = this) {
|
|
15438
|
+
const object3 = await supplier();
|
|
15439
|
+
return this.initialize(object3, parent);
|
|
15440
|
+
}
|
|
15441
|
+
async initialize(object3, parent = this) {
|
|
15442
|
+
object3.scene = this;
|
|
15443
|
+
try {
|
|
15444
|
+
await object3.init();
|
|
15445
|
+
parent.add(object3);
|
|
15446
|
+
return object3;
|
|
15447
|
+
} catch (error) {
|
|
15448
|
+
object3.dispose();
|
|
15449
|
+
object3.removeFromParent();
|
|
15450
|
+
throw error;
|
|
15451
|
+
}
|
|
15452
|
+
}
|
|
15453
|
+
dispose() {
|
|
15454
|
+
for (const child of [...this.children]) {
|
|
15455
|
+
if (child.parent !== this) continue;
|
|
15456
|
+
if (isSceneObject(child)) child.dispose();
|
|
15457
|
+
child.removeFromParent();
|
|
15458
|
+
}
|
|
15459
|
+
}
|
|
15460
|
+
};
|
|
15461
|
+
async function skinTexture(value, cape = false) {
|
|
15462
|
+
if (!/^[a-zA-Z0-9_-]{1,36}$/.test(value)) return value;
|
|
15463
|
+
const texture = await (cape ? Skins.capeFromUuidOrUsername(value) : Skins.fromUuidOrUsername(value));
|
|
15464
|
+
if (!texture) throw new Error(`Could not find ${cape ? "cape" : "skin"} for "${value}"`);
|
|
15465
|
+
return texture;
|
|
15466
|
+
}
|
|
15467
|
+
var SceneDocumentLoader = class {
|
|
15468
|
+
static parse(value) {
|
|
15469
|
+
return parseSceneDocument(value);
|
|
15470
|
+
}
|
|
15471
|
+
/**
|
|
15472
|
+
* Loads objects concurrently and attaches them in document order after every load succeeds.
|
|
15473
|
+
* A failure waits for all loads, disposes staged objects, and reports the first error in document order.
|
|
15474
|
+
*/
|
|
15475
|
+
static async load(scene, value, parent = scene) {
|
|
15476
|
+
const definition = this.parse(value);
|
|
15477
|
+
if (definition.minecraftVersion !== void 0 && definition.minecraftVersion !== AssetLoader.version) {
|
|
15478
|
+
throw new Error(`Scene requires Minecraft ${definition.minecraftVersion}; call AssetLoader.setVersion("${definition.minecraftVersion}") before loading it`);
|
|
15479
|
+
}
|
|
15480
|
+
const root = new import_three38.Group();
|
|
15481
|
+
root.name = "MineRender scene document";
|
|
15482
|
+
const objects = [];
|
|
15483
|
+
let disposed = false;
|
|
15484
|
+
const loaded = {
|
|
15485
|
+
root,
|
|
15486
|
+
objects,
|
|
15487
|
+
definition,
|
|
15488
|
+
advanceAnimations: (delta) => {
|
|
15489
|
+
if (!disposed) for (const object3 of objects) object3.advanceAnimation(delta);
|
|
15490
|
+
},
|
|
15491
|
+
dispose: () => {
|
|
15492
|
+
if (disposed) return;
|
|
15493
|
+
disposed = true;
|
|
15494
|
+
root.removeFromParent();
|
|
15495
|
+
for (const object3 of objects) object3.dispose();
|
|
15496
|
+
root.clear();
|
|
15497
|
+
scene.dirty = true;
|
|
15498
|
+
}
|
|
15499
|
+
};
|
|
15500
|
+
try {
|
|
15501
|
+
const results = await Promise.allSettled(definition.objects.map((object3) => this.loadValidatedObject(scene, object3)));
|
|
15502
|
+
for (const result of results) if (result.status === "fulfilled") objects.push(result.value);
|
|
15503
|
+
const failure = results.find((result) => result.status === "rejected");
|
|
15504
|
+
if (failure) throw failure.reason;
|
|
15505
|
+
for (const object3 of objects) root.add(object3.root);
|
|
15506
|
+
parent.add(root);
|
|
15507
|
+
scene.dirty = true;
|
|
15508
|
+
return loaded;
|
|
15509
|
+
} catch (error) {
|
|
15510
|
+
loaded.dispose();
|
|
15511
|
+
throw error;
|
|
15512
|
+
}
|
|
15513
|
+
}
|
|
15514
|
+
/** Loads an independently editable object. Its root owns the document's position, rotation, and scale. */
|
|
15515
|
+
static async loadObject(scene, value, parent = scene) {
|
|
15516
|
+
const definition = this.parse({ format: "minerender-scene", version: 1, objects: [value] }).objects[0];
|
|
15517
|
+
return this.loadValidatedObject(scene, definition, parent);
|
|
15518
|
+
}
|
|
15519
|
+
static async loadValidatedObject(scene, definition, parent) {
|
|
15520
|
+
const root = new import_three38.Group();
|
|
15521
|
+
root.name = definition.name ?? definition.id;
|
|
15522
|
+
root.userData.sceneObjectId = definition.id;
|
|
15523
|
+
root.position.fromArray(definition.position ?? [0, 0, 0]);
|
|
15524
|
+
root.rotation.set(...definition.rotation ?? [0, 0, 0]);
|
|
15525
|
+
root.scale.fromArray(definition.scale ?? [1, 1, 1]);
|
|
15526
|
+
root.visible = definition.visible ?? true;
|
|
15527
|
+
const content = new DocumentObjectScene();
|
|
15528
|
+
root.add(content);
|
|
15529
|
+
let object3;
|
|
15530
|
+
try {
|
|
15531
|
+
switch (definition.type) {
|
|
15532
|
+
case "skin": {
|
|
15533
|
+
const skin = new SkinObject({ ...definition.options, instanceMeshes: false });
|
|
15534
|
+
object3 = skin;
|
|
15535
|
+
const texture = definition.skin ? await skinTexture(definition.skin) : `${AssetLoader.ROOT}/assets/minecraft/textures/entity/player/${definition.options?.slim ? "slim/alex" : "wide/steve"}.png`;
|
|
15536
|
+
await skin.setSkinTexture(texture);
|
|
15537
|
+
await content.initialize(skin);
|
|
15538
|
+
if (definition.cape) await skin.setCapeTexture(await skinTexture(definition.cape.texture, true), definition.cape.layout);
|
|
15539
|
+
for (const [part, rotation] of Object.entries(definition.pose ?? {})) {
|
|
15540
|
+
skin.getGroupByName(part)?.rotation.set(...rotation, "XYZ");
|
|
15541
|
+
}
|
|
15542
|
+
for (const part of definition.hiddenParts ?? []) {
|
|
15543
|
+
const mesh = skin.getMeshByName(part);
|
|
15544
|
+
if (mesh) mesh.visible = false;
|
|
15545
|
+
}
|
|
15546
|
+
break;
|
|
15547
|
+
}
|
|
15548
|
+
case "block": {
|
|
15549
|
+
const state = await BlockStates.get(AssetKey.parse("blockstates", definition.asset));
|
|
15550
|
+
if (!state) throw new Error(`Could not load block ${definition.asset}`);
|
|
15551
|
+
object3 = await content.addBlock(state, { ...definition.options, initialState: definition.state, instanceMeshes: false });
|
|
15552
|
+
break;
|
|
15553
|
+
}
|
|
15554
|
+
case "item":
|
|
15555
|
+
case "model": {
|
|
15556
|
+
let key = AssetKey.parse("models", definition.asset);
|
|
15557
|
+
if (definition.type === "item" && key.type !== "item") {
|
|
15558
|
+
key = new AssetKey(key.namespace, key.getFullPath(), "models", "item");
|
|
15559
|
+
}
|
|
15560
|
+
const model = await Models.getMerged(key);
|
|
15561
|
+
if (!model) throw new Error(`Could not load ${definition.type} ${definition.asset}`);
|
|
15562
|
+
object3 = await content.addModel(model, {
|
|
15563
|
+
...definition.type === "item" ? { displayPosition: "gui" /* GUI */ } : {},
|
|
15564
|
+
...definition.options,
|
|
15565
|
+
instanceMeshes: false
|
|
15566
|
+
});
|
|
15567
|
+
break;
|
|
15568
|
+
}
|
|
15569
|
+
case "entity": {
|
|
15570
|
+
const key = AssetKey.parse("entity-models", definition.asset);
|
|
15571
|
+
const model = await Entities.getEntity(key, definition.texture ? AssetKey.parse("textures", definition.texture) : void 0, {
|
|
15572
|
+
layers: definition.layers,
|
|
15573
|
+
when: definition.when,
|
|
15574
|
+
textures: definition.textures && Object.fromEntries(Object.entries(definition.textures).map(([name, texture]) => [name, AssetKey.parse("textures", texture)]))
|
|
15575
|
+
});
|
|
15576
|
+
if (!model) throw new Error(`Could not load entity ${definition.asset}`);
|
|
15577
|
+
const entity = await content.addEntity(model, { ...definition.options, instanceMeshes: false });
|
|
15578
|
+
object3 = entity;
|
|
15579
|
+
if (definition.animation) {
|
|
15580
|
+
const animations = await Entities.getAnimations(key);
|
|
15581
|
+
const clip = animations?.[definition.animation.name];
|
|
15582
|
+
if (!clip) throw new Error(`Entity ${definition.asset} has no animation "${definition.animation.name}"`);
|
|
15583
|
+
entity.playAnimation(clip, definition.animation);
|
|
15584
|
+
}
|
|
15585
|
+
break;
|
|
15586
|
+
}
|
|
15587
|
+
case "gui":
|
|
15588
|
+
object3 = await content.initialize(new GuiObject(definition.layers));
|
|
15589
|
+
break;
|
|
15590
|
+
}
|
|
15591
|
+
let disposed = false;
|
|
15592
|
+
const loaded = {
|
|
15593
|
+
root,
|
|
15594
|
+
object: object3,
|
|
15595
|
+
definition,
|
|
15596
|
+
advanceAnimation: (delta) => {
|
|
15597
|
+
if (!disposed && definition.type === "entity" && !definition.animation?.paused) object3.advanceAnimation(delta);
|
|
15598
|
+
},
|
|
15599
|
+
dispose: () => {
|
|
15600
|
+
if (disposed) return;
|
|
15601
|
+
disposed = true;
|
|
15602
|
+
root.removeFromParent();
|
|
15603
|
+
object3.dispose();
|
|
15604
|
+
object3.removeFromParent();
|
|
15605
|
+
content.dispose();
|
|
15606
|
+
root.clear();
|
|
15607
|
+
scene.dirty = true;
|
|
15608
|
+
}
|
|
15609
|
+
};
|
|
15610
|
+
parent?.add(root);
|
|
15611
|
+
scene.dirty = true;
|
|
15612
|
+
return loaded;
|
|
15613
|
+
} catch (error) {
|
|
15614
|
+
object3?.dispose();
|
|
15615
|
+
object3?.removeFromParent();
|
|
15616
|
+
content.dispose();
|
|
15617
|
+
root.removeFromParent();
|
|
15618
|
+
root.clear();
|
|
15619
|
+
throw new Error(`Scene object "${definition.name ?? definition.id}": ${error instanceof Error ? error.message : String(error)}`);
|
|
15620
|
+
}
|
|
15621
|
+
}
|
|
15622
|
+
};
|
|
15623
|
+
|
|
15207
15624
|
// src/texture/index.ts
|
|
15208
15625
|
init_Colormaps();
|
|
15209
15626
|
init_TextureAtlas();
|
|
@@ -15485,12 +15902,12 @@ var AnvilParser = class {
|
|
|
15485
15902
|
};
|
|
15486
15903
|
|
|
15487
15904
|
// src/world/Chunk.ts
|
|
15488
|
-
var
|
|
15905
|
+
var import_three42 = require("three");
|
|
15489
15906
|
init_BlockStates();
|
|
15490
15907
|
init_AssetKey();
|
|
15491
15908
|
|
|
15492
15909
|
// src/world/MineRenderWorld.ts
|
|
15493
|
-
var
|
|
15910
|
+
var import_three40 = require("three");
|
|
15494
15911
|
init_Model();
|
|
15495
15912
|
init_BatchedExecutor();
|
|
15496
15913
|
init_AssetKey();
|
|
@@ -15498,7 +15915,7 @@ init_BlockStates();
|
|
|
15498
15915
|
init_CubeFace();
|
|
15499
15916
|
|
|
15500
15917
|
// src/world/SectionModels.ts
|
|
15501
|
-
var
|
|
15918
|
+
var import_three39 = require("three");
|
|
15502
15919
|
init_AssetKey();
|
|
15503
15920
|
init_Models();
|
|
15504
15921
|
init_CubeFace();
|
|
@@ -15557,20 +15974,20 @@ var SectionModels = class {
|
|
|
15557
15974
|
if (!models) this.models.set(model, models = /* @__PURE__ */ new Map());
|
|
15558
15975
|
const key = JSON.stringify([rotation.x, rotation.y, rotation.z, variant.uvlock, tints]);
|
|
15559
15976
|
const template = await cached(models, key, async () => {
|
|
15560
|
-
const
|
|
15977
|
+
const object3 = new SectionModel(model, {
|
|
15561
15978
|
instanceMeshes: false,
|
|
15562
15979
|
mergeMeshes: false,
|
|
15563
15980
|
tints,
|
|
15564
15981
|
uvLockRotation: variant.uvlock && (rotation.x !== 0 || rotation.y !== 0) ? [rotation.x, rotation.y, rotation.z] : void 0
|
|
15565
15982
|
});
|
|
15566
|
-
await
|
|
15567
|
-
const geometry =
|
|
15568
|
-
geometry.applyMatrix4(new
|
|
15569
|
-
|
|
15983
|
+
await object3.init();
|
|
15984
|
+
const geometry = object3.children[0].geometry;
|
|
15985
|
+
geometry.applyMatrix4(new import_three39.Matrix4().makeRotationFromEuler(rotation));
|
|
15986
|
+
object3.clear();
|
|
15570
15987
|
const cullFaces = CUBE_FACES.map((face) => {
|
|
15571
15988
|
const local = CUBE_FACES.findIndex((name) => name === atlas.model.elements[0].faces[face]?.cullface);
|
|
15572
15989
|
if (local < 0) return 0;
|
|
15573
|
-
const normal = new
|
|
15990
|
+
const normal = new import_three39.Vector3(...CUBE_FACE_OFFSETS[local]).applyEuler(rotation);
|
|
15574
15991
|
const world = CUBE_FACE_OFFSETS.findIndex(([x, y, z]) => Math.abs(normal.x - x) < 1e-6 && Math.abs(normal.y - y) < 1e-6 && Math.abs(normal.z - z) < 1e-6);
|
|
15575
15992
|
return 1 << world;
|
|
15576
15993
|
});
|
|
@@ -15601,20 +16018,20 @@ var MineRenderWorld = class {
|
|
|
15601
16018
|
}
|
|
15602
16019
|
getBlockAt(posOrX, y, z) {
|
|
15603
16020
|
if (typeof posOrX == "number") {
|
|
15604
|
-
return this.getBlockAt(new
|
|
16021
|
+
return this.getBlockAt(new import_three40.Vector3(posOrX, y, z));
|
|
15605
16022
|
}
|
|
15606
16023
|
if (isTripleArray(posOrX)) {
|
|
15607
|
-
return this.getBlockAt(new
|
|
16024
|
+
return this.getBlockAt(new import_three40.Vector3(posOrX[0], posOrX[1], posOrX[2]));
|
|
15608
16025
|
}
|
|
15609
16026
|
this.validatePosBounds(posOrX);
|
|
15610
16027
|
return this.getChunkAt(posOrX)?.getBlockAt(posOrX);
|
|
15611
16028
|
}
|
|
15612
16029
|
async setBlockAt(posOrX, yOrBlock, z, block) {
|
|
15613
16030
|
if (typeof posOrX == "number") {
|
|
15614
|
-
return this.setBlockAt(new
|
|
16031
|
+
return this.setBlockAt(new import_three40.Vector3(posOrX, yOrBlock, z), block);
|
|
15615
16032
|
}
|
|
15616
16033
|
if (isTripleArray(posOrX)) {
|
|
15617
|
-
return this.setBlockAt(new
|
|
16034
|
+
return this.setBlockAt(new import_three40.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
|
|
15618
16035
|
}
|
|
15619
16036
|
return this.placeBlock(posOrX, yOrBlock);
|
|
15620
16037
|
}
|
|
@@ -15625,10 +16042,10 @@ var MineRenderWorld = class {
|
|
|
15625
16042
|
}
|
|
15626
16043
|
async setBlockVisibleAt(posOrX, yOrVisible, z, visible) {
|
|
15627
16044
|
if (typeof posOrX === "number") {
|
|
15628
|
-
return this.setBlockVisibleAt(new
|
|
16045
|
+
return this.setBlockVisibleAt(new import_three40.Vector3(posOrX, yOrVisible, z), visible);
|
|
15629
16046
|
}
|
|
15630
16047
|
if (isTripleArray(posOrX)) {
|
|
15631
|
-
return this.setBlockVisibleAt(new
|
|
16048
|
+
return this.setBlockVisibleAt(new import_three40.Vector3(...posOrX), yOrVisible);
|
|
15632
16049
|
}
|
|
15633
16050
|
this.validatePosBounds(posOrX);
|
|
15634
16051
|
await this.getChunkAt(posOrX)?.setBlockVisibleAt(posOrX, yOrVisible);
|
|
@@ -15652,7 +16069,7 @@ var MineRenderWorld = class {
|
|
|
15652
16069
|
const collect = async (positions2) => {
|
|
15653
16070
|
for (const pos of positions2) changes.set(pos.toArray().join(","), pos);
|
|
15654
16071
|
};
|
|
15655
|
-
const place = (block) => this.placeBlock(new
|
|
16072
|
+
const place = (block) => this.placeBlock(new import_three40.Vector3(...block.position), block, collect);
|
|
15656
16073
|
const keys = /* @__PURE__ */ new Map();
|
|
15657
16074
|
for (const block of multiblock.blocks) {
|
|
15658
16075
|
if (Chunk.isAir(block)) continue;
|
|
@@ -15750,13 +16167,13 @@ var MineRenderWorld = class {
|
|
|
15750
16167
|
for (const pos of positions) {
|
|
15751
16168
|
this.pendingCulling.set(pos.toArray().join(","), pos.clone());
|
|
15752
16169
|
for (const offset of CUBE_FACE_OFFSETS) {
|
|
15753
|
-
const neighbor = pos.clone().add(new
|
|
16170
|
+
const neighbor = pos.clone().add(new import_three40.Vector3(...offset));
|
|
15754
16171
|
this.pendingCulling.set(neighbor.toArray().join(","), neighbor);
|
|
15755
16172
|
}
|
|
15756
16173
|
for (let y = -1; y <= 1; y++) {
|
|
15757
16174
|
for (let z = -1; z <= 1; z++) {
|
|
15758
16175
|
for (let x = -1; x <= 1; x++) {
|
|
15759
|
-
const neighbor = pos.clone().add(new
|
|
16176
|
+
const neighbor = pos.clone().add(new import_three40.Vector3(x, y, z));
|
|
15760
16177
|
if (this.getBlockAt(neighbor)?.object?.fluidKind) {
|
|
15761
16178
|
this.pendingCulling.set(neighbor.toArray().join(","), neighbor);
|
|
15762
16179
|
}
|
|
@@ -15780,19 +16197,19 @@ var MineRenderWorld = class {
|
|
|
15780
16197
|
}
|
|
15781
16198
|
if (block.object?.fluidKind) {
|
|
15782
16199
|
await block.object.updateFluid((x, y, z) => {
|
|
15783
|
-
const neighbor = pos.clone().add(new
|
|
16200
|
+
const neighbor = pos.clone().add(new import_three40.Vector3(x, y, z));
|
|
15784
16201
|
const section = this.getChunkAt(neighbor);
|
|
15785
|
-
const
|
|
16202
|
+
const object3 = section?.isBlockVisibleAt(neighbor) ? section.getBlockAt(neighbor)?.object : void 0;
|
|
15786
16203
|
return {
|
|
15787
|
-
fluid:
|
|
15788
|
-
level:
|
|
16204
|
+
fluid: object3?.fluidKind,
|
|
16205
|
+
level: object3?.fluidLevel,
|
|
15789
16206
|
solid: section?.isOccludingAt(neighbor) ?? false
|
|
15790
16207
|
};
|
|
15791
16208
|
});
|
|
15792
16209
|
}
|
|
15793
16210
|
let mask = 0;
|
|
15794
16211
|
for (const [face, offset] of CUBE_FACE_OFFSETS.entries()) {
|
|
15795
|
-
const neighbor = pos.clone().add(new
|
|
16212
|
+
const neighbor = pos.clone().add(new import_three40.Vector3(...offset));
|
|
15796
16213
|
if (this.getChunkAt(neighbor)?.isOccludingAt(neighbor)) {
|
|
15797
16214
|
mask |= 1 << face;
|
|
15798
16215
|
}
|
|
@@ -15828,7 +16245,7 @@ var MineRenderWorld = class {
|
|
|
15828
16245
|
}
|
|
15829
16246
|
/** Converts block coordinates to scene units by multiplying each component by 16. */
|
|
15830
16247
|
static worldToScenePosition(pos) {
|
|
15831
|
-
return new
|
|
16248
|
+
return new import_three40.Vector3(
|
|
15832
16249
|
pos.x * 16,
|
|
15833
16250
|
pos.y * 16,
|
|
15834
16251
|
pos.z * 16
|
|
@@ -15836,7 +16253,7 @@ var MineRenderWorld = class {
|
|
|
15836
16253
|
}
|
|
15837
16254
|
/** Converts scene units to block coordinates without rounding to an integer block. */
|
|
15838
16255
|
static sceneToWorldPosition(pos) {
|
|
15839
|
-
return new
|
|
16256
|
+
return new import_three40.Vector3(
|
|
15840
16257
|
pos.x / 16,
|
|
15841
16258
|
pos.y / 16,
|
|
15842
16259
|
pos.z / 16
|
|
@@ -15859,10 +16276,10 @@ var MineRenderWorld = class {
|
|
|
15859
16276
|
init_Model();
|
|
15860
16277
|
|
|
15861
16278
|
// src/world/SectionMesh.ts
|
|
15862
|
-
var
|
|
16279
|
+
var import_three41 = require("three");
|
|
15863
16280
|
init_CanvasCompat();
|
|
15864
16281
|
init_Materials();
|
|
15865
|
-
var SectionMesh = class _SectionMesh extends
|
|
16282
|
+
var SectionMesh = class _SectionMesh extends import_three41.Group {
|
|
15866
16283
|
constructor() {
|
|
15867
16284
|
super(...arguments);
|
|
15868
16285
|
this.ownedMeshes = [];
|
|
@@ -15915,7 +16332,7 @@ var SectionMesh = class _SectionMesh extends import_three40.Group {
|
|
|
15915
16332
|
const normal = template.geometry.getAttribute("normal");
|
|
15916
16333
|
const uv = template.geometry.getAttribute("uv");
|
|
15917
16334
|
const bounds = template.geometry.getAttribute("uvBounds");
|
|
15918
|
-
const
|
|
16335
|
+
const color2 = template.geometry.getAttribute("color");
|
|
15919
16336
|
const sourceIndices = template.geometry.getIndex();
|
|
15920
16337
|
const placement = locations.get(template.atlas).placement;
|
|
15921
16338
|
const mapU = (u) => (placement.x + u * template.atlas.image.width) / page.width;
|
|
@@ -15937,24 +16354,24 @@ var SectionMesh = class _SectionMesh extends import_three40.Group {
|
|
|
15937
16354
|
mapU(bounds?.getZ(vertex) ?? 1),
|
|
15938
16355
|
mapV(bounds?.getW(vertex) ?? 1)
|
|
15939
16356
|
);
|
|
15940
|
-
colors.push(
|
|
16357
|
+
colors.push(color2?.getX(vertex) ?? 1, color2?.getY(vertex) ?? 1, color2?.getZ(vertex) ?? 1);
|
|
15941
16358
|
}
|
|
15942
16359
|
for (let corner = 0; corner < 6; corner++) indices.push(start + sourceIndices.getX(face * 6 + corner) - face * 4);
|
|
15943
16360
|
}
|
|
15944
16361
|
}
|
|
15945
|
-
const geometry = new
|
|
15946
|
-
geometry.setAttribute("position", new
|
|
15947
|
-
geometry.setAttribute("normal", new
|
|
15948
|
-
geometry.setAttribute("uv", new
|
|
15949
|
-
geometry.setAttribute("uvBounds", new
|
|
15950
|
-
geometry.setAttribute("color", new
|
|
16362
|
+
const geometry = new import_three41.BufferGeometry();
|
|
16363
|
+
geometry.setAttribute("position", new import_three41.Float32BufferAttribute(positions, 3));
|
|
16364
|
+
geometry.setAttribute("normal", new import_three41.Float32BufferAttribute(normals, 3));
|
|
16365
|
+
geometry.setAttribute("uv", new import_three41.Float32BufferAttribute(uvs, 2));
|
|
16366
|
+
geometry.setAttribute("uvBounds", new import_three41.Float32BufferAttribute(uvBounds, 4));
|
|
16367
|
+
geometry.setAttribute("color", new import_three41.Float32BufferAttribute(colors, 3));
|
|
15951
16368
|
geometry.setIndex(indices);
|
|
15952
16369
|
geometry.computeBoundingBox();
|
|
15953
16370
|
geometry.computeBoundingSphere();
|
|
15954
16371
|
const material = Materials.createShadedCanvasMaterial(canvas, false, false, true);
|
|
15955
16372
|
material.vertexColors = true;
|
|
15956
16373
|
const texture = material.uniforms?.map?.value ?? material.map;
|
|
15957
|
-
const mesh = new
|
|
16374
|
+
const mesh = new import_three41.Mesh(geometry, material);
|
|
15958
16375
|
section.add(mesh);
|
|
15959
16376
|
section.ownedMeshes.push({ mesh, texture });
|
|
15960
16377
|
}
|
|
@@ -15990,10 +16407,10 @@ var Chunk = class _Chunk {
|
|
|
15990
16407
|
}
|
|
15991
16408
|
getBlockAt(posOrX, y, z) {
|
|
15992
16409
|
if (typeof posOrX == "number") {
|
|
15993
|
-
return this.getBlockAt(new
|
|
16410
|
+
return this.getBlockAt(new import_three42.Vector3(posOrX, y, z));
|
|
15994
16411
|
}
|
|
15995
16412
|
if (isTripleArray(posOrX)) {
|
|
15996
|
-
return this.getBlockAt(new
|
|
16413
|
+
return this.getBlockAt(new import_three42.Vector3(posOrX[0], posOrX[1], posOrX[2]));
|
|
15997
16414
|
}
|
|
15998
16415
|
const pos = this.worldPosToChunkPos(posOrX);
|
|
15999
16416
|
const index = _Chunk.chunkPosToBlockIndex(pos);
|
|
@@ -16001,10 +16418,10 @@ var Chunk = class _Chunk {
|
|
|
16001
16418
|
}
|
|
16002
16419
|
async setBlockAt(posOrX, yOrBlock, z, block) {
|
|
16003
16420
|
if (typeof posOrX == "number") {
|
|
16004
|
-
return this.setBlockAt(new
|
|
16421
|
+
return this.setBlockAt(new import_three42.Vector3(posOrX, yOrBlock, z), block);
|
|
16005
16422
|
}
|
|
16006
16423
|
if (isTripleArray(posOrX)) {
|
|
16007
|
-
return this.setBlockAt(new
|
|
16424
|
+
return this.setBlockAt(new import_three42.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
|
|
16008
16425
|
}
|
|
16009
16426
|
const worldPos = posOrX;
|
|
16010
16427
|
const pos = this.worldPosToChunkPos(worldPos);
|
|
@@ -16025,7 +16442,7 @@ var Chunk = class _Chunk {
|
|
|
16025
16442
|
this.renderedBlocks.get(index)?.object?.removeFromScene();
|
|
16026
16443
|
if (this.sectionBlocks.delete(index)) this.meshDirty = true;
|
|
16027
16444
|
this.renderedBlocks.delete(index);
|
|
16028
|
-
let
|
|
16445
|
+
let object3;
|
|
16029
16446
|
try {
|
|
16030
16447
|
if (!readBlock) return void 0;
|
|
16031
16448
|
const stored = readBlock();
|
|
@@ -16040,22 +16457,22 @@ var Chunk = class _Chunk {
|
|
|
16040
16457
|
this.sectionBlocks.set(index, { index, template, cullMask: 0 });
|
|
16041
16458
|
this.meshDirty = true;
|
|
16042
16459
|
} else {
|
|
16043
|
-
|
|
16460
|
+
object3 = await this.scene.addBlock(blockState, {
|
|
16044
16461
|
mergeMeshes: true,
|
|
16045
16462
|
instanceMeshes: true,
|
|
16046
16463
|
maxInstanceCount: 2e3,
|
|
16047
16464
|
initialState: stored.properties
|
|
16048
16465
|
});
|
|
16049
|
-
|
|
16466
|
+
object3.setPosition(MineRenderWorld.worldToScenePosition(worldPos));
|
|
16050
16467
|
}
|
|
16051
16468
|
const info = { get block() {
|
|
16052
16469
|
return readBlock();
|
|
16053
|
-
}, object:
|
|
16470
|
+
}, object: object3 };
|
|
16054
16471
|
this.renderedBlocks.set(index, info);
|
|
16055
16472
|
return info;
|
|
16056
16473
|
} catch (error) {
|
|
16057
16474
|
this.data.set(index, void 0);
|
|
16058
|
-
|
|
16475
|
+
object3?.removeFromScene();
|
|
16059
16476
|
throw error;
|
|
16060
16477
|
} finally {
|
|
16061
16478
|
await onBlocksChanged?.([worldPos]);
|
|
@@ -16118,7 +16535,7 @@ var Chunk = class _Chunk {
|
|
|
16118
16535
|
/** Removes stored blocks and their render objects, then notifies the owning world of changed positions. */
|
|
16119
16536
|
async clear(onBlocksChanged = this.onBlocksChanged) {
|
|
16120
16537
|
const positions = [...this.renderedBlocks.keys()].map((index) => this.chunkPosToWorldPos(
|
|
16121
|
-
new
|
|
16538
|
+
new import_three42.Vector3(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
|
|
16122
16539
|
));
|
|
16123
16540
|
for (const info of this.renderedBlocks.values()) info.object?.removeFromScene();
|
|
16124
16541
|
this.sectionBlocks.clear();
|
|
@@ -16144,14 +16561,14 @@ var Chunk = class _Chunk {
|
|
|
16144
16561
|
return pos.y * 16 * 16 + pos.z * 16 + pos.x;
|
|
16145
16562
|
}
|
|
16146
16563
|
worldPosToChunkPos(pos) {
|
|
16147
|
-
return new
|
|
16564
|
+
return new import_three42.Vector3(
|
|
16148
16565
|
pos.x - this.x * 16,
|
|
16149
16566
|
pos.y - this.y * 16,
|
|
16150
16567
|
pos.z - this.z * 16
|
|
16151
16568
|
);
|
|
16152
16569
|
}
|
|
16153
16570
|
chunkPosToWorldPos(pos) {
|
|
16154
|
-
return new
|
|
16571
|
+
return new import_three42.Vector3(
|
|
16155
16572
|
this.x * 16 + pos.x,
|
|
16156
16573
|
this.y * 16 + pos.y,
|
|
16157
16574
|
this.z * 16 + pos.z
|
|
@@ -16239,6 +16656,7 @@ var Chunk = class _Chunk {
|
|
|
16239
16656
|
RequestError,
|
|
16240
16657
|
Requests,
|
|
16241
16658
|
SKIN_PARTS,
|
|
16659
|
+
SceneDocumentLoader,
|
|
16242
16660
|
SceneExporter,
|
|
16243
16661
|
SceneInspector,
|
|
16244
16662
|
SceneObject,
|
|
@@ -16314,6 +16732,7 @@ var Chunk = class _Chunk {
|
|
|
16314
16732
|
mergeBufferAttributes,
|
|
16315
16733
|
mergeBufferGeometries,
|
|
16316
16734
|
mergeVertices,
|
|
16735
|
+
parseSceneDocument,
|
|
16317
16736
|
prefix,
|
|
16318
16737
|
registerNodeEnv,
|
|
16319
16738
|
sampleEntityAnimation,
|