minerender 2.1.0-alpha.135 → 2.1.0-alpha.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/esm/Materials.mjs +3 -1
- package/dist/browser/esm/Materials.mjs.map +1 -1
- package/dist/browser/esm/Ticker.mjs +3 -1
- package/dist/browser/esm/Ticker.mjs.map +1 -1
- package/dist/browser/esm/UVMapper.mjs +9 -9
- package/dist/browser/esm/UVMapper.mjs.map +1 -1
- package/dist/browser/esm/assets/AssetLoader.mjs +4 -4
- package/dist/browser/esm/assets/AssetLoader.mjs.map +1 -1
- package/dist/browser/esm/assets/BlockEntities.mjs +3 -1
- package/dist/browser/esm/assets/BlockEntities.mjs.map +1 -1
- package/dist/browser/esm/assets/_fonts/Unihex.mjs +4 -2
- package/dist/browser/esm/assets/_fonts/Unihex.mjs.map +1 -1
- package/dist/browser/esm/assets/source/HostedAssetSource.mjs +6 -7
- package/dist/browser/esm/assets/source/HostedAssetSource.mjs.map +1 -1
- package/dist/browser/esm/env/browser/BrowserCache.mjs +3 -3
- package/dist/browser/esm/env/browser/BrowserCache.mjs.map +1 -1
- package/dist/browser/esm/image/ImageLoader.mjs +3 -3
- package/dist/browser/esm/image/ImageLoader.mjs.map +1 -1
- package/dist/browser/esm/index.browser.d.mts +32 -1
- package/dist/browser/esm/inspector/SceneInspector.mjs +3 -3
- package/dist/browser/esm/inspector/SceneInspector.mjs.map +1 -1
- package/dist/browser/esm/instance/InstanceManager.mjs +4 -4
- package/dist/browser/esm/instance/InstanceManager.mjs.map +1 -1
- package/dist/browser/esm/model/block/scene/BlockObject.mjs +3 -1
- package/dist/browser/esm/model/block/scene/BlockObject.mjs.map +1 -1
- package/dist/browser/esm/model/scene/ModelObject.mjs +4 -4
- package/dist/browser/esm/model/scene/ModelObject.mjs.map +1 -1
- package/dist/browser/esm/nbt/NBTHelper.mjs +5 -2
- package/dist/browser/esm/nbt/NBTHelper.mjs.map +1 -1
- package/dist/browser/esm/renderer/Renderer.mjs +4 -2
- package/dist/browser/esm/renderer/Renderer.mjs.map +1 -1
- package/dist/browser/esm/renderer/SceneObject.mjs +0 -6
- package/dist/browser/esm/renderer/SceneObject.mjs.map +1 -1
- package/dist/browser/esm/request/Requests.mjs +3 -3
- package/dist/browser/esm/request/Requests.mjs.map +1 -1
- package/dist/browser/esm/skin/Skins.mjs +6 -4
- package/dist/browser/esm/skin/Skins.mjs.map +1 -1
- package/dist/browser/esm/texture/TextureLoader.mjs +4 -2
- package/dist/browser/esm/texture/TextureLoader.mjs.map +1 -1
- package/dist/browser/esm/util/log.mjs +75 -0
- package/dist/browser/esm/util/log.mjs.map +1 -1
- package/dist/browser/esm/util/performance.mjs.map +1 -1
- package/dist/browser/esm/world/MineRenderWorld.mjs +4 -2
- package/dist/browser/esm/world/MineRenderWorld.mjs.map +1 -1
- package/dist/browser/esm/world/_entities/WorldEntities.mjs +3 -1
- package/dist/browser/esm/world/_entities/WorldEntities.mjs.map +1 -1
- package/dist/browser/index.d.ts +32 -1
- package/dist/browser/index.js +450 -386
- package/dist/browser/index.js.map +1 -1
- package/dist/bundle.js +2148 -2082
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +32 -1
- package/dist/node/index.d.ts +32 -1
- package/dist/node/index.js +450 -384
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +421 -356
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -88,12 +88,80 @@ var init_PersistentCache = __esm({
|
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
// src/util/log.ts
|
|
91
|
+
function readSwitch() {
|
|
92
|
+
switchRead = true;
|
|
93
|
+
let value;
|
|
94
|
+
if (typeof runtime.process?.versions?.node === "string") {
|
|
95
|
+
value = runtime.process.env?.MINERENDER_LOG;
|
|
96
|
+
} else {
|
|
97
|
+
try {
|
|
98
|
+
value = runtime.localStorage?.getItem("minerender:log");
|
|
99
|
+
} catch {
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (value) {
|
|
103
|
+
for (const entry of value.split(",")) {
|
|
104
|
+
const separator = entry.indexOf("=");
|
|
105
|
+
const name = separator < 0 ? void 0 : entry.slice(0, separator).trim();
|
|
106
|
+
const setting = (separator < 0 ? entry : entry.slice(separator + 1)).trim();
|
|
107
|
+
if (!Object.prototype.hasOwnProperty.call(levels, setting) || name === "") continue;
|
|
108
|
+
if (name === void 0) {
|
|
109
|
+
switchThreshold = setting;
|
|
110
|
+
} else {
|
|
111
|
+
switchNamespaces ?? (switchNamespaces = /* @__PURE__ */ new Map());
|
|
112
|
+
switchNamespaces.set(name, setting);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function logger(namespace) {
|
|
118
|
+
const write = (level, args) => {
|
|
119
|
+
if (!switchRead) readSwitch();
|
|
120
|
+
if (levels[level] < levels[switchNamespaces?.get(namespace) ?? switchThreshold ?? namespaces?.get(namespace) ?? threshold]) return;
|
|
121
|
+
if (logHandler) {
|
|
122
|
+
logHandler(level, namespace, args);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (tagStyle === void 0) {
|
|
126
|
+
tagStyle = typeof runtime.process?.versions?.node === "string" ? runtime.process.stdout?.isTTY === true ? "ansi" : "plain" : "browser";
|
|
127
|
+
}
|
|
128
|
+
if (tagStyle === "browser") {
|
|
129
|
+
console[level](`%cMineRender%c ${namespace}`, "background:#3c8527;color:#fff;border-radius:3px;padding:0 4px", "font-weight:bold", ...args);
|
|
130
|
+
} else {
|
|
131
|
+
const color2 = colors[level];
|
|
132
|
+
const tag = `[minerender:${namespace}]`;
|
|
133
|
+
console[level](tagStyle === "ansi" ? `\x1B[${color2}m${tag}\x1B[0m` : tag, ...args);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
debug: (...args) => write("debug", args),
|
|
138
|
+
info: (...args) => write("info", args),
|
|
139
|
+
warn: (...args) => write("warn", args),
|
|
140
|
+
error: (...args) => write("error", args)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
91
143
|
function prefix(prefix2) {
|
|
92
144
|
return `${FgGreen}MR${BgBlack}${prefix2 ?? ""}${Reset}`;
|
|
93
145
|
}
|
|
94
|
-
var Reset, FgGreen, BgBlack;
|
|
146
|
+
var runtime, levels, colors, threshold, namespaces, logHandler, tagStyle, switchRead, switchThreshold, switchNamespaces, Logging, Reset, FgGreen, BgBlack;
|
|
95
147
|
var init_log = __esm({
|
|
96
148
|
"src/util/log.ts"() {
|
|
149
|
+
runtime = globalThis;
|
|
150
|
+
levels = { debug: 0, info: 1, warn: 2, error: 3, silent: 4 };
|
|
151
|
+
colors = { debug: 90, info: 36, warn: 33, error: 31 };
|
|
152
|
+
threshold = "warn";
|
|
153
|
+
switchRead = false;
|
|
154
|
+
Logging = class {
|
|
155
|
+
/** Updates the given settings and keeps the others. */
|
|
156
|
+
static configure(options) {
|
|
157
|
+
if (options.level !== void 0) threshold = options.level;
|
|
158
|
+
if (options.namespaces !== void 0) namespaces = new Map(Object.entries(options.namespaces));
|
|
159
|
+
}
|
|
160
|
+
/** Sends messages to `handler` instead of the console. Call without an argument to restore console output. */
|
|
161
|
+
static setHandler(handler) {
|
|
162
|
+
logHandler = handler;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
97
165
|
Reset = "\x1B[0m";
|
|
98
166
|
FgGreen = "\x1B[32m";
|
|
99
167
|
BgBlack = "\x1B[40m";
|
|
@@ -443,12 +511,12 @@ async function abortable(promise, signal) {
|
|
|
443
511
|
signal.removeEventListener("abort", abort);
|
|
444
512
|
}
|
|
445
513
|
}
|
|
446
|
-
var import_jobqu,
|
|
514
|
+
var import_jobqu, log2, RequestError, RequestQueue, Requests;
|
|
447
515
|
var init_Requests = __esm({
|
|
448
516
|
"src/request/Requests.ts"() {
|
|
449
517
|
import_jobqu = require("jobqu");
|
|
450
518
|
init_log();
|
|
451
|
-
|
|
519
|
+
log2 = logger("Requests");
|
|
452
520
|
RequestError = class extends Error {
|
|
453
521
|
constructor(message, response, cause) {
|
|
454
522
|
super(message);
|
|
@@ -475,7 +543,7 @@ var init_Requests = __esm({
|
|
|
475
543
|
try {
|
|
476
544
|
return await abortable(this.queue.add(request), signal);
|
|
477
545
|
} catch (error) {
|
|
478
|
-
|
|
546
|
+
log2.debug("Request failed", error);
|
|
479
547
|
const delay = this.retryDelay(error, request, retries);
|
|
480
548
|
if (delay === void 0) {
|
|
481
549
|
throw error;
|
|
@@ -657,7 +725,7 @@ var init_base64 = __esm({
|
|
|
657
725
|
});
|
|
658
726
|
|
|
659
727
|
// src/image/ImageLoader.ts
|
|
660
|
-
var
|
|
728
|
+
var log3, ImageLoader;
|
|
661
729
|
var init_ImageLoader = __esm({
|
|
662
730
|
"src/image/ImageLoader.ts"() {
|
|
663
731
|
init_CanvasCompat();
|
|
@@ -668,7 +736,7 @@ var init_ImageLoader = __esm({
|
|
|
668
736
|
init_WrappedImage();
|
|
669
737
|
init_base64();
|
|
670
738
|
init_log();
|
|
671
|
-
|
|
739
|
+
log3 = logger("ImageLoader");
|
|
672
740
|
ImageLoader = class _ImageLoader {
|
|
673
741
|
static _createImage() {
|
|
674
742
|
return createImage();
|
|
@@ -693,7 +761,7 @@ var init_ImageLoader = __esm({
|
|
|
693
761
|
return image;
|
|
694
762
|
}
|
|
695
763
|
static async loadData(src) {
|
|
696
|
-
|
|
764
|
+
log3.debug("loadData", src);
|
|
697
765
|
const image = await this.loadCanvasData(src);
|
|
698
766
|
return image.data.getImageData(0, 0, image.width, image.height);
|
|
699
767
|
}
|
|
@@ -800,13 +868,15 @@ var init_ImageLoader = __esm({
|
|
|
800
868
|
});
|
|
801
869
|
|
|
802
870
|
// src/texture/TextureLoader.ts
|
|
803
|
-
var import_three3, THREE, TextureLoader;
|
|
871
|
+
var import_three3, THREE, log4, TextureLoader;
|
|
804
872
|
var init_TextureLoader = __esm({
|
|
805
873
|
"src/texture/TextureLoader.ts"() {
|
|
806
874
|
import_three3 = require("three");
|
|
807
875
|
THREE = __toESM(require("three"));
|
|
808
876
|
init_ImageLoader();
|
|
809
877
|
init_Textures();
|
|
878
|
+
init_log();
|
|
879
|
+
log4 = logger("TextureLoader");
|
|
810
880
|
TextureLoader = class {
|
|
811
881
|
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
812
882
|
static hasFailed(texture) {
|
|
@@ -822,7 +892,7 @@ var init_TextureLoader = __esm({
|
|
|
822
892
|
texture.needsUpdate = true;
|
|
823
893
|
}, (error) => {
|
|
824
894
|
this.failedTextures.add(texture);
|
|
825
|
-
|
|
895
|
+
log4.warn("Failed to load texture", src, error);
|
|
826
896
|
});
|
|
827
897
|
texture.image = image;
|
|
828
898
|
texture.format = format2;
|
|
@@ -838,7 +908,7 @@ var init_TextureLoader = __esm({
|
|
|
838
908
|
texture.needsUpdate = true;
|
|
839
909
|
}).catch((error) => {
|
|
840
910
|
this.failedTextures.add(texture);
|
|
841
|
-
|
|
911
|
+
log4.warn("Failed to load texture", src, error);
|
|
842
912
|
});
|
|
843
913
|
texture.format = format2;
|
|
844
914
|
texture.rotation = rotation;
|
|
@@ -914,7 +984,7 @@ var init_Textures = __esm({
|
|
|
914
984
|
});
|
|
915
985
|
|
|
916
986
|
// src/Materials.ts
|
|
917
|
-
var import_three5, Materials;
|
|
987
|
+
var import_three5, log5, Materials;
|
|
918
988
|
var init_Materials = __esm({
|
|
919
989
|
"src/Materials.ts"() {
|
|
920
990
|
init_CacheKey();
|
|
@@ -922,6 +992,8 @@ var init_Materials = __esm({
|
|
|
922
992
|
init_Textures();
|
|
923
993
|
init_TextureLoader();
|
|
924
994
|
init_Caching();
|
|
995
|
+
init_log();
|
|
996
|
+
log5 = logger("Materials");
|
|
925
997
|
Materials = class _Materials {
|
|
926
998
|
/** Shared checkerboard material, created on first access. */
|
|
927
999
|
static get MISSING_TEXTURE() {
|
|
@@ -1192,7 +1264,7 @@ var init_Materials = __esm({
|
|
|
1192
1264
|
Object.assign(material.defaultAttributeValues, { shade: [1], uvBounds: [0, 0, 1, 1] });
|
|
1193
1265
|
return material;
|
|
1194
1266
|
} catch (e) {
|
|
1195
|
-
|
|
1267
|
+
log5.warn(e);
|
|
1196
1268
|
}
|
|
1197
1269
|
return this.createBasicCanvasMaterial(canvas, transparent, shade);
|
|
1198
1270
|
}
|
|
@@ -1333,12 +1405,12 @@ var init_AssetKey = __esm({
|
|
|
1333
1405
|
}
|
|
1334
1406
|
/** Joins the type subdirectory and path without adding a namespace or file extension. */
|
|
1335
1407
|
getFullPath() {
|
|
1336
|
-
let
|
|
1408
|
+
let p = [];
|
|
1337
1409
|
if (this.type) {
|
|
1338
|
-
|
|
1410
|
+
p.push(this.type);
|
|
1339
1411
|
}
|
|
1340
|
-
|
|
1341
|
-
return
|
|
1412
|
+
p.push(this.path);
|
|
1413
|
+
return p.join("/");
|
|
1342
1414
|
}
|
|
1343
1415
|
toNamespacedString() {
|
|
1344
1416
|
return this.namespace + ":" + this.getFullPath();
|
|
@@ -1384,194 +1456,19 @@ var init_AssetSource = __esm({
|
|
|
1384
1456
|
}
|
|
1385
1457
|
});
|
|
1386
1458
|
|
|
1387
|
-
// src/util/BatchedExecutor.ts
|
|
1388
|
-
var import_jobqu2, BatchedExecutor;
|
|
1389
|
-
var init_BatchedExecutor = __esm({
|
|
1390
|
-
"src/util/BatchedExecutor.ts"() {
|
|
1391
|
-
import_jobqu2 = require("jobqu");
|
|
1392
|
-
BatchedExecutor = class {
|
|
1393
|
-
/**
|
|
1394
|
-
* @param interval - Delay between queue runs, in milliseconds.
|
|
1395
|
-
* @param batch - Maximum tasks started per run and maximum tasks active at once.
|
|
1396
|
-
*/
|
|
1397
|
-
constructor(interval = 1, batch = 30) {
|
|
1398
|
-
if (!Number.isFinite(interval) || interval < 0) throw new RangeError("Batch interval must be finite and nonnegative");
|
|
1399
|
-
if (!Number.isInteger(batch) || batch < 1) throw new RangeError("Batch size must be a positive integer");
|
|
1400
|
-
this.interval = interval;
|
|
1401
|
-
this.batch = batch;
|
|
1402
|
-
this.queue = new import_jobqu2.JobQueue(async (task) => task(), { interval, maxPerRun: batch, maxActive: batch });
|
|
1403
|
-
}
|
|
1404
|
-
/** Queues a task and resolves with its result, or rejects with its error. */
|
|
1405
|
-
submit(task) {
|
|
1406
|
-
return this.queue.add(() => task());
|
|
1407
|
-
}
|
|
1408
|
-
/** Rejects queued and future tasks. Tasks already running are allowed to finish. */
|
|
1409
|
-
stop() {
|
|
1410
|
-
this.queue.end();
|
|
1411
|
-
}
|
|
1412
|
-
};
|
|
1413
|
-
}
|
|
1414
|
-
});
|
|
1415
|
-
|
|
1416
|
-
// src/util/model.ts
|
|
1417
|
-
function applyElementRotation(rotation, geometry) {
|
|
1418
|
-
const origin = new import_three7.Vector3(rotation.origin[0], rotation.origin[1], rotation.origin[2]);
|
|
1419
|
-
geometry.translate(-origin.x, -origin.y, -origin.z);
|
|
1420
|
-
switch (rotation.axis) {
|
|
1421
|
-
case "x" /* X */:
|
|
1422
|
-
geometry.rotateX(toRadians(rotation.angle));
|
|
1423
|
-
break;
|
|
1424
|
-
case "y" /* Y */:
|
|
1425
|
-
geometry.rotateY(toRadians(rotation.angle));
|
|
1426
|
-
break;
|
|
1427
|
-
case "z" /* Z */:
|
|
1428
|
-
geometry.rotateZ(toRadians(rotation.angle));
|
|
1429
|
-
break;
|
|
1430
|
-
}
|
|
1431
|
-
if (rotation.rescale) {
|
|
1432
|
-
const angle = toRadians(rotation.angle);
|
|
1433
|
-
const s = 1 / Math.max(Math.abs(Math.cos(angle)), Math.abs(Math.sin(angle)));
|
|
1434
|
-
geometry.scale(
|
|
1435
|
-
rotation.axis === "x" /* X */ ? 1 : s,
|
|
1436
|
-
rotation.axis === "y" /* Y */ ? 1 : s,
|
|
1437
|
-
rotation.axis === "z" /* Z */ ? 1 : s
|
|
1438
|
-
);
|
|
1439
|
-
}
|
|
1440
|
-
geometry.translate(origin.x, origin.y, origin.z);
|
|
1441
|
-
}
|
|
1442
|
-
function applyGenericRotation(axis, rotation, obj) {
|
|
1443
|
-
switch (axis) {
|
|
1444
|
-
case "x" /* X */:
|
|
1445
|
-
obj.rotateOnAxis(new import_three7.Vector3(1, 0, 0), toRadians(rotation));
|
|
1446
|
-
break;
|
|
1447
|
-
case "y" /* Y */:
|
|
1448
|
-
obj.rotateOnAxis(new import_three7.Vector3(0, 1, 0), toRadians(rotation));
|
|
1449
|
-
break;
|
|
1450
|
-
case "z" /* Z */:
|
|
1451
|
-
obj.rotateOnAxis(new import_three7.Vector3(0, 0, 1), toRadians(rotation));
|
|
1452
|
-
break;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
function addBox3WireframeToObject(box, obj, color2 = 16777215, w = 2) {
|
|
1456
|
-
let size = new import_three7.Vector3();
|
|
1457
|
-
box.getSize(size);
|
|
1458
|
-
let boxGeo = new import_three7.BoxGeometry(size.x, size.y, size.z, 1, 1, 1);
|
|
1459
|
-
let wireGeo = new import_three7.EdgesGeometry(boxGeo);
|
|
1460
|
-
let wireMat = new import_three7.LineBasicMaterial({ color: color2, linewidth: w });
|
|
1461
|
-
let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
|
|
1462
|
-
obj.add(wireframe);
|
|
1463
|
-
let axes = new import_three7.AxesHelper(1);
|
|
1464
|
-
obj.add(axes);
|
|
1465
|
-
}
|
|
1466
|
-
function addWireframeToObject(obj, color2 = 16777215, w = 2) {
|
|
1467
|
-
let boxGeo = new import_three7.BoxGeometry(16, 16, 16, 1, 1, 1);
|
|
1468
|
-
let wireGeo = new import_three7.EdgesGeometry(boxGeo);
|
|
1469
|
-
let wireMat = new import_three7.LineBasicMaterial({ color: color2, linewidth: w });
|
|
1470
|
-
let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
|
|
1471
|
-
obj.add(wireframe);
|
|
1472
|
-
let axes = new import_three7.AxesHelper(1);
|
|
1473
|
-
obj.add(axes);
|
|
1474
|
-
}
|
|
1475
|
-
function addWireframeToMesh(geo, mesh, color2 = 16777215, w = 2) {
|
|
1476
|
-
let wireGeo = new import_three7.EdgesGeometry(geo);
|
|
1477
|
-
let wireMat = new import_three7.LineBasicMaterial({ color: color2, linewidth: w });
|
|
1478
|
-
let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
|
|
1479
|
-
mesh.add(wireframe);
|
|
1480
|
-
let axes = new import_three7.AxesHelper(1);
|
|
1481
|
-
mesh.add(axes);
|
|
1482
|
-
return () => {
|
|
1483
|
-
wireGeo.dispose();
|
|
1484
|
-
wireMat.dispose();
|
|
1485
|
-
axes.dispose();
|
|
1486
|
-
};
|
|
1487
|
-
}
|
|
1488
|
-
var import_three7;
|
|
1489
|
-
var init_model = __esm({
|
|
1490
|
-
"src/util/model.ts"() {
|
|
1491
|
-
init_Axis();
|
|
1492
|
-
init_util();
|
|
1493
|
-
import_three7 = require("three");
|
|
1494
|
-
}
|
|
1495
|
-
});
|
|
1496
|
-
|
|
1497
|
-
// src/util/performance.ts
|
|
1498
|
-
function captureException(e, ...extra) {
|
|
1499
|
-
console.error(e, extra);
|
|
1500
|
-
}
|
|
1501
|
-
function timingStart(marker) {
|
|
1502
|
-
console.time(marker);
|
|
1503
|
-
}
|
|
1504
|
-
function timingEnd(marker) {
|
|
1505
|
-
console.timeEnd(marker);
|
|
1506
|
-
}
|
|
1507
|
-
var init_performance = __esm({
|
|
1508
|
-
"src/util/performance.ts"() {
|
|
1509
|
-
}
|
|
1510
|
-
});
|
|
1511
|
-
|
|
1512
|
-
// src/util/sha.ts
|
|
1513
|
-
function sha1(str) {
|
|
1514
|
-
return (0, import_sha1.default)(str).toString();
|
|
1515
|
-
}
|
|
1516
|
-
function sha256(str) {
|
|
1517
|
-
return (0, import_sha256.default)(str).toString();
|
|
1518
|
-
}
|
|
1519
|
-
function sha512(str) {
|
|
1520
|
-
return (0, import_sha512.default)(str).toString();
|
|
1521
|
-
}
|
|
1522
|
-
var import_sha1, import_sha256, import_sha512;
|
|
1523
|
-
var init_sha = __esm({
|
|
1524
|
-
"src/util/sha.ts"() {
|
|
1525
|
-
import_sha1 = __toESM(require("crypto-js/sha1.js"));
|
|
1526
|
-
import_sha256 = __toESM(require("crypto-js/sha256.js"));
|
|
1527
|
-
import_sha512 = __toESM(require("crypto-js/sha512.js"));
|
|
1528
|
-
}
|
|
1529
|
-
});
|
|
1530
|
-
|
|
1531
|
-
// src/util/three.ts
|
|
1532
|
-
function isObject3D(obj) {
|
|
1533
|
-
return obj.isObject3D;
|
|
1534
|
-
}
|
|
1535
|
-
function isMesh(obj) {
|
|
1536
|
-
return obj.isMesh;
|
|
1537
|
-
}
|
|
1538
|
-
function isInstancedMesh(obj) {
|
|
1539
|
-
return obj.isInstancedMesh;
|
|
1540
|
-
}
|
|
1541
|
-
function isPerspectiveCamera(obj) {
|
|
1542
|
-
return obj.isPerspectiveCamera;
|
|
1543
|
-
}
|
|
1544
|
-
function isOrthographicCamera(obj) {
|
|
1545
|
-
return obj.isOrthographicCamera;
|
|
1546
|
-
}
|
|
1547
|
-
var init_three = __esm({
|
|
1548
|
-
"src/util/three.ts"() {
|
|
1549
|
-
}
|
|
1550
|
-
});
|
|
1551
|
-
|
|
1552
|
-
// src/util/index.ts
|
|
1553
|
-
var init_util2 = __esm({
|
|
1554
|
-
"src/util/index.ts"() {
|
|
1555
|
-
init_BatchedExecutor();
|
|
1556
|
-
init_log();
|
|
1557
|
-
init_model();
|
|
1558
|
-
init_performance();
|
|
1559
|
-
init_sha();
|
|
1560
|
-
init_three();
|
|
1561
|
-
init_util();
|
|
1562
|
-
}
|
|
1563
|
-
});
|
|
1564
|
-
|
|
1565
1459
|
// src/nbt/NBTHelper.ts
|
|
1460
|
+
function commonJsExports(module2) {
|
|
1461
|
+
return module2.default ?? module2;
|
|
1462
|
+
}
|
|
1566
1463
|
var NBTHelper;
|
|
1567
1464
|
var init_NBTHelper = __esm({
|
|
1568
1465
|
"src/nbt/NBTHelper.ts"() {
|
|
1569
1466
|
NBTHelper = class {
|
|
1570
1467
|
/** Parses NBT bytes and preserves format and compression metadata. Omit `format` for automatic detection. */
|
|
1571
1468
|
static async fromBuffer(data, format2) {
|
|
1572
|
-
const { Buffer: Buffer2 } = await import("buffer");
|
|
1469
|
+
const { Buffer: Buffer2 } = commonJsExports(await import("buffer"));
|
|
1573
1470
|
const buffer = Buffer2.from(data instanceof Uint8Array ? data : new Uint8Array(data));
|
|
1574
|
-
const prismarineNbt = await import("prismarine-nbt");
|
|
1471
|
+
const prismarineNbt = commonJsExports(await import("prismarine-nbt"));
|
|
1575
1472
|
const { parsed, type, metadata } = await prismarineNbt.parse(buffer, format2);
|
|
1576
1473
|
return Object.assign(parsed, {
|
|
1577
1474
|
format: type,
|
|
@@ -1644,8 +1541,8 @@ var require_dist = __commonJS({
|
|
|
1644
1541
|
__assign = Object.assign || function(t) {
|
|
1645
1542
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1646
1543
|
s = arguments[i];
|
|
1647
|
-
for (var
|
|
1648
|
-
t[
|
|
1544
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1545
|
+
t[p] = s[p];
|
|
1649
1546
|
}
|
|
1650
1547
|
return t;
|
|
1651
1548
|
};
|
|
@@ -1737,11 +1634,11 @@ var init_merge = __esm({
|
|
|
1737
1634
|
});
|
|
1738
1635
|
|
|
1739
1636
|
// src/assets/source/HostedAssetSource.ts
|
|
1740
|
-
var BINARY_TIMEOUT,
|
|
1637
|
+
var BINARY_TIMEOUT, log6, DEFAULT_OPTIONS, _HostedAssetSource, HostedAssetSource;
|
|
1741
1638
|
var init_HostedAssetSource = __esm({
|
|
1742
1639
|
"src/assets/source/HostedAssetSource.ts"() {
|
|
1743
1640
|
init_AssetSource();
|
|
1744
|
-
|
|
1641
|
+
init_log();
|
|
1745
1642
|
init_nbt();
|
|
1746
1643
|
init_image();
|
|
1747
1644
|
init_AssetKey();
|
|
@@ -1751,7 +1648,7 @@ var init_HostedAssetSource = __esm({
|
|
|
1751
1648
|
init_parser();
|
|
1752
1649
|
init_merge();
|
|
1753
1650
|
BINARY_TIMEOUT = 6e4;
|
|
1754
|
-
|
|
1651
|
+
log6 = logger("HostedAssetSource");
|
|
1755
1652
|
DEFAULT_OPTIONS = {
|
|
1756
1653
|
retryDefaults: true
|
|
1757
1654
|
};
|
|
@@ -1763,14 +1660,14 @@ var init_HostedAssetSource = __esm({
|
|
|
1763
1660
|
return direct;
|
|
1764
1661
|
}
|
|
1765
1662
|
if (key.namespace !== DEFAULT_NAMESPACE) {
|
|
1766
|
-
|
|
1663
|
+
log6.debug("Retrying", key, "with default namespace");
|
|
1767
1664
|
const namespaceKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, key.root);
|
|
1768
1665
|
const namespaced = await this.load(namespaceKey, parser);
|
|
1769
1666
|
if (typeof namespaced !== "undefined") {
|
|
1770
1667
|
return namespaced;
|
|
1771
1668
|
}
|
|
1772
1669
|
if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
|
|
1773
|
-
|
|
1670
|
+
log6.debug("Retrying", key, "with default root+namespace");
|
|
1774
1671
|
const namespacedRootedKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
|
|
1775
1672
|
const namespacedRooted = await this.load(namespacedRootedKey, parser);
|
|
1776
1673
|
if (typeof namespacedRooted !== "undefined") {
|
|
@@ -1778,7 +1675,7 @@ var init_HostedAssetSource = __esm({
|
|
|
1778
1675
|
}
|
|
1779
1676
|
}
|
|
1780
1677
|
} else if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
|
|
1781
|
-
|
|
1678
|
+
log6.debug("Retrying", key, "with default root");
|
|
1782
1679
|
const rootKey = new AssetKey(key.namespace, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
|
|
1783
1680
|
const rooted = await this.load(rootKey, parser);
|
|
1784
1681
|
if (typeof rooted !== "undefined") {
|
|
@@ -1788,9 +1685,8 @@ var init_HostedAssetSource = __esm({
|
|
|
1788
1685
|
return void 0;
|
|
1789
1686
|
}
|
|
1790
1687
|
async load(key, parser) {
|
|
1791
|
-
console.info(p4, "Loading", key);
|
|
1792
1688
|
const url = `${this.assetBasePath(key)}${key.type !== void 0 ? key.type + "/" : ""}${key.path}${key.extension}`;
|
|
1793
|
-
|
|
1689
|
+
log6.debug("Loading", url);
|
|
1794
1690
|
const request = { url };
|
|
1795
1691
|
try {
|
|
1796
1692
|
parser.config(request);
|
|
@@ -2243,7 +2139,7 @@ var init_source = __esm({
|
|
|
2243
2139
|
});
|
|
2244
2140
|
|
|
2245
2141
|
// src/assets/AssetLoader.ts
|
|
2246
|
-
var
|
|
2142
|
+
var log7, AssetLoader;
|
|
2247
2143
|
var init_AssetLoader = __esm({
|
|
2248
2144
|
"src/assets/AssetLoader.ts"() {
|
|
2249
2145
|
init_AssetDefaults();
|
|
@@ -2251,7 +2147,7 @@ var init_AssetLoader = __esm({
|
|
|
2251
2147
|
init_log();
|
|
2252
2148
|
init_source();
|
|
2253
2149
|
init_Caching();
|
|
2254
|
-
|
|
2150
|
+
log7 = logger("AssetLoader");
|
|
2255
2151
|
AssetLoader = class {
|
|
2256
2152
|
static get _SOURCES() {
|
|
2257
2153
|
return this.sources ?? (this.sources = [{ key: "mcassets", source: new HostedAssetSource(this.ROOT, { retryDefaults: false }) }]);
|
|
@@ -2306,11 +2202,11 @@ ${key}` : key;
|
|
|
2306
2202
|
if (override) {
|
|
2307
2203
|
const existing = this.removeSource(key);
|
|
2308
2204
|
if (existing) {
|
|
2309
|
-
|
|
2205
|
+
log7.info("Removed existing AssetSource", key);
|
|
2310
2206
|
}
|
|
2311
2207
|
}
|
|
2312
2208
|
this._SOURCES.unshift({ key, source });
|
|
2313
|
-
|
|
2209
|
+
log7.info("Added AssetSource", key);
|
|
2314
2210
|
}
|
|
2315
2211
|
/** Removes and returns the first source with this name. Call {@link Caching.clear} to reload assets. */
|
|
2316
2212
|
static removeSource(key) {
|
|
@@ -2490,9 +2386,11 @@ var init_CanvasImage = __esm({
|
|
|
2490
2386
|
});
|
|
2491
2387
|
|
|
2492
2388
|
// src/Ticker.ts
|
|
2493
|
-
var _Ticker, Ticker;
|
|
2389
|
+
var log8, _Ticker, Ticker;
|
|
2494
2390
|
var init_Ticker = __esm({
|
|
2495
2391
|
"src/Ticker.ts"() {
|
|
2392
|
+
init_log();
|
|
2393
|
+
log8 = logger("Ticker");
|
|
2496
2394
|
_Ticker = class _Ticker {
|
|
2497
2395
|
static schedule(fn, ms) {
|
|
2498
2396
|
const handle = setInterval(fn, ms);
|
|
@@ -2510,7 +2408,7 @@ var init_Ticker = __esm({
|
|
|
2510
2408
|
try {
|
|
2511
2409
|
t();
|
|
2512
2410
|
} catch (e) {
|
|
2513
|
-
|
|
2411
|
+
log8.warn(e);
|
|
2514
2412
|
}
|
|
2515
2413
|
});
|
|
2516
2414
|
_Ticker.oneSecondTicks++;
|
|
@@ -2755,10 +2653,10 @@ var init_cubeUv = __esm({
|
|
|
2755
2653
|
});
|
|
2756
2654
|
|
|
2757
2655
|
// src/UVMapper.ts
|
|
2758
|
-
var
|
|
2656
|
+
var import_three7, log9, X, Y, Z, FACE_UV_AXES, UVMapper, MinecraftFaceUV;
|
|
2759
2657
|
var init_UVMapper = __esm({
|
|
2760
2658
|
"src/UVMapper.ts"() {
|
|
2761
|
-
|
|
2659
|
+
import_three7 = require("three");
|
|
2762
2660
|
init_CubeFace();
|
|
2763
2661
|
init_ModelTextures();
|
|
2764
2662
|
init_WrappedImage();
|
|
@@ -2770,17 +2668,17 @@ var init_UVMapper = __esm({
|
|
|
2770
2668
|
init_ModelGenerator();
|
|
2771
2669
|
init_log();
|
|
2772
2670
|
init_cubeUv();
|
|
2773
|
-
|
|
2671
|
+
log9 = logger("UVMapper");
|
|
2774
2672
|
X = 0;
|
|
2775
2673
|
Y = 1;
|
|
2776
2674
|
Z = 2;
|
|
2777
2675
|
FACE_UV_AXES = {
|
|
2778
|
-
east: [new
|
|
2779
|
-
west: [new
|
|
2780
|
-
up: [new
|
|
2781
|
-
down: [new
|
|
2782
|
-
south: [new
|
|
2783
|
-
north: [new
|
|
2676
|
+
east: [new import_three7.Vector3(0, 0, -1), new import_three7.Vector3(0, -1, 0)],
|
|
2677
|
+
west: [new import_three7.Vector3(0, 0, 1), new import_three7.Vector3(0, -1, 0)],
|
|
2678
|
+
up: [new import_three7.Vector3(1, 0, 0), new import_three7.Vector3(0, 0, 1)],
|
|
2679
|
+
down: [new import_three7.Vector3(1, 0, 0), new import_three7.Vector3(0, 0, -1)],
|
|
2680
|
+
south: [new import_three7.Vector3(1, 0, 0), new import_three7.Vector3(0, -1, 0)],
|
|
2681
|
+
north: [new import_three7.Vector3(-1, 0, 0), new import_three7.Vector3(0, -1, 0)]
|
|
2784
2682
|
};
|
|
2785
2683
|
UVMapper = class {
|
|
2786
2684
|
static makeUv(uvCoord, originalTextureSize, actualTextureSize) {
|
|
@@ -2847,7 +2745,7 @@ var init_UVMapper = __esm({
|
|
|
2847
2745
|
return facesToUvArray(faces, originalTextureSize, actualTextureSize);
|
|
2848
2746
|
}
|
|
2849
2747
|
static facesToUv(faces, originalTextureSize, actualTextureSize) {
|
|
2850
|
-
return new
|
|
2748
|
+
return new import_three7.Float32BufferAttribute(this.facesToUvArray(faces, originalTextureSize, actualTextureSize), 2);
|
|
2851
2749
|
}
|
|
2852
2750
|
/** Bounds texture sampling to texel centres without changing cropped face UVs. */
|
|
2853
2751
|
static setAtlasUvBounds(geometry, faces, atlas) {
|
|
@@ -2878,7 +2776,7 @@ var init_UVMapper = __esm({
|
|
|
2878
2776
|
bounds.set([minU + insetU, minV + insetV, maxU - insetU, maxV - insetV], (faceIndex * 4 + corner) * 4);
|
|
2879
2777
|
}
|
|
2880
2778
|
}
|
|
2881
|
-
geometry.setAttribute("uvBounds", new
|
|
2779
|
+
geometry.setAttribute("uvBounds", new import_three7.Float32BufferAttribute(bounds, 4));
|
|
2882
2780
|
}
|
|
2883
2781
|
static lockUvs(geometry, faces, atlas, rotation) {
|
|
2884
2782
|
const uv = geometry.getAttribute("uv");
|
|
@@ -2960,32 +2858,32 @@ var init_UVMapper = __esm({
|
|
|
2960
2858
|
v1 *= scaleV;
|
|
2961
2859
|
u2 *= scaleU;
|
|
2962
2860
|
v2 *= scaleV;
|
|
2963
|
-
let tl = new
|
|
2964
|
-
let tr = new
|
|
2965
|
-
let bl = new
|
|
2966
|
-
let br = new
|
|
2861
|
+
let tl = new import_three7.Vector2(u1, v1);
|
|
2862
|
+
let tr = new import_three7.Vector2(u2, v1);
|
|
2863
|
+
let bl = new import_three7.Vector2(u1, v2);
|
|
2864
|
+
let br = new import_three7.Vector2(u2, v2);
|
|
2967
2865
|
switch (rotation) {
|
|
2968
2866
|
case 0:
|
|
2969
2867
|
case 360:
|
|
2970
2868
|
default:
|
|
2971
2869
|
break;
|
|
2972
2870
|
case 90:
|
|
2973
|
-
tl = new
|
|
2974
|
-
tr = new
|
|
2975
|
-
bl = new
|
|
2976
|
-
br = new
|
|
2871
|
+
tl = new import_three7.Vector2(u1, v2);
|
|
2872
|
+
tr = new import_three7.Vector2(u1, v1);
|
|
2873
|
+
bl = new import_three7.Vector2(u2, v2);
|
|
2874
|
+
br = new import_three7.Vector2(u2, v1);
|
|
2977
2875
|
break;
|
|
2978
2876
|
case 180:
|
|
2979
|
-
tl = new
|
|
2980
|
-
tr = new
|
|
2981
|
-
bl = new
|
|
2982
|
-
br = new
|
|
2877
|
+
tl = new import_three7.Vector2(u2, v2);
|
|
2878
|
+
tr = new import_three7.Vector2(u1, v2);
|
|
2879
|
+
bl = new import_three7.Vector2(u2, v1);
|
|
2880
|
+
br = new import_three7.Vector2(u1, v1);
|
|
2983
2881
|
break;
|
|
2984
2882
|
case 270:
|
|
2985
|
-
tl = new
|
|
2986
|
-
tr = new
|
|
2987
|
-
bl = new
|
|
2988
|
-
br = new
|
|
2883
|
+
tl = new import_three7.Vector2(u2, v1);
|
|
2884
|
+
tr = new import_three7.Vector2(u2, v2);
|
|
2885
|
+
bl = new import_three7.Vector2(u1, v1);
|
|
2886
|
+
br = new import_three7.Vector2(u1, v2);
|
|
2989
2887
|
break;
|
|
2990
2888
|
}
|
|
2991
2889
|
return [tl, tr, bl, br];
|
|
@@ -3003,7 +2901,7 @@ var init_UVMapper = __esm({
|
|
|
3003
2901
|
model.elements = originalModel.elements.map((element) => ({ ...element }));
|
|
3004
2902
|
}
|
|
3005
2903
|
const isItemModel = !("elements" in model);
|
|
3006
|
-
|
|
2904
|
+
log9.debug("Creating Atlas for", model.key);
|
|
3007
2905
|
if (model.textures) {
|
|
3008
2906
|
const promises = [];
|
|
3009
2907
|
const uniqueTextureNames = [];
|
|
@@ -3017,7 +2915,7 @@ var init_UVMapper = __esm({
|
|
|
3017
2915
|
const assetKey = AssetKey.parse("textures", textureValue, model.key);
|
|
3018
2916
|
promises.push(ModelTextures.get(assetKey).then((asset2) => {
|
|
3019
2917
|
if (!asset2) {
|
|
3020
|
-
|
|
2918
|
+
log9.warn("Missing texture", assetKey);
|
|
3021
2919
|
return;
|
|
3022
2920
|
}
|
|
3023
2921
|
textureMap[textureKey] = new WrappedImage(asset2);
|
|
@@ -3029,7 +2927,7 @@ var init_UVMapper = __esm({
|
|
|
3029
2927
|
}
|
|
3030
2928
|
await Promise.all(promises);
|
|
3031
2929
|
const textureCount = uniqueTextureNames.length;
|
|
3032
|
-
|
|
2930
|
+
log9.debug("Creating Atlas for", textureCount, "textures");
|
|
3033
2931
|
this.fillMissingTextureKeys(model.textures, textureMap);
|
|
3034
2932
|
this.fillMissingTextureKeys(model.textures, metaMap);
|
|
3035
2933
|
const sizes = {};
|
|
@@ -3060,7 +2958,7 @@ var init_UVMapper = __esm({
|
|
|
3060
2958
|
this.fillMissingTextureKeys(model.textures, sizes);
|
|
3061
2959
|
const s = Math.ceil(Math.sqrt(textureCount + 1));
|
|
3062
2960
|
const size = Math.ceil(s * maxWidth);
|
|
3063
|
-
|
|
2961
|
+
log9.debug("Atlas size:", size);
|
|
3064
2962
|
const squaredSize = size * size;
|
|
3065
2963
|
const image = new CanvasImage(size, size);
|
|
3066
2964
|
const missing = Textures.getMissing().image;
|
|
@@ -3139,7 +3037,7 @@ var init_UVMapper = __esm({
|
|
|
3139
3037
|
}
|
|
3140
3038
|
this.fillMissingTextureKeys(model.textures, positions);
|
|
3141
3039
|
if (isItemModel) {
|
|
3142
|
-
|
|
3040
|
+
log9.debug("Generating item model for", model);
|
|
3143
3041
|
model.elements = [];
|
|
3144
3042
|
for (let layerName of ModelGenerator.ITEM_LAYERS) {
|
|
3145
3043
|
const textureImage = textureMap[layerName];
|
|
@@ -3155,7 +3053,7 @@ var init_UVMapper = __esm({
|
|
|
3155
3053
|
), layerName));
|
|
3156
3054
|
}
|
|
3157
3055
|
}
|
|
3158
|
-
|
|
3056
|
+
log9.debug("Item model elements", model.elements);
|
|
3159
3057
|
}
|
|
3160
3058
|
if (!model.elements) {
|
|
3161
3059
|
}
|
|
@@ -3180,7 +3078,7 @@ var init_UVMapper = __esm({
|
|
|
3180
3078
|
const faceTexture = face.texture.substr(1);
|
|
3181
3079
|
const texPosition = positions[faceTexture] || [0, 0];
|
|
3182
3080
|
const texSize = sizes[faceTexture] || [16, 16];
|
|
3183
|
-
let texPosV = new
|
|
3081
|
+
let texPosV = new import_three7.Vector2(texPosition[0], texPosition[1]);
|
|
3184
3082
|
const [tl, tr, bl, br] = this.expandAndRotateMcUvs(face.uv, face.rotation, texSize[0], texSize[1]);
|
|
3185
3083
|
tl.add(texPosV);
|
|
3186
3084
|
tr.add(texPosV);
|
|
@@ -3212,7 +3110,7 @@ var init_UVMapper = __esm({
|
|
|
3212
3110
|
hasTranslucency
|
|
3213
3111
|
);
|
|
3214
3112
|
} else {
|
|
3215
|
-
|
|
3113
|
+
log9.warn("Model does not have any textures", model);
|
|
3216
3114
|
}
|
|
3217
3115
|
return void 0;
|
|
3218
3116
|
}
|
|
@@ -3537,10 +3435,10 @@ var init_DisplayPosition = __esm({
|
|
|
3537
3435
|
});
|
|
3538
3436
|
|
|
3539
3437
|
// src/model/DisplayTransforms.ts
|
|
3540
|
-
var
|
|
3438
|
+
var import_three8, DisplayTransforms;
|
|
3541
3439
|
var init_DisplayTransforms = __esm({
|
|
3542
3440
|
"src/model/DisplayTransforms.ts"() {
|
|
3543
|
-
|
|
3441
|
+
import_three8 = require("three");
|
|
3544
3442
|
init_DisplayPosition();
|
|
3545
3443
|
init_util();
|
|
3546
3444
|
DisplayTransforms = class {
|
|
@@ -3559,7 +3457,7 @@ var init_DisplayTransforms = __esm({
|
|
|
3559
3457
|
/** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
3560
3458
|
static getMatrix(display, position) {
|
|
3561
3459
|
const transform = this.getTransform(display, position);
|
|
3562
|
-
return new
|
|
3460
|
+
return new import_three8.Matrix4().compose(transform.position, transform.quaternion, transform.scale);
|
|
3563
3461
|
}
|
|
3564
3462
|
/** Position, rotation, and scale of a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
|
|
3565
3463
|
static getTransform(display, position) {
|
|
@@ -3567,10 +3465,10 @@ var init_DisplayTransforms = __esm({
|
|
|
3567
3465
|
const left = position === "firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */ || position === "thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */;
|
|
3568
3466
|
const sign = left ? -1 : 1;
|
|
3569
3467
|
const [x, y, z] = transform.rotation ?? [0, 0, 0];
|
|
3570
|
-
const rotation = new
|
|
3571
|
-
const translation = new
|
|
3468
|
+
const rotation = new import_three8.Quaternion().setFromEuler(new import_three8.Euler(toRadians(x), sign * toRadians(y), sign * toRadians(z), "XYZ"));
|
|
3469
|
+
const translation = new import_three8.Vector3(...transform.translation ?? [0, 0, 0]).clampScalar(-80, 80);
|
|
3572
3470
|
translation.x *= sign;
|
|
3573
|
-
const scale = new
|
|
3471
|
+
const scale = new import_three8.Vector3(...transform.scale ?? [1, 1, 1]).clampScalar(-4, 4);
|
|
3574
3472
|
return { position: translation, quaternion: rotation, scale };
|
|
3575
3473
|
}
|
|
3576
3474
|
/** Transforms geometry in place and reverses triangle winding when the matrix reflects it. */
|
|
@@ -3614,7 +3512,7 @@ var init_ModelMerger = __esm({
|
|
|
3614
3512
|
merged.display = { ...inheritedDisplay, ...DisplayTransforms.withHandFallbacks(source.display) };
|
|
3615
3513
|
}
|
|
3616
3514
|
}
|
|
3617
|
-
merged.hierarchy = models.map((m) => m.parent).filter((
|
|
3515
|
+
merged.hierarchy = models.map((m) => m.parent).filter((p) => `${p}`);
|
|
3618
3516
|
merged.hierarchy.push(`${merged.parent}`);
|
|
3619
3517
|
if (model.components) merged.components = model.components;
|
|
3620
3518
|
return merged;
|
|
@@ -3693,11 +3591,11 @@ var init_BannerPatterns = __esm({
|
|
|
3693
3591
|
static async getLayers(value, target, root) {
|
|
3694
3592
|
if (value === void 0) return [];
|
|
3695
3593
|
if (!Array.isArray(value)) throw new Error("banner_patterns must be an array");
|
|
3696
|
-
const
|
|
3594
|
+
const colors2 = value.length ? await this.getColors(root) : void 0;
|
|
3697
3595
|
return Promise.all(value.slice(0, 16).map(async (layer) => {
|
|
3698
3596
|
if (!layer || typeof layer !== "object" || Array.isArray(layer)) throw new Error("Each banner pattern requires a pattern and dye color");
|
|
3699
|
-
if (typeof layer.color !== "string" || !Object.prototype.hasOwnProperty.call(
|
|
3700
|
-
const color2 =
|
|
3597
|
+
if (typeof layer.color !== "string" || !Object.prototype.hasOwnProperty.call(colors2, layer.color)) throw new Error(`Unsupported dye color ${layer.color}`);
|
|
3598
|
+
const color2 = colors2[layer.color];
|
|
3701
3599
|
let pattern2 = layer.pattern;
|
|
3702
3600
|
if (typeof pattern2 === "string") {
|
|
3703
3601
|
const id = this.identifier(pattern2);
|
|
@@ -3806,49 +3704,49 @@ var init_ItemTints = __esm({
|
|
|
3806
3704
|
const sources = model.tints;
|
|
3807
3705
|
if (!sources?.length) return tints;
|
|
3808
3706
|
const components = model.components ?? {};
|
|
3809
|
-
const
|
|
3707
|
+
const colors2 = { ...tints };
|
|
3810
3708
|
await Promise.all(sources.map(async (source, index) => {
|
|
3811
|
-
if (
|
|
3709
|
+
if (colors2[index] !== void 0) return;
|
|
3812
3710
|
switch (source.type) {
|
|
3813
3711
|
case "constant":
|
|
3814
3712
|
case "minecraft:constant":
|
|
3815
|
-
|
|
3713
|
+
colors2[index] = this.rgb(source.value);
|
|
3816
3714
|
break;
|
|
3817
3715
|
case "grass":
|
|
3818
3716
|
case "minecraft:grass":
|
|
3819
|
-
|
|
3717
|
+
colors2[index] = await Colormaps.grassColor(model.key, source.temperature, source.downfall);
|
|
3820
3718
|
break;
|
|
3821
3719
|
case "dye":
|
|
3822
3720
|
case "minecraft:dye":
|
|
3823
|
-
|
|
3721
|
+
colors2[index] = this.colorOrDefault(components["minecraft:dyed_color"], source.default, true);
|
|
3824
3722
|
break;
|
|
3825
3723
|
case "potion":
|
|
3826
3724
|
case "minecraft:potion": {
|
|
3827
|
-
|
|
3725
|
+
colors2[index] = await this.potionColor(components["minecraft:potion_contents"], source.default, model.key?.root);
|
|
3828
3726
|
break;
|
|
3829
3727
|
}
|
|
3830
3728
|
case "map_color":
|
|
3831
3729
|
case "minecraft:map_color":
|
|
3832
|
-
|
|
3730
|
+
colors2[index] = this.colorOrDefault(components["minecraft:map_color"], source.default);
|
|
3833
3731
|
break;
|
|
3834
3732
|
case "firework":
|
|
3835
3733
|
case "minecraft:firework": {
|
|
3836
3734
|
const values = this.componentField(components, "firework_explosion", "colors");
|
|
3837
3735
|
if (values !== void 0 && !Array.isArray(values)) throw new MineRenderError("Item tint firework_explosion.colors must be an array");
|
|
3838
3736
|
if (!values?.length) {
|
|
3839
|
-
|
|
3737
|
+
colors2[index] = this.rgb(source.default);
|
|
3840
3738
|
break;
|
|
3841
3739
|
}
|
|
3842
3740
|
const rgb = values.map((value) => this.componentColor(value));
|
|
3843
3741
|
const red = Math.floor(rgb.reduce((sum, color2) => sum + (color2 >> 16 & 255), 0) / rgb.length);
|
|
3844
3742
|
const green = Math.floor(rgb.reduce((sum, color2) => sum + (color2 >> 8 & 255), 0) / rgb.length);
|
|
3845
3743
|
const blue = Math.floor(rgb.reduce((sum, color2) => sum + (color2 & 255), 0) / rgb.length);
|
|
3846
|
-
|
|
3744
|
+
colors2[index] = red << 16 | green << 8 | blue;
|
|
3847
3745
|
break;
|
|
3848
3746
|
}
|
|
3849
3747
|
case "team":
|
|
3850
3748
|
case "minecraft:team":
|
|
3851
|
-
|
|
3749
|
+
colors2[index] = this.rgb(source.default);
|
|
3852
3750
|
break;
|
|
3853
3751
|
case "custom_model_data":
|
|
3854
3752
|
case "minecraft:custom_model_data": {
|
|
@@ -3856,14 +3754,14 @@ var init_ItemTints = __esm({
|
|
|
3856
3754
|
if (!Number.isSafeInteger(colorIndex) || colorIndex < 0) throw new MineRenderError("Item tint custom_model_data index must be a nonnegative integer");
|
|
3857
3755
|
const values = this.componentField(components, "custom_model_data", "colors");
|
|
3858
3756
|
if (values !== void 0 && !Array.isArray(values)) throw new MineRenderError("Item tint custom_model_data.colors must be an array");
|
|
3859
|
-
|
|
3757
|
+
colors2[index] = this.colorOrDefault(values?.[colorIndex], source.default, true);
|
|
3860
3758
|
break;
|
|
3861
3759
|
}
|
|
3862
3760
|
default:
|
|
3863
3761
|
throw new MineRenderError(`Unsupported item tint source ${source.type}`);
|
|
3864
3762
|
}
|
|
3865
3763
|
}));
|
|
3866
|
-
return
|
|
3764
|
+
return colors2;
|
|
3867
3765
|
}
|
|
3868
3766
|
/** Whether a potion component contains a known effect, including effects with hidden particles. */
|
|
3869
3767
|
static async hasPotionEffects(value, root) {
|
|
@@ -4435,7 +4333,7 @@ function createPermutation() {
|
|
|
4435
4333
|
return values;
|
|
4436
4334
|
}
|
|
4437
4335
|
function swampGrassColor(x, z) {
|
|
4438
|
-
const
|
|
4336
|
+
const p = permutation ?? (permutation = createPermutation());
|
|
4439
4337
|
x *= 0.0225;
|
|
4440
4338
|
z *= 0.0225;
|
|
4441
4339
|
const s = (x + z) * skew;
|
|
@@ -4446,7 +4344,7 @@ function swampGrassColor(x, z) {
|
|
|
4446
4344
|
const corner = (gx, gz, a, b) => {
|
|
4447
4345
|
let falloff = 0.5 - a * a - b * b;
|
|
4448
4346
|
if (falloff < 0) return 0;
|
|
4449
|
-
const gradient = gradients[
|
|
4347
|
+
const gradient = gradients[p[gx + p[gz & 255] & 255] % 12];
|
|
4450
4348
|
falloff *= falloff;
|
|
4451
4349
|
return falloff * falloff * (gradient[0] * a + gradient[1] * b);
|
|
4452
4350
|
};
|
|
@@ -4524,14 +4422,16 @@ var init_Biomes = __esm({
|
|
|
4524
4422
|
});
|
|
4525
4423
|
|
|
4526
4424
|
// src/assets/BlockEntities.ts
|
|
4527
|
-
var
|
|
4425
|
+
var import_three9, log10, BlockEntities;
|
|
4528
4426
|
var init_BlockEntities = __esm({
|
|
4529
4427
|
"src/assets/BlockEntities.ts"() {
|
|
4530
|
-
|
|
4428
|
+
import_three9 = require("three");
|
|
4531
4429
|
init_AssetKey();
|
|
4532
4430
|
init_AssetLoader();
|
|
4533
4431
|
init_source();
|
|
4534
4432
|
init_Caching();
|
|
4433
|
+
init_log();
|
|
4434
|
+
log10 = logger("BlockEntities");
|
|
4535
4435
|
BlockEntities = class {
|
|
4536
4436
|
/**
|
|
4537
4437
|
* Loads the block index of a version. Versions and sources without one yield an empty index, and so does
|
|
@@ -4545,7 +4445,7 @@ var init_BlockEntities = __esm({
|
|
|
4545
4445
|
try {
|
|
4546
4446
|
return await AssetLoader.get(key, "json" /* JSON */) ?? {};
|
|
4547
4447
|
} catch (error) {
|
|
4548
|
-
|
|
4448
|
+
log10.warn("Could not load the block entity index; block entities are drawn as plain block models", error);
|
|
4549
4449
|
return {};
|
|
4550
4450
|
}
|
|
4551
4451
|
});
|
|
@@ -4572,8 +4472,8 @@ var init_BlockEntities = __esm({
|
|
|
4572
4472
|
return { parts, rotation, translation: entry.translation ?? [0, 0, 0] };
|
|
4573
4473
|
}
|
|
4574
4474
|
/** Placement in block space (0..16 per axis), applied on top of the model's own transform. */
|
|
4575
|
-
static matrix(resolved, matrix = new
|
|
4576
|
-
return matrix.makeTranslation(8, 0, 8).multiply(new
|
|
4475
|
+
static matrix(resolved, matrix = new import_three9.Matrix4()) {
|
|
4476
|
+
return matrix.makeTranslation(8, 0, 8).multiply(new import_three9.Matrix4().makeRotationY(resolved.rotation * Math.PI / 180)).multiply(new import_three9.Matrix4().makeTranslation(resolved.translation[0] - 8, resolved.translation[1], resolved.translation[2] - 8));
|
|
4577
4477
|
}
|
|
4578
4478
|
};
|
|
4579
4479
|
}
|
|
@@ -4816,7 +4716,7 @@ async function parseUnihex(key) {
|
|
|
4816
4716
|
}
|
|
4817
4717
|
return { indices, rows, metrics };
|
|
4818
4718
|
} catch (error) {
|
|
4819
|
-
|
|
4719
|
+
log11.warn(`Could not load Unihex file ${key.toNamespacedString()}`, error);
|
|
4820
4720
|
return void 0;
|
|
4821
4721
|
}
|
|
4822
4722
|
}
|
|
@@ -4835,7 +4735,7 @@ async function loadUnihex(provider, fontKey, characters) {
|
|
|
4835
4735
|
return { ...override, from, to };
|
|
4836
4736
|
});
|
|
4837
4737
|
} catch (error) {
|
|
4838
|
-
|
|
4738
|
+
log11.warn(`Could not load Unihex file ${key.toNamespacedString()}`, error);
|
|
4839
4739
|
return glyphs;
|
|
4840
4740
|
}
|
|
4841
4741
|
const file = await Caching.unihexCache.get(key.serialize(), () => parseUnihex(key));
|
|
@@ -4883,7 +4783,7 @@ async function loadUnihex(provider, fontKey, characters) {
|
|
|
4883
4783
|
}
|
|
4884
4784
|
return glyphs;
|
|
4885
4785
|
}
|
|
4886
|
-
var import_zip2, ATLAS_SIZE, GLYPH_HEIGHT, UnihexAtlas, atlases;
|
|
4786
|
+
var import_zip2, log11, ATLAS_SIZE, GLYPH_HEIGHT, UnihexAtlas, atlases;
|
|
4887
4787
|
var init_Unihex = __esm({
|
|
4888
4788
|
"src/assets/_fonts/Unihex.ts"() {
|
|
4889
4789
|
import_zip2 = require("@zip.js/zip.js");
|
|
@@ -4893,6 +4793,8 @@ var init_Unihex = __esm({
|
|
|
4893
4793
|
init_Caching();
|
|
4894
4794
|
init_AssetParsers();
|
|
4895
4795
|
init_CanvasCompat();
|
|
4796
|
+
init_log();
|
|
4797
|
+
log11 = logger("Unihex");
|
|
4896
4798
|
ATLAS_SIZE = 512;
|
|
4897
4799
|
GLYPH_HEIGHT = 16;
|
|
4898
4800
|
UnihexAtlas = class {
|
|
@@ -5057,8 +4959,8 @@ var init_Fonts = __esm({
|
|
|
5057
4959
|
});
|
|
5058
4960
|
|
|
5059
4961
|
// src/entity/EntityAnimation.ts
|
|
5060
|
-
function catmullRom(delta, p0, p1,
|
|
5061
|
-
return 0.5 * (2 * p1 + (
|
|
4962
|
+
function catmullRom(delta, p0, p1, p2, p3) {
|
|
4963
|
+
return 0.5 * (2 * p1 + (p2 - p0) * delta + (2 * p0 - 5 * p1 + 4 * p2 - p3) * delta * delta + (3 * p1 - p0 - 3 * p2 + p3) * delta * delta * delta);
|
|
5062
4964
|
}
|
|
5063
4965
|
function sampleEntityKeyframes(keyframes, time) {
|
|
5064
4966
|
if (keyframes.length === 0) return [0, 0, 0];
|
|
@@ -5111,10 +5013,10 @@ function validateAnimationWeights(weights, count) {
|
|
|
5111
5013
|
}
|
|
5112
5014
|
return values;
|
|
5113
5015
|
}
|
|
5114
|
-
var
|
|
5016
|
+
var import_three10, ZERO, EntityAnimationPlayer;
|
|
5115
5017
|
var init_EntityAnimationPlayer = __esm({
|
|
5116
5018
|
"src/entity/scene/EntityAnimationPlayer.ts"() {
|
|
5117
|
-
|
|
5019
|
+
import_three10 = require("three");
|
|
5118
5020
|
init_EntityAnimation();
|
|
5119
5021
|
ZERO = [0, 0, 0];
|
|
5120
5022
|
EntityAnimationPlayer = class {
|
|
@@ -5180,9 +5082,9 @@ var init_EntityAnimationPlayer = __esm({
|
|
|
5180
5082
|
position: object4.position.clone(),
|
|
5181
5083
|
rotation: object4.rotation.clone(),
|
|
5182
5084
|
scale: object4.scale.clone(),
|
|
5183
|
-
basePosition: pose ? new
|
|
5184
|
-
baseRotation: pose ? new
|
|
5185
|
-
baseScale: pose ? new
|
|
5085
|
+
basePosition: pose ? new import_three10.Vector3(...pose.offset) : object4.position.clone(),
|
|
5086
|
+
baseRotation: pose ? new import_three10.Euler(...pose.rotation, "ZYX") : object4.rotation.clone(),
|
|
5087
|
+
baseScale: pose ? new import_three10.Vector3(...pose.scale ?? [1, 1, 1]) : object4.scale.clone()
|
|
5186
5088
|
});
|
|
5187
5089
|
}
|
|
5188
5090
|
}
|
|
@@ -5318,14 +5220,35 @@ var init_InstanceReference = __esm({
|
|
|
5318
5220
|
}
|
|
5319
5221
|
});
|
|
5320
5222
|
|
|
5223
|
+
// src/util/three.ts
|
|
5224
|
+
function isObject3D(obj) {
|
|
5225
|
+
return obj.isObject3D;
|
|
5226
|
+
}
|
|
5227
|
+
function isMesh(obj) {
|
|
5228
|
+
return obj.isMesh;
|
|
5229
|
+
}
|
|
5230
|
+
function isInstancedMesh(obj) {
|
|
5231
|
+
return obj.isInstancedMesh;
|
|
5232
|
+
}
|
|
5233
|
+
function isPerspectiveCamera(obj) {
|
|
5234
|
+
return obj.isPerspectiveCamera;
|
|
5235
|
+
}
|
|
5236
|
+
function isOrthographicCamera(obj) {
|
|
5237
|
+
return obj.isOrthographicCamera;
|
|
5238
|
+
}
|
|
5239
|
+
var init_three = __esm({
|
|
5240
|
+
"src/util/three.ts"() {
|
|
5241
|
+
}
|
|
5242
|
+
});
|
|
5243
|
+
|
|
5321
5244
|
// src/renderer/SceneObject.ts
|
|
5322
5245
|
function isSceneObject(obj) {
|
|
5323
5246
|
return obj.isSceneObject;
|
|
5324
5247
|
}
|
|
5325
|
-
var
|
|
5248
|
+
var import_three11, _SceneObject, SceneObject;
|
|
5326
5249
|
var init_SceneObject = __esm({
|
|
5327
5250
|
"src/renderer/SceneObject.ts"() {
|
|
5328
|
-
|
|
5251
|
+
import_three11 = require("three");
|
|
5329
5252
|
init_Geometries();
|
|
5330
5253
|
init_cubeUv();
|
|
5331
5254
|
init_Axis();
|
|
@@ -5335,9 +5258,7 @@ var init_SceneObject = __esm({
|
|
|
5335
5258
|
init_three();
|
|
5336
5259
|
init_Disposable();
|
|
5337
5260
|
init_merge();
|
|
5338
|
-
|
|
5339
|
-
p7 = prefix("SceneObject");
|
|
5340
|
-
_SceneObject = class _SceneObject extends import_three12.Object3D {
|
|
5261
|
+
_SceneObject = class _SceneObject extends import_three11.Object3D {
|
|
5341
5262
|
constructor(options) {
|
|
5342
5263
|
super();
|
|
5343
5264
|
this.isSceneObject = true;
|
|
@@ -5348,7 +5269,6 @@ var init_SceneObject = __esm({
|
|
|
5348
5269
|
this.freeInstanceIndices = [];
|
|
5349
5270
|
this.hiddenInstanceMatrices = /* @__PURE__ */ new Map();
|
|
5350
5271
|
this.options = (0, import_ts_deepmerge.default)({}, _SceneObject.DEFAULT_OPTIONS, options ?? {});
|
|
5351
|
-
console.log("SceneObject options", this.options);
|
|
5352
5272
|
}
|
|
5353
5273
|
set scene(scene) {
|
|
5354
5274
|
if (!!this._scene) throw new MineRenderError("Scene already set");
|
|
@@ -5377,13 +5297,12 @@ var init_SceneObject = __esm({
|
|
|
5377
5297
|
this.remove(existing);
|
|
5378
5298
|
}
|
|
5379
5299
|
}
|
|
5380
|
-
console.log("add", group, group.name);
|
|
5381
5300
|
this.add(group);
|
|
5382
5301
|
this.notifyDirty();
|
|
5383
5302
|
return group;
|
|
5384
5303
|
}
|
|
5385
5304
|
createGroup(name, x = 0, y = 0, z = 0, offsetAxis, offset = 0) {
|
|
5386
|
-
const obj = new
|
|
5305
|
+
const obj = new import_three11.Object3D();
|
|
5387
5306
|
if (name) {
|
|
5388
5307
|
obj.name = `group:${name}`;
|
|
5389
5308
|
}
|
|
@@ -5417,11 +5336,9 @@ var init_SceneObject = __esm({
|
|
|
5417
5336
|
if (name) {
|
|
5418
5337
|
const existing = parent.getObjectByName(mesh.name);
|
|
5419
5338
|
if (existing) {
|
|
5420
|
-
console.log("remove", existing.name, existing);
|
|
5421
5339
|
parent.remove(existing);
|
|
5422
5340
|
}
|
|
5423
5341
|
}
|
|
5424
|
-
console.log("add", mesh, mesh.name);
|
|
5425
5342
|
parent.add(mesh);
|
|
5426
5343
|
}
|
|
5427
5344
|
createAndAddMesh(name, group, geometry, material, offsetAxis, offset = 0) {
|
|
@@ -5435,7 +5352,7 @@ var init_SceneObject = __esm({
|
|
|
5435
5352
|
return mesh;
|
|
5436
5353
|
}
|
|
5437
5354
|
createMesh(name, geometry, material, offsetAxis, offset = 0) {
|
|
5438
|
-
const mesh = new
|
|
5355
|
+
const mesh = new import_three11.Mesh(geometry, material);
|
|
5439
5356
|
if (name) {
|
|
5440
5357
|
mesh.name = `mesh:${name}`;
|
|
5441
5358
|
}
|
|
@@ -5447,7 +5364,7 @@ var init_SceneObject = __esm({
|
|
|
5447
5364
|
return mesh;
|
|
5448
5365
|
}
|
|
5449
5366
|
createInstancedMesh(name, geometry, material, count) {
|
|
5450
|
-
const mesh = new
|
|
5367
|
+
const mesh = new import_three11.InstancedMesh(geometry, material, count);
|
|
5451
5368
|
mesh.count = 0;
|
|
5452
5369
|
this.instanceMesh = mesh;
|
|
5453
5370
|
this._isInstanced = true;
|
|
@@ -5530,11 +5447,11 @@ var init_SceneObject = __esm({
|
|
|
5530
5447
|
this._instanceCounter = this.instanceReferences.size;
|
|
5531
5448
|
mesh.count = Math.max(mesh.count, index + 1);
|
|
5532
5449
|
if (mesh.instanceColor) {
|
|
5533
|
-
mesh.setColorAt(index, new
|
|
5450
|
+
mesh.setColorAt(index, new import_three11.Color(16777215));
|
|
5534
5451
|
mesh.instanceColor.needsUpdate = true;
|
|
5535
5452
|
}
|
|
5536
5453
|
if (this._scene) this._scene.stats.instanceCount++;
|
|
5537
|
-
this.setMatrixAt(index, new
|
|
5454
|
+
this.setMatrixAt(index, new import_three11.Matrix4());
|
|
5538
5455
|
return reference;
|
|
5539
5456
|
}
|
|
5540
5457
|
/** Returns the live reference for a raycast hit on this object's instance mesh. */
|
|
@@ -5548,7 +5465,7 @@ var init_SceneObject = __esm({
|
|
|
5548
5465
|
if (!this.instanceReferences.has(index)) return;
|
|
5549
5466
|
const mesh = this.instanceMesh;
|
|
5550
5467
|
this.hiddenInstanceMatrices.delete(index);
|
|
5551
|
-
this.setMatrixAt(index, new
|
|
5468
|
+
this.setMatrixAt(index, new import_three11.Matrix4().makeScale(0, 0, 0));
|
|
5552
5469
|
this.instanceReferences.delete(index);
|
|
5553
5470
|
this.freeInstanceIndices.push(index);
|
|
5554
5471
|
this._instanceCounter = this.instanceReferences.size;
|
|
@@ -5561,7 +5478,7 @@ var init_SceneObject = __esm({
|
|
|
5561
5478
|
const grow = (attribute, fill) => {
|
|
5562
5479
|
const array = new Float32Array(capacity * attribute.itemSize).fill(fill);
|
|
5563
5480
|
array.set(attribute.array);
|
|
5564
|
-
return new
|
|
5481
|
+
return new import_three11.InstancedBufferAttribute(array, attribute.itemSize, attribute.normalized, attribute.meshPerAttribute).setUsage(attribute.usage);
|
|
5565
5482
|
};
|
|
5566
5483
|
const matrix = grow(mesh.instanceMatrix, 0);
|
|
5567
5484
|
const color2 = mesh.instanceColor ? grow(mesh.instanceColor, 1) : null;
|
|
@@ -5578,7 +5495,7 @@ var init_SceneObject = __esm({
|
|
|
5578
5495
|
}
|
|
5579
5496
|
//</editor-fold>
|
|
5580
5497
|
//<editor-fold desc="TRANSFORMATION">
|
|
5581
|
-
getMatrixAt(index, matrix = new
|
|
5498
|
+
getMatrixAt(index, matrix = new import_three11.Matrix4()) {
|
|
5582
5499
|
if (!this.instanceReferences.has(index)) throw new MineRenderError("Instance is not active");
|
|
5583
5500
|
const hidden = this.hiddenInstanceMatrices.get(index);
|
|
5584
5501
|
if (hidden) {
|
|
@@ -5594,7 +5511,7 @@ var init_SceneObject = __esm({
|
|
|
5594
5511
|
if (hidden) {
|
|
5595
5512
|
hidden.copy(matrix);
|
|
5596
5513
|
}
|
|
5597
|
-
mesh.setMatrixAt(index, hidden ? new
|
|
5514
|
+
mesh.setMatrixAt(index, hidden ? new import_three11.Matrix4().makeScale(0, 0, 0) : matrix);
|
|
5598
5515
|
mesh.instanceMatrix.needsUpdate = true;
|
|
5599
5516
|
mesh.boundingBox = null;
|
|
5600
5517
|
mesh.boundingSphere = null;
|
|
@@ -5622,16 +5539,16 @@ var init_SceneObject = __esm({
|
|
|
5622
5539
|
}
|
|
5623
5540
|
setPositionRotationScaleAt(index, position, rotation, scale) {
|
|
5624
5541
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
5625
|
-
const oldPosition = new
|
|
5626
|
-
const oldRotation = new
|
|
5627
|
-
const oldScale = new
|
|
5628
|
-
const matrix = new
|
|
5542
|
+
const oldPosition = new import_three11.Vector3();
|
|
5543
|
+
const oldRotation = new import_three11.Quaternion();
|
|
5544
|
+
const oldScale = new import_three11.Vector3();
|
|
5545
|
+
const matrix = new import_three11.Matrix4();
|
|
5629
5546
|
if (!scale || !rotation || !position) {
|
|
5630
5547
|
this.getMatrixAt(index, matrix).decompose(oldPosition, oldRotation, oldScale);
|
|
5631
5548
|
}
|
|
5632
5549
|
matrix.compose(
|
|
5633
5550
|
position ? position : oldPosition,
|
|
5634
|
-
rotation ? new
|
|
5551
|
+
rotation ? new import_three11.Quaternion().setFromEuler(rotation) : oldRotation,
|
|
5635
5552
|
scale ? scale : oldScale
|
|
5636
5553
|
);
|
|
5637
5554
|
this.setMatrixAt(index, matrix);
|
|
@@ -5640,7 +5557,7 @@ var init_SceneObject = __esm({
|
|
|
5640
5557
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
5641
5558
|
this.setPositionRotationScaleAt(index, position);
|
|
5642
5559
|
}
|
|
5643
|
-
getPositionAt(index, vector = new
|
|
5560
|
+
getPositionAt(index, vector = new import_three11.Vector3()) {
|
|
5644
5561
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
5645
5562
|
const matrix = this.getMatrixAt(index);
|
|
5646
5563
|
vector.setFromMatrixPosition(matrix);
|
|
@@ -5650,17 +5567,17 @@ var init_SceneObject = __esm({
|
|
|
5650
5567
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
5651
5568
|
this.setPositionRotationScaleAt(index, void 0, rotation, void 0);
|
|
5652
5569
|
}
|
|
5653
|
-
getRotationAt(index, euler = new
|
|
5570
|
+
getRotationAt(index, euler = new import_three11.Euler()) {
|
|
5654
5571
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
5655
|
-
const rotation = new
|
|
5656
|
-
this.getMatrixAt(index).decompose(new
|
|
5572
|
+
const rotation = new import_three11.Quaternion();
|
|
5573
|
+
this.getMatrixAt(index).decompose(new import_three11.Vector3(), rotation, new import_three11.Vector3());
|
|
5657
5574
|
return euler.setFromQuaternion(rotation);
|
|
5658
5575
|
}
|
|
5659
5576
|
setScaleAt(index, scale) {
|
|
5660
5577
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
5661
5578
|
this.setPositionRotationScaleAt(index, void 0, void 0, scale);
|
|
5662
5579
|
}
|
|
5663
|
-
getScaleAt(index, vector = new
|
|
5580
|
+
getScaleAt(index, vector = new import_three11.Vector3()) {
|
|
5664
5581
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
5665
5582
|
const matrix = this.getMatrixAt(index);
|
|
5666
5583
|
vector.setFromMatrixScale(matrix);
|
|
@@ -5799,6 +5716,87 @@ var init_SceneObject = __esm({
|
|
|
5799
5716
|
}
|
|
5800
5717
|
});
|
|
5801
5718
|
|
|
5719
|
+
// src/util/model.ts
|
|
5720
|
+
function applyElementRotation(rotation, geometry) {
|
|
5721
|
+
const origin = new import_three13.Vector3(rotation.origin[0], rotation.origin[1], rotation.origin[2]);
|
|
5722
|
+
geometry.translate(-origin.x, -origin.y, -origin.z);
|
|
5723
|
+
switch (rotation.axis) {
|
|
5724
|
+
case "x" /* X */:
|
|
5725
|
+
geometry.rotateX(toRadians(rotation.angle));
|
|
5726
|
+
break;
|
|
5727
|
+
case "y" /* Y */:
|
|
5728
|
+
geometry.rotateY(toRadians(rotation.angle));
|
|
5729
|
+
break;
|
|
5730
|
+
case "z" /* Z */:
|
|
5731
|
+
geometry.rotateZ(toRadians(rotation.angle));
|
|
5732
|
+
break;
|
|
5733
|
+
}
|
|
5734
|
+
if (rotation.rescale) {
|
|
5735
|
+
const angle = toRadians(rotation.angle);
|
|
5736
|
+
const s = 1 / Math.max(Math.abs(Math.cos(angle)), Math.abs(Math.sin(angle)));
|
|
5737
|
+
geometry.scale(
|
|
5738
|
+
rotation.axis === "x" /* X */ ? 1 : s,
|
|
5739
|
+
rotation.axis === "y" /* Y */ ? 1 : s,
|
|
5740
|
+
rotation.axis === "z" /* Z */ ? 1 : s
|
|
5741
|
+
);
|
|
5742
|
+
}
|
|
5743
|
+
geometry.translate(origin.x, origin.y, origin.z);
|
|
5744
|
+
}
|
|
5745
|
+
function applyGenericRotation(axis, rotation, obj) {
|
|
5746
|
+
switch (axis) {
|
|
5747
|
+
case "x" /* X */:
|
|
5748
|
+
obj.rotateOnAxis(new import_three13.Vector3(1, 0, 0), toRadians(rotation));
|
|
5749
|
+
break;
|
|
5750
|
+
case "y" /* Y */:
|
|
5751
|
+
obj.rotateOnAxis(new import_three13.Vector3(0, 1, 0), toRadians(rotation));
|
|
5752
|
+
break;
|
|
5753
|
+
case "z" /* Z */:
|
|
5754
|
+
obj.rotateOnAxis(new import_three13.Vector3(0, 0, 1), toRadians(rotation));
|
|
5755
|
+
break;
|
|
5756
|
+
}
|
|
5757
|
+
}
|
|
5758
|
+
function addBox3WireframeToObject(box, obj, color2 = 16777215, w = 2) {
|
|
5759
|
+
let size = new import_three13.Vector3();
|
|
5760
|
+
box.getSize(size);
|
|
5761
|
+
let boxGeo = new import_three13.BoxGeometry(size.x, size.y, size.z, 1, 1, 1);
|
|
5762
|
+
let wireGeo = new import_three13.EdgesGeometry(boxGeo);
|
|
5763
|
+
let wireMat = new import_three13.LineBasicMaterial({ color: color2, linewidth: w });
|
|
5764
|
+
let wireframe = new import_three13.LineSegments(wireGeo, wireMat);
|
|
5765
|
+
obj.add(wireframe);
|
|
5766
|
+
let axes = new import_three13.AxesHelper(1);
|
|
5767
|
+
obj.add(axes);
|
|
5768
|
+
}
|
|
5769
|
+
function addWireframeToObject(obj, color2 = 16777215, w = 2) {
|
|
5770
|
+
let boxGeo = new import_three13.BoxGeometry(16, 16, 16, 1, 1, 1);
|
|
5771
|
+
let wireGeo = new import_three13.EdgesGeometry(boxGeo);
|
|
5772
|
+
let wireMat = new import_three13.LineBasicMaterial({ color: color2, linewidth: w });
|
|
5773
|
+
let wireframe = new import_three13.LineSegments(wireGeo, wireMat);
|
|
5774
|
+
obj.add(wireframe);
|
|
5775
|
+
let axes = new import_three13.AxesHelper(1);
|
|
5776
|
+
obj.add(axes);
|
|
5777
|
+
}
|
|
5778
|
+
function addWireframeToMesh(geo, mesh, color2 = 16777215, w = 2) {
|
|
5779
|
+
let wireGeo = new import_three13.EdgesGeometry(geo);
|
|
5780
|
+
let wireMat = new import_three13.LineBasicMaterial({ color: color2, linewidth: w });
|
|
5781
|
+
let wireframe = new import_three13.LineSegments(wireGeo, wireMat);
|
|
5782
|
+
mesh.add(wireframe);
|
|
5783
|
+
let axes = new import_three13.AxesHelper(1);
|
|
5784
|
+
mesh.add(axes);
|
|
5785
|
+
return () => {
|
|
5786
|
+
wireGeo.dispose();
|
|
5787
|
+
wireMat.dispose();
|
|
5788
|
+
axes.dispose();
|
|
5789
|
+
};
|
|
5790
|
+
}
|
|
5791
|
+
var import_three13;
|
|
5792
|
+
var init_model = __esm({
|
|
5793
|
+
"src/util/model.ts"() {
|
|
5794
|
+
init_Axis();
|
|
5795
|
+
init_util();
|
|
5796
|
+
import_three13 = require("three");
|
|
5797
|
+
}
|
|
5798
|
+
});
|
|
5799
|
+
|
|
5802
5800
|
// src/entity/scene/EntityObject.ts
|
|
5803
5801
|
var EntityObject_exports = {};
|
|
5804
5802
|
__export(EntityObject_exports, {
|
|
@@ -8314,7 +8312,7 @@ function createGuiTextGeometry(layout, shadow = true) {
|
|
|
8314
8312
|
}
|
|
8315
8313
|
}
|
|
8316
8314
|
}
|
|
8317
|
-
return batches.map(({ image, positions, uvs, colors, indices }) => ({ image, geometry: new import_three20.BufferGeometry().setAttribute("position", new import_three20.Float32BufferAttribute(positions, 3)).setAttribute("uv", new import_three20.Float32BufferAttribute(uvs, 2)).setAttribute("color", new import_three20.Float32BufferAttribute(
|
|
8315
|
+
return batches.map(({ image, positions, uvs, colors: colors2, indices }) => ({ image, geometry: new import_three20.BufferGeometry().setAttribute("position", new import_three20.Float32BufferAttribute(positions, 3)).setAttribute("uv", new import_three20.Float32BufferAttribute(uvs, 2)).setAttribute("color", new import_three20.Float32BufferAttribute(colors2, 3)).setIndex(indices) }));
|
|
8318
8316
|
}
|
|
8319
8317
|
var import_three20;
|
|
8320
8318
|
var init_GuiText = __esm({
|
|
@@ -8990,11 +8988,13 @@ var init_ModelCulling = __esm({
|
|
|
8990
8988
|
});
|
|
8991
8989
|
|
|
8992
8990
|
// src/skin/Skins.ts
|
|
8993
|
-
var Skins;
|
|
8991
|
+
var log12, Skins;
|
|
8994
8992
|
var init_Skins = __esm({
|
|
8995
8993
|
"src/skin/Skins.ts"() {
|
|
8996
8994
|
init_Requests();
|
|
8997
8995
|
init_Caching();
|
|
8996
|
+
init_log();
|
|
8997
|
+
log12 = logger("Skins");
|
|
8998
8998
|
Skins = class {
|
|
8999
8999
|
//<editor-fold desc="Skins">
|
|
9000
9000
|
/** Returns a skin URL for {@link MineRenderScene.addSkin}, or `undefined` if name lookup fails. */
|
|
@@ -9066,7 +9066,7 @@ var init_Skins = __esm({
|
|
|
9066
9066
|
}
|
|
9067
9067
|
return void 0;
|
|
9068
9068
|
}).catch((err) => {
|
|
9069
|
-
|
|
9069
|
+
log12.warn(err);
|
|
9070
9070
|
return void 0;
|
|
9071
9071
|
});
|
|
9072
9072
|
}
|
|
@@ -9081,7 +9081,7 @@ var init_Skins = __esm({
|
|
|
9081
9081
|
}
|
|
9082
9082
|
return void 0;
|
|
9083
9083
|
}).catch((err) => {
|
|
9084
|
-
|
|
9084
|
+
log12.warn(err);
|
|
9085
9085
|
return void 0;
|
|
9086
9086
|
});
|
|
9087
9087
|
}
|
|
@@ -9095,7 +9095,7 @@ var init_Skins = __esm({
|
|
|
9095
9095
|
}
|
|
9096
9096
|
return void 0;
|
|
9097
9097
|
}).catch((err) => {
|
|
9098
|
-
|
|
9098
|
+
log12.warn(err);
|
|
9099
9099
|
return void 0;
|
|
9100
9100
|
});
|
|
9101
9101
|
}
|
|
@@ -9119,7 +9119,7 @@ var init_Skins = __esm({
|
|
|
9119
9119
|
}
|
|
9120
9120
|
return void 0;
|
|
9121
9121
|
}).catch((err) => {
|
|
9122
|
-
|
|
9122
|
+
log12.warn(err);
|
|
9123
9123
|
return void 0;
|
|
9124
9124
|
});
|
|
9125
9125
|
}
|
|
@@ -9563,10 +9563,10 @@ var init_SpecialItems = __esm({
|
|
|
9563
9563
|
case "minecraft:shield":
|
|
9564
9564
|
case "shield": {
|
|
9565
9565
|
const banner = special.type === "banner" || special.type === "minecraft:banner";
|
|
9566
|
-
const
|
|
9566
|
+
const colors2 = await BannerPatterns.getColors(root);
|
|
9567
9567
|
const dye = banner ? special.color : components["minecraft:base_color"];
|
|
9568
|
-
if (dye !== void 0 && (typeof dye !== "string" || !Object.prototype.hasOwnProperty.call(
|
|
9569
|
-
const color2 = dye === void 0 ? void 0 :
|
|
9568
|
+
if (dye !== void 0 && (typeof dye !== "string" || !Object.prototype.hasOwnProperty.call(colors2, dye))) throw new Error(`Unsupported dye color ${dye}`);
|
|
9569
|
+
const color2 = dye === void 0 ? void 0 : colors2[dye];
|
|
9570
9570
|
const patterns = await BannerPatterns.getLayers(components["minecraft:banner_patterns"], banner ? "banner" : "shield", root);
|
|
9571
9571
|
const patterned = banner || color2 !== void 0 || patterns.length > 0;
|
|
9572
9572
|
const baseTexture = texture(banner ? "banner_base" : patterned ? "shield_base" : "shield_base_nopattern", "");
|
|
@@ -9591,7 +9591,7 @@ var init_SpecialItems = __esm({
|
|
|
9591
9591
|
}
|
|
9592
9592
|
const tints = {};
|
|
9593
9593
|
if (patterned) {
|
|
9594
|
-
const draws = [{ texture: texture(`${banner ? "banner" : "shield"}/base`, ""), color: color2 ??
|
|
9594
|
+
const draws = [{ texture: texture(`${banner ? "banner" : "shield"}/base`, ""), color: color2 ?? colors2.white }, ...patterns];
|
|
9595
9595
|
draws.forEach((draw, index) => {
|
|
9596
9596
|
const name = index === 0 ? "pattern_base" : `pattern_${index - 1}`;
|
|
9597
9597
|
layers[name] = { key: draw.texture, texture: draw.texture, layer: overlay2, render: "no_outline", tint: name };
|
|
@@ -9921,7 +9921,7 @@ __export(ModelObject_exports, {
|
|
|
9921
9921
|
function isModelObject(obj) {
|
|
9922
9922
|
return obj.isModelObject;
|
|
9923
9923
|
}
|
|
9924
|
-
var import_three27,
|
|
9924
|
+
var import_three27, log13, _ModelObject, ModelObject;
|
|
9925
9925
|
var init_ModelObject = __esm({
|
|
9926
9926
|
"src/model/scene/ModelObject.ts"() {
|
|
9927
9927
|
init_SceneObject();
|
|
@@ -9941,7 +9941,7 @@ var init_ModelObject = __esm({
|
|
|
9941
9941
|
init_GuiLight();
|
|
9942
9942
|
init_ItemTints();
|
|
9943
9943
|
init_ItemGlint();
|
|
9944
|
-
|
|
9944
|
+
log13 = logger("ModelObject");
|
|
9945
9945
|
_ModelObject = class _ModelObject extends SceneObject {
|
|
9946
9946
|
constructor(originalModel, options) {
|
|
9947
9947
|
super(options);
|
|
@@ -10092,7 +10092,7 @@ var init_ModelObject = __esm({
|
|
|
10092
10092
|
}
|
|
10093
10093
|
UVMapper.setAtlasUvBounds(elGeo, el.faces, this.atlas);
|
|
10094
10094
|
if (this.options.tints) {
|
|
10095
|
-
const
|
|
10095
|
+
const colors2 = new Float32Array(elGeo.getAttribute("position").count * 3).fill(1);
|
|
10096
10096
|
for (const [faceIndex, faceName] of CUBE_FACES.entries()) {
|
|
10097
10097
|
const tintIndex = el.faces[faceName]?.tintindex;
|
|
10098
10098
|
if (tintIndex === void 0 || tintIndex < 0) continue;
|
|
@@ -10100,10 +10100,10 @@ var init_ModelObject = __esm({
|
|
|
10100
10100
|
if (tint === void 0) continue;
|
|
10101
10101
|
const color2 = new import_three27.Color(tint);
|
|
10102
10102
|
for (let vertex = 0; vertex < 4; vertex++) {
|
|
10103
|
-
color2.toArray(
|
|
10103
|
+
color2.toArray(colors2, (faceIndex * 4 + vertex) * 3);
|
|
10104
10104
|
}
|
|
10105
10105
|
}
|
|
10106
|
-
elGeo.setAttribute("color", new import_three27.BufferAttribute(
|
|
10106
|
+
elGeo.setAttribute("color", new import_three27.BufferAttribute(colors2, 3));
|
|
10107
10107
|
}
|
|
10108
10108
|
elGeo.applyMatrix4(new import_three27.Matrix4().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
|
|
10109
10109
|
elGeo.applyMatrix4(new import_three27.Matrix4().makeTranslation(el.from[0], el.from[1], el.from[2]));
|
|
@@ -10123,10 +10123,10 @@ var init_ModelObject = __esm({
|
|
|
10123
10123
|
}
|
|
10124
10124
|
});
|
|
10125
10125
|
} else {
|
|
10126
|
-
|
|
10126
|
+
log13.debug(this.atlas.model, "has no elements");
|
|
10127
10127
|
}
|
|
10128
10128
|
} else {
|
|
10129
|
-
|
|
10129
|
+
log13.debug("Missing atlas for", this);
|
|
10130
10130
|
}
|
|
10131
10131
|
if (this.options.mergeMeshes) {
|
|
10132
10132
|
let combinedGeo;
|
|
@@ -10900,9 +10900,9 @@ var init_FluidModelObject = __esm({
|
|
|
10900
10900
|
}
|
|
10901
10901
|
geometry.clearGroups();
|
|
10902
10902
|
const color2 = new import_three33.Color(this.options.tints?.[0] ?? (this.kind === "water" ? 4159204 : 16777215));
|
|
10903
|
-
const
|
|
10904
|
-
for (let i = 0; i <
|
|
10905
|
-
geometry.setAttribute("color", new import_three33.BufferAttribute(
|
|
10903
|
+
const colors2 = new Float32Array(geometry.getAttribute("position").count * 3);
|
|
10904
|
+
for (let i = 0; i < colors2.length; i += 3) color2.toArray(colors2, i);
|
|
10905
|
+
geometry.setAttribute("color", new import_three33.BufferAttribute(colors2, 3));
|
|
10906
10906
|
geometry.computeBoundingBox();
|
|
10907
10907
|
geometry.computeBoundingSphere();
|
|
10908
10908
|
if (this.options.instanceMeshes) {
|
|
@@ -10939,7 +10939,7 @@ __export(BlockObject_exports, {
|
|
|
10939
10939
|
function isBlockObject(obj) {
|
|
10940
10940
|
return obj.isBlockObject;
|
|
10941
10941
|
}
|
|
10942
|
-
var import_three34, _BlockObject, BlockObject;
|
|
10942
|
+
var import_three34, log16, _BlockObject, BlockObject;
|
|
10943
10943
|
var init_BlockObject = __esm({
|
|
10944
10944
|
"src/model/block/scene/BlockObject.ts"() {
|
|
10945
10945
|
init_SceneObject();
|
|
@@ -10958,6 +10958,8 @@ var init_BlockObject = __esm({
|
|
|
10958
10958
|
init_BlockEntities();
|
|
10959
10959
|
init_Entities();
|
|
10960
10960
|
init_Biomes();
|
|
10961
|
+
init_log();
|
|
10962
|
+
log16 = logger("BlockObject");
|
|
10961
10963
|
_BlockObject = class _BlockObject extends SceneObject {
|
|
10962
10964
|
constructor(blockState3, options) {
|
|
10963
10965
|
super(options);
|
|
@@ -11062,7 +11064,7 @@ var init_BlockObject = __esm({
|
|
|
11062
11064
|
created.push(await this.scene.addEntity(entity, { wireframe: this.options.wireframe }));
|
|
11063
11065
|
}
|
|
11064
11066
|
} catch (error) {
|
|
11065
|
-
|
|
11067
|
+
log16.warn(`Could not draw block entity ${key.toNamespacedString()}, using its block model`, error);
|
|
11066
11068
|
this.removeEntities(created);
|
|
11067
11069
|
return false;
|
|
11068
11070
|
}
|
|
@@ -11437,6 +11439,7 @@ __export(index_browser_exports, {
|
|
|
11437
11439
|
ItemGlint: () => ItemGlint,
|
|
11438
11440
|
ItemTints: () => ItemTints,
|
|
11439
11441
|
LitematicaParser: () => LitematicaParser,
|
|
11442
|
+
Logging: () => Logging,
|
|
11440
11443
|
MapControls: () => MapControls,
|
|
11441
11444
|
Materials: () => Materials,
|
|
11442
11445
|
Meshes: () => Meshes,
|
|
@@ -11548,6 +11551,7 @@ __export(index_browser_exports, {
|
|
|
11548
11551
|
isTripleArray: () => isTripleArray,
|
|
11549
11552
|
isVector3: () => isVector3,
|
|
11550
11553
|
layoutGuiText: () => layoutGuiText,
|
|
11554
|
+
logger: () => logger,
|
|
11551
11555
|
md5: () => md5,
|
|
11552
11556
|
mergeBufferAttributes: () => mergeBufferAttributes,
|
|
11553
11557
|
mergeBufferGeometries: () => mergeBufferGeometries,
|
|
@@ -11593,7 +11597,7 @@ init_Env();
|
|
|
11593
11597
|
// src/env/browser/BrowserCache.ts
|
|
11594
11598
|
init_PersistentCache();
|
|
11595
11599
|
init_log();
|
|
11596
|
-
var
|
|
11600
|
+
var log = logger("BrowserCache");
|
|
11597
11601
|
var BrowserCache = class extends PersistentCache {
|
|
11598
11602
|
constructor(backing) {
|
|
11599
11603
|
super(backing);
|
|
@@ -11604,7 +11608,7 @@ var BrowserCache = class extends PersistentCache {
|
|
|
11604
11608
|
return true;
|
|
11605
11609
|
} catch (error) {
|
|
11606
11610
|
this.memory = /* @__PURE__ */ new Map();
|
|
11607
|
-
|
|
11611
|
+
log.warn("Could not open browser storage; using an in-memory store", error);
|
|
11608
11612
|
return false;
|
|
11609
11613
|
}
|
|
11610
11614
|
}
|
|
@@ -12013,15 +12017,15 @@ var OBJExporter = class {
|
|
|
12013
12017
|
let nbVertex = 0;
|
|
12014
12018
|
const geometry = points.geometry;
|
|
12015
12019
|
const vertices = geometry.getAttribute("position");
|
|
12016
|
-
const
|
|
12020
|
+
const colors2 = geometry.getAttribute("color");
|
|
12017
12021
|
output += "o " + points.name + "\n";
|
|
12018
12022
|
if (vertices !== void 0) {
|
|
12019
12023
|
for (let i = 0, l = vertices.count; i < l; i++, nbVertex++) {
|
|
12020
12024
|
vertex.fromBufferAttribute(vertices, i);
|
|
12021
12025
|
vertex.applyMatrix4(points.matrixWorld);
|
|
12022
12026
|
output += "v " + vertex.x + " " + vertex.y + " " + vertex.z;
|
|
12023
|
-
if (
|
|
12024
|
-
color2.fromBufferAttribute(
|
|
12027
|
+
if (colors2 !== void 0) {
|
|
12028
|
+
color2.fromBufferAttribute(colors2, i);
|
|
12025
12029
|
import_three16.ColorManagement.workingToColorSpace(color2, import_three16.SRGBColorSpace);
|
|
12026
12030
|
output += " " + color2.r + " " + color2.g + " " + color2.b;
|
|
12027
12031
|
}
|
|
@@ -12105,7 +12109,7 @@ var PLYExporter = class {
|
|
|
12105
12109
|
const vertices = geometry.getAttribute("position");
|
|
12106
12110
|
const normals = geometry.getAttribute("normal");
|
|
12107
12111
|
const uvs = geometry.getAttribute("uv");
|
|
12108
|
-
const
|
|
12112
|
+
const colors2 = geometry.getAttribute("color");
|
|
12109
12113
|
const indices = geometry.getIndex();
|
|
12110
12114
|
if (vertices === void 0) {
|
|
12111
12115
|
return;
|
|
@@ -12121,9 +12125,9 @@ var PLYExporter = class {
|
|
|
12121
12125
|
includeUVs = true;
|
|
12122
12126
|
uvType = getPlyType(uvs.array);
|
|
12123
12127
|
}
|
|
12124
|
-
if (
|
|
12128
|
+
if (colors2 !== void 0) {
|
|
12125
12129
|
includeColors = true;
|
|
12126
|
-
colorType = getPlyType(
|
|
12130
|
+
colorType = getPlyType(colors2.array);
|
|
12127
12131
|
}
|
|
12128
12132
|
for (const name of customAttributeNames) {
|
|
12129
12133
|
const attr = geometry.getAttribute(name);
|
|
@@ -12134,16 +12138,16 @@ var PLYExporter = class {
|
|
|
12134
12138
|
const geometry = mesh.geometry;
|
|
12135
12139
|
const vertices = geometry.getAttribute("position");
|
|
12136
12140
|
const normals = geometry.getAttribute("normal");
|
|
12137
|
-
const
|
|
12141
|
+
const colors2 = geometry.getAttribute("color");
|
|
12138
12142
|
vertexCount += vertices.count;
|
|
12139
12143
|
positionType = getPlyType(vertices.array);
|
|
12140
12144
|
if (normals !== void 0) {
|
|
12141
12145
|
includeNormals = true;
|
|
12142
12146
|
normalType = getPlyType(normals.array);
|
|
12143
12147
|
}
|
|
12144
|
-
if (
|
|
12148
|
+
if (colors2 !== void 0) {
|
|
12145
12149
|
includeColors = true;
|
|
12146
|
-
colorType = getPlyType(
|
|
12150
|
+
colorType = getPlyType(colors2.array);
|
|
12147
12151
|
}
|
|
12148
12152
|
for (const name of customAttributeNames) {
|
|
12149
12153
|
const attr = geometry.getAttribute(name);
|
|
@@ -12233,7 +12237,7 @@ property list uchar int vertex_index
|
|
|
12233
12237
|
const vertices = geometry.getAttribute("position");
|
|
12234
12238
|
const normals = geometry.getAttribute("normal");
|
|
12235
12239
|
const uvs = geometry.getAttribute("uv");
|
|
12236
|
-
const
|
|
12240
|
+
const colors2 = geometry.getAttribute("color");
|
|
12237
12241
|
const indices = geometry.getIndex();
|
|
12238
12242
|
normalMatrixWorld.getNormalMatrix(mesh.matrixWorld);
|
|
12239
12243
|
for (let i = 0, l = vertices.count; i < l; i++) {
|
|
@@ -12278,8 +12282,8 @@ property list uchar int vertex_index
|
|
|
12278
12282
|
}
|
|
12279
12283
|
}
|
|
12280
12284
|
if (includeColors === true) {
|
|
12281
|
-
if (
|
|
12282
|
-
tempColor.fromBufferAttribute(
|
|
12285
|
+
if (colors2 != null) {
|
|
12286
|
+
tempColor.fromBufferAttribute(colors2, i);
|
|
12283
12287
|
import_three17.ColorManagement.workingToColorSpace(tempColor, import_three17.SRGBColorSpace);
|
|
12284
12288
|
const r = colorIsFloat ? tempColor.r : Math.round(tempColor.r * colorScale);
|
|
12285
12289
|
const g = colorIsFloat ? tempColor.g : Math.round(tempColor.g * colorScale);
|
|
@@ -12356,7 +12360,7 @@ property list uchar int vertex_index
|
|
|
12356
12360
|
const vertices = geometry.getAttribute("position");
|
|
12357
12361
|
const normals = geometry.getAttribute("normal");
|
|
12358
12362
|
const uvs = geometry.getAttribute("uv");
|
|
12359
|
-
const
|
|
12363
|
+
const colors2 = geometry.getAttribute("color");
|
|
12360
12364
|
const indices = geometry.getIndex();
|
|
12361
12365
|
normalMatrixWorld.getNormalMatrix(mesh.matrixWorld);
|
|
12362
12366
|
for (let i = 0, l = vertices.count; i < l; i++) {
|
|
@@ -12380,8 +12384,8 @@ property list uchar int vertex_index
|
|
|
12380
12384
|
}
|
|
12381
12385
|
}
|
|
12382
12386
|
if (includeColors === true) {
|
|
12383
|
-
if (
|
|
12384
|
-
tempColor.fromBufferAttribute(
|
|
12387
|
+
if (colors2 != null) {
|
|
12388
|
+
tempColor.fromBufferAttribute(colors2, i);
|
|
12385
12389
|
import_three17.ColorManagement.workingToColorSpace(tempColor, import_three17.SRGBColorSpace);
|
|
12386
12390
|
const r = colorIsFloat ? tempColor.r : Math.round(tempColor.r * colorScale);
|
|
12387
12391
|
const g = colorIsFloat ? tempColor.g : Math.round(tempColor.g * colorScale);
|
|
@@ -12623,11 +12627,11 @@ function createSnapshot(root, gltf, bakeColors = false) {
|
|
|
12623
12627
|
if (instanceColor) tint.multiply(instanceColor);
|
|
12624
12628
|
if (bakeColors) {
|
|
12625
12629
|
const original = geometry.getAttribute("color");
|
|
12626
|
-
const
|
|
12627
|
-
for (let i = 0; i <
|
|
12628
|
-
|
|
12630
|
+
const colors2 = new import_three19.Float32BufferAttribute(new Float32Array(geometry.getAttribute("position").count * 3), 3);
|
|
12631
|
+
for (let i = 0; i < colors2.count; i++) {
|
|
12632
|
+
colors2.setXYZ(i, (original?.getX(i) ?? 1) * tint.r, (original?.getY(i) ?? 1) * tint.g, (original?.getZ(i) ?? 1) * tint.b);
|
|
12629
12633
|
}
|
|
12630
|
-
geometry.setAttribute("color",
|
|
12634
|
+
geometry.setAttribute("color", colors2);
|
|
12631
12635
|
} else if (material.color) {
|
|
12632
12636
|
material.color.copy(tint);
|
|
12633
12637
|
}
|
|
@@ -12676,8 +12680,8 @@ function selectAlphaMode(material, geometry) {
|
|
|
12676
12680
|
const texture = material.map;
|
|
12677
12681
|
if (material.type !== "MeshBasicMaterial" || !material.transparent || !material.depthWrite || material.opacity !== 1 || material.alphaMap || !texture?.isDataTexture || texture.format !== import_three19.RGBAFormat || texture.type !== import_three19.UnsignedByteType || texture.wrapS !== import_three19.ClampToEdgeWrapping || texture.wrapT !== import_three19.ClampToEdgeWrapping || texture.magFilter !== import_three19.NearestFilter || texture.minFilter !== import_three19.NearestFilter || texture.anisotropy > 1 || texture.offset.x !== 0 || texture.offset.y !== 0 || texture.repeat.x !== 1 || texture.repeat.y !== 1 || texture.rotation !== 0 || !texture.matrixAutoUpdate && !texture.matrix.elements.every((value, i) => value === (i % 4 === 0 ? 1 : 0))) return;
|
|
12678
12682
|
const uv = geometry.getAttribute(texture.channel === 0 ? "uv" : `uv${texture.channel}`);
|
|
12679
|
-
const
|
|
12680
|
-
if (!uv || material.vertexColors &&
|
|
12683
|
+
const colors2 = geometry.getAttribute("color");
|
|
12684
|
+
if (!uv || material.vertexColors && colors2?.itemSize === 4) return;
|
|
12681
12685
|
const { data, width, height } = texture.image;
|
|
12682
12686
|
if (!data || width < 1 || height < 1 || data.length < width * height * 4) return;
|
|
12683
12687
|
const count = geometry.index?.count ?? uv.count;
|
|
@@ -13086,7 +13090,7 @@ init_SceneObject();
|
|
|
13086
13090
|
init_util();
|
|
13087
13091
|
init_log();
|
|
13088
13092
|
init_three();
|
|
13089
|
-
var
|
|
13093
|
+
var log14 = logger("SceneInspector");
|
|
13090
13094
|
var help = "<span>Ctrl/Cmd+Click to Select<br/></span><br/>";
|
|
13091
13095
|
var SceneInspector = class {
|
|
13092
13096
|
constructor(renderer) {
|
|
@@ -13180,7 +13184,7 @@ var SceneInspector = class {
|
|
|
13180
13184
|
}
|
|
13181
13185
|
selectObject(targetObject, targetIntersection, instance = this.getIntersectionInstance(targetIntersection)) {
|
|
13182
13186
|
this.selectedObject = targetObject;
|
|
13183
|
-
|
|
13187
|
+
log14.debug("selected", targetObject);
|
|
13184
13188
|
this.redraw(targetObject, targetIntersection, instance);
|
|
13185
13189
|
}
|
|
13186
13190
|
redraw(targetObject, targetIntersection, instance) {
|
|
@@ -13440,7 +13444,7 @@ var SceneStatsDisplay = class {
|
|
|
13440
13444
|
|
|
13441
13445
|
// src/instance/InstanceManager.ts
|
|
13442
13446
|
init_log();
|
|
13443
|
-
var
|
|
13447
|
+
var log15 = logger("InstanceManager");
|
|
13444
13448
|
var InstanceManager = class {
|
|
13445
13449
|
constructor() {
|
|
13446
13450
|
this.isInstanceManager = true;
|
|
@@ -13449,7 +13453,7 @@ var InstanceManager = class {
|
|
|
13449
13453
|
/** Allocates a new placement of a cached model, or returns `undefined` if the key is unknown. */
|
|
13450
13454
|
async get(key) {
|
|
13451
13455
|
if (key in this.instanceCache) {
|
|
13452
|
-
|
|
13456
|
+
log15.debug("key in cache", key);
|
|
13453
13457
|
return (await this.instanceCache[key]).nextInstance();
|
|
13454
13458
|
}
|
|
13455
13459
|
return void 0;
|
|
@@ -13459,7 +13463,7 @@ var InstanceManager = class {
|
|
|
13459
13463
|
if (key in this.instanceCache) {
|
|
13460
13464
|
return await this.get(key);
|
|
13461
13465
|
}
|
|
13462
|
-
|
|
13466
|
+
log15.debug("key not in cache", key);
|
|
13463
13467
|
const pending = Promise.resolve().then(supplier).then((obj) => obj.nextInstance());
|
|
13464
13468
|
this.instanceCache[key] = pending;
|
|
13465
13469
|
try {
|
|
@@ -16061,6 +16065,8 @@ var MapControls = class extends OrbitControls {
|
|
|
16061
16065
|
};
|
|
16062
16066
|
|
|
16063
16067
|
// src/renderer/Renderer.ts
|
|
16068
|
+
init_log();
|
|
16069
|
+
var log17 = logger("Renderer");
|
|
16064
16070
|
var _Renderer = class _Renderer {
|
|
16065
16071
|
constructor(options, surface) {
|
|
16066
16072
|
this._width = 0;
|
|
@@ -16305,10 +16311,10 @@ var _Renderer = class _Renderer {
|
|
|
16305
16311
|
this._element = element;
|
|
16306
16312
|
this._element.appendChild(this.renderer.domElement);
|
|
16307
16313
|
if (this.viewWidth == 0) {
|
|
16308
|
-
|
|
16314
|
+
log17.warn("0 element width");
|
|
16309
16315
|
}
|
|
16310
16316
|
if (this.viewHeight == 0) {
|
|
16311
|
-
|
|
16317
|
+
log17.warn("0 element height");
|
|
16312
16318
|
}
|
|
16313
16319
|
this.resize(this.viewWidth, this.viewHeight);
|
|
16314
16320
|
}
|
|
@@ -17162,8 +17168,62 @@ init_Textures();
|
|
|
17162
17168
|
// src/three/index.ts
|
|
17163
17169
|
init_BufferGeometryUtils();
|
|
17164
17170
|
|
|
17165
|
-
// src/
|
|
17166
|
-
|
|
17171
|
+
// src/util/BatchedExecutor.ts
|
|
17172
|
+
var import_jobqu2 = require("jobqu");
|
|
17173
|
+
var BatchedExecutor = class {
|
|
17174
|
+
/**
|
|
17175
|
+
* @param interval - Delay between queue runs, in milliseconds.
|
|
17176
|
+
* @param batch - Maximum tasks started per run and maximum tasks active at once.
|
|
17177
|
+
*/
|
|
17178
|
+
constructor(interval = 1, batch = 30) {
|
|
17179
|
+
if (!Number.isFinite(interval) || interval < 0) throw new RangeError("Batch interval must be finite and nonnegative");
|
|
17180
|
+
if (!Number.isInteger(batch) || batch < 1) throw new RangeError("Batch size must be a positive integer");
|
|
17181
|
+
this.interval = interval;
|
|
17182
|
+
this.batch = batch;
|
|
17183
|
+
this.queue = new import_jobqu2.JobQueue(async (task) => task(), { interval, maxPerRun: batch, maxActive: batch });
|
|
17184
|
+
}
|
|
17185
|
+
/** Queues a task and resolves with its result, or rejects with its error. */
|
|
17186
|
+
submit(task) {
|
|
17187
|
+
return this.queue.add(() => task());
|
|
17188
|
+
}
|
|
17189
|
+
/** Rejects queued and future tasks. Tasks already running are allowed to finish. */
|
|
17190
|
+
stop() {
|
|
17191
|
+
this.queue.end();
|
|
17192
|
+
}
|
|
17193
|
+
};
|
|
17194
|
+
|
|
17195
|
+
// src/util/index.ts
|
|
17196
|
+
init_log();
|
|
17197
|
+
init_model();
|
|
17198
|
+
|
|
17199
|
+
// src/util/performance.ts
|
|
17200
|
+
function captureException(e, ...extra) {
|
|
17201
|
+
console.error(e, extra);
|
|
17202
|
+
}
|
|
17203
|
+
function timingStart(marker) {
|
|
17204
|
+
console.time(marker);
|
|
17205
|
+
}
|
|
17206
|
+
function timingEnd(marker) {
|
|
17207
|
+
console.timeEnd(marker);
|
|
17208
|
+
}
|
|
17209
|
+
|
|
17210
|
+
// src/util/sha.ts
|
|
17211
|
+
var import_sha1 = __toESM(require("crypto-js/sha1.js"));
|
|
17212
|
+
var import_sha256 = __toESM(require("crypto-js/sha256.js"));
|
|
17213
|
+
var import_sha512 = __toESM(require("crypto-js/sha512.js"));
|
|
17214
|
+
function sha1(str) {
|
|
17215
|
+
return (0, import_sha1.default)(str).toString();
|
|
17216
|
+
}
|
|
17217
|
+
function sha256(str) {
|
|
17218
|
+
return (0, import_sha256.default)(str).toString();
|
|
17219
|
+
}
|
|
17220
|
+
function sha512(str) {
|
|
17221
|
+
return (0, import_sha512.default)(str).toString();
|
|
17222
|
+
}
|
|
17223
|
+
|
|
17224
|
+
// src/util/index.ts
|
|
17225
|
+
init_three();
|
|
17226
|
+
init_util();
|
|
17167
17227
|
|
|
17168
17228
|
// src/world/AnvilParser.ts
|
|
17169
17229
|
init_MineRenderError();
|
|
@@ -18253,6 +18313,8 @@ function hitNormal(hit) {
|
|
|
18253
18313
|
}
|
|
18254
18314
|
|
|
18255
18315
|
// src/world/_entities/WorldEntities.ts
|
|
18316
|
+
init_log();
|
|
18317
|
+
var log18 = logger("WorldEntities");
|
|
18256
18318
|
var WorldEntities = class {
|
|
18257
18319
|
constructor(scene) {
|
|
18258
18320
|
this.scene = scene;
|
|
@@ -18321,7 +18383,7 @@ var WorldEntities = class {
|
|
|
18321
18383
|
placement.owner.set(object4, { type: key.toNamespacedString(), position: placement.position });
|
|
18322
18384
|
this.scene.add(object4);
|
|
18323
18385
|
} catch (error) {
|
|
18324
|
-
|
|
18386
|
+
log18.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error);
|
|
18325
18387
|
} finally {
|
|
18326
18388
|
if (object4 && !placement.owner.has(object4)) object4.dispose();
|
|
18327
18389
|
}
|
|
@@ -18398,14 +18460,14 @@ var BiomeBlend = class {
|
|
|
18398
18460
|
this.tiles.set(key, tile);
|
|
18399
18461
|
} else {
|
|
18400
18462
|
const snapshot = new AssetKey("minecraft", "", void 0, void 0, "assets", ".json", root);
|
|
18401
|
-
const
|
|
18402
|
-
if (!result2.complete && this.tiles.get(key)?.colors ===
|
|
18463
|
+
const colors2 = this.buildTile(kind, snapshot, tileX, quartY, tileZ, this._radius).then((result2) => {
|
|
18464
|
+
if (!result2.complete && this.tiles.get(key)?.colors === colors2) this.tiles.delete(key);
|
|
18403
18465
|
return result2;
|
|
18404
18466
|
}, (error) => {
|
|
18405
|
-
if (this.tiles.get(key)?.colors ===
|
|
18467
|
+
if (this.tiles.get(key)?.colors === colors2) this.tiles.delete(key);
|
|
18406
18468
|
throw error;
|
|
18407
18469
|
});
|
|
18408
|
-
tile = { x: tileX, z: tileZ, colors };
|
|
18470
|
+
tile = { x: tileX, z: tileZ, colors: colors2 };
|
|
18409
18471
|
this.tiles.set(key, tile);
|
|
18410
18472
|
if (this.tiles.size > MAX_TILES) this.tiles.delete(this.tiles.keys().next().value);
|
|
18411
18473
|
}
|
|
@@ -18463,7 +18525,7 @@ var BiomeBlend = class {
|
|
|
18463
18525
|
}
|
|
18464
18526
|
}
|
|
18465
18527
|
}
|
|
18466
|
-
const
|
|
18528
|
+
const colors2 = new Int32Array(256).fill(-1), width = radius * 2 + 1;
|
|
18467
18529
|
for (let z = 0; z < 16; z++) {
|
|
18468
18530
|
for (let x = 0; x < 16; x++) {
|
|
18469
18531
|
if (samples[(z + radius) * size + x + radius] === -1) continue;
|
|
@@ -18471,10 +18533,10 @@ var BiomeBlend = class {
|
|
|
18471
18533
|
const bottomLeft = (z + width) * stride + x, bottomRight = bottomLeft + width;
|
|
18472
18534
|
const sum = (values) => values[bottomRight] - values[bottomLeft] - values[topRight] + values[topLeft];
|
|
18473
18535
|
const count = sum(sums[3]);
|
|
18474
|
-
if (count)
|
|
18536
|
+
if (count) colors2[z * 16 + x] = Math.floor(sum(sums[0]) / count) << 16 | Math.floor(sum(sums[1]) / count) << 8 | Math.floor(sum(sums[2]) / count);
|
|
18475
18537
|
}
|
|
18476
18538
|
}
|
|
18477
|
-
return { colors, complete, failures };
|
|
18539
|
+
return { colors: colors2, complete, failures };
|
|
18478
18540
|
}
|
|
18479
18541
|
};
|
|
18480
18542
|
|
|
@@ -18533,6 +18595,8 @@ function skipsBlockFace(data, rule, block, neighbor, face) {
|
|
|
18533
18595
|
}
|
|
18534
18596
|
|
|
18535
18597
|
// src/world/MineRenderWorld.ts
|
|
18598
|
+
init_log();
|
|
18599
|
+
var log19 = logger("MineRenderWorld");
|
|
18536
18600
|
var MineRenderWorld = class {
|
|
18537
18601
|
constructor(scene, options = {}) {
|
|
18538
18602
|
this._chunks = /* @__PURE__ */ new Map();
|
|
@@ -18888,7 +18952,7 @@ var MineRenderWorld = class {
|
|
|
18888
18952
|
} finally {
|
|
18889
18953
|
this.markBiomesChanged(chunk.x, chunk.z, void 0, false);
|
|
18890
18954
|
const failures = await this.refreshBiomes();
|
|
18891
|
-
if (failures.size)
|
|
18955
|
+
if (failures.size) log19.warn("Failed to refresh biome colors", failures.values().next().value);
|
|
18892
18956
|
await this.updateCulling([...changes.values()]);
|
|
18893
18957
|
}
|
|
18894
18958
|
}
|
|
@@ -18906,7 +18970,7 @@ var MineRenderWorld = class {
|
|
|
18906
18970
|
await this.clearChunkColumn(x, z);
|
|
18907
18971
|
} finally {
|
|
18908
18972
|
const failures = await this.refreshBiomes();
|
|
18909
|
-
if (failures.size)
|
|
18973
|
+
if (failures.size) log19.warn("Failed to refresh biome colors", failures.values().next().value);
|
|
18910
18974
|
await this.updateCulling([]);
|
|
18911
18975
|
}
|
|
18912
18976
|
}
|
|
@@ -19331,7 +19395,7 @@ function buildSectionGeometry(input) {
|
|
|
19331
19395
|
}
|
|
19332
19396
|
}
|
|
19333
19397
|
const positions = new Float32Array(faces * 12), normals = new Float32Array(faces * 12);
|
|
19334
|
-
const uvs = new Float32Array(faces * 8), uvBounds = new Float32Array(faces * 16),
|
|
19398
|
+
const uvs = new Float32Array(faces * 8), uvBounds = new Float32Array(faces * 16), colors2 = new Float32Array(faces * 12);
|
|
19335
19399
|
const shade = new Float32Array(faces * 4).fill(1);
|
|
19336
19400
|
const outputIndices = new Uint32Array(faces * 6);
|
|
19337
19401
|
const blockIndices = new Uint16Array(faces);
|
|
@@ -19370,9 +19434,9 @@ function buildSectionGeometry(input) {
|
|
|
19370
19434
|
uvBounds[vertex * 4 + 2] = mapU(template.uvBounds[source * 4 + 2]);
|
|
19371
19435
|
uvBounds[vertex * 4 + 3] = mapV(template.uvBounds[source * 4 + 3]);
|
|
19372
19436
|
const factor = brightness * (ambientMask ? cornerBrightness2[corner] : 1);
|
|
19373
|
-
|
|
19374
|
-
|
|
19375
|
-
|
|
19437
|
+
colors2[vertex * 3] = (tint === void 0 ? template.colors[source * 3] : biomeTints[tint]) * factor;
|
|
19438
|
+
colors2[vertex * 3 + 1] = (tint === void 0 ? template.colors[source * 3 + 1] : biomeTints[tint + 1]) * factor;
|
|
19439
|
+
colors2[vertex * 3 + 2] = (tint === void 0 ? template.colors[source * 3 + 2] : biomeTints[tint + 2]) * factor;
|
|
19376
19440
|
}
|
|
19377
19441
|
for (let corner = 0; corner < 6; corner++) outputIndices[indexOffset++] = start + template.indices[quad * 6 + corner];
|
|
19378
19442
|
}
|
|
@@ -19407,15 +19471,15 @@ function buildSectionGeometry(input) {
|
|
|
19407
19471
|
mapU((rect[0] + rect[2]) / atlas.width),
|
|
19408
19472
|
mapV(1 - rect[1] / atlas.height)
|
|
19409
19473
|
], vertex * 4);
|
|
19410
|
-
|
|
19411
|
-
|
|
19412
|
-
|
|
19474
|
+
colors2[vertex * 3] = tint[0] * brightness;
|
|
19475
|
+
colors2[vertex * 3 + 1] = tint[1] * brightness;
|
|
19476
|
+
colors2[vertex * 3 + 2] = tint[2] * brightness;
|
|
19413
19477
|
}
|
|
19414
19478
|
outputIndices.set([start, start + 1, start + 2, start, start + 2, start + 3], indexOffset);
|
|
19415
19479
|
indexOffset += 6;
|
|
19416
19480
|
}
|
|
19417
19481
|
}
|
|
19418
|
-
return { layer: page.layer, width: page.width, height: page.height, placements: page.placements, positions, normals, uvs, uvBounds, colors, shade, indices: outputIndices, blockIndices };
|
|
19482
|
+
return { layer: page.layer, width: page.width, height: page.height, placements: page.placements, positions, normals, uvs, uvBounds, colors: colors2, shade, indices: outputIndices, blockIndices };
|
|
19419
19483
|
});
|
|
19420
19484
|
}
|
|
19421
19485
|
function sectionGeometryTransferables(pages) {
|