@adatechnology/game-urban-three 0.3.0 → 0.3.2
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/{chunk-6VTMXFGC.js → chunk-XUITKOBO.js} +15 -10
- package/dist/chunk-XUITKOBO.js.map +1 -0
- package/dist/index.d.ts +18 -12
- package/dist/index.global.js +48 -33
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{testing-BzxRwx1k.d.ts → testing-ZS5dhCJM.d.ts} +7 -6
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-6VTMXFGC.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -37,6 +37,7 @@ var GameUrbanThree = (() => {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
// ../game-contracts/dist/index.js
|
|
40
|
+
var DEFAULT_BLAST_IMPULSE = { bodyArea: 0.7, lift: 0.15, minSpeed: 0.3, tntPerJoule: 0.24 / 2e5 };
|
|
40
41
|
var DEFAULT_COST_ALLOCATION_BYTES = 1024 * 1024;
|
|
41
42
|
var DEFERRED_QUEUE_ID = {
|
|
42
43
|
DESTRUCTION_EVENTS: "destruction.events",
|
|
@@ -162,7 +163,7 @@ var GameUrbanThree = (() => {
|
|
|
162
163
|
}
|
|
163
164
|
var EFFECT_STEP_SECONDS = 1 / 50;
|
|
164
165
|
|
|
165
|
-
// ../game-shapes/dist/chunk-
|
|
166
|
+
// ../game-shapes/dist/chunk-M5N2SHNL.js
|
|
166
167
|
function canonicalJson(value) {
|
|
167
168
|
if (value === null) return "null";
|
|
168
169
|
if (typeof value === "number") return Object.is(value, -0) ? "-0" : Number.isFinite(value) ? String(value) : JSON.stringify(String(value));
|
|
@@ -1409,8 +1410,8 @@ var GameUrbanThree = (() => {
|
|
|
1409
1410
|
groups: []
|
|
1410
1411
|
};
|
|
1411
1412
|
}
|
|
1412
|
-
function make(
|
|
1413
|
-
switch (kind) {
|
|
1413
|
+
function make(p) {
|
|
1414
|
+
switch (p.kind) {
|
|
1414
1415
|
case "box": {
|
|
1415
1416
|
const size = p.size ?? [1, 1, 1];
|
|
1416
1417
|
const segments = p.segments ?? [1, 1, 1];
|
|
@@ -1439,7 +1440,7 @@ var GameUrbanThree = (() => {
|
|
|
1439
1440
|
case "mesh":
|
|
1440
1441
|
return mesh(p);
|
|
1441
1442
|
default:
|
|
1442
|
-
throw new Error(`game-shapes: unknown primitive kind "${String(kind)}"`);
|
|
1443
|
+
throw new Error(`game-shapes: unknown primitive kind "${String(p.kind)}"`);
|
|
1443
1444
|
}
|
|
1444
1445
|
}
|
|
1445
1446
|
var templates = /* @__PURE__ */ new Map();
|
|
@@ -1447,7 +1448,7 @@ var GameUrbanThree = (() => {
|
|
|
1447
1448
|
var stats = { hits: 0, misses: 0 };
|
|
1448
1449
|
function buildPrimitive(node, options = {}) {
|
|
1449
1450
|
const parameters = primitiveParameters(node, options);
|
|
1450
|
-
if (node.kind === "mesh" || templateLimit === 0) return make(node
|
|
1451
|
+
if (node.kind === "mesh" || templateLimit === 0) return make({ ...node, ...parameters });
|
|
1451
1452
|
const key = `${node.kind}:${canonicalJson(parameters)}`;
|
|
1452
1453
|
const cached = templates.get(key);
|
|
1453
1454
|
if (cached) {
|
|
@@ -1457,7 +1458,7 @@ var GameUrbanThree = (() => {
|
|
|
1457
1458
|
return cached;
|
|
1458
1459
|
}
|
|
1459
1460
|
stats.misses++;
|
|
1460
|
-
const built = make(node
|
|
1461
|
+
const built = make({ ...node, ...parameters });
|
|
1461
1462
|
templates.set(key, built);
|
|
1462
1463
|
if (templates.size > templateLimit) templates.delete(templates.keys().next().value);
|
|
1463
1464
|
return built;
|
|
@@ -1816,6 +1817,7 @@ var GameUrbanThree = (() => {
|
|
|
1816
1817
|
canvas.width = o.width;
|
|
1817
1818
|
canvas.height = o.height;
|
|
1818
1819
|
const g = canvas.getContext("2d");
|
|
1820
|
+
if (!g) throw new Error("game-urban-three: the canvas has no 2D context");
|
|
1819
1821
|
g.fillStyle = o.background;
|
|
1820
1822
|
g.fillRect(0, 0, o.width, o.height);
|
|
1821
1823
|
g.fillStyle = o.foreground;
|
|
@@ -2109,7 +2111,9 @@ var GameUrbanThree = (() => {
|
|
|
2109
2111
|
lights,
|
|
2110
2112
|
animate: (t) => animators.forEach((step) => step(t)),
|
|
2111
2113
|
dispose: () => {
|
|
2112
|
-
if (options.lights)
|
|
2114
|
+
if (options.lights) {
|
|
2115
|
+
for (const lamp of lights) if ("source" in lamp) lamp.source.remove();
|
|
2116
|
+
}
|
|
2113
2117
|
root.parent?.remove(root);
|
|
2114
2118
|
for (const item of disposables.splice(0)) item.dispose?.();
|
|
2115
2119
|
for (const geometry of geometries.values()) geometry.dispose();
|
|
@@ -2122,7 +2126,7 @@ var GameUrbanThree = (() => {
|
|
|
2122
2126
|
return { THREE, draw };
|
|
2123
2127
|
}
|
|
2124
2128
|
|
|
2125
|
-
// ../game-vegetation/dist/chunk-
|
|
2129
|
+
// ../game-vegetation/dist/chunk-CJRLKDWB.js
|
|
2126
2130
|
var __defProp2 = Object.defineProperty;
|
|
2127
2131
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2128
2132
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -9328,6 +9332,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
9328
9332
|
var MAX_CANDIDATES = 80;
|
|
9329
9333
|
function carCandidates(slot, item, car) {
|
|
9330
9334
|
const front = [slot.frontU, slot.frontV];
|
|
9335
|
+
if (!slot._cell) throw new Error("Slot without a cell: " + slot.id);
|
|
9331
9336
|
const zone = slot._cell.R;
|
|
9332
9337
|
const alongV = Math.abs(front[1]) === 1;
|
|
9333
9338
|
const [extentU, extentV] = extent([item.w, item.d], front);
|
|
@@ -9547,6 +9552,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
9547
9552
|
}
|
|
9548
9553
|
function itemRect(slot, it, shift) {
|
|
9549
9554
|
const c = slot._cell;
|
|
9555
|
+
if (!c) throw new Error("Slot without a cell: " + slot.id);
|
|
9550
9556
|
const f = c.f;
|
|
9551
9557
|
const [extentU, extentV] = extent([it.w, it.d], f);
|
|
9552
9558
|
const R = c.R;
|
|
@@ -9651,7 +9657,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
9651
9657
|
if (!parent) return null;
|
|
9652
9658
|
for (const { it } of cands) {
|
|
9653
9659
|
if (it.w > parent.w + EPS || it.d > parent.d + EPS) continue;
|
|
9654
|
-
const f = [parent.frontU, parent.frontV];
|
|
9660
|
+
const f = [parent.frontU ?? 0, parent.frontV ?? 1];
|
|
9655
9661
|
const r = parent.aabb;
|
|
9656
9662
|
const [extentU, extentV] = extent([it.w, it.d], f);
|
|
9657
9663
|
const cu = (r[0] + r[2]) / 2 - f[0] * (parent.d / 2 - it.d / 2);
|
|
@@ -9685,7 +9691,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
9685
9691
|
if (!car && !relax && s.clearance > 0 && !it.low) {
|
|
9686
9692
|
cl2 = clearRect(r3, f, s.clearance);
|
|
9687
9693
|
if (!insideUnion(cl2, inners)) continue;
|
|
9688
|
-
if (items.some((m2) => !m2.low && !m2.flat && !m2.on && overlaps(cl2, m2._r))) continue;
|
|
9694
|
+
if (items.some((m2) => !m2.low && !m2.flat && !m2.on && overlaps(cl2, m2._r ?? m2.aabb))) continue;
|
|
9689
9695
|
}
|
|
9690
9696
|
if (!it.low && reserves.some((q) => overlaps(r3, q))) continue;
|
|
9691
9697
|
let rimRect2 = null;
|
|
@@ -9869,7 +9875,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
9869
9875
|
if (!(opts.without && opts.without(r))) return r;
|
|
9870
9876
|
continue;
|
|
9871
9877
|
}
|
|
9872
|
-
if (occupied.some((m) => !m.low && !m.flat && !m.on && !m.decor && m.clearance > 0 && overlaps(r, clearRect(m._r, [m.frontU, m.frontV], m.clearance)))) continue;
|
|
9878
|
+
if (occupied.some((m) => !m.low && !m.flat && !m.on && !m.decor && (m.clearance ?? 0) > 0 && overlaps(r, clearRect(m._r, [m.frontU ?? 0, m.frontV ?? 1], m.clearance ?? 0)))) continue;
|
|
9873
9879
|
if (opts.without && opts.without(r)) continue;
|
|
9874
9880
|
if (!reachable(opts.railing || gridOf(room), solidList.concat([r]), room.outdoor ? 0.16 : plan.playerRadius)) continue;
|
|
9875
9881
|
return r;
|
|
@@ -10130,7 +10136,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
10130
10136
|
const far = m.built / area3;
|
|
10131
10137
|
if (far > zone.maxFar + 1e-9) out.push({ rule: "far", actual: r2(far), limit: zone.maxFar });
|
|
10132
10138
|
let permeable = 0;
|
|
10133
|
-
for (const z of lot.zones) if (registries().PERMEABLE_GROUNDS.has(z.ground)) for (const p of z.parts) permeable += (p[2] - p[0]) * (p[3] - p[1]);
|
|
10139
|
+
for (const z of lot.zones) if (z.ground && registries().PERMEABLE_GROUNDS.has(z.ground)) for (const p of z.parts) permeable += (p[2] - p[0]) * (p[3] - p[1]);
|
|
10134
10140
|
const permeability = permeable / area3;
|
|
10135
10141
|
if (permeability < zone.permeableMin - 1e-9) out.push({ rule: "permeable", actual: r2(permeability), limit: zone.permeableMin });
|
|
10136
10142
|
return out;
|
|
@@ -10173,12 +10179,12 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
10173
10179
|
const [u0, v0, u1, v1] = lot.rect;
|
|
10174
10180
|
const area3 = (u1 - u0) * (v1 - v0);
|
|
10175
10181
|
const areaOfZone = (z) => z.parts.reduce((s, p) => s + (p[2] - p[0]) * (p[3] - p[1]), 0);
|
|
10176
|
-
let permeable = zones.filter((z) => registries().PERMEABLE_GROUNDS.has(z.ground)).reduce((s, z) => s + areaOfZone(z), 0);
|
|
10182
|
+
let permeable = zones.filter((z) => z.ground != null && registries().PERMEABLE_GROUNDS.has(z.ground)).reduce((s, z) => s + areaOfZone(z), 0);
|
|
10177
10183
|
if (permeable / area3 >= zone.permeableMin) return;
|
|
10178
|
-
const candidates = zones.filter((z) => ADJUSTABLE_ZONES.has(z.type) && !registries().PERMEABLE_GROUNDS.has(z.ground)).sort((a, b) => areaOfZone(b) - areaOfZone(a));
|
|
10184
|
+
const candidates = zones.filter((z) => ADJUSTABLE_ZONES.has(z.type) && !(z.ground != null && registries().PERMEABLE_GROUNDS.has(z.ground))).sort((a, b) => areaOfZone(b) - areaOfZone(a));
|
|
10179
10185
|
for (const z of candidates) {
|
|
10180
10186
|
if (permeable / area3 >= zone.permeableMin) break;
|
|
10181
|
-
adjustments.push({ field: "ground:" + z.id, from: z.ground, to: target, reason: "permeable_min" });
|
|
10187
|
+
adjustments.push({ field: "ground:" + z.id, from: z.ground ?? "", to: target, reason: "permeable_min" });
|
|
10182
10188
|
z.ground = target;
|
|
10183
10189
|
permeable += areaOfZone(z);
|
|
10184
10190
|
}
|
|
@@ -10445,9 +10451,9 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
10445
10451
|
height: type === "pedestrian" ? style.height : Math.min(style.height, 2.2),
|
|
10446
10452
|
side,
|
|
10447
10453
|
to: toTarget || null,
|
|
10448
|
-
material: "iron"
|
|
10454
|
+
material: "iron",
|
|
10455
|
+
zones: openingZones(u, v, "u", width, openingDepth(width, type === "pedestrian" ? width : 0))
|
|
10449
10456
|
};
|
|
10450
|
-
g.zones = openingZones(u, v, "u", width, openingDepth(width, type === "pedestrian" ? width : 0));
|
|
10451
10457
|
gates.push(g);
|
|
10452
10458
|
return g;
|
|
10453
10459
|
};
|
|
@@ -10730,7 +10736,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
10730
10736
|
};
|
|
10731
10737
|
const invalid = (m) => Object.assign(base, { valid: false, reason: m, x: 0, z: 0, ry: 0, w: 0, d: 0, frontU: 0, frontV: 1, aabb: [0, 0, 0, 0], _cell: null });
|
|
10732
10738
|
if (def.anchor === "on" || def.anchor === "inside") {
|
|
10733
|
-
const parent = byId2[def.parent];
|
|
10739
|
+
const parent = def.parent ? byId2[def.parent] : void 0;
|
|
10734
10740
|
if (!parent || !parent.valid) return invalid("invalid_parent");
|
|
10735
10741
|
return Object.assign(base, { x: parent.x, z: parent.z, ry: parent.ry, w: parent.w, d: parent.d, frontU: parent.frontU, frontV: parent.frontV, aabb: parent.aabb, _cell: parent._cell });
|
|
10736
10742
|
}
|
|
@@ -10771,9 +10777,10 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
10771
10777
|
const windowList = windowsOfRoom(plan, room);
|
|
10772
10778
|
win = windowList[def.n];
|
|
10773
10779
|
if (!win) return invalid("no_window");
|
|
10780
|
+
const found2 = win;
|
|
10774
10781
|
side = room.outdoor ? SIDE_OPPOSITE[win.side] : WINDOW_SIDE[win.side];
|
|
10775
10782
|
const cand = room.parts.map(inner).find(
|
|
10776
|
-
(r) => (
|
|
10783
|
+
(r) => (found2.axis === "u" ? found2.u >= r[0] - TOL && found2.u <= r[2] + TOL : found2.v >= r[1] - TOL && found2.v <= r[3] + TOL) && (side === "left" && eq(r[0], found2.pos + MARGIN) || side === "right" && eq(r[2], found2.pos - MARGIN) || side === "front" && eq(r[1], found2.pos + MARGIN) || side === "back" && eq(r[3], found2.pos - MARGIN))
|
|
10777
10784
|
);
|
|
10778
10785
|
if (!cand) return invalid("window_outside_room");
|
|
10779
10786
|
R = cand;
|
|
@@ -10965,7 +10972,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
10965
10972
|
if (m.category) out.color = colorOf(m, seed);
|
|
10966
10973
|
return out;
|
|
10967
10974
|
});
|
|
10968
|
-
const
|
|
10975
|
+
const base = {
|
|
10969
10976
|
template: tpl.id,
|
|
10970
10977
|
name: translate("templates", tpl.id, locale),
|
|
10971
10978
|
use: useOf(tpl),
|
|
@@ -11002,8 +11009,8 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
11002
11009
|
building: tpl.building ? tpl.building(plan.w, plan.d, op) : null,
|
|
11003
11010
|
missing
|
|
11004
11011
|
};
|
|
11005
|
-
if (tpl.singleFloor)
|
|
11006
|
-
result.partyWalls
|
|
11012
|
+
if (tpl.singleFloor) base.floorNumber = op.floor || 3;
|
|
11013
|
+
const result = Object.assign(base, { partyWalls: tpl.partyWalls || [] });
|
|
11007
11014
|
if (plan.config) result.config = plan.config;
|
|
11008
11015
|
runResultExtensions(plan, result, seed, op);
|
|
11009
11016
|
if (zone) {
|
|
@@ -17470,7 +17477,9 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
17470
17477
|
function fogLamp(c, s, r) {
|
|
17471
17478
|
onSurf(c.cylinder(r * 1.4, r * 1.4, 0.014, LH, 0, 0, 0), s, 6e-3).castShadow = false;
|
|
17472
17479
|
onSurf(c.cylinder(r, r, 0.012, REFL, 0, 0, 0), s, 0.012).castShadow = false;
|
|
17473
|
-
onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016)
|
|
17480
|
+
const bulb = onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016);
|
|
17481
|
+
bulb.castShadow = false;
|
|
17482
|
+
(c.fogBulbs ?? (c.fogBulbs = [])).push(bulb);
|
|
17474
17483
|
}
|
|
17475
17484
|
function crease(c, I, sd, pts, o) {
|
|
17476
17485
|
o = o || {};
|
|
@@ -20747,6 +20756,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
20747
20756
|
hood: true
|
|
20748
20757
|
},
|
|
20749
20758
|
function(c) {
|
|
20759
|
+
c.meta.armor = "III";
|
|
20750
20760
|
const f = 3.75, W = 2.32, len2 = 1.85, ax = 2.5, wr = 0.506, ww = 0.28, col = "#56616b";
|
|
20751
20761
|
c.meta.bullet = true;
|
|
20752
20762
|
c.meta.cabLength = len2 + 0.15;
|
|
@@ -26471,7 +26481,9 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
26471
26481
|
function fogLamp(c, s, r) {
|
|
26472
26482
|
onSurf(c.cylinder(r * 1.4, r * 1.4, 0.014, LH, 0, 0, 0), s, 6e-3).castShadow = false;
|
|
26473
26483
|
onSurf(c.cylinder(r, r, 0.012, REFL, 0, 0, 0), s, 0.012).castShadow = false;
|
|
26474
|
-
onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016)
|
|
26484
|
+
const bulb = onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016);
|
|
26485
|
+
bulb.castShadow = false;
|
|
26486
|
+
(c.fogBulbs ?? (c.fogBulbs = [])).push(bulb);
|
|
26475
26487
|
}
|
|
26476
26488
|
function crease(c, I, sd, pts, o) {
|
|
26477
26489
|
o = o || {};
|
|
@@ -33680,7 +33692,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
33680
33692
|
const x = kit.profX(s.lower, s.bottomY + 0.14, true) + 0.09;
|
|
33681
33693
|
[1, -1].forEach(function(sd) {
|
|
33682
33694
|
c.roundBox(0.04, r * 2.6, r * 3.2, 0.015, MT.housing, x, y, sd * z);
|
|
33683
|
-
kit.headlight(c, {
|
|
33695
|
+
const lamp = kit.headlight(c, {
|
|
33684
33696
|
style: "round",
|
|
33685
33697
|
x: x + 0.01,
|
|
33686
33698
|
y,
|
|
@@ -33692,6 +33704,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
33692
33704
|
label: sd > 0 ? trl("labels.right_fog_light") : trl("labels.left_fog_light"),
|
|
33693
33705
|
reach: 0.5
|
|
33694
33706
|
});
|
|
33707
|
+
lamp.fog = true;
|
|
33695
33708
|
});
|
|
33696
33709
|
}
|
|
33697
33710
|
function roofBars(c, z, h, r) {
|
|
@@ -40477,6 +40490,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
40477
40490
|
var VIEW_FAR = 600;
|
|
40478
40491
|
var GRID = { block: 36, count: 2, width: 10 };
|
|
40479
40492
|
var LAMP_SHARES = { pattern: void 0, all: 1, half: 0.5, none: 0 };
|
|
40493
|
+
var isMesh = (o) => o.isMesh === true;
|
|
40480
40494
|
function createUrbanTestModule(options = {}) {
|
|
40481
40495
|
const locale = (options.locale ?? "pt-BR").toLowerCase().startsWith("en") ? "en" : "pt-BR";
|
|
40482
40496
|
const text2 = TEXT[locale];
|
|
@@ -40542,7 +40556,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
40542
40556
|
movable: false,
|
|
40543
40557
|
build: (THREE) => {
|
|
40544
40558
|
three = THREE;
|
|
40545
|
-
const made = sample(
|
|
40559
|
+
const made = sample(three, id);
|
|
40546
40560
|
made.root.userData.urbanItem = id;
|
|
40547
40561
|
placed.set(made.root.uuid, made);
|
|
40548
40562
|
return made.root;
|
|
@@ -40643,7 +40657,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
40643
40657
|
}
|
|
40644
40658
|
if (host.bench.layer("light_radius")) {
|
|
40645
40659
|
for (const lamp of entry.drawn.lights) {
|
|
40646
|
-
const light =
|
|
40660
|
+
const light = "bulb" in lamp ? { node: lamp.bulb, distance: lamp.part.distance, color: lamp.part.color } : lamp.isLight ? { node: lamp, distance: lamp.distance, color: lamp.color } : null;
|
|
40647
40661
|
if (!light) continue;
|
|
40648
40662
|
const reach = new three.Mesh(new (shapeGeometries(three)).SphereGeometry(Math.min(light.distance || 10, 60), 14, 8), new three.MeshBasicMaterial({ color: light.color ?? 16764006, wireframe: true, transparent: true, opacity: 0.25 }));
|
|
40649
40663
|
reach.position.copy(light.node.position);
|
|
@@ -40658,7 +40672,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
40658
40672
|
for (const entry of roots()) entry.drawn.animate(clock);
|
|
40659
40673
|
for (const [id, entry] of placed) {
|
|
40660
40674
|
if (entry.root.parent) continue;
|
|
40661
|
-
for (const lamp of entry.drawn.lights) lamp.source
|
|
40675
|
+
for (const lamp of entry.drawn.lights) if ("source" in lamp) lamp.source.remove();
|
|
40662
40676
|
placed.delete(id);
|
|
40663
40677
|
}
|
|
40664
40678
|
if (host?.bench && boxKey() !== helpersShown && (host.bench.layer("light_radius") || host.bench.layer("bounds") || helpersShown !== "")) refreshLayers();
|
|
@@ -40671,15 +40685,16 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
40671
40685
|
for (const entry of roots()) {
|
|
40672
40686
|
entry.root.traverse((o) => {
|
|
40673
40687
|
if (o.isLight) lights += 1;
|
|
40674
|
-
if (!o
|
|
40688
|
+
if (!isMesh(o) || o.userData.helper) return;
|
|
40675
40689
|
for (let p = o; p; p = p.parent) if (p.visible === false) return;
|
|
40676
40690
|
drawCalls += 1;
|
|
40677
|
-
|
|
40691
|
+
const instanced = o.isInstancedMesh === true;
|
|
40692
|
+
if (instanced) instances += o.count;
|
|
40678
40693
|
const g = o.geometry;
|
|
40679
40694
|
const perInstance = (g.index ? g.index.count : g.attributes.position.count) / 3;
|
|
40680
|
-
triangles += perInstance * (
|
|
40695
|
+
triangles += perInstance * (instanced ? o.count : 1);
|
|
40681
40696
|
});
|
|
40682
|
-
lights += entry.drawn.lights.filter((lamp) => lamp
|
|
40697
|
+
lights += entry.drawn.lights.filter((lamp) => "source" in lamp).length;
|
|
40683
40698
|
}
|
|
40684
40699
|
return { drawCalls, triangles: Math.round(triangles), lights, instances };
|
|
40685
40700
|
};
|
|
@@ -40752,7 +40767,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
40752
40767
|
}
|
|
40753
40768
|
resolvers.plant?.dispose?.();
|
|
40754
40769
|
resolvers.vehicle?.dispose?.();
|
|
40755
|
-
for (const entry of placed.values()) for (const lamp of entry.drawn.lights) lamp.source
|
|
40770
|
+
for (const entry of placed.values()) for (const lamp of entry.drawn.lights) if ("source" in lamp) lamp.source.remove();
|
|
40756
40771
|
placed.clear();
|
|
40757
40772
|
host = null;
|
|
40758
40773
|
};
|