@adatechnology/game-urban-three 0.3.16 → 0.4.0

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.
@@ -22,6 +22,7 @@ var GameUrbanThree = (() => {
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
24
  DEFAULT_TEST_TERRAIN: () => DEFAULT_TEST_TERRAIN,
25
+ LAMP_FLICKER: () => LAMP_FLICKER,
25
26
  POLE_TOPS: () => POLE_TOPS,
26
27
  TEXT: () => TEXT,
27
28
  URBAN_AREA_ID: () => URBAN_AREA_ID,
@@ -33,7 +34,11 @@ var GameUrbanThree = (() => {
33
34
  createUrbanTestModule: () => createUrbanTestModule,
34
35
  createUrbanThree: () => createUrbanThree,
35
36
  createVehicleResolver: () => createVehicleResolver,
36
- loadUrbanTestModule: () => loadUrbanTestModule
37
+ flickerGroupOf: () => flickerGroupOf,
38
+ flickerGroupPhase: () => flickerGroupPhase,
39
+ flickerLevel: () => flickerLevel,
40
+ loadUrbanTestModule: () => loadUrbanTestModule,
41
+ physicalIntensityOf: () => physicalIntensityOf
37
42
  });
38
43
 
39
44
  // ../game-contracts/dist/index.js
@@ -42,15 +47,37 @@ var GameUrbanThree = (() => {
42
47
  var DEFERRED_QUEUE_ID = {
43
48
  DESTRUCTION_EVENTS: "destruction.events",
44
49
  BREACH_PAINT: "floorplan.breach-paint",
50
+ BREACH_CUT: "floorplan.breach-cut",
45
51
  AUDIO_VOICES: "audio.voices",
46
- VEHICLE_CREASE: "vehicles.crease"
52
+ VEHICLE_CREASE: "vehicles.crease",
53
+ AUDIO_OCCLUSION: "audio.occlusion",
54
+ FLUID_FILM: "fluids.film",
55
+ VEHICLE_LOD_BATCH: "vehicles.lod-batch",
56
+ SETTLED_BATCH: "destruction.settled-batch",
57
+ STATIC_BATCH: "render.static-batch",
58
+ ANIMALS_STATIC_BATCH: "animals.static-batch",
59
+ CHARACTERS_STATIC_BATCH: "characters.static-batch",
60
+ HOUSE_SHADOW_BATCH: "floorplan.shadow-batch",
61
+ DESTRUCTION_PREFIT: "destruction.prefit"
47
62
  };
48
63
  var DEFERRED_PRIORITY = {
49
64
  [DEFERRED_QUEUE_ID.DESTRUCTION_EVENTS]: { priority: 300, phase: "present" },
50
- [DEFERRED_QUEUE_ID.BREACH_PAINT]: { priority: 250, phase: "present" },
65
+ // every frame: the walls cut since the last frame are painted once each, and a hole must show in the frame of the blast
66
+ [DEFERRED_QUEUE_ID.BREACH_CUT]: { priority: 260, phase: "present", minEveryFrames: 1 },
67
+ [DEFERRED_QUEUE_ID.BREACH_PAINT]: { priority: 250, phase: "present", minEveryFrames: 1 },
51
68
  [DEFERRED_QUEUE_ID.AUDIO_VOICES]: { priority: 200, phase: "idle", reserveMs: 1 },
52
- [DEFERRED_QUEUE_ID.VEHICLE_CREASE]: { priority: 100, phase: "idle" }
69
+ [DEFERRED_QUEUE_ID.AUDIO_OCCLUSION]: { priority: 190, phase: "idle", minEveryFrames: 8 },
70
+ [DEFERRED_QUEUE_ID.FLUID_FILM]: { priority: 120, phase: "idle", minEveryFrames: 2 },
71
+ [DEFERRED_QUEUE_ID.VEHICLE_CREASE]: { priority: 100, phase: "idle" },
72
+ [DEFERRED_QUEUE_ID.VEHICLE_LOD_BATCH]: { priority: 90, phase: "idle", minEveryFrames: 4 },
73
+ [DEFERRED_QUEUE_ID.SETTLED_BATCH]: { priority: 70, phase: "idle", minEveryFrames: 8 },
74
+ [DEFERRED_QUEUE_ID.STATIC_BATCH]: { priority: 60, phase: "idle", minEveryFrames: 8 },
75
+ [DEFERRED_QUEUE_ID.ANIMALS_STATIC_BATCH]: { priority: 60, phase: "idle", minEveryFrames: 8 },
76
+ [DEFERRED_QUEUE_ID.CHARACTERS_STATIC_BATCH]: { priority: 60, phase: "idle", minEveryFrames: 8 },
77
+ [DEFERRED_QUEUE_ID.HOUSE_SHADOW_BATCH]: { priority: 50, phase: "idle", minEveryFrames: 8 },
78
+ [DEFERRED_QUEUE_ID.DESTRUCTION_PREFIT]: { priority: 40, phase: "idle", minEveryFrames: 30 }
53
79
  };
80
+ var MUST_DRAIN_QUEUE_IDS = /* @__PURE__ */ new Set([DEFERRED_QUEUE_ID.DESTRUCTION_EVENTS, DEFERRED_QUEUE_ID.BREACH_CUT]);
54
81
  var WARNED_KEY = /* @__PURE__ */ Symbol.for("@adatechnology/game-contracts.warned");
55
82
  var warnedKeys = () => {
56
83
  const holder = globalThis;
@@ -143,6 +170,22 @@ var GameUrbanThree = (() => {
143
170
  var FOOTSTEP_SOUND_IDS = SURFACE_IDS.flatMap((surface) => GAIT_IDS.map((gait) => footstepSoundId(surface, gait)));
144
171
  var LAND_SOUND_IDS = SURFACE_IDS.flatMap((surface) => LANDING_IDS.map((landing) => `land_${surface}_${landing}`));
145
172
  var BODY_FOLEY_IDS = [...FOOTSTEP_SOUND_IDS, ...LAND_SOUND_IDS, ...BODY_SOUND_IDS];
173
+ var WORKER_KIND_ID = {
174
+ GROUND_TILES: "destruction.ground-tiles",
175
+ CROWD_PHYSICS: "crowd.physics",
176
+ PIECE_BOXES: "destruction.piece-boxes",
177
+ STATIC_COLLIDERS: "destruction.static-colliders",
178
+ SHAPES_GENERATE: "shapes.generate",
179
+ WORLD_REGION: "world.region"
180
+ };
181
+ var WORKER_KIND_DEFAULTS = {
182
+ [WORKER_KIND_ID.GROUND_TILES]: { lane: "sim", priority: 300, latencyFrames: 2, late: "sync" },
183
+ [WORKER_KIND_ID.CROWD_PHYSICS]: { lane: "sim", priority: 250, latencyFrames: 1, late: "sync" },
184
+ [WORKER_KIND_ID.PIECE_BOXES]: { lane: "sim", priority: 200, latencyFrames: 2, late: "sync" },
185
+ [WORKER_KIND_ID.STATIC_COLLIDERS]: { lane: "build", priority: 150, late: "sync" },
186
+ [WORKER_KIND_ID.SHAPES_GENERATE]: { lane: "build", priority: 100, late: "sync" },
187
+ [WORKER_KIND_ID.WORLD_REGION]: { lane: "background", priority: 10, latencyFrames: 10, late: "drop" }
188
+ };
146
189
 
147
190
  // ../game-render-three/dist/index.js
148
191
  var DEFAULT_ANGLE = Math.PI / 3;
@@ -163,7 +206,7 @@ var GameUrbanThree = (() => {
163
206
  }
164
207
  var EFFECT_STEP_SECONDS = 1 / 50;
165
208
 
166
- // ../game-shapes/dist/chunk-FZQTELDQ.js
209
+ // ../game-shapes/dist/chunk-E3X7UDDV.js
167
210
  function canonicalJson(value) {
168
211
  if (value === null) return "null";
169
212
  if (typeof value === "number") return Object.is(value, -0) ? "-0" : Number.isFinite(value) ? String(value) : JSON.stringify(String(value));
@@ -1553,6 +1596,266 @@ var GameUrbanThree = (() => {
1553
1596
  custom: { fields: { generator: str, params: () => null }, required: ["generator"] }
1554
1597
  };
1555
1598
 
1599
+ // ../game-shapes/dist/index.js
1600
+ var ZERO = [0, 0, 0];
1601
+ function normalOf(t) {
1602
+ const ax = t[1][0] - t[0][0], ay = t[1][1] - t[0][1], az = t[1][2] - t[0][2];
1603
+ const bx = t[2][0] - t[0][0], by = t[2][1] - t[0][1], bz = t[2][2] - t[0][2];
1604
+ const nx = ay * bz - az * by, ny = az * bx - ax * bz, nz = ax * by - ay * bx;
1605
+ const length = Math.hypot(nx, ny, nz);
1606
+ return length < 1e-12 ? ZERO : [nx / length, ny / length, nz / length];
1607
+ }
1608
+ function dominantAxis(n) {
1609
+ const x = Math.abs(n[0]), y = Math.abs(n[1]), z = Math.abs(n[2]);
1610
+ if (x >= y && x >= z) return 0;
1611
+ return y >= z ? 1 : 2;
1612
+ }
1613
+ function keptAxes(drop) {
1614
+ if (drop === 0) return [1, 2];
1615
+ return drop === 1 ? [0, 2] : [0, 1];
1616
+ }
1617
+ function projectTriangle(t, drop) {
1618
+ const [u, w] = keptAxes(drop);
1619
+ return [[t[0][u], t[0][w]], [t[1][u], t[1][w]], [t[2][u], t[2][w]]];
1620
+ }
1621
+ function unprojectPoint(p, drop, plane2) {
1622
+ const [u, w] = keptAxes(drop);
1623
+ const out = [0, 0, 0];
1624
+ out[u] = p[0];
1625
+ out[w] = p[1];
1626
+ out[drop] = (plane2.offset - plane2.n[u] * p[0] - plane2.n[w] * p[1]) / plane2.n[drop];
1627
+ return out;
1628
+ }
1629
+ function cross2(a, b, c) {
1630
+ return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
1631
+ }
1632
+ function edgeCrossing(p0, p1, e0, e1) {
1633
+ const dx = p1[0] - p0[0], dy = p1[1] - p0[1], ex = e1[0] - e0[0], ey = e1[1] - e0[1];
1634
+ const d = dx * ey - dy * ex;
1635
+ if (Math.abs(d) < 1e-15) return p1;
1636
+ const t = ((e0[0] - p0[0]) * ey - (e0[1] - p0[1]) * ex) / d;
1637
+ return [p0[0] + t * dx, p0[1] + t * dy];
1638
+ }
1639
+ function clipByEdge(polygon, e0, e1) {
1640
+ const out = [];
1641
+ for (let j = 0; j < polygon.length; j++) {
1642
+ const current = polygon[j], previous = polygon[(j + polygon.length - 1) % polygon.length];
1643
+ const currentIn = cross2(e0, e1, current) >= -1e-12, previousIn = cross2(e0, e1, previous) >= -1e-12;
1644
+ if (currentIn !== previousIn) out.push(edgeCrossing(previous, current, e0, e1));
1645
+ if (currentIn) out.push(current);
1646
+ }
1647
+ return out;
1648
+ }
1649
+ function polygonAreaAndCenter(polygon) {
1650
+ let twice = 0, cx = 0, cy = 0;
1651
+ for (let i = 0; i < polygon.length; i++) {
1652
+ const p = polygon[i], q = polygon[(i + 1) % polygon.length];
1653
+ twice += p[0] * q[1] - q[0] * p[1];
1654
+ cx += p[0];
1655
+ cy += p[1];
1656
+ }
1657
+ return { area: Math.abs(twice) / 2, center: [cx / polygon.length, cy / polygon.length] };
1658
+ }
1659
+ function overlapOfTriangles(a, b) {
1660
+ const clip = cross2(b[0], b[1], b[2]) >= 0 ? b : [b[0], b[2], b[1]];
1661
+ let polygon = [...a];
1662
+ for (let i = 0; i < 3 && polygon.length > 0; i++) polygon = clipByEdge(polygon, clip[i], clip[(i + 1) % 3]);
1663
+ if (polygon.length < 3) return void 0;
1664
+ const overlap = polygonAreaAndCenter(polygon);
1665
+ return overlap.area < 1e-12 ? void 0 : overlap;
1666
+ }
1667
+ var GAME_DEPTH_PRECISION = { viewDistance: 30, near: 0.05, far: 140, depthBits: 24 };
1668
+ function depthResolution(precision = GAME_DEPTH_PRECISION) {
1669
+ const { viewDistance: z, near, far, depthBits } = precision;
1670
+ return z * z * (far - near) / (far * near * 2 ** depthBits);
1671
+ }
1672
+ function boxOf(t) {
1673
+ const xs = [t[0][0], t[1][0], t[2][0]], ys = [t[0][1], t[1][1], t[2][1]], zs = [t[0][2], t[1][2], t[2][2]];
1674
+ return [Math.min(...xs), Math.min(...ys), Math.min(...zs), Math.max(...xs), Math.max(...ys), Math.max(...zs)];
1675
+ }
1676
+ var SAME_COLOUR = 1 / 512;
1677
+ var SAME_UV = 1e-3;
1678
+ var SAME_FACING = 1 - 1e-6;
1679
+ var PARALLEL = Math.cos(2 * Math.PI / 180);
1680
+ var DEFAULT_MAX_PER_PAIR = 3;
1681
+ var kindOf = (label) => label.replace(/\d+(\.\d+)?/g, "#");
1682
+ function facesOf(batches) {
1683
+ const faces = [];
1684
+ batches.forEach((batch, index) => {
1685
+ const label = batch.label ?? `batch ${index}`;
1686
+ const { positions: p, indices } = batch;
1687
+ const count = indices ? indices.length : p.length / 3;
1688
+ const vertex = (i) => [p[i * 3], p[i * 3 + 1], p[i * 3 + 2]];
1689
+ for (let i = 0; i + 2 < count; i += 3) {
1690
+ const corners = indices ? [indices[i], indices[i + 1], indices[i + 2]] : [i, i + 1, i + 2];
1691
+ const triangle = [vertex(corners[0]), vertex(corners[1]), vertex(corners[2])];
1692
+ const n = normalOf(triangle);
1693
+ if (n[0] === 0 && n[1] === 0 && n[2] === 0) continue;
1694
+ const offset = n[0] * triangle[0][0] + n[1] * triangle[0][1] + n[2] * triangle[0][2];
1695
+ faces.push({ triangle, n, offset, label, doubleSided: batch.doubleSided === true, box: boxOf(triangle), batch, batchIndex: index, corners });
1696
+ }
1697
+ });
1698
+ return faces;
1699
+ }
1700
+ function weightsOf(t, n, point) {
1701
+ const area3 = (a, b, c) => {
1702
+ const ux = b[0] - a[0], uy = b[1] - a[1], uz = b[2] - a[2], vx = c[0] - a[0], vy = c[1] - a[1], vz = c[2] - a[2];
1703
+ return n[0] * (uy * vz - uz * vy) + n[1] * (uz * vx - ux * vz) + n[2] * (ux * vy - uy * vx);
1704
+ };
1705
+ const whole = area3(t[0], t[1], t[2]) || 1;
1706
+ return [area3(point, t[1], t[2]) / whole, area3(t[0], point, t[2]) / whole, area3(t[0], t[1], point) / whole];
1707
+ }
1708
+ function attributeAt(values, size, face, point) {
1709
+ const w = weightsOf(face.triangle, face.n, point);
1710
+ return Array.from({ length: size }, (_, k) => w[0] * values[face.corners[0] * size + k] + w[1] * values[face.corners[1] * size + k] + w[2] * values[face.corners[2] * size + k]);
1711
+ }
1712
+ var close = (a, b, tolerance) => a.every((v, k) => Math.abs(v - b[k]) <= tolerance);
1713
+ function drawAlike(a, b, point) {
1714
+ if (a.batch.look === void 0 || a.batch.look !== b.batch.look) return false;
1715
+ if (a.n[0] * b.n[0] + a.n[1] * b.n[1] + a.n[2] * b.n[2] < SAME_FACING) return false;
1716
+ const ca = a.batch.colors, cb = b.batch.colors;
1717
+ if (ca === void 0 !== (cb === void 0)) return false;
1718
+ if (ca && cb && !close(attributeAt(ca, 3, a, point), attributeAt(cb, 3, b, point), SAME_COLOUR)) return false;
1719
+ const ua = a.batch.uvs, ub = b.batch.uvs;
1720
+ if (ua === void 0 !== (ub === void 0)) return false;
1721
+ return !(ua && ub && !close(attributeAt(ua, 2, a, point), attributeAt(ub, 2, b, point), SAME_UV));
1722
+ }
1723
+ function touch(a, b, slack) {
1724
+ return a[1] <= b[4] + slack && b[1] <= a[4] + slack && a[2] <= b[5] + slack && b[2] <= a[5] + slack && a[0] <= b[3] + slack && b[0] <= a[3] + slack;
1725
+ }
1726
+ function nearHit(a, b, eps, minArea) {
1727
+ const facing = a.n[0] * b.n[0] + a.n[1] * b.n[1] + a.n[2] * b.n[2];
1728
+ if (Math.abs(facing) < PARALLEL) return void 0;
1729
+ if (facing < 0 && !(a.doubleSided || b.doubleSided)) return void 0;
1730
+ const drop = dominantAxis(a.n);
1731
+ const overlap = overlapOfTriangles(projectTriangle(a.triangle, drop), projectTriangle(b.triangle, drop));
1732
+ if (!overlap || overlap.area < minArea) return void 0;
1733
+ const point = unprojectPoint(overlap.center, drop, a);
1734
+ const separation = Math.abs(b.n[0] * point[0] + b.n[1] * point[1] + b.n[2] * point[2] - b.offset);
1735
+ if (separation >= eps) return void 0;
1736
+ if (facing > 0 && drawAlike(a, b, point)) return void 0;
1737
+ return { normal: a.n, offset: a.offset, area: overlap.area, point, labelA: a.label, labelB: b.label, batchA: a.batchIndex, batchB: b.batchIndex, kind: facing > 0 ? "coplanar" : "opposed", separation };
1738
+ }
1739
+ var CELL = 2;
1740
+ var LARGE_CELLS = 64;
1741
+ function nearCoincidentFaces(batches, options) {
1742
+ const eps = depthResolution(options.depth);
1743
+ const minArea = options.minArea ?? 1e-4;
1744
+ const maxHits = options.maxHits ?? 200;
1745
+ const maxPerPair = options.maxPerPair ?? DEFAULT_MAX_PER_PAIR;
1746
+ const faces = facesOf(batches);
1747
+ const perPair = /* @__PURE__ */ new Map();
1748
+ const hits = [];
1749
+ const cells = /* @__PURE__ */ new Map();
1750
+ const large = [];
1751
+ const seen = new Int32Array(faces.length).fill(-1);
1752
+ const cellKey = (x, y, z) => ((x + 4096) * 8192 + (y + 4096)) * 8192 + (z + 4096);
1753
+ const range2 = (lo, hi) => [Math.floor((lo - eps) / CELL), Math.floor((hi + eps) / CELL)];
1754
+ const consider = (index, otherIndex) => {
1755
+ const face = faces[index], other = faces[otherIndex];
1756
+ if (Math.abs(face.n[0] * other.n[0] + face.n[1] * other.n[1] + face.n[2] * other.n[2]) < PARALLEL) return false;
1757
+ if (!touch(other.box, face.box, eps)) return false;
1758
+ const hit = nearHit(other, face, eps, minArea);
1759
+ if (!hit) return false;
1760
+ const [first, second] = [kindOf(other.label), kindOf(face.label)].sort();
1761
+ const key = `${first}|${second}|${hit.kind}`;
1762
+ const count = perPair.get(key) ?? 0;
1763
+ if (count >= maxPerPair) return false;
1764
+ perPair.set(key, count + 1);
1765
+ hits.push(hit);
1766
+ return hits.length >= maxHits;
1767
+ };
1768
+ for (let index = 0; index < faces.length; index++) {
1769
+ const face = faces[index];
1770
+ const [x0, x1] = range2(face.box[0], face.box[3]), [y0, y1] = range2(face.box[1], face.box[4]), [z0, z1] = range2(face.box[2], face.box[5]);
1771
+ const span = (x1 - x0 + 1) * (y1 - y0 + 1) * (z1 - z0 + 1);
1772
+ if (span > LARGE_CELLS) {
1773
+ for (let other = 0; other < index; other++) if (consider(index, other)) return hits;
1774
+ large.push(index);
1775
+ continue;
1776
+ }
1777
+ for (const otherIndex of large) if (consider(index, otherIndex)) return hits;
1778
+ for (let x = x0; x <= x1; x++) for (let y = y0; y <= y1; y++) for (let z = z0; z <= z1; z++) {
1779
+ const key = cellKey(x, y, z);
1780
+ const list2 = cells.get(key);
1781
+ if (!list2) {
1782
+ cells.set(key, [index]);
1783
+ continue;
1784
+ }
1785
+ for (const otherIndex of list2) {
1786
+ if (seen[otherIndex] === index) continue;
1787
+ seen[otherIndex] = index;
1788
+ if (consider(index, otherIndex)) return hits;
1789
+ }
1790
+ list2.push(index);
1791
+ }
1792
+ }
1793
+ return hits;
1794
+ }
1795
+ var NORMAL_STEP = 2e-3;
1796
+ function trianglesOf(batch) {
1797
+ const { positions: p, indices } = batch;
1798
+ const vertex = (i) => [p[i * 3], p[i * 3 + 1], p[i * 3 + 2]];
1799
+ const count = indices ? indices.length : p.length / 3;
1800
+ const out = [];
1801
+ for (let i = 0; i + 2 < count; i += 3) {
1802
+ out.push(indices ? [vertex(indices[i]), vertex(indices[i + 1]), vertex(indices[i + 2])] : [vertex(i), vertex(i + 1), vertex(i + 2)]);
1803
+ }
1804
+ return out;
1805
+ }
1806
+ function directionKey(n) {
1807
+ return n.map((c) => Math.round(c / NORMAL_STEP)).join(",");
1808
+ }
1809
+ function boxesTouch(a, b, slack) {
1810
+ return a[0] <= b[3] + slack && b[0] <= a[3] + slack && a[1] <= b[4] + slack && b[1] <= a[4] + slack && a[2] <= b[5] + slack && b[2] <= a[5] + slack;
1811
+ }
1812
+ function bucketFaces(batches, eps) {
1813
+ const buckets = /* @__PURE__ */ new Map();
1814
+ batches.forEach((batch, index) => {
1815
+ const label = batch.label ?? `batch ${index}`;
1816
+ for (const triangle of trianglesOf(batch)) {
1817
+ const n = normalOf(triangle);
1818
+ if (n[0] === 0 && n[1] === 0 && n[2] === 0) continue;
1819
+ const offset = n[0] * triangle[0][0] + n[1] * triangle[0][1] + n[2] * triangle[0][2];
1820
+ const key = `${directionKey(n)}|${Math.floor(offset / eps)}`;
1821
+ const list2 = buckets.get(key) ?? [];
1822
+ list2.push({ triangle, n, offset, label, batch: index, box: boxOf(triangle) });
1823
+ buckets.set(key, list2);
1824
+ }
1825
+ });
1826
+ return buckets;
1827
+ }
1828
+ function overlapHit(a, b, minArea) {
1829
+ const drop = dominantAxis(a.n);
1830
+ const overlap = overlapOfTriangles(projectTriangle(a.triangle, drop), projectTriangle(b.triangle, drop));
1831
+ if (!overlap || overlap.area < minArea) return void 0;
1832
+ const point = unprojectPoint(overlap.center, drop, a);
1833
+ return { normal: a.n, offset: a.offset, area: overlap.area, point, labelA: a.label, labelB: b.label, batchA: a.batch, batchB: b.batch };
1834
+ }
1835
+ function coincidentFaces(batches, options = {}) {
1836
+ if (options.depth) return nearCoincidentFaces(batches, options);
1837
+ const eps = options.eps ?? 1e-3;
1838
+ const minArea = options.minArea ?? 1e-4;
1839
+ const maxHits = options.maxHits ?? 200;
1840
+ const buckets = bucketFaces(batches, eps);
1841
+ const hits = [];
1842
+ for (const [key, faces] of buckets) {
1843
+ const [direction, slot] = key.split("|");
1844
+ const next = buckets.get(`${direction}|${Number(slot) + 1}`) ?? [];
1845
+ for (let i = 0; i < faces.length; i++) {
1846
+ const a = faces[i];
1847
+ for (let j = i + 1; j < faces.length + next.length; j++) {
1848
+ const b = j < faces.length ? faces[j] : next[j - faces.length];
1849
+ if (Math.abs(a.offset - b.offset) > eps || !boxesTouch(a.box, b.box, eps)) continue;
1850
+ const hit = overlapHit(a, b, minArea);
1851
+ if (hit) hits.push(hit);
1852
+ if (hits.length >= maxHits) return hits;
1853
+ }
1854
+ }
1855
+ }
1856
+ return hits;
1857
+ }
1858
+
1556
1859
  // ../game-shapes-three/dist/index.js
1557
1860
  var UV_BEFORE_NORMAL = /* @__PURE__ */ new Set(["LatheGeometry", "ExtrudeGeometry"]);
1558
1861
  var INDEX_FIRST = /* @__PURE__ */ new Set(["BoxGeometry", "CylinderGeometry", "ConeGeometry", "SphereGeometry", "PlaneGeometry", "CircleGeometry", "RingGeometry", "LatheGeometry", "TorusGeometry"]);
@@ -1765,6 +2068,194 @@ var GameUrbanThree = (() => {
1765
2068
  }
1766
2069
  return releaseObject3D(list2, { keep });
1767
2070
  }
2071
+ function isMesh(o) {
2072
+ return !!o && o.isMesh === true;
2073
+ }
2074
+ function isFartherLevel(o) {
2075
+ const lod = o.parent;
2076
+ return !!lod?.isLOD && lod.levels.length > 0 && lod.levels[0].object !== o;
2077
+ }
2078
+ function isDrawn(node, root) {
2079
+ for (let o = node; o; o = o.parent) {
2080
+ if (!o.visible || isFartherLevel(o)) return false;
2081
+ if (o === root) return true;
2082
+ }
2083
+ return true;
2084
+ }
2085
+ function isOffsetDecal(mesh2) {
2086
+ const materials = Array.isArray(mesh2.material) ? mesh2.material : [mesh2.material];
2087
+ return materials.length > 0 && materials.every((m) => m?.polygonOffset === true);
2088
+ }
2089
+ function labelOf(mesh2, root) {
2090
+ const names = [];
2091
+ for (let o = mesh2; o && o !== root; o = o.parent) {
2092
+ const part = o.userData?.destructionPart;
2093
+ const name = o.name || (typeof part === "string" ? part : "");
2094
+ if (name) names.unshift(name);
2095
+ }
2096
+ const material = Array.isArray(mesh2.material) ? mesh2.material[0] : mesh2.material;
2097
+ const path = names.join("/") || mesh2.type;
2098
+ return material?.name ? `${path} [${material.name}]` : path;
2099
+ }
2100
+ function worldPositions(position, matrix) {
2101
+ const e = matrix.elements;
2102
+ const out = new Float64Array(position.count * 3);
2103
+ for (let i = 0; i < position.count; i++) {
2104
+ const x = position.getX(i), y = position.getY(i), z = position.getZ(i);
2105
+ const w = e[3] * x + e[7] * y + e[11] * z + e[15] || 1;
2106
+ out[i * 3] = (e[0] * x + e[4] * y + e[8] * z + e[12]) / w;
2107
+ out[i * 3 + 1] = (e[1] * x + e[5] * y + e[9] * z + e[13]) / w;
2108
+ out[i * 3 + 2] = (e[2] * x + e[6] * y + e[10] * z + e[14]) / w;
2109
+ }
2110
+ return out;
2111
+ }
2112
+ var DOUBLE_SIDE = 2;
2113
+ function isDoubleSided(mesh2) {
2114
+ const materials = Array.isArray(mesh2.material) ? mesh2.material : [mesh2.material];
2115
+ return materials.some((m) => m?.side === DOUBLE_SIDE);
2116
+ }
2117
+ var attributeValues = (attribute, size) => {
2118
+ const out = new Array(attribute.count * size);
2119
+ const read = [(i) => attribute.getX(i), (i) => attribute.getY(i), (i) => attribute.getZ(i)];
2120
+ for (let i = 0; i < attribute.count; i++) for (let k = 0; k < size; k++) out[i * size + k] = read[k](i);
2121
+ return out;
2122
+ };
2123
+ function lookOf(mesh2, geometry) {
2124
+ if (Array.isArray(mesh2.material)) return {};
2125
+ const material = mesh2.material;
2126
+ const color2 = material.vertexColors ? geometry.getAttribute("color") : void 0;
2127
+ const textured = Boolean(material.map || material.normalMap || material.bumpMap || material.alphaMap || material.roughnessMap);
2128
+ const uv = textured ? geometry.getAttribute("uv") : void 0;
2129
+ if (textured && !uv) return {};
2130
+ return { look: material.uuid, ...color2 ? { colors: attributeValues(color2, 3) } : {}, ...uv ? { uvs: attributeValues(uv, 2) } : {} };
2131
+ }
2132
+ function drawnIndices(geometry) {
2133
+ const { start, count } = geometry.drawRange;
2134
+ const index = geometry.index?.array;
2135
+ const total = index ? index.length : geometry.getAttribute("position").count;
2136
+ const end = Math.min(total, start + (Number.isFinite(count) ? count : total));
2137
+ if (index) return start === 0 && end === index.length ? index : Array.from(index).slice(start, end);
2138
+ if (start === 0 && end === total) return void 0;
2139
+ return Array.from({ length: end - start }, (_, i) => start + i);
2140
+ }
2141
+ function batchesOfMesh(mesh2, label) {
2142
+ const doubleSided = isDoubleSided(mesh2);
2143
+ const geometry = mesh2.geometry;
2144
+ const position = geometry?.getAttribute("position");
2145
+ if (!geometry || !position) return [];
2146
+ const indices = drawnIndices(geometry);
2147
+ const instanced = mesh2;
2148
+ const look = lookOf(mesh2, geometry);
2149
+ if (!instanced.isInstancedMesh) return [{ positions: worldPositions(position, mesh2.matrixWorld), ...indices ? { indices } : {}, label, doubleSided, ...look }];
2150
+ const batches = [];
2151
+ const instance = mesh2.matrixWorld.clone();
2152
+ const tint = instanced.instanceColor;
2153
+ for (let i = 0; i < instanced.count; i++) {
2154
+ instanced.getMatrixAt(i, instance);
2155
+ instance.premultiply(mesh2.matrixWorld);
2156
+ const instanceLook = tint && look.look !== void 0 ? { ...look, look: `${look.look}:${tint.getX(i)},${tint.getY(i)},${tint.getZ(i)}` } : look;
2157
+ batches.push({ positions: worldPositions(position, instance), ...indices ? { indices } : {}, label: `${label} #${i}`, doubleSided, ...instanceLook });
2158
+ }
2159
+ return batches;
2160
+ }
2161
+ function meshBatchesOf(root, options = {}) {
2162
+ root.updateMatrixWorld(true);
2163
+ const batches = [];
2164
+ const meshes = [];
2165
+ root.traverse((node) => {
2166
+ if (!isMesh(node) || node.isSprite) return;
2167
+ if (!options.includeHidden && !isDrawn(node, root)) return;
2168
+ if (isOffsetDecal(node)) return;
2169
+ for (const batch of batchesOfMesh(node, labelOf(node, root))) {
2170
+ batches.push(batch);
2171
+ meshes.push(node);
2172
+ }
2173
+ });
2174
+ return { batches, meshes };
2175
+ }
2176
+ function localSize(mesh2, out) {
2177
+ const geometry = mesh2.geometry;
2178
+ if (!geometry.boundingBox) geometry.computeBoundingBox();
2179
+ return geometry.boundingBox.getSize(out);
2180
+ }
2181
+ function volumeOf(mesh2) {
2182
+ const size = localSize(mesh2, mesh2.position.clone());
2183
+ const scale = mesh2.getWorldScale(mesh2.position.clone());
2184
+ return Math.max(Math.abs(size.x * scale.x), 1e-4) * Math.max(Math.abs(size.y * scale.y), 1e-4) * Math.max(Math.abs(size.z * scale.z), 1e-4);
2185
+ }
2186
+ function markSide(mesh2, hit, sides, way) {
2187
+ const inverse = mesh2.getWorldQuaternion(mesh2.quaternion.clone()).invert();
2188
+ const n = mesh2.position.clone().set(hit.normal[0], hit.normal[1], hit.normal[2]).applyQuaternion(inverse);
2189
+ const scale = mesh2.getWorldScale(mesh2.position.clone());
2190
+ const local = [n.x * Math.sign(scale.x || 1), n.y * Math.sign(scale.y || 1), n.z * Math.sign(scale.z || 1)];
2191
+ const axis = local.reduce((best, v, i) => Math.abs(v) > Math.abs(local[best]) ? i : best, 0);
2192
+ sides[axis * 2 + (local[axis] > 0 ? 1 : 0)] = way;
2193
+ }
2194
+ function pushSides(mesh2, sides, gap) {
2195
+ const size = localSize(mesh2, mesh2.position.clone());
2196
+ const world = mesh2.getWorldScale(mesh2.position.clone());
2197
+ const shift = mesh2.position.clone().set(0, 0, 0);
2198
+ const scale = [mesh2.scale.x, mesh2.scale.y, mesh2.scale.z];
2199
+ const extent2 = [size.x, size.y, size.z];
2200
+ const worldScale = [Math.abs(world.x), Math.abs(world.y), Math.abs(world.z)];
2201
+ const centre = mesh2.geometry.boundingBox.getCenter(mesh2.position.clone());
2202
+ const centres = [centre.x, centre.y, centre.z];
2203
+ for (let axis = 0; axis < 3; axis++) {
2204
+ const minus = sides[axis * 2] * gap, plus = sides[axis * 2 + 1] * gap;
2205
+ const s = extent2[axis] * worldScale[axis];
2206
+ if (!minus && !plus || s < 1e-6 || s + minus + plus < s / 2) continue;
2207
+ const oldScale = scale[axis];
2208
+ scale[axis] = oldScale * (s + minus + plus) / s;
2209
+ const parentPerWorld = oldScale / worldScale[axis];
2210
+ const outward = (plus - minus) / 2 * parentPerWorld;
2211
+ const recentre = centres[axis] * (oldScale - scale[axis]);
2212
+ shift.setComponent(axis, outward + recentre);
2213
+ }
2214
+ mesh2.scale.set(scale[0], scale[1], scale[2]);
2215
+ mesh2.position.add(shift.applyQuaternion(mesh2.quaternion));
2216
+ mesh2.updateMatrixWorld(true);
2217
+ }
2218
+ function standOutCoincident(root, options = {}) {
2219
+ const gap = options.gap ?? 2e-3;
2220
+ const grown = /* @__PURE__ */ new Set();
2221
+ const volumes = /* @__PURE__ */ new Map();
2222
+ const volume = (mesh2) => volumes.get(mesh2) ?? volumes.set(mesh2, volumeOf(mesh2)).get(mesh2);
2223
+ let left = 0;
2224
+ for (let round2 = 0; round2 < (options.rounds ?? 3); round2++) {
2225
+ const { batches, meshes } = meshBatchesOf(root);
2226
+ const hits = coincidentFaces(batches, { maxHits: Number.POSITIVE_INFINITY });
2227
+ left = hits.length;
2228
+ if (!left) break;
2229
+ const toPush = /* @__PURE__ */ new Map();
2230
+ for (const hit of hits) {
2231
+ const a = meshes[hit.batchA], b = meshes[hit.batchB];
2232
+ const [smaller, bigger] = volume(a) <= volume(b) ? [a, b] : [b, a];
2233
+ const mesh2 = grown.has(smaller) ? bigger : smaller;
2234
+ if (grown.has(mesh2) || mesh2.isInstancedMesh) continue;
2235
+ const sides = toPush.get(mesh2) ?? [0, 0, 0, 0, 0, 0];
2236
+ markSide(mesh2, hit, sides, 1);
2237
+ toPush.set(mesh2, sides);
2238
+ }
2239
+ for (const [mesh2, sides] of toPush) {
2240
+ pushSides(mesh2, sides, gap);
2241
+ grown.add(mesh2);
2242
+ }
2243
+ }
2244
+ return { grown: grown.size, left };
2245
+ }
2246
+
2247
+ // src/lamp-light.ts
2248
+ var LAMP_FLICKER = { dim: 0.15, fast: 23, slow: 3.1, fastAbove: 0.3, slowAbove: 0.85, groups: 4 };
2249
+ var TURN = 2 * Math.PI;
2250
+ var flickerGroupOf = (phase) => Math.floor((phase % TURN + TURN) % TURN / TURN * LAMP_FLICKER.groups) % LAMP_FLICKER.groups;
2251
+ var flickerGroupPhase = (group) => group / LAMP_FLICKER.groups * TURN;
2252
+ var flickerLevel = (t, phase) => Math.sin(t * LAMP_FLICKER.fast + phase) > LAMP_FLICKER.fastAbove || Math.sin(t * LAMP_FLICKER.slow + phase) > LAMP_FLICKER.slowAbove ? LAMP_FLICKER.dim : 1;
2253
+ function physicalIntensityOf(part, reference = part.y) {
2254
+ const foot = Math.max(reference, 0.5);
2255
+ const legacyFalloff = part.distance > 0 ? Math.max(0, 1 - foot / part.distance) ** part.decay : 1;
2256
+ const window = part.distance > 0 ? Math.max(1e-6, 1 - (foot / part.distance) ** 4) ** 2 : 1;
2257
+ return part.intensity * Math.PI * legacyFalloff * foot ** part.decay / window;
2258
+ }
1768
2259
 
1769
2260
  // src/rounded-box.ts
1770
2261
  function createRoundedBox(THREE, width, height, depth, radius) {
@@ -1846,6 +2337,7 @@ var GameUrbanThree = (() => {
1846
2337
  var DARK_WINDOW = { color: 856599, roughness: 0.3, metalness: 0.5 };
1847
2338
  var SIGN_FONT = '700 56px "Arial Narrow", Arial, sans-serif';
1848
2339
  var SIGN_CANVAS = { width: 512, height: 128 };
2340
+ var PLANE_LAYER_GAP = 2e-3;
1849
2341
  function createUrbanThree(THREE, options = {}) {
1850
2342
  const T = shapeGeometries(THREE);
1851
2343
  const geometries = /* @__PURE__ */ new Map();
@@ -1862,6 +2354,23 @@ var GameUrbanThree = (() => {
1862
2354
  }
1863
2355
  return material;
1864
2356
  };
2357
+ let animatedLenses = /* @__PURE__ */ new Set();
2358
+ const flickeringLens = (color2, phase, animators) => {
2359
+ const group = flickerGroupOf(phase);
2360
+ const key = `f|${color2}|${group}`;
2361
+ let material = materials.get(key);
2362
+ if (!material) {
2363
+ material = new THREE.MeshBasicMaterial({ color: color2 });
2364
+ materials.set(key, material);
2365
+ }
2366
+ if (!animatedLenses.has(key)) {
2367
+ animatedLenses.add(key);
2368
+ const lens = material;
2369
+ const groupPhase = flickerGroupPhase(group);
2370
+ animators.push((t) => lens.color.setHex(color2).multiplyScalar(flickerLevel(t, groupPhase)));
2371
+ }
2372
+ return material;
2373
+ };
1865
2374
  const glowing = (color2) => {
1866
2375
  const key = `b|${color2}`;
1867
2376
  let material = materials.get(key);
@@ -1903,17 +2412,25 @@ var GameUrbanThree = (() => {
1903
2412
  node.quaternion.setFromUnitVectors(forward, new THREE.Vector3(to.x - from.x, to.y - from.y, to.z - from.z).normalize());
1904
2413
  };
1905
2414
  const sourceOf = (part, bulb, extra) => options.lights.addSource({ owner: "urban.light", priority: LIGHT_PRIORITY.street, color: part.color, intensity: part.intensity, distance: part.distance, decay: part.decay, position: [0, 0, 0], follow: bulb, ...extra });
2415
+ const pageFlicker = (t, x) => Math.sin(t * 23 + x) > 0.3 || Math.sin(t * 3.1) > 0.85 ? 0.15 : 1;
2416
+ const groupedPhaseOf = (part) => options.flickerLenses && part.kind === "point" && part.flickerPhase !== void 0 ? flickerGroupPhase(flickerGroupOf(part.flickerPhase)) : void 0;
1906
2417
  const drawBudgetedLight = (part, animators, lights) => {
1907
2418
  const bulb = new THREE.Object3D();
1908
2419
  bulb.position.set(part.x, part.y, part.z);
1909
2420
  if (part.kind === "point") {
1910
- const source2 = sourceOf(part, bulb, {});
2421
+ const intensity2 = options.physicalLights ? physicalIntensityOf(part) : part.intensity;
2422
+ const source2 = sourceOf(part, bulb, { intensity: intensity2 });
1911
2423
  lights.push({ bulb, part, source: source2 });
1912
- if (part.flicker) animators.push((t) => source2.update({ intensity: part.intensity * (Math.sin(t * 23 + part.x) > 0.3 || Math.sin(t * 3.1) > 0.85 ? 0.15 : 1) }));
2424
+ if (part.flicker) {
2425
+ const phase = groupedPhaseOf(part);
2426
+ animators.push((t) => source2.update({ intensity: intensity2 * (phase === void 0 ? pageFlicker(t, part.x) : flickerLevel(t, phase)) }));
2427
+ }
1913
2428
  return [bulb];
1914
2429
  }
1915
2430
  aimAt(bulb, part, part.target);
1916
- const source = sourceOf(part, bulb, { kind: "spot", angle: part.angle, penumbra: part.penumbra });
2431
+ const beam = Math.hypot(part.target.x - part.x, part.target.y - part.y, part.target.z - part.z);
2432
+ const intensity = options.physicalLights ? physicalIntensityOf(part, beam) : part.intensity;
2433
+ const source = sourceOf(part, bulb, { kind: "spot", angle: part.angle, penumbra: part.penumbra, intensity });
1917
2434
  lights.push({ bulb, part, source });
1918
2435
  const { sweep } = part;
1919
2436
  if (sweep) animators.push((t) => aimAt(bulb, part, { x: part.x + Math.sin(t * sweep.speed + part.x) * sweep.radius, y: 0, z: part.z + Math.cos(t * sweep.speed + part.x) * sweep.radius }));
@@ -1928,7 +2445,8 @@ var GameUrbanThree = (() => {
1928
2445
  return [group];
1929
2446
  }
1930
2447
  case "box": {
1931
- const mesh2 = new THREE.Mesh(roundedBox(part.width, part.height, part.depth, part.radius), part.emissive ? glowing(part.color) : standard(part.color, part.style));
2448
+ const lens = options.flickerLenses && part.emissive && part.flickerPhase !== void 0 ? flickeringLens(part.color, part.flickerPhase, animators) : void 0;
2449
+ const mesh2 = new THREE.Mesh(roundedBox(part.width, part.height, part.depth, part.radius), lens ?? (part.emissive ? glowing(part.color) : standard(part.color, part.style)));
1932
2450
  mesh2.position.set(part.x, part.y, part.z);
1933
2451
  if (part.ry) mesh2.rotation.y = part.ry;
1934
2452
  if (part.rz) mesh2.rotation.z = part.rz;
@@ -2038,8 +2556,9 @@ var GameUrbanThree = (() => {
2038
2556
  light2.position.set(part.x, part.y, part.z);
2039
2557
  lights.push(light2);
2040
2558
  if (part.flicker) {
2559
+ const phase = groupedPhaseOf(part);
2041
2560
  animators.push((t) => {
2042
- light2.intensity = part.intensity * (Math.sin(t * 23 + part.x) > 0.3 || Math.sin(t * 3.1) > 0.85 ? 0.15 : 1);
2561
+ light2.intensity = part.intensity * (phase === void 0 ? pageFlicker(t, part.x) : flickerLevel(t, phase));
2043
2562
  });
2044
2563
  }
2045
2564
  return [light2];
@@ -2060,7 +2579,22 @@ var GameUrbanThree = (() => {
2060
2579
  }
2061
2580
  }
2062
2581
  };
2063
- const instancedItems = (list2) => {
2582
+ const layerItems = (list2) => {
2583
+ const placed = [];
2584
+ return list2.map((entry) => {
2585
+ const quarterTurn = Math.abs(Math.sin(entry.ry * 2)) < 1e-6;
2586
+ if (entry.rx || entry.rz || !quarterTurn) return entry;
2587
+ const turned2 = Math.abs(Math.cos(entry.ry)) < 0.5;
2588
+ const [halfX, halfZ] = turned2 ? [entry.depth / 2, entry.width / 2] : [entry.width / 2, entry.depth / 2];
2589
+ const rect = { x0: entry.x - halfX, x1: entry.x + halfX, z0: entry.z - halfZ, z1: entry.z + halfZ };
2590
+ let lift = 0;
2591
+ while (placed.some((other) => Math.abs(other.top - (entry.y + entry.height + lift)) < PLANE_LAYER_GAP / 2 && other.x0 < rect.x1 && rect.x0 < other.x1 && other.z0 < rect.z1 && rect.z0 < other.z1)) lift += PLANE_LAYER_GAP;
2592
+ placed.push({ top: entry.y + entry.height + lift, ...rect });
2593
+ return lift ? { ...entry, y: entry.y + lift } : entry;
2594
+ });
2595
+ };
2596
+ const instancedItems = (items) => {
2597
+ const list2 = options.standOut === false ? items : layerItems(items);
2064
2598
  const mesh2 = new THREE.InstancedMesh(roundedBox(1, 1, 1, ITEM_ROUNDNESS), standard(16777215), list2.length);
2065
2599
  const matrix = new THREE.Matrix4();
2066
2600
  const quaternion = new THREE.Quaternion();
@@ -2094,17 +2628,43 @@ var GameUrbanThree = (() => {
2094
2628
  });
2095
2629
  return mesh2;
2096
2630
  };
2631
+ const layerPlanes = (parts) => {
2632
+ const placed = [];
2633
+ return (part, made) => {
2634
+ if (part.shape !== "plane") return;
2635
+ const origin = { x: part.x, y: part.y, z: part.z };
2636
+ for (let parent = part.parent; parent >= 0; parent = parts[parent].parent) {
2637
+ const group = parts[parent];
2638
+ if (group.shape !== "group" || group.ry) return;
2639
+ origin.x += group.x;
2640
+ origin.y += group.y;
2641
+ origin.z += group.z;
2642
+ }
2643
+ const rect = { x0: origin.x - part.width / 2, x1: origin.x + part.width / 2, z0: origin.z - part.depth / 2, z1: origin.z + part.depth / 2 };
2644
+ let lift = 0;
2645
+ while (placed.some((other) => Math.abs(other.y - (origin.y + lift)) < PLANE_LAYER_GAP / 2 && other.x0 < rect.x1 && rect.x0 < other.x1 && other.z0 < rect.z1 && rect.z0 < other.z1)) lift += PLANE_LAYER_GAP;
2646
+ placed.push({ y: origin.y + lift, ...rect });
2647
+ made[0].position.y += lift;
2648
+ };
2649
+ };
2097
2650
  function draw(scene, drawOptions = {}) {
2098
2651
  const root = markKitOrigin(drawOptions.root ?? new THREE.Group(), { owner: "game-urban-three", kind: "urban" });
2099
2652
  const animators = [];
2100
2653
  const lights = [];
2654
+ animatedLenses = /* @__PURE__ */ new Set();
2101
2655
  const objects = [];
2656
+ const layer = options.standOut === false ? () => void 0 : layerPlanes(scene.parts);
2102
2657
  for (const part of scene.parts) {
2103
2658
  const made = drawPart(part, animators, lights);
2659
+ layer(part, made);
2104
2660
  objects.push(made);
2105
2661
  const parent = part.parent < 0 ? root : objects[part.parent][0];
2106
2662
  parent.add(...made);
2107
2663
  }
2664
+ if (options.standOut === true) {
2665
+ let passes = 0;
2666
+ while (passes++ < 3 && standOutCoincident(root).left > 0) ;
2667
+ }
2108
2668
  if (scene.items.length) root.add(instancedItems(scene.items));
2109
2669
  if (scene.windows.lit.length) root.add(instancedWindows(scene.windows.lit, glowing(LIT_WINDOW)));
2110
2670
  if (scene.windows.dark.length) root.add(instancedWindows(scene.windows.dark, standard(DARK_WINDOW.color, DARK_WINDOW)));
@@ -2128,7 +2688,7 @@ var GameUrbanThree = (() => {
2128
2688
  return { THREE, draw };
2129
2689
  }
2130
2690
 
2131
- // ../game-vegetation/dist/chunk-CJRLKDWB.js
2691
+ // ../game-vegetation/dist/chunk-57VLOYXL.js
2132
2692
  var __defProp2 = Object.defineProperty;
2133
2693
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2134
2694
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -3020,12 +3580,18 @@ var GameUrbanThree = (() => {
3020
3580
  }
3021
3581
  }
3022
3582
  }
3023
- function kite(b, base, dir, up, length, width, c0, c1, sway0, sway1, lift = 0.35) {
3583
+ function kite(b, base, dir, up, length, width, c0, c1, sway0, sway1, lift = 0.35, roll = 0) {
3024
3584
  const d = norm(dir);
3025
3585
  let right = cross(d, up);
3026
3586
  if (dot(right, right) < 1e-6) right = cross(d, [1, 0, 0]);
3027
3587
  right = norm(right);
3028
- const n2 = norm(cross(right, d));
3588
+ let n2 = norm(cross(right, d));
3589
+ if (roll !== 0) {
3590
+ const cr = Math.cos(roll);
3591
+ const sr = Math.sin(roll);
3592
+ right = add(mul(right, cr), mul(n2, sr));
3593
+ n2 = norm(cross(right, d));
3594
+ }
3029
3595
  const m = add(base, mul(d, length * 0.4));
3030
3596
  const hw = width * 0.5;
3031
3597
  const L = add(add(m, mul(right, -hw)), mul(n2, hw * lift));
@@ -3159,13 +3725,15 @@ var GameUrbanThree = (() => {
3159
3725
  return { p, r, members: g.members };
3160
3726
  });
3161
3727
  }
3162
- function octa(b, center, radii, color2, sway) {
3728
+ function octa(b, center, radii, color2, sway, yaw = 0) {
3729
+ const cy = Math.cos(yaw);
3730
+ const sy = Math.sin(yaw);
3163
3731
  const pts = [
3164
3732
  [radii[0], 0, 0],
3165
3733
  [0, 0, radii[2]],
3166
3734
  [-radii[0], 0, 0],
3167
3735
  [0, 0, -radii[2]]
3168
- ].map((p) => add(center, [p[0], p[1] + 0, p[2]]));
3736
+ ].map((p) => add(center, [p[0] * cy + p[2] * sy, p[1] + 0, p[2] * cy - p[0] * sy]));
3169
3737
  const top = add(center, [0, radii[1], 0]);
3170
3738
  const bot = add(center, [0, -radii[1], 0]);
3171
3739
  for (let i = 0; i < 4; i++) {
@@ -3808,6 +4376,7 @@ var GameUrbanThree = (() => {
3808
4376
  void mul;
3809
4377
  return groups;
3810
4378
  }
4379
+ var GOLDEN_ANGLE = 2.399963;
3811
4380
  var DEFAULT_LEAF = [5085763, 5941322, 4360766];
3812
4381
  function generateBroadleafTree(spec, ctx) {
3813
4382
  const height = spec.height ?? 6;
@@ -3987,7 +4556,7 @@ var GameUrbanThree = (() => {
3987
4556
  const out = [Math.cos(ang), r22.range(-0.3, 0.5), Math.sin(ang)];
3988
4557
  const center = add(pos, mul(norm(out), rad + fr * 0.4));
3989
4558
  const rr = fr * r22.range(0.8, 1.2);
3990
- ctx.fruitItem(() => octa(ctx.fruit, center, [rr, rr, rr], (h) => shade(c, 0.75 + h * 0.6), 0));
4559
+ ctx.fruitItem(() => octa(ctx.fruit, center, [rr, rr, rr], (h) => shade(c, 0.75 + h * 0.6), 0, i * GOLDEN_ANGLE));
3991
4560
  }
3992
4561
  } else {
3993
4562
  for (let i = 0; i < count; i++) {
@@ -4002,7 +4571,7 @@ var GameUrbanThree = (() => {
4002
4571
  const centre = [top[0], top[1] - drop - s * 0.6, top[2]];
4003
4572
  ctx.fruitItem(() => {
4004
4573
  tube(ctx.wood, [top, [top[0], top[1] - drop * 0.8, top[2]]], { sides: 3, radii: [8e-3, 8e-3], color: () => [0.3, 0.4, 0.2], sway: () => 0.5, end: "none" });
4005
- if (s < 0.06) octa(ctx.fruit, centre, [s * 0.85, s * 1.2, s * 0.85], (h) => shade(c, 0.7 + h * 0.45), 0.4);
4574
+ if (s < 0.06) octa(ctx.fruit, centre, [s * 0.85, s * 1.2, s * 0.85], (h) => shade(c, 0.7 + h * 0.45), 0.4, i * GOLDEN_ANGLE);
4006
4575
  else icoShell(ctx.fruit, { center: centre, radii: [s * 0.85, s * 1.2, s * 0.85], detail: 0, rng: r22, noise: 0.04, color: (v) => shade(c, 0.7 + v.h * 0.45), sway: () => 0.4 });
4007
4576
  });
4008
4577
  }
@@ -4368,7 +4937,7 @@ var GameUrbanThree = (() => {
4368
4937
  const col1 = jitter(c1, rng, 0.01, 0.06, 0.04);
4369
4938
  for (const s of [-1, 1]) {
4370
4939
  const dir = norm(add(add(mul(side, s * 0.95), mul(d, 0.6)), [0, -0.28, 0]));
4371
- kite(ctx.foliage, p, dir, [0, 1, 0], len2, len2 * 0.5, col0, col1, 0.3 + 0.6 * t, 0.4 + 0.6 * t);
4940
+ kite(ctx.foliage, p, dir, [0, 1, 0], len2, len2 * 0.5, col0, col1, 0.3 + 0.6 * t, 0.4 + 0.6 * t, 0.35, (k % 4 - 1.5) * 0.03);
4372
4941
  }
4373
4942
  }
4374
4943
  }
@@ -4448,11 +5017,17 @@ var GameUrbanThree = (() => {
4448
5017
  for (let k = 0; k < count; k++) {
4449
5018
  const t0 = 0.12 + 0.7 * k / count;
4450
5019
  const t1 = t0 + 0.05;
5020
+ const edgeAt = (t, sd) => {
5021
+ const f = Math.min(R - 1, Math.floor(t * R));
5022
+ const a = sd < 0 ? rows[f].L : rows[f].R;
5023
+ const z = sd < 0 ? rows[f + 1].L : rows[f + 1].R;
5024
+ return add(mul(a, 1 - (t * R - f)), mul(z, t * R - f));
5025
+ };
4451
5026
  const i0 = Math.min(R, Math.round(t0 * R));
4452
5027
  const i1 = Math.min(R, Math.max(i0 + 1, Math.round(t1 * R)));
4453
5028
  for (const sd of [-1, 1]) {
4454
- const e0 = sd < 0 ? rows[i0].L : rows[i0].R;
4455
- const e1 = sd < 0 ? rows[i1].L : rows[i1].R;
5029
+ const e0 = edgeAt(t0, sd);
5030
+ const e1 = edgeAt(t1, sd);
4456
5031
  const out = mul(right, sd * width * size);
4457
5032
  const tip = add(add(mul(add(e0, e1), 0.5), out), mul(d, length * 0.02));
4458
5033
  b.flatTri(e0, tip, e1, color2, shade(color2, 1.3), color2, rows[i0].s, rows[i0].s, rows[i1].s, add(out, n2));
@@ -4959,7 +5534,7 @@ var GameUrbanThree = (() => {
4959
5534
  const cc1 = jitter(o.c1, o.rng, 8e-3, 0.05, 0.03);
4960
5535
  for (const s of [-1, 1]) {
4961
5536
  const dir = norm(add(add(mul(sideV, s * 0.85), mul(d, 0.6)), [0, -hang, 0]));
4962
- kite(b, p, dir, [0, 1, 0], len2, len2 * lw * (o.lod === 0 ? 1 : 2.3), mix(cc0, cc1, 0.1), cc1, sw, Math.min(1, sw + 0.1));
5537
+ kite(b, p, dir, [0, 1, 0], len2, len2 * lw * (o.lod === 0 ? 1 : 2.3), mix(cc0, cc1, 0.1), cc1, sw, Math.min(1, sw + 0.1), 0.35, (k % 10 - 4.5) * 0.014);
4963
5538
  }
4964
5539
  }
4965
5540
  return pts[segs];
@@ -5746,6 +6321,9 @@ var GameUrbanThree = (() => {
5746
6321
  vine: generateVine,
5747
6322
  potted: generatePotted
5748
6323
  };
6324
+ function groundLiftAt(x, z) {
6325
+ return 1e-3 + 4e-3 * (hashMix(Math.round(x * 1e4) >>> 0, Math.round(z * 1e4) >>> 0) / 4294967296);
6326
+ }
5749
6327
  function generate2(spec, opts = {}) {
5750
6328
  const gen = GENERATORS[spec.archetype];
5751
6329
  if (!gen) throw new Error(`game-vegetation: unknown archetype "${spec.archetype}"`);
@@ -5824,7 +6402,7 @@ var GameUrbanThree = (() => {
5824
6402
  pos[i + 1] *= scale;
5825
6403
  pos[i + 2] *= scale;
5826
6404
  }
5827
- if (pos[i + 1] < 0) pos[i + 1] = 0;
6405
+ if (pos[i + 1] < 0) pos[i + 1] = key === "foliage" ? groundLiftAt(pos[i], pos[i + 2]) : 0;
5828
6406
  const r = Math.hypot(pos[i], pos[i + 2]);
5829
6407
  if (r > radius) radius = r;
5830
6408
  if (pos[i + 1] > height) height = pos[i + 1];
@@ -8900,6 +9478,7 @@ gl_Position = projectionMatrix * mvPosition;
8900
9478
  SEED_KEYS: { rooms: {}, items: {} },
8901
9479
  stateDistribution: { weights: null, seedKey: "state" },
8902
9480
  RESULT_EXTENSIONS: [],
9481
+ OPTION_RESOLVERS: [],
8903
9482
  FINDS_PROVIDERS: [],
8904
9483
  VIEWER_LAYERS: [],
8905
9484
  LOCALES: {},
@@ -8986,6 +9565,12 @@ gl_Position = projectionMatrix * mvPosition;
8986
9565
  function styleOf(id) {
8987
9566
  return registries().STYLES[id] || registries().STYLES.budget || Object.values(registries().STYLES)[0];
8988
9567
  }
9568
+ function registerOptionResolver(name, resolve) {
9569
+ const list2 = registries().OPTION_RESOLVERS;
9570
+ const i = list2.findIndex((x) => x.name === name);
9571
+ if (i >= 0) list2[i] = { name, resolve };
9572
+ else list2.push({ name, resolve });
9573
+ }
8989
9574
  function registerResultExtension(name, run, options = {}) {
8990
9575
  const entry = { name, run, after: options.after || [], seedKey: options.seedKey ?? name };
8991
9576
  const i = registries().RESULT_EXTENSIONS.findIndex((x) => x.name === name);
@@ -9121,10 +9706,25 @@ gl_Position = projectionMatrix * mvPosition;
9121
9706
  "outhouse"
9122
9707
  ]);
9123
9708
  var CAR_CLEARANCE = { driver: 0.8, side: 0.6, end: 0.6 };
9709
+ var active = WALL_THICKNESS;
9710
+ var wallThickness = () => active;
9711
+ var wallMargin = () => active / 2;
9712
+ var wallThicknessFor = (tpl, op) => op.wallThickness ?? tpl.wallThickness ?? WALL_THICKNESS;
9713
+ function withWallThickness(thickness, fn) {
9714
+ const previous = active;
9715
+ active = thickness;
9716
+ try {
9717
+ return fn();
9718
+ } finally {
9719
+ active = previous;
9720
+ }
9721
+ }
9722
+ var roomMargin = (room) => room.outdoor ? WALL_THICKNESS / 2 : wallMargin();
9124
9723
  var r2 = (x) => Math.round(x * 100) / 100;
9125
9724
  var clamp3 = (x, a, b) => Math.max(a, Math.min(b, x));
9126
9725
  var overlaps = (a, b, e = EPS) => a[0] < b[2] - e && a[2] > b[0] + e && a[1] < b[3] - e && a[3] > b[1] + e;
9127
- var inner = (p) => [p[0] + MARGIN, p[1] + MARGIN, p[2] - MARGIN, p[3] - MARGIN];
9726
+ var inner = (p) => insetBy(p, wallMargin());
9727
+ var insetBy = (p, margin) => [p[0] + margin, p[1] + margin, p[2] - margin, p[3] - margin];
9128
9728
  var eq = (a, b) => Math.abs(a - b) < TOL;
9129
9729
  var inflate2 = (r, e) => [r[0] - e, r[1] - e, r[2] + e, r[3] + e];
9130
9730
  var areaOf = (r) => (r[2] - r[0]) * (r[3] - r[1]);
@@ -9197,7 +9797,7 @@ gl_Position = projectionMatrix * mvPosition;
9197
9797
  const h = width / 2;
9198
9798
  return axis === "u" ? [[u - h, v - depth, u + h, v], [u - h, v, u + h, v + depth]] : [[u - depth, v - h, u, v + h], [u, v - h, u + depth, v + h]];
9199
9799
  }
9200
- var openingDepth = (width, leaf2) => Math.max(0.9, leaf2) + MARGIN;
9800
+ var openingDepth = (width, leaf2) => Math.max(0.9, leaf2) + wallMargin();
9201
9801
  function entryPoints(ab) {
9202
9802
  return ab.axis === "u" ? [[ab.u, ab.v - 0.55], [ab.u, ab.v + 0.55]] : [[ab.u - 0.55, ab.v], [ab.u + 0.55, ab.v]];
9203
9803
  }
@@ -9221,7 +9821,7 @@ gl_Position = projectionMatrix * mvPosition;
9221
9821
  };
9222
9822
  }
9223
9823
  function usableParts(room, extra) {
9224
- const m = MARGIN + (extra || 0);
9824
+ const m = roomMargin(room) + (extra || 0);
9225
9825
  const out = [];
9226
9826
  for (const p of room.parts) {
9227
9827
  out.push([p[0] + m, p[1] + m, p[2] - m, p[3] - m]);
@@ -9319,7 +9919,7 @@ gl_Position = projectionMatrix * mvPosition;
9319
9919
  v0: g.axis === "u" ? g.pos : x,
9320
9920
  u1: g.axis === "u" ? y : g.pos,
9321
9921
  v1: g.axis === "u" ? g.pos : y,
9322
- thickness: WALL_THICKNESS,
9922
+ thickness: wallThickness(),
9323
9923
  sides: [s.A, s.B],
9324
9924
  exterior: s.A === "outside" || s.B === "outside",
9325
9925
  type: railing ? "railing" : "wall",
@@ -9339,7 +9939,7 @@ gl_Position = projectionMatrix * mvPosition;
9339
9939
  const alongV = Math.abs(front[1]) === 1;
9340
9940
  const [extentU, extentV] = extent([item.w, item.d], front);
9341
9941
  const across = alongV ? extentU : extentV;
9342
- const along = alongV ? extentV : extentU;
9942
+ const along2 = alongV ? extentV : extentU;
9343
9943
  const a = alongV ? 0 : 1;
9344
9944
  const b = alongV ? 1 : 0;
9345
9945
  const driverSign = alongV ? front[1] : -front[0];
@@ -9349,7 +9949,7 @@ gl_Position = projectionMatrix * mvPosition;
9349
9949
  const lo = zone[a] + lowClear;
9350
9950
  const hi = zone[a + 2] - highClear - across;
9351
9951
  const alongLo = zone[b] + car.end;
9352
- const alongHi = zone[b + 2] - car.end - along;
9952
+ const alongHi = zone[b + 2] - car.end - along2;
9353
9953
  if (hi < lo - 1e-6 || alongHi < alongLo - 1e-6) return [];
9354
9954
  const preferred = (alongV ? slot.x : slot.z) - across / 2;
9355
9955
  const alongStart = frontSign < 0 ? alongHi : alongLo;
@@ -9357,8 +9957,8 @@ gl_Position = projectionMatrix * mvPosition;
9357
9957
  for (let p = lo; p <= hi + 1e-6; p += STEP) positions.push(Math.min(p, hi));
9358
9958
  positions.sort((x, y) => Math.abs(x - preferred) - Math.abs(y - preferred));
9359
9959
  return positions.slice(0, MAX_CANDIDATES).map((p) => {
9360
- const rect = alongV ? [p, alongStart, p + across, alongStart + along] : [alongStart, p, alongStart + along, p + across];
9361
- const clear = alongV ? [p - lowClear, alongStart - car.end, p + across + highClear, alongStart + along + car.end] : [alongStart - car.end, p - lowClear, alongStart + along + car.end, p + across + highClear];
9960
+ const rect = alongV ? [p, alongStart, p + across, alongStart + along2] : [alongStart, p, alongStart + along2, p + across];
9961
+ const clear = alongV ? [p - lowClear, alongStart - car.end, p + across + highClear, alongStart + along2 + car.end] : [alongStart - car.end, p - lowClear, alongStart + along2 + car.end, p + across + highClear];
9362
9962
  return { rect, clear };
9363
9963
  });
9364
9964
  }
@@ -9389,8 +9989,9 @@ gl_Position = projectionMatrix * mvPosition;
9389
9989
  if (outside) n = [-n[0], -n[1]];
9390
9990
  const u = j.u;
9391
9991
  const v = j.v;
9392
- if (j.axis === "u") return n[1] > 0 ? [u - h, v - MARGIN, u + h, v + depth] : [u - h, v - depth, u + h, v + MARGIN];
9393
- return n[0] > 0 ? [u - MARGIN, v - h, u + depth, v + h] : [u - depth, v - h, u + MARGIN, v + h];
9992
+ const MARGIN2 = wallMargin();
9993
+ if (j.axis === "u") return n[1] > 0 ? [u - h, v - MARGIN2, u + h, v + depth] : [u - h, v - depth, u + h, v + MARGIN2];
9994
+ return n[0] > 0 ? [u - MARGIN2, v - h, u + depth, v + h] : [u - depth, v - h, u + MARGIN2, v + h];
9394
9995
  }
9395
9996
  function blocksWindow(it, win, overheadOff) {
9396
9997
  const height = Math.max(it.h, it.windowHeight || 0, it.overhead && !overheadOff ? OVERHEAD_TOP : 0);
@@ -9422,14 +10023,15 @@ gl_Position = projectionMatrix * mvPosition;
9422
10023
  const cache2 = plan.wallBodies = plan.wallBodies || {};
9423
10024
  if (cache2[floor]) return cache2[floor];
9424
10025
  const doors = plan.doors.filter((p) => p.floor === floor);
10026
+ const MARGIN2 = plan.wallThickness / 2;
9425
10027
  return cache2[floor] = plan.walls.filter((p) => p.floor === floor && (p.type === "wall" || p.type === "railing")).map((p) => {
9426
10028
  const a0 = p.axis === "u" ? p.u0 : p.v0;
9427
10029
  const a1 = p.axis === "u" ? p.u1 : p.v1;
9428
10030
  const pos = p.axis === "u" ? p.v0 : p.u0;
9429
10031
  const atDoor = (x) => doors.some((q) => q.axis === p.axis && eq(q.pos, pos) && (eq(q.at - q.width / 2, x) || eq(q.at + q.width / 2, x)));
9430
- const e0 = atDoor(a0) ? 0 : MARGIN;
9431
- const e1 = atDoor(a1) ? 0 : MARGIN;
9432
- return p.axis === "u" ? [a0 - e0, pos - MARGIN, a1 + e1, pos + MARGIN] : [pos - MARGIN, a0 - e0, pos + MARGIN, a1 + e1];
10032
+ const e0 = atDoor(a0) ? 0 : MARGIN2;
10033
+ const e1 = atDoor(a1) ? 0 : MARGIN2;
10034
+ return p.axis === "u" ? [a0 - e0, pos - MARGIN2, a1 + e1, pos + MARGIN2] : [pos - MARGIN2, a0 - e0, pos + MARGIN2, a1 + e1];
9433
10035
  });
9434
10036
  }
9435
10037
  function createGrid(plan, room, ignored, radius = plan.playerRadius) {
@@ -9765,7 +10367,9 @@ gl_Position = projectionMatrix * mvPosition;
9765
10367
  palettePrefix: "paleta:"
9766
10368
  };
9767
10369
  var placementKit = {
9768
- MARGIN,
10370
+ get MARGIN() {
10371
+ return wallMargin();
10372
+ },
9769
10373
  EPS,
9770
10374
  r2,
9771
10375
  clamp: clamp3,
@@ -10206,6 +10810,7 @@ gl_Position = projectionMatrix * mvPosition;
10206
10810
  const FLOOR_DEFS = floorsOf(tpl, op);
10207
10811
  const style = styleOf(styleId);
10208
10812
  const plan = {
10813
+ wallThickness: wallThickness(),
10209
10814
  w,
10210
10815
  d,
10211
10816
  tpl,
@@ -10678,7 +11283,7 @@ gl_Position = projectionMatrix * mvPosition;
10678
11283
  const key = registries().LIBRARY_ALIAS[name] || name;
10679
11284
  const library = room.slots ? room.slots : registries().LIBRARIES[key];
10680
11285
  if (!library) return [];
10681
- const R = inner(room.parts[0]);
11286
+ const R = insetBy(room.parts[0], roomMargin(room));
10682
11287
  let defs = typeof library === "function" ? library({ w: R[2] - R[0], d: R[3] - R[1] }) : library.slice();
10683
11288
  defs = defs.map((x) => Object.assign({}, x));
10684
11289
  for (const id of room.without || []) defs = defs.filter((x) => x.id !== id);
@@ -10744,7 +11349,7 @@ gl_Position = projectionMatrix * mvPosition;
10744
11349
  }
10745
11350
  const size = def.size;
10746
11351
  const roomCenter = (() => {
10747
- const R0 = inner(room.parts[0]);
11352
+ const R0 = insetBy(room.parts[0], roomMargin(room));
10748
11353
  return [(R0[0] + R0[2]) / 2, (R0[1] + R0[3]) / 2];
10749
11354
  })();
10750
11355
  const openings = openingsOfFloor(plan, room.floor);
@@ -10770,7 +11375,7 @@ gl_Position = projectionMatrix * mvPosition;
10770
11375
  };
10771
11376
  const free = (rect) => !!def.floorFree || !zones.some((z) => overlaps(rect, z, room.type === "stairs" ? -0.011 : EPS));
10772
11377
  const rule = def.facing || "center";
10773
- let R = inner(room.parts[Math.min(def.part || 0, room.parts.length - 1)]);
11378
+ let R = insetBy(room.parts[Math.min(def.part || 0, room.parts.length - 1)], roomMargin(room));
10774
11379
  if (def.anchor === "wall" || def.anchor === "window") {
10775
11380
  let side = def.side;
10776
11381
  let a = null;
@@ -10782,7 +11387,7 @@ gl_Position = projectionMatrix * mvPosition;
10782
11387
  const found2 = win;
10783
11388
  side = room.outdoor ? SIDE_OPPOSITE[win.side] : WINDOW_SIDE[win.side];
10784
11389
  const cand = room.parts.map(inner).find(
10785
- (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))
11390
+ (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 + roomMargin(room)) || side === "right" && eq(r[2], found2.pos - roomMargin(room)) || side === "front" && eq(r[1], found2.pos + roomMargin(room)) || side === "back" && eq(r[3], found2.pos - roomMargin(room)))
10786
11391
  );
10787
11392
  if (!cand) return invalid("window_outside_room");
10788
11393
  R = cand;
@@ -10799,7 +11404,7 @@ gl_Position = projectionMatrix * mvPosition;
10799
11404
  const hw = Math.min(size[0], len2) / 2;
10800
11405
  const cell = (ac) => side === "left" ? [R[0], ac - hw, R[0] + depth, ac + hw] : side === "right" ? [R[2] - depth, ac - hw, R[2], ac + hw] : side === "front" ? [ac - hw, R[1], ac + hw, R[1] + depth] : [ac - hw, R[3] - depth, ac + hw, R[3]];
10801
11406
  const nominal = a != null ? a : a0 + hw + (def.pos == null ? 0.5 : def.pos) * Math.max(0, len2 - 2 * hw) + (def.shift || 0);
10802
- const wp = side === "left" ? R[0] - MARGIN : side === "right" ? R[2] + MARGIN : side === "front" ? R[1] - MARGIN : R[3] + MARGIN;
11407
+ const wp = side === "left" ? R[0] - roomMargin(room) : side === "right" ? R[2] + roomMargin(room) : side === "front" ? R[1] - roomMargin(room) : R[3] + roomMargin(room);
10803
11408
  const pa = clamp3(nominal, a0 + hw, a1 - hw);
10804
11409
  let found = null;
10805
11410
  const steps = [0];
@@ -10838,7 +11443,7 @@ gl_Position = projectionMatrix * mvPosition;
10838
11443
  if (extentU > R[2] - R[0] + EPS || extentV > R[3] - R[1] + EPS) return invalid("larger_than_room");
10839
11444
  const rect = [cornerU === "left" ? R[0] : R[2] - extentU, cornerV === "front" ? R[1] : R[3] - extentV, cornerU === "left" ? R[0] + extentU : R[2], cornerV === "front" ? R[1] + extentV : R[3]];
10840
11445
  if (!free(rect)) return invalid("blocked_by_door");
10841
- for (const sp of [[kx - normalU[0] * (MARGIN + 0.1), (rect[1] + rect[3]) / 2], [(rect[0] + rect[2]) / 2, kz - normalV[1] * (MARGIN + 0.1)]]) if (isOpenSide(plan, room, sp[0], sp[1])) return invalid("open_wall");
11446
+ for (const sp of [[kx - normalU[0] * (roomMargin(room) + 0.1), (rect[1] + rect[3]) / 2], [(rect[0] + rect[2]) / 2, kz - normalV[1] * (roomMargin(room) + 0.1)]]) if (isOpenSide(plan, room, sp[0], sp[1])) return invalid("open_wall");
10842
11447
  return Object.assign(base, { x: r2((rect[0] + rect[2]) / 2), z: r2((rect[1] + rect[3]) / 2), frontU: f[0], frontV: f[1], ry: r2(Math.atan2(f[0], f[1])), w: size[0], d: size[1], aabb: rect.map(r2), _cell: { rect, f, enclosed: [cornerU, cornerV], R, size } });
10843
11448
  }
10844
11449
  if (def.anchor === "center") {
@@ -10878,7 +11483,10 @@ gl_Position = projectionMatrix * mvPosition;
10878
11483
  };
10879
11484
  function slots(template, options) {
10880
11485
  const tpl = templateOf(template);
10881
- const o = options || {};
11486
+ const o = resolveOptions(tpl, options || {});
11487
+ return withWallThickness(wallThicknessFor(tpl, o), () => slotsWith(tpl, o));
11488
+ }
11489
+ function slotsWith(tpl, o) {
10882
11490
  const plan = buildPlan(tpl, o.w, o.d, o);
10883
11491
  const locale = o.locale || "en";
10884
11492
  return resolveSlots(plan).map(cleanSlot).map((s) => s.reason ? Object.assign(s, { reason: translate("reasons", s.reason, locale) }) : s);
@@ -10921,7 +11529,11 @@ gl_Position = projectionMatrix * mvPosition;
10921
11529
  var loc = (key, locale, ns = "labels", vars) => key ? translate(ns, key, locale, vars) : key;
10922
11530
  function generate3(template, options) {
10923
11531
  const tpl = templateOf(template);
10924
- const o = options || {};
11532
+ const o = resolveOptions(tpl, options || {});
11533
+ return withWallThickness(wallThicknessFor(tpl, o), () => generateWith(tpl, o));
11534
+ }
11535
+ var resolveOptions = (tpl, options) => registries().OPTION_RESOLVERS.reduce((op, r) => r.resolve(tpl, op), options);
11536
+ function generateWith(tpl, o) {
10925
11537
  const seed = o.seed == null ? 1 : o.seed;
10926
11538
  const locale = o.locale || "en";
10927
11539
  let op = Object.assign({}, o, { seed });
@@ -11304,6 +11916,7 @@ gl_Position = projectionMatrix * mvPosition;
11304
11916
  registerState: scoped(registerState),
11305
11917
  setStateDistribution: scoped(setStateDistribution),
11306
11918
  registerLocale: scoped(registerLocale),
11919
+ registerOptionResolver: scoped(registerOptionResolver),
11307
11920
  registerResultExtension: scoped(registerResultExtension),
11308
11921
  registerFindsProvider: scoped(registerFindsProvider),
11309
11922
  findsFor: scoped(findsFor),
@@ -15180,6 +15793,32 @@ gl_Position = projectionMatrix * mvPosition;
15180
15793
  }
15181
15794
  ];
15182
15795
  }
15796
+ var THICKNESS_STEP = 0.0625;
15797
+ var THINNEST = 0.15;
15798
+ var CLEARANCE = 15e-4;
15799
+ var SPOKE_HALF_THICKNESS = 0.02;
15800
+ var DISH_HALF_THICKNESS = 0.025;
15801
+ function sharesPlaneWithDish(reach, scale) {
15802
+ const dishReach = reach * 0.9;
15803
+ const outer = Math.abs(reach + SPOKE_HALF_THICKNESS * scale - (dishReach + DISH_HALF_THICKNESS));
15804
+ const inner2 = Math.abs(reach - SPOKE_HALF_THICKNESS * scale - (dishReach - DISH_HALF_THICKNESS));
15805
+ return outer < CLEARANCE || inner2 < CLEARANCE;
15806
+ }
15807
+ function separateSpokes(context) {
15808
+ for (const wheel of context.wheels) {
15809
+ let previous = 1 + THICKNESS_STEP;
15810
+ for (const child of wheel.children) {
15811
+ const mesh2 = child;
15812
+ const type = mesh2.geometry?.type;
15813
+ if (!mesh2.isMesh || type !== "BufferGeometry" && type !== "BoxGeometry" || mesh2.position.z === 0) continue;
15814
+ const reach = Math.abs(mesh2.position.z);
15815
+ let scale = previous - THICKNESS_STEP;
15816
+ while (sharesPlaneWithDish(reach, scale) && scale > THINNEST) scale -= THICKNESS_STEP / 2;
15817
+ mesh2.scale.z = Math.max(scale, THINNEST);
15818
+ previous = scale;
15819
+ }
15820
+ }
15821
+ }
15183
15822
  function installBoatsExtra(fx) {
15184
15823
  const kit = fx.kit;
15185
15824
  const THREE = kit.THREE;
@@ -15613,12 +16252,12 @@ gl_Position = projectionMatrix * mvPosition;
15613
16252
  cs.castShadow = false;
15614
16253
  [1, -1].forEach(function(s) {
15615
16254
  c.roundBox(2.6, 0.06, 0.42, 0.02, teak, -2.45, 0.86, s * 0.82);
15616
- c.roundBox(2.6, 0.38, 0.06, 0.02, white, -2.45, 0.67, s * 0.6);
16255
+ c.roundBox(2.6, 0.376, 0.06, 0.02, white, -2.45, 0.671, s * 0.6);
15617
16256
  c.roundBox(2.8, 0.22, 0.05, 0.02, white, -2.4, 1.02, s * (H.sheerAt(-2.4).z - 0.32));
15618
16257
  c.cylinder(0.06, 0.07, 0.11, MT.chrome, -1.6, 1.15, s * 1.06);
15619
16258
  c.cylinder(0.035, 0.035, 0.02, MT.chrome, -1.6, 1.21, s * 1.06);
15620
16259
  });
15621
- c.roundBox(0.3, 0.38, 1.2, 0.03, white, -3.75, 0.67, 0);
16260
+ c.roundBox(0.3, 0.376, 1.2, 0.03, white, -3.75, 0.671, 0);
15622
16261
  c.seatTops.push({ x: -2.6, y: 0.9, z: 0.82, w: 0.42, l: 2.4 }, { x: -2.6, y: 0.9, z: -0.82, w: 0.42, l: 2.4 });
15623
16262
  const trST = [
15624
16263
  [-1.1, 0.8, 1.56, 2, 6],
@@ -16027,9 +16666,9 @@ gl_Position = projectionMatrix * mvPosition;
16027
16666
  });
16028
16667
  c.roundBox(1.6, 0.03, 0.1, 0.01, MT.wood, 0.3, 0.05, 0.38, { rot: [0.2, 0, 0] });
16029
16668
  c.roundBox(1.6, 0.03, 0.1, 0.01, MT.wood, 0.3, 0.06, 0.28, { rot: [0.2, 0, 0] });
16030
- c.roundBox(0.36, 0.24, 0.26, 0.03, CM("#ffffff", { roughness: 0.5 }), 1.25, 0.14, 0.15);
16669
+ c.roundBox(0.36, 0.24, 0.26, 0.03, CM("#ffffff", { roughness: 0.5 }), 1.25, 0.142, 0.15);
16031
16670
  c.roundBox(0.1, 0.03, 0.02, 5e-3, CM("#d01c1c"), 1.25, 0.2, 0.282);
16032
- c.roundBox(0.03, 0.1, 0.02, 5e-3, CM("#d01c1c"), 1.25, 0.2, 0.282);
16671
+ c.roundBox(0.03, 0.1, 0.02, 5e-3, CM("#d01c1c"), 1.25, 0.2, 0.284);
16033
16672
  const buoy = c.add(new THREE.TorusGeometry(0.24, 0.06, 10, 24), CM("#f0f0ea", { roughness: 0.6 }), 1.1, 0.1, -0.2);
16034
16673
  buoy.rotation.x = PI / 2;
16035
16674
  const motor = EA.outboard(c, -1.99, 0.55, 0, { k: 1, tiller: true, label: "40", col: "#1d1f22" });
@@ -16165,7 +16804,7 @@ gl_Position = projectionMatrix * mvPosition;
16165
16804
  return Math.min(0.06 - y, x - x0 - 0.04);
16166
16805
  }),
16167
16806
  CM("#1d2023", { roughness: 0.6 }),
16168
- { sz: 1.004, dy: 3e-3 }
16807
+ { sz: 1.004, dy: 3e-3, ends: false }
16169
16808
  );
16170
16809
  EA.sheerTube(c, H, x0 + 0.02, 6.2, 0.07, blk, { dy: -0.1, dz: 0.02 });
16171
16810
  const deck = c.add(EA.deckGeo(H, x0 + 0.02, 6.32, { n: 40, m: 10, crown: 0.05 }), deckC);
@@ -19256,7 +19895,7 @@ gl_Position = projectionMatrix * mvPosition;
19256
19895
  [0.62, 0.48, -0.48, -0.62].forEach(function(z) {
19257
19896
  const s = dg.at(dg.uz(z), 0.25);
19258
19897
  c2.cylinder(0.045, 0.045, 0.1, EXH, s.p.x - 0.02, 0.25, z, "x");
19259
- c2.cylinder(0.036, 0.036, 0.102, MT.dark, s.p.x - 0.02, 0.25, z, "x");
19898
+ c2.cylinder(0.036, 0.036, 0.106, MT.dark, s.p.x - 0.02, 0.25, z, "x");
19260
19899
  });
19261
19900
  const lip = K.grid(-1, 0, { z1: 0.7, y0: 0.88, y1: 0.97, du: 0.03, dv: 0.02 });
19262
19901
  K.skin(lip, GLOSS, { u0: 0.05, u1: 0.95, yb: 0.925, yt: 0.955, off: 0.016, thick: 0.02, nv: 2 });
@@ -19359,9 +19998,9 @@ gl_Position = projectionMatrix * mvPosition;
19359
19998
  c.cylinder(0.08, 0.065, 0.12, MT.steel, x, y, z, "x");
19360
19999
  c.cylinder(0.07, 0.07, 0.012, MT.head, x + 0.065, y, z, "x");
19361
20000
  }
19362
- function sandbags(c, x0, x1, y, z, along) {
20001
+ function sandbags(c, x0, x1, y, z, along2) {
19363
20002
  const bag = CM("#6e6248", { roughness: 0.95 });
19364
- if (along === "z") {
20003
+ if (along2 === "z") {
19365
20004
  for (let zz = x0; zz <= x1 + 1e-6; zz += 0.42) {
19366
20005
  c.roundBox(0.3, 0.16, 0.4, 0.07, bag, z, y, zz);
19367
20006
  c.roundBox(0.3, 0.16, 0.4, 0.07, bag, z, y + 0.15, zz + 0.2 > x1 ? zz : zz + 0.2);
@@ -19669,7 +20308,7 @@ gl_Position = projectionMatrix * mvPosition;
19669
20308
  side: s,
19670
20309
  noPart: true
19671
20310
  });
19672
- c.roundBox(0.03, 0.12, 0.42, 0.02, MT.dark, bx + 0.125, by - bh * 0.3, s * 0.35);
20311
+ c.roundBox(0.03, 0.12, 0.42, 0.02, MT.dark, bx + 0.119, by - bh * 0.3, s * 0.35);
19673
20312
  });
19674
20313
  }
19675
20314
  c.roundBox(0.06, 0.06, 0.12, 0.02, MT.steel, bx + 0.13, by - bh * 0.35, 0);
@@ -19772,7 +20411,7 @@ gl_Position = projectionMatrix * mvPosition;
19772
20411
  -(W - 0.2) / 2 + (k + 0.5) * (W - 0.2) / 8
19773
20412
  );
19774
20413
  [1, -1].forEach(function(s) {
19775
- c.roundBox(0.06, 0.32, 0.06, 0.01, MT.trim, rear + 0.12, ry - 0.2, s * 0.43);
20414
+ c.roundBox(0.06, 0.32, 0.06, 0.01, MT.trim, rear + 0.118, ry - 0.2, s * 0.43);
19776
20415
  });
19777
20416
  m.rearBumper = bar;
19778
20417
  c.part("bumper", trl("labels.rear_bumper"), bar, new V3(rear, 0.52, 0), 1);
@@ -20834,7 +21473,7 @@ gl_Position = projectionMatrix * mvPosition;
20834
21473
  });
20835
21474
  const vg = c.roundBox(0.32, 0.2, 0.03, 0.03, MT.armorGlass, 1.3, 2.45, zs);
20836
21475
  kit.asGlass(c, vg, s > 0 ? lbl("right_armored_viewport") : lbl("left_armored_viewport"), "laminated");
20837
- c.roundBox(0.4, 0.28, 0.02, 0.03, plate, 1.3, 2.45, zs - s * 4e-3);
21476
+ c.roundBox(0.4, 0.28, 0.02, 0.03, plate, 1.3, 2.45, zs - s * 8e-3);
20838
21477
  for (let x = rear + 0.2; x < bx0; x += 0.3) {
20839
21478
  c.sphere(0.018, MT.steel, x, 1.2, zs);
20840
21479
  c.sphere(0.018, MT.steel, x, 2.98, zs);
@@ -20943,7 +21582,7 @@ gl_Position = projectionMatrix * mvPosition;
20943
21582
  const hx0 = 0.02, hx1 = 1.84 + FX, hy = 1.48;
20944
21583
  [1, -1].forEach(function(s) {
20945
21584
  c.roundBox(hx1 - hx0, 0.38, 0.035, 0.02, paint, (hx0 + hx1) / 2, 1.22, s * 0.36, { def: true });
20946
- for (let j = 0; j < 5; j++) c.roundBox(0.22, 0.025, 0.012, 8e-3, MT.dark, 0.75 + j * 0.16, 1.24, s * 0.38);
21585
+ for (let j = 0; j < 5; j++) c.roundBox(0.22, 0.025, 0.012, 8e-3, MT.dark, 0.75 + j * 0.16, 1.24, s * (0.38 + j % 2 * 3e-3));
20947
21586
  c.roundBox(1, 0.03, 0.02, 0.01, CM("#e9e6dd"), 0.55, 1.36, s * 0.38);
20948
21587
  c.text("275", 0.3, 0.14, 0.32, 1.2, s * 0.384, s > 0 ? "+z" : "-z", { fg: "#f2efe6" });
20949
21588
  });
@@ -21417,7 +22056,7 @@ gl_Position = projectionMatrix * mvPosition;
21417
22056
  const hs = c.add(
21418
22057
  EA.foilGeo(
21419
22058
  [
21420
- { p: [-3.9, 1.44, 0], c: 0.3, t: 0.1 },
22059
+ { p: [-3.9, 1.44, s * 2e-3], c: 0.3, t: 0.1 },
21421
22060
  { p: [-3.95, 1.44, s * 0.42], c: 0.22, t: 0.09 }
21422
22061
  ],
21423
22062
  { up: "y", n: 8 }
@@ -21656,7 +22295,7 @@ gl_Position = projectionMatrix * mvPosition;
21656
22295
  },
21657
22296
  lbl("chin_windows"),
21658
22297
  "tempered",
21659
- { pos: new V3(2.3, 0.88, 0) }
22298
+ { pos: new V3(2.3, 0.88, 0), k: 0.988 }
21660
22299
  );
21661
22300
  [1, -1].forEach(function(s) {
21662
22301
  EA.fuseGlass(
@@ -21756,7 +22395,7 @@ gl_Position = projectionMatrix * mvPosition;
21756
22395
  tipCol: "#e6e4dd",
21757
22396
  phase: 0.25
21758
22397
  });
21759
- c.roundBox(0.5, 0.12, 0.16, 0.05, MT.steel, 0, 2.8, 0);
22398
+ c.roundBox(0.5, 0.12, 0.16, 0.05, MT.steel, 0, 2.797, 0);
21760
22399
  const bm = boom(
21761
22400
  c,
21762
22401
  EA,
@@ -21790,7 +22429,7 @@ gl_Position = projectionMatrix * mvPosition;
21790
22429
  const hs = c.add(
21791
22430
  EA.foilGeo(
21792
22431
  [
21793
- { p: [-4.05, 1.68, 0], c: 0.42, t: 0.12, cam: -0.04 },
22432
+ { p: [-4.05, 1.68, s * 2e-3], c: 0.42, t: 0.12, cam: -0.04 },
21794
22433
  { p: [-4.1, 1.68, s * 0.99], c: 0.38, t: 0.11, cam: -0.04 }
21795
22434
  ],
21796
22435
  { up: "y", n: 8 }
@@ -22039,7 +22678,7 @@ gl_Position = projectionMatrix * mvPosition;
22039
22678
  },
22040
22679
  lbl("chin_windows"),
22041
22680
  "tempered",
22042
- { pos: new V3(3.05, 0.95, 0) }
22681
+ { pos: new V3(3.05, 0.95, 0), k: 0.988 }
22043
22682
  );
22044
22683
  [1, -1].forEach(function(s) {
22045
22684
  EA.fuseGlass(c, ST, EA.sideKeepP(fdP, 0.6, s), s > 0 ? lbl("co_pilot_door_window") : lbl("pilot_door_window"), "tempered", {
@@ -22204,7 +22843,7 @@ gl_Position = projectionMatrix * mvPosition;
22204
22843
  const hs = c.add(
22205
22844
  EA.foilGeo(
22206
22845
  [
22207
- { p: [-5.75, 2.1, 0], c: 0.62, t: 0.12, cam: -0.03 },
22846
+ { p: [-5.75, 2.1, s * 2e-3], c: 0.62, t: 0.12, cam: -0.03 },
22208
22847
  { p: [-5.85, 2.1, s * 1.05], c: 0.52, t: 0.11, cam: -0.03 }
22209
22848
  ],
22210
22849
  { up: "y", n: 8 }
@@ -22617,7 +23256,7 @@ gl_Position = projectionMatrix * mvPosition;
22617
23256
  EA.colorize(
22618
23257
  EA.foilGeo(
22619
23258
  [
22620
- { p: [-8.3, 2.75, 0], c: 1, t: 0.1 },
23259
+ { p: [-8.3, 2.75, s * 2e-3], c: 1, t: 0.1 },
22621
23260
  { p: [-8.5, 2.75, s * 1.85], c: 0.7, t: 0.09 }
22622
23261
  ],
22623
23262
  { up: "y", n: 8 }
@@ -23060,13 +23699,13 @@ gl_Position = projectionMatrix * mvPosition;
23060
23699
  });
23061
23700
  return out;
23062
23701
  }
23063
- function sandbags(c, x0, x1, y, z, along, rows) {
23702
+ function sandbags(c, x0, x1, y, z, along2, rows) {
23064
23703
  rows = rows || 2;
23065
23704
  for (let r = 0; r < rows; r++) {
23066
23705
  const off = r % 2 ? 0.2 : 0;
23067
23706
  for (let t = x0 + off; t <= x1 + 1e-6; t += 0.42) {
23068
23707
  const j = kit.hash(t, r, z) - 0.5;
23069
- if (along === "z") c.roundBox(0.32, 0.16, 0.42, 0.07, BAG, z, y + r * 0.14, t, { rot: [0, j * 0.2, 0] });
23708
+ if (along2 === "z") c.roundBox(0.32, 0.16, 0.42, 0.07, BAG, z, y + r * 0.14, t, { rot: [0, j * 0.2, 0] });
23070
23709
  else c.roundBox(0.42, 0.16, 0.32, 0.07, BAG, t, y + r * 0.14, z, { rot: [0, j * 0.2, 0] });
23071
23710
  }
23072
23711
  }
@@ -23687,7 +24326,7 @@ gl_Position = projectionMatrix * mvPosition;
23687
24326
  const floor = c.roundBox(L, 0.1, W, 0.02, wood, cx, y0, 0, { def: true });
23688
24327
  c.roundBox(L - 0.1, 0.14, 0.2, 0.02, MT.trim, cx, y0 - 0.12, 0.45);
23689
24328
  c.roundBox(L - 0.1, 0.14, 0.2, 0.02, MT.trim, cx, y0 - 0.12, -0.45);
23690
- for (let xs = x1 + 0.2; xs < x0; xs += 0.55) c.roundBox(0.08, 0.1, W - 0.05, 0.02, MT.trim, xs, y0 - 0.1, 0);
24329
+ for (let xs = x1 + 0.2; xs < x0; xs += 0.55) c.roundBox(0.08, 0.1, W - 0.05, 0.02, MT.trim, xs, y0 - 0.102, 0);
23691
24330
  const sides = [];
23692
24331
  [1, -1].forEach(function(s) {
23693
24332
  const sd = c.roundBox(L, sideH, 0.06, 0.02, wood, cx, y0 + sideH / 2 + 0.05, s * (W / 2 - 0.03), { def: true });
@@ -23698,7 +24337,7 @@ gl_Position = projectionMatrix * mvPosition;
23698
24337
  c.roundBox(L, 0.03, 0.015, 6e-3, CM("#3a3c2e", { roughness: 0.9 }), cx, y0 + 0.05 + sideH * t * 2, s * (W / 2 + 2e-3));
23699
24338
  });
23700
24339
  });
23701
- c.roundBox(0.06, sideH, W, 0.02, wood, x0 - 0.03, y0 + sideH / 2 + 0.05, 0, { def: true });
24340
+ c.roundBox(0.06, sideH, W, 0.02, wood, x0 - 0.028, y0 + sideH / 2 + 0.05, 0, { def: true });
23702
24341
  const tg = c.roundBox(0.06, sideH * 0.7, W - 0.1, 0.02, wood, x1 - 0.02, y0 - sideH * 0.3, 0);
23703
24342
  tg.rotation.z = 0.08;
23704
24343
  const top = y0 + sideH + bowH, yb = y0 + sideH + 0.05, nseg = 20, pos = [], idx = [];
@@ -24092,7 +24731,7 @@ gl_Position = projectionMatrix * mvPosition;
24092
24731
  top: roofY + 0.03,
24093
24732
  k: 0.28,
24094
24733
  holes,
24095
- archInner: W / 2 - ww - 0.1,
24734
+ archInner: W / 2 - ww - 0.098,
24096
24735
  sub: 0.18,
24097
24736
  bev: 0.025
24098
24737
  });
@@ -24425,8 +25064,7 @@ gl_Position = projectionMatrix * mvPosition;
24425
25064
  [1.3, roofY, 0.1],
24426
25065
  [F - 0.04, 1.02, 0.06],
24427
25066
  [F, 0.9, 0.05],
24428
- [2.05, 0.46, 0.06],
24429
- [-1.4, 0.44, 0.04]
25067
+ [2.05, 0.46, 0.06]
24430
25068
  ];
24431
25069
  const arches = axles.map(function(x) {
24432
25070
  return [x, wr, wr + 0.09];
@@ -24504,8 +25142,8 @@ gl_Position = projectionMatrix * mvPosition;
24504
25142
  [1, -1].forEach(function(s) {
24505
25143
  c.roundBox(1.6, 0.16, 0.12, 0.04, OLIVE_STEEL, (axles[1] + axles[2]) / 2, wr, s * (W / 2 - ww - 0.1));
24506
25144
  c.cylinder(0.12, 0.12, 0.2, OLIVE_STEEL, (axles[1] + axles[2]) / 2, wr, s * (W / 2 - ww - 0.1), "z");
24507
- c.roundBox(1, 0.05, 0.32, 0.02, paintMat(c, col), axles[0], 1.12, s * (W / 2 - 0.16), { def: true });
24508
- c.roundBox(2.35, 0.05, 0.32, 0.02, paintMat(c, col), (axles[1] + axles[2]) / 2, 1.12, s * (W / 2 - 0.16), { def: true });
25145
+ c.roundBox(1, 0.05, 0.32, 0.02, paintMat(c, col), axles[0], 1.12, s * (W / 2 - 0.158), { def: true });
25146
+ c.roundBox(2.35, 0.05, 0.32, 0.02, paintMat(c, col), (axles[1] + axles[2]) / 2, 1.12, s * (W / 2 - 0.158), { def: true });
24509
25147
  c.roundBox(1.2, 0.26, 0.28, 0.03, paintMat(c, OLIVE2), -1.45, 1.28, s * (W / 2 - 0.17));
24510
25148
  [-0.95, -1.95].forEach(function(x) {
24511
25149
  c.roundBox(0.3, 0.2, 0.02, 0.01, MT.dark, x, 1.28, s * (W / 2 - 0.025));
@@ -24662,7 +25300,7 @@ gl_Position = projectionMatrix * mvPosition;
24662
25300
  m.kind = "car";
24663
25301
  m.bullet = true;
24664
25302
  const low = c.roundBox(6.6, 0.62, 2, 0.08, paintMat(c, col), -0.1, 0.78, 0, { def: true, sub: 0.3 });
24665
- c.roundBox(0.55, 0.62, 2, 0.06, paintMat(c, col), 3.1, 0.8, 0, { def: true, rot: [0, 0, -0.95] });
25303
+ c.roundBox(0.55, 0.62, 2.004, 0.06, paintMat(c, col), 3.1, 0.8, 0, { def: true, rot: [0, 0, -0.95] });
24666
25304
  const items = [
24667
25305
  [R, 1.05, 0.04],
24668
25306
  [R - 0.02, deckY - 0.04, 0.05],
@@ -24705,7 +25343,7 @@ gl_Position = projectionMatrix * mvPosition;
24705
25343
  (ex0 + ex1) / 2
24706
25344
  );
24707
25345
  scale(c, nB, bcen, 1.45);
24708
- c.roundBox(ex1 - ex0 - 0.1, 0.02, 2.1, 0.01, BAY_LIGHT, bcen.x, 0.95, 0);
25346
+ c.roundBox(ex1 - ex0 - 0.1, 0.012, 2.1, 0.01, BAY_LIGHT, bcen.x, 0.957, 0);
24709
25347
  [1, -1].forEach(function(sd) {
24710
25348
  c.roundBox(ex1 - ex0 - 0.1, 0.55, 0.02, 0.01, BAY_LIGHT, bcen.x, 1.25, sd * 1.08);
24711
25349
  });
@@ -24731,12 +25369,12 @@ gl_Position = projectionMatrix * mvPosition;
24731
25369
  c.roundBox(0.55, 0.42, 0.03, 0.01, MT.rubber, 2.95, 0.86, s * (W / 2 + 0.05));
24732
25370
  c.part("armor", s > 0 ? trl("labels.right_skirt") : trl("labels.left_skirt"), sk, new V3(-0.2, 0.86, s * W / 2), 1.2);
24733
25371
  c.roundBox(0.5, 0.03, 0.6, 0.01, paintMat(c, col), F - 0.25, 1.08, s * tz, { rot: [0, 0, -0.35] });
24734
- c.roundBox(0.03, 0.5, 0.55, 0.01, MT.rubber, R + 0.02, 0.85, s * tz);
25372
+ c.roundBox(0.03, 0.5, 0.55, 0.01, MT.rubber, R + 0.015, 0.85, s * tz);
24735
25373
  star(c, 0.6, 1.3, s * (H.half(1.3) + 0.01), 0.17, s > 0 ? "+z" : "-z", { ring: true });
24736
25374
  c.text(trl("texts.army"), 1, 0.16, -1.5, 1.3, s * (H.half(1.3) + 0.01), s > 0 ? "+z" : "-z", { fg: "#dcdace", size: 0.7 });
24737
25375
  guardedHeadlight(c, 2.95, gl(2.95) + 0.16, s * 1.3, s, { style: "round" });
24738
25376
  c.roundBox(0.1, 0.16, 0.08, 0.02, OLIVE_STEEL, 2.9, gl(2.9) + 0.04, s * 1.3);
24739
- c.roundBox(0.1, 0.18, 0.3, 0.03, OLIVE_STEEL, R - 0.04, 1.35, s * 1.25);
25377
+ c.roundBox(0.1, 0.18, 0.3, 0.03, OLIVE_STEEL, R - 0.037, 1.35, s * 1.25);
24740
25378
  kit.taillight(c, { style: "round2", x: R - 0.08, y: 1.35, z: s * 1.25, w: 0.2, h: 0.09, d: 0.05, side: s });
24741
25379
  c.tube(
24742
25380
  [
@@ -24778,7 +25416,7 @@ gl_Position = projectionMatrix * mvPosition;
24778
25416
  { rot: [0, 0, -0.18] }
24779
25417
  );
24780
25418
  hatch(c, 2.05, roofY - 0.1, -0.78, 0.28, 0, OLIVE_STEEL, { yaw: 0 });
24781
- kit.seat(c, 1.95, 0.62, -0.78, { w: 0.44, h: 0.34, back: 0.5, lean: 0.5, mat: CM("#2f3226", { roughness: 0.9 }) });
25419
+ kit.seat(c, 1.95, 0.62, -0.76, { w: 0.44, h: 0.34, back: 0.5, lean: 0.5, mat: CM("#2f3226", { roughness: 0.9 }) });
24782
25420
  [-0.95, -0.78, -0.61].forEach(function(z, i) {
24783
25421
  periscope(c, 2.3, roofY - 0.08, z, 0.14, i === 1 ? lbl("driver_periscope") : null);
24784
25422
  });
@@ -24900,14 +25538,14 @@ gl_Position = projectionMatrix * mvPosition;
24900
25538
  const g = new THREE.Group();
24901
25539
  g.position.set(x, y, z);
24902
25540
  c.vehicle.add(g);
24903
- const wmsh = new THREE.Mesh(new THREE.CylinderGeometry(rad, rad, w * 0.8, 24), wm);
25541
+ const wmsh = new THREE.Mesh(new THREE.CylinderGeometry(rad, rad, w * (opt.width ?? 0.8), 24), wm);
24904
25542
  wmsh.rotation.x = PI / 2;
24905
25543
  wmsh.castShadow = true;
24906
25544
  g.add(wmsh);
24907
25545
  if (opt.tires)
24908
25546
  [-1, 1].forEach(function(q) {
24909
25547
  const t = new THREE.Mesh(new THREE.TorusGeometry(rad - 0.035, 0.035, 6, 24), MT.rubber);
24910
- t.position.z = q * w * 0.22;
25548
+ t.position.z = q * w * (opt.tireAt ?? 0.22);
24911
25549
  g.add(t);
24912
25550
  });
24913
25551
  const hb = new THREE.Mesh(new THREE.CylinderGeometry(rad * 0.32, rad * 0.32, w * 0.86, 10), MT.steel);
@@ -24924,21 +25562,21 @@ gl_Position = projectionMatrix * mvPosition;
24924
25562
  for (let k = 0; k < 6; k++) {
24925
25563
  const b = new THREE.Mesh(G.roundedBox(rad * 1.5, 0.05, 0.04, 0.01), wm);
24926
25564
  b.rotation.z = k / 6 * PI;
24927
- b.position.z = (z > 0 ? 1 : -1) * w * 0.42;
25565
+ b.position.z = (z > 0 ? 1 : -1) * (w * 0.42 + k * 3e-3);
24928
25566
  g.add(b);
24929
25567
  }
24930
25568
  c.spin.push({ o: g, axis: "z", v: 0, track: true });
24931
25569
  return g;
24932
25570
  }
24933
25571
  for (let i = 0; i < n; i++) wheel(xs + i * sp, r + th, r, { tires: true });
24934
- wheel(x0, yS, rS, { teeth: true });
24935
- wheel(x1, yI, rI, { spokes: true, tires: true });
25572
+ wheel(x0, yS, rS, { teeth: true, width: 0.76 });
25573
+ wheel(x1, yI, rI, { spokes: true, tires: true, width: 0.76, tireAt: 0.2 });
24936
25574
  const topY = function(x) {
24937
25575
  return yS + rS + th / 2 + (yI + rI - yS - rS) * (x - x0) / (x1 - x0);
24938
25576
  };
24939
25577
  for (let q = 0; q < 4; q++) {
24940
25578
  const xr = x0 + (x1 - x0) * (0.2 + q * 0.2);
24941
- wheel(xr, topY(xr) - rr - th / 2 - 0.01, rr, {});
25579
+ wheel(xr, topY(xr) - rr - th / 2 - 0.01, rr, { width: 0.7 });
24942
25580
  }
24943
25581
  const path = [], segs = 12;
24944
25582
  function arc(cx, cy, rad, a0, a1) {
@@ -24962,7 +25600,7 @@ gl_Position = projectionMatrix * mvPosition;
24962
25600
  const curve = new THREE.SplineCurve(pts.concat([pts[0]])), lenT = curve.getLength(), nl = Math.round(lenT / 0.15), links = [];
24963
25601
  for (let l = 0; l < nl; l++) {
24964
25602
  const t = l / nl, p = curve.getPointAt(t), tg = curve.getTangentAt(t), ang = Math.atan2(tg.y, tg.x);
24965
- const lg = G.roundedBox(0.13, th, w, 0.015);
25603
+ const lg = G.roundedBox(0.13, th, w - l % 2 * 4e-3, 0.015);
24966
25604
  lg.applyMatrix4(new THREE.Matrix4().makeRotationZ(ang).setPosition(p.x, p.y, 0));
24967
25605
  links.push(lg);
24968
25606
  const gh2 = G.roundedBox(0.05, 0.05, 0.05, 0.01);
@@ -26376,8 +27014,8 @@ gl_Position = projectionMatrix * mvPosition;
26376
27014
  [-0.3, 0.2].forEach(function(z, index) {
26377
27015
  const spindle = new V3(wx + 0.02, wy, z + 0.02);
26378
27016
  const blade2 = c.rod(spindle, new V3(wx - 0.13, wy + 0.13, z - 0.36), 9e-3, MT.trim);
26379
- const along = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize();
26380
- tagWiper({ context: c, parts: [blade2], spindle, normal: new V3(along.y, -along.x, 0), index });
27017
+ const along2 = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize();
27018
+ tagWiper({ context: c, parts: [blade2], spindle, normal: new V3(along2.y, -along2.x, 0), index });
26381
27019
  });
26382
27020
  if (s.fin !== false)
26383
27021
  c.sphere(0.1, s.roofCol ? c.paint(s.roofCol) : GLOSS, gh.rt + 0.2, roofAt(gh, gh.rt + 0.2) + 0.045, 0, 1, 0.45, 0.28, {
@@ -28666,9 +29304,9 @@ gl_Position = projectionMatrix * mvPosition;
28666
29304
  ],
28667
29305
  col
28668
29306
  );
28669
- lamp(c, { style: "rect", x: 0.57, y: 0.91, z: 0, w: 0.2, h: 0.11, d: 0.08, side: 1, label: trl("labels.headlight") });
29307
+ lamp(c, { style: "rect", x: 0.575, y: 0.91, z: 0, w: 0.2, h: 0.11, d: 0.08, side: 1, label: trl("labels.headlight") });
28670
29308
  c.roundBox(0.1, 0.07, 0.18, 0.02, blk, 0.36, 1.04, 0, { rot: [0, 0, 0.4] });
28671
- c.roundBox(0.02, 0.05, 0.15, 0.01, MT.gauge, 0.39, 1.06, 0, { rot: [0, 0, 0.4] });
29309
+ c.roundBox(0.02, 0.05, 0.15, 0.01, MT.gauge, 0.39, 1.064, 0, { rot: [0, 0, 0.4] });
28672
29310
  handlebar(c, 0.36, 1.03, 0.37, { rise: 0.04, back: 0.06, mat: MT.chrome, stalk: 0.19 });
28673
29311
  [1, -1].forEach(function(s) {
28674
29312
  blinker(c, 0.48, 0.9, s * 0.17, true);
@@ -28870,7 +29508,7 @@ gl_Position = projectionMatrix * mvPosition;
28870
29508
  body(
28871
29509
  c,
28872
29510
  [
28873
- [0.44, 1.13, 0.85, 0.24, 2.6],
29511
+ [0.435, 1.13, 0.85, 0.24, 2.6],
28874
29512
  [0.55, 1.11, 0.87, 0.24, 2.6],
28875
29513
  [0.6, 1.05, 0.91, 0.16, 2.4]
28876
29514
  ],
@@ -29037,7 +29675,7 @@ gl_Position = projectionMatrix * mvPosition;
29037
29675
  body(
29038
29676
  c,
29039
29677
  [
29040
- [0.62, 1.32, 0.98, 0.3, 2.6],
29678
+ [0.615, 1.32, 0.98, 0.3, 2.6],
29041
29679
  [0.72, 1.28, 1, 0.3, 2.6],
29042
29680
  [0.78, 1.2, 1.02, 0.22, 2.4]
29043
29681
  ],
@@ -29968,8 +30606,8 @@ gl_Position = projectionMatrix * mvPosition;
29968
30606
  return b;
29969
30607
  }
29970
30608
  function plateMoto(c, x, y, txt) {
29971
- c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 0.012, y, 0);
29972
- c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x, y, 0, "-x", {
30609
+ c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 9e-3, y, 0);
30610
+ c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 3e-3, y, 0, "-x", {
29973
30611
  w: 300,
29974
30612
  h: 220,
29975
30613
  bg: "#f2f2ee",
@@ -30084,7 +30722,7 @@ gl_Position = projectionMatrix * mvPosition;
30084
30722
  g.add(d);
30085
30723
  for (let q = 0; q < 12; q++) {
30086
30724
  const a2 = q / 12 * PI * 2, sl = new THREE.Mesh(G.roundedBox(rimR * 0.42, 0.016, 6e-3, 5e-3), o.slot || CM("#1c1e21", { metalness: 0.5, roughness: 0.4 }));
30087
- sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 6e-3));
30725
+ sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.0105));
30088
30726
  sl.rotation.z = a2;
30089
30727
  g.add(sl);
30090
30728
  }
@@ -30182,7 +30820,7 @@ gl_Position = projectionMatrix * mvPosition;
30182
30820
  body(
30183
30821
  c,
30184
30822
  [
30185
- [0.34, 0.36, 0.29, 0.28, 2.6],
30823
+ [0.335, 0.36, 0.29, 0.28, 2.6],
30186
30824
  [0.46, 0.38, 0.31, 0.46, 3],
30187
30825
  [0.6, 0.41, 0.34, 0.5, 3],
30188
30826
  [0.74, 0.43, 0.37, 0.46, 2.8],
@@ -30590,7 +31228,7 @@ gl_Position = projectionMatrix * mvPosition;
30590
31228
  body(
30591
31229
  c,
30592
31230
  [
30593
- [0.42, 1.05, 0.82, 0.26, 2.6],
31231
+ [0.415, 1.05, 0.82, 0.26, 2.6],
30594
31232
  [0.52, 1.03, 0.83, 0.28, 2.6],
30595
31233
  [0.59, 0.99, 0.85, 0.22, 2.4],
30596
31234
  [0.62, 0.95, 0.87, 0.1, 2.2]
@@ -30611,7 +31249,7 @@ gl_Position = projectionMatrix * mvPosition;
30611
31249
  });
30612
31250
  c.roundBox(0.015, 0.1, 0.2, 0.02, SMOKEG, 0.55, 1.035, 0, { rot: [0, 0, 0.55] });
30613
31251
  c.roundBox(0.07, 0.03, 0.16, 0.01, CM("#121518", { roughness: 0.25, metalness: 0.3 }), 0.44, 1.07, 0, { rot: [0, 0, 0.5] });
30614
- c.roundBox(0.04, 0.032, 0.1, 6e-3, MT.gauge, 0.45, 1.075, 0, { rot: [0, 0, 0.5] });
31252
+ c.roundBox(0.04, 0.032, 0.1, 6e-3, MT.gauge, 0.45, 1.078, 0, { rot: [0, 0, 0.5] });
30615
31253
  [1, -1].forEach(function(s) {
30616
31254
  blinker(c, 0.5, 0.92, s * 0.16, true);
30617
31255
  });
@@ -31028,7 +31666,7 @@ gl_Position = projectionMatrix * mvPosition;
31028
31666
  });
31029
31667
  c.cylinder(0.12, 0.12, 0.07, CH, 0.2, 0.56, 0.17, "z");
31030
31668
  c.cylinder(0.1, 0.1, 0.012, CM("#9ea3a7", { metalness: 0.55, roughness: 0.35 }), 0.2, 0.56, 0.21, "z");
31031
- c.text("114", 0.1, 0.04, 0.2, 0.56, 0.217, "+z", { fg: "#1b1c1f", size: 0.85 });
31669
+ c.text("114", 0.1, 0.04, 0.2, 0.56, 0.219, "+z", { fg: "#1b1c1f", size: 0.85 });
31032
31670
  c.sphere(0.17, CH, -0.06, 0.32, -0.17, 1.35, 0.85, 0.28);
31033
31671
  c.cylinder(0.07, 0.07, 0.02, CH, -0.02, 0.3, -0.215, "z");
31034
31672
  c.roundBox(0.86, 0.035, 0.02, 0.015, CM("#1a1a1a", { roughness: 0.8 }), -0.43, 0.32, 0.15, { rot: [0, 0, 0] });
@@ -31423,12 +32061,12 @@ gl_Position = projectionMatrix * mvPosition;
31423
32061
  col
31424
32062
  );
31425
32063
  c.roundBox(0.1, 0.07, 0.18, 0.02, blk, 0.36, 1.04, 0, { rot: [0, 0, 0.4] });
31426
- c.roundBox(0.02, 0.05, 0.15, 0.01, MT.gauge, 0.39, 1.06, 0, { rot: [0, 0, 0.4] });
32064
+ c.roundBox(0.02, 0.05, 0.15, 0.01, MT.gauge, 0.39, 1.064, 0, { rot: [0, 0, 0.4] });
31427
32065
  [1, -1].forEach(function(s) {
31428
32066
  blinker(c, 0.48, 0.9, s * 0.17, true);
31429
32067
  });
31430
32068
  Z.fairing = grab(c, n0);
31431
- lamp(c, { style: "rect", x: 0.57, y: 0.91, z: 0, w: 0.2, h: 0.11, d: 0.08, side: 1, label: trl("labels.headlight") });
32069
+ lamp(c, { style: "rect", x: 0.575, y: 0.91, z: 0, w: 0.2, h: 0.11, d: 0.08, side: 1, label: trl("labels.headlight") });
31432
32070
  n0 = c.vehicle.children.length;
31433
32071
  handlebar(c, 0.36, 1.02, 0.36, { rise: 0.03, back: 0.06, mat: MT.chrome, stalk: 0.19 });
31434
32072
  Z.handlebar = grab(c, n0);
@@ -31552,9 +32190,19 @@ gl_Position = projectionMatrix * mvPosition;
31552
32190
  return [s[0], cy - hh, cy + hh, s[3] * k, s[4], s[5]];
31553
32191
  });
31554
32192
  }
32193
+ function stretchSt(st) {
32194
+ const out = st.map(function(q) {
32195
+ return q.slice();
32196
+ });
32197
+ const last = out.length - 1;
32198
+ const dir = out[last][0] >= out[0][0] ? 1 : -1;
32199
+ out[0][0] = out[0][0] + dir * 3e-3;
32200
+ out[last][0] = out[last][0] - dir * 3e-3;
32201
+ return out;
32202
+ }
31555
32203
  function fSkin(c, EA, st, keep, mat, o) {
31556
32204
  o = o || {};
31557
- const m = c.add(EA.fuseGeo(scaleSt(st, o.k || 1.004), { smooth: o.smooth || 48, seg: o.seg || 30 }), mat, 0, 0, 0, o.parent);
32205
+ const m = c.add(EA.fuseGeo(stretchSt(scaleSt(st, o.k || EA.nextSkinScale(c))), { smooth: o.smooth || 48, seg: o.seg || 30 }), mat, 0, 0, 0, o.parent);
31558
32206
  m.castShadow = false;
31559
32207
  cutSub(m, [keep], o.sub || 0.06, o.pre);
31560
32208
  c.deform.push(m);
@@ -31562,7 +32210,7 @@ gl_Position = projectionMatrix * mvPosition;
31562
32210
  }
31563
32211
  function fGlass(c, EA, st, keep, label, type, o) {
31564
32212
  o = o || {};
31565
- const m = new THREE.Mesh(EA.fuseGeo(scaleSt(st, o.k || 0.988), { smooth: o.smooth || 48, seg: o.seg || 30 }), o.mat || MT.glass);
32213
+ const m = new THREE.Mesh(EA.fuseGeo(scaleSt(st, o.k || EA.nextPaneScale(c)), { smooth: o.smooth || 48, seg: o.seg || 30 }), o.mat || MT.glass);
31566
32214
  (o.parent || c.vehicle).add(m);
31567
32215
  cutSub(m, [keep], o.sub || 0.07, o.pre);
31568
32216
  return kit.asGlass(c, m, label, type || "tempered", o.pos ? { pos: o.pos } : {});
@@ -31724,7 +32372,7 @@ gl_Position = projectionMatrix * mvPosition;
31724
32372
  return Math.min(boltW(x) - Math.abs(y - bolt(x)), x + 3.2, 2.93 - x, Math.abs(z) - 0.12);
31725
32373
  }),
31726
32374
  black,
31727
- { parent: grp, sub: 0.05, pre: EA.keepT([-3.3, 3, -0.35, 0.2, 0.1]) }
32375
+ { parent: grp, sub: 0.05, k: 1.013, pre: EA.keepT([-3.3, 3, -0.35, 0.2, 0.1]) }
31728
32376
  );
31729
32377
  const doorR = EA.polySdf([
31730
32378
  [1.38, -0.4],
@@ -31789,7 +32437,7 @@ gl_Position = projectionMatrix * mvPosition;
31789
32437
  };
31790
32438
  const g = EA.foilGeo(
31791
32439
  [
31792
- { p: [1.46, dh(0), 0], c: 1.6, t: 0.12, cam: 0.025, noCap: true },
32440
+ { p: [1.46, dh(0), s * 2e-3], c: 1.6, t: 0.12, cam: 0.025, noCap: true },
31793
32441
  { p: [1.46, dh(2.6), s * 2.6], c: 1.6, t: 0.12, cam: 0.025 },
31794
32442
  { p: [1.46, dh(4.9), s * 4.9], c: 1.6, t: 0.12, cam: 0.025 },
31795
32443
  { p: [1.43, dh(5.18), s * 5.18], c: 1.5, t: 0.11, cam: 0.02 },
@@ -31846,7 +32494,7 @@ gl_Position = projectionMatrix * mvPosition;
31846
32494
  const hs = c.add(
31847
32495
  EA.foilGeo(
31848
32496
  [
31849
- { p: [-2.78, 0.1, 0], c: 0.78, t: 0.07 },
32497
+ { p: [-2.78, 0.1, s * 2e-3], c: 0.78, t: 0.07 },
31850
32498
  { p: [-2.85, 0.1, s * 1.1], c: 0.74, t: 0.07 },
31851
32499
  { p: [-2.95, 0.1, s * 1.36], c: 0.6, t: 0.06 },
31852
32500
  { p: [-3.1, 0.1, s * 1.46], c: 0.32, t: 0.05 }
@@ -32097,7 +32745,7 @@ gl_Position = projectionMatrix * mvPosition;
32097
32745
  EA.sideKeepP(ckP, 0.5, s),
32098
32746
  s > 0 ? lbl("right_flight_deck_window") : lbl("left_flight_deck_window"),
32099
32747
  "tempered",
32100
- { pos: new V3(5.4, 2.25, s * 0.8) }
32748
+ { pos: new V3(5.4, 2.25, s * 0.8), k: 1.0085 }
32101
32749
  );
32102
32750
  fGlass(
32103
32751
  c,
@@ -32151,7 +32799,7 @@ gl_Position = projectionMatrix * mvPosition;
32151
32799
  const w = c.add(
32152
32800
  EA.foilGeo(
32153
32801
  [
32154
- { p: [1.52, dh(0), 0], c: 2.38, t: 0.15, cam: 0.02 },
32802
+ { p: [1.52, dh(0), s * 2e-3], c: 2.38, t: 0.15, cam: 0.02 },
32155
32803
  { p: [1.52, dh(0.86), s * 0.86], c: 2.38, t: 0.15, cam: 0.02 },
32156
32804
  { p: [1.42, dh(2.47), s * 2.47], c: 2.25, t: 0.145, cam: 0.02 },
32157
32805
  { p: [0.98, dh(7.42), s * 7.42], c: 1.4, t: 0.12, cam: 0.02 },
@@ -32286,7 +32934,7 @@ gl_Position = projectionMatrix * mvPosition;
32286
32934
  const hs = c.add(
32287
32935
  EA.foilGeo(
32288
32936
  [
32289
- { p: [-5.95, 2.3, 0], c: 1.55, t: 0.1 },
32937
+ { p: [-5.95, 2.3, s * 2e-3], c: 1.55, t: 0.1 },
32290
32938
  { p: [-6.62, 2.3 + 3.2 * 0.176, s * 3.2], c: 0.86, t: 0.09 }
32291
32939
  ],
32292
32940
  { up: "y", n: 10 }
@@ -32549,7 +33197,7 @@ gl_Position = projectionMatrix * mvPosition;
32549
33197
  const w = c.add(
32550
33198
  EA.foilGeo(
32551
33199
  [
32552
- { p: [1.56, dh(0), 0], c: 1.98, t: 0.15, cam: 0.025, noCap: true },
33200
+ { p: [1.56, dh(0), s * 2e-3], c: 1.98, t: 0.15, cam: 0.025, noCap: true },
32553
33201
  { p: [1.56, dh(3.6), s * 3.6], c: 1.98, t: 0.15, cam: 0.025 },
32554
33202
  { p: [1.38, dh(7.7), s * 7.7], c: 1.3, t: 0.12, cam: 0.02 },
32555
33203
  { p: [1.32, dh(7.94), s * 7.94], c: 1.1, t: 0.06, cam: 0.01 }
@@ -32691,7 +33339,7 @@ gl_Position = projectionMatrix * mvPosition;
32691
33339
  const hs = c.add(
32692
33340
  EA.foilGeo(
32693
33341
  [
32694
- { p: [-4.8, 3.08, 0], c: 1.55, t: 0.1 },
33342
+ { p: [-4.8, 3.08, s * 2e-3], c: 1.55, t: 0.1 },
32695
33343
  { p: [-5.15, 3.08, s * 3.1], c: 1, t: 0.09 }
32696
33344
  ],
32697
33345
  { up: "y", n: 10 }
@@ -32894,7 +33542,7 @@ gl_Position = projectionMatrix * mvPosition;
32894
33542
  EA.sideKeepP(ckP, 0.5, s),
32895
33543
  s > 0 ? lbl("right_flight_deck_side_window") : lbl("left_flight_deck_side_window"),
32896
33544
  "tempered",
32897
- { pos: new V3(3.6, 2, s * 0.78) }
33545
+ { pos: new V3(3.6, 2, s * 0.78), k: 1.0085 }
32898
33546
  );
32899
33547
  fGlass(
32900
33548
  c,
@@ -32922,7 +33570,7 @@ gl_Position = projectionMatrix * mvPosition;
32922
33570
  return Math.min(8e-3 - Math.abs(EA.polySdf(rrect(2.62, 3.25, 0.72, 2.22, 0.12))(x, y)), -z - 0.5);
32923
33571
  }),
32924
33572
  MT.dark,
32925
- { k: 1.003 }
33573
+ { k: 1.0065 }
32926
33574
  );
32927
33575
  void dF;
32928
33576
  EA.fuseSkin(
@@ -32932,7 +33580,7 @@ gl_Position = projectionMatrix * mvPosition;
32932
33580
  return Math.min(0.035 - Math.abs(x - 3.88 - (y - 1.75) * 0.5), y - 1.7, 2.42 - y);
32933
33581
  }),
32934
33582
  blk,
32935
- { k: 1.004 }
33583
+ { k: 1.0065 }
32936
33584
  );
32937
33585
  c.rod(new V3(5, 1.74, 0), new V3(4.05, 2.4, 0), 0.02, blk);
32938
33586
  const fl = 0.8, fab = CM("#c9bda6", { roughness: 0.75 });
@@ -32971,7 +33619,7 @@ gl_Position = projectionMatrix * mvPosition;
32971
33619
  const w = c.add(
32972
33620
  EA.foilGeo(
32973
33621
  [
32974
- { p: [1, dh(0), 0], c: 2.45, t: 0.14, cam: 0.02 },
33622
+ { p: [1, dh(0), s * 2e-3], c: 2.45, t: 0.14, cam: 0.02 },
32975
33623
  { p: [0.95, dh(0.85), s * 0.85], c: 2.42, t: 0.14, cam: 0.02 },
32976
33624
  { p: [0.55, dh(2.4), s * 2.4], c: 1.9, t: 0.13, cam: 0.02 },
32977
33625
  { p: [-0.32, dh(5.75), s * 5.75], c: 1.08, t: 0.11, cam: 0.02 },
@@ -33053,7 +33701,7 @@ gl_Position = projectionMatrix * mvPosition;
33053
33701
  const finB = c.add(
33054
33702
  EA.foilGeo(
33055
33703
  [
33056
- { p: [-3.89, 2.25, 0], c: 2.22, t: 0.115 },
33704
+ { p: [-3.89, 2.253, 0], c: 2.22, t: 0.115 },
33057
33705
  { p: [-5.34, 4.185, 0], c: 1.17, t: 0.105 }
33058
33706
  ],
33059
33707
  { up: "z", n: 10 }
@@ -33076,7 +33724,7 @@ gl_Position = projectionMatrix * mvPosition;
33076
33724
  const hs = c.add(
33077
33725
  EA.foilGeo(
33078
33726
  [
33079
- { p: [-5.3, 4.2, 0], c: 1.18, t: 0.1 },
33727
+ { p: [-5.3, 4.2, s * 2e-3], c: 1.18, t: 0.1 },
33080
33728
  { p: [-5.9, 4.24, s * 2.55], c: 0.62, t: 0.09 }
33081
33729
  ],
33082
33730
  { up: "y", n: 10 }
@@ -33338,7 +33986,7 @@ gl_Position = projectionMatrix * mvPosition;
33338
33986
  [1, -1].forEach(function(s) {
33339
33987
  const g = EA.foilGeo(
33340
33988
  [
33341
- { p: [1.52, dh(0), 0], c: 2.35, t: 0.15, cam: 0.02 },
33989
+ { p: [1.52, dh(0), s * 2e-3], c: 2.35, t: 0.15, cam: 0.02 },
33342
33990
  { p: [1.5, dh(0.48), s * 0.48], c: 2.32, t: 0.15, cam: 0.02 },
33343
33991
  { p: [0.78, dh(5.4), s * 5.4], c: 1.2, t: 0.12, cam: 0.02 },
33344
33992
  { p: [0.74, dh(5.57), s * 5.57], c: 1.1, t: 0.07, cam: 0.01 }
@@ -33443,7 +34091,7 @@ gl_Position = projectionMatrix * mvPosition;
33443
34091
  [1, -1].forEach(function(s) {
33444
34092
  const g = EA.foilGeo(
33445
34093
  [
33446
- { p: [-4.3, 1.72, 0], c: 1.3, t: 0.1 },
34094
+ { p: [-4.3, 1.72, s * 2e-3], c: 1.3, t: 0.1 },
33447
34095
  { p: [-4.72, 1.76, s * 2.2], c: 0.75, t: 0.09 }
33448
34096
  ],
33449
34097
  { up: "y", n: 10 }
@@ -33704,7 +34352,7 @@ gl_Position = projectionMatrix * mvPosition;
33704
34352
  const fl = c.roundBox(L, 0.035, 2 * hw, 0.01, LINER, cx, o.floor, 0);
33705
34353
  for (let k = 0; k < 7; k++) c.roundBox(L - 0.04, 0.018, 0.04, 8e-3, LINER, cx, o.floor + 0.025, -hw * 0.8 + k * hw * 1.6 / 6);
33706
34354
  [1, -1].forEach(function(s) {
33707
- c.roundBox(L, h, 0.025, 0.01, LINER, cx, o.floor + h / 2, s * (hw + 0.012));
34355
+ c.roundBox(L - 8e-3, h, 0.025, 0.01, LINER, cx, o.floor + h / 2, s * (hw + 0.012));
33708
34356
  });
33709
34357
  c.roundBox(0.025, h, 2 * hw, 0.01, LINER, o.x0 + 0.012, o.floor + h / 2, 0);
33710
34358
  c.roundBox(0.03, h + 0.05, 2 * hw + 0.02, 0.01, c.paint(c.meta.color), o.x1 - 0.015, o.floor + (h + 0.05) / 2, 0);
@@ -34600,10 +35248,10 @@ gl_Position = projectionMatrix * mvPosition;
34600
35248
  pre: function(c2, _m) {
34601
35249
  const gx = fX(s, 0.82) - 0.012, gy = 0.82, gh = 0.46, gw = 1.08, tz = 0.8;
34602
35250
  c2.roundBox(0.05, gh, gw, 0.04, MT.chrome, gx, gy, 0, { taper: { sz: tz } });
34603
- c2.roundBox(0.056, gh - 0.1, gw - 0.16, 0.02, GLOSS, gx + 2e-3, gy, 0, { taper: { sz: tz - 0.02 } });
35251
+ c2.roundBox(0.058, gh - 0.1, gw - 0.16, 0.02, GLOSS, gx + 2e-3, gy, 0, { taper: { sz: tz - 0.02 } });
34604
35252
  [0.13, 0.045, -0.04, -0.125].forEach(function(dy) {
34605
35253
  const k = (dy + gh / 2 - 0.05) / (gh - 0.1);
34606
- c2.roundBox(0.06, 0.022, (gw - 0.2) * (1 + (tz - 1) * k), 8e-3, MT.chrome, gx + 4e-3, gy + dy, 0);
35254
+ c2.roundBox(0.066, 0.022, (gw - 0.2) * (1 + (tz - 1) * k), 8e-3, MT.chrome, gx + 4e-3, gy + dy, 0);
34607
35255
  });
34608
35256
  c2.roundBox(0.04, 0.04, 1.32, 0.015, MT.chrome, fX(s, 1.04) - 0.03, 1.04, 0);
34609
35257
  kit.emblem(c2, fX(s, 0.9) + 0.03, 0.9, 0, 0.06);
@@ -34939,9 +35587,9 @@ gl_Position = projectionMatrix * mvPosition;
34939
35587
  pre: function(c2, _m) {
34940
35588
  const gx = fX(s, 0.8) - 0.012, gy = 0.8, gw = 1.14, gh = 0.52;
34941
35589
  c2.roundBox(0.05, gh, gw, 0.04, MT.chrome, gx, gy, 0, { taper: { sz: 0.84 } });
34942
- c2.roundBox(0.056, gh - 0.12, gw - 0.16, 0.02, GLOSS, gx + 2e-3, gy - 0.01, 0, { taper: { sz: 0.82 } });
35590
+ c2.roundBox(0.058, gh - 0.12, gw - 0.16, 0.02, GLOSS, gx + 2e-3, gy - 0.01, 0, { taper: { sz: 0.82 } });
34943
35591
  [0.12, -0.02, -0.14].forEach(function(dy) {
34944
- c2.roundBox(0.06, 0.03, (gw - 0.22) * (1 - (dy + 0.2) * 0.4), 0.01, MT.housing, gx + 4e-3, gy + dy, 0);
35592
+ c2.roundBox(0.066, 0.03, (gw - 0.22) * (1 - (dy + 0.2) * 0.4), 0.01, MT.housing, gx + 4e-3, gy + dy, 0);
34945
35593
  });
34946
35594
  c2.roundBox(0.04, 0.05, 1.3, 0.02, MT.chrome, fX(s, 1.04) - 0.03, 1.04, 0);
34947
35595
  kit.emblem(c2, gx + 0.035, gy + 0.06, 0, 0.06);
@@ -35107,7 +35755,7 @@ gl_Position = projectionMatrix * mvPosition;
35107
35755
  wg.add(bolt);
35108
35756
  }
35109
35757
  for (let sk = 0; sk < 6; sk++) {
35110
- const sa = sk / 6 * PI * 2, hole = new THREE.Mesh(new THREE.CylinderGeometry(rr * 0.13, rr * 0.13, 0.034, 14), MT.hole);
35758
+ const sa = sk / 6 * PI * 2, hole = new THREE.Mesh(new THREE.CylinderGeometry(rr * 0.13, rr * 0.13, 0.03, 14), MT.hole);
35111
35759
  hole.rotation.x = PI / 2;
35112
35760
  hole.position.set(Math.cos(sa) * rr * 0.58, Math.sin(sa) * rr * 0.58, fz + zs * 2e-3);
35113
35761
  wg.add(hole);
@@ -35136,7 +35784,7 @@ gl_Position = projectionMatrix * mvPosition;
35136
35784
  c.rod(new V3(0.6, 2.8, sd * 0.78), new V3(-0.25, 2.8, sd * 0.78), 0.035, red);
35137
35785
  });
35138
35786
  c.rod(new V3(0.6, 2.8, -0.78), new V3(0.6, 2.8, 0.78), 0.035, red);
35139
- c.rod(new V3(-0.25, 2.8, -0.78), new V3(-0.25, 2.8, 0.78), 0.035, red);
35787
+ c.rod(new V3(-0.25, 2.8, -0.78), new V3(-0.25, 2.8, 0.78), 0.032, red);
35140
35788
  c.rod(new V3(-0.25, 2.3, -0.8), new V3(-0.25, 2.8, 0.78), 0.03, red);
35141
35789
  const roofItems = [c.roundBox(0.16, 0.05, 1.3, 0.02, MT.trim, 0.42, m.top + 0.08, 0)];
35142
35790
  [-0.48, -0.16, 0.16, 0.48].forEach(function(z) {
@@ -35717,8 +36365,8 @@ gl_Position = projectionMatrix * mvPosition;
35717
36365
  );
35718
36366
  const zz = sd * (kit.halfAt(W, m.tumble, 1.75) + 0.012), zt = sd * (kit.halfAt(W, m.tumble, 2.22) + 0.012);
35719
36367
  c2.text("RESGATE", 1.2, 0.3, sd > 0 ? -1.5 : -0.85, 2.22, zt, sd > 0 ? "+z" : "-z", { fg: red });
35720
- [0, PI / 3, -PI / 3].forEach(function(a) {
35721
- c2.roundBox(0.09, 0.36, 0.01, 0.01, blu, -2.25, 1.75, zz, { rot: [0, 0, a] });
36368
+ [0, PI / 3, -PI / 3].forEach(function(a, i) {
36369
+ c2.roundBox(0.09, 0.36, 0.01, 0.01, blu, -2.25, 1.75, zz + sd * i * 25e-4, { rot: [0, 0, a] });
35722
36370
  });
35723
36371
  });
35724
36372
  if (c2.hood) {
@@ -36068,9 +36716,31 @@ gl_Position = projectionMatrix * mvPosition;
36068
36716
  if (o.col) colorize(g, o.col);
36069
36717
  return g;
36070
36718
  }
36719
+ function stretchEnds(st, by) {
36720
+ const out = st.map(function(q) {
36721
+ return q.slice();
36722
+ });
36723
+ const last = out.length - 1;
36724
+ const dir = out[last][0] >= out[0][0] ? 1 : -1;
36725
+ out[0][0] = out[0][0] - dir * by;
36726
+ out[last][0] = out[last][0] + dir * by;
36727
+ return out;
36728
+ }
36729
+ const paneCount = /* @__PURE__ */ new WeakMap();
36730
+ function nextPaneScale(c) {
36731
+ const n = paneCount.get(c) ?? 0;
36732
+ paneCount.set(c, n + 1);
36733
+ return 0.988 - 35e-4 * (n % 4);
36734
+ }
36735
+ const skinCount = /* @__PURE__ */ new WeakMap();
36736
+ function nextSkinScale(c) {
36737
+ const n = skinCount.get(c) ?? 0;
36738
+ skinCount.set(c, n + 1);
36739
+ return 1.004 + 25e-4 * (n % 3);
36740
+ }
36071
36741
  function fuseGlass(c, st, keep, label, type, o) {
36072
36742
  o = o || {};
36073
- const k = o.k || 0.988;
36743
+ const k = o.k || nextPaneScale(c);
36074
36744
  const st2 = st.map(function(s) {
36075
36745
  const cy = (s[1] + s[2]) / 2, hh = (s[2] - s[1]) / 2 * k;
36076
36746
  return [s[0], cy - hh, cy + hh, s[3] * k, s[4], s[5]];
@@ -36083,12 +36753,12 @@ gl_Position = projectionMatrix * mvPosition;
36083
36753
  }
36084
36754
  function fuseSkin(c, st, keep, mat, o) {
36085
36755
  o = o || {};
36086
- const k = o.k || 1.004;
36756
+ const k = o.k || nextSkinScale(c);
36087
36757
  const st2 = st.map(function(s) {
36088
36758
  const cy = (s[1] + s[2]) / 2, hh = (s[2] - s[1]) / 2 * k;
36089
36759
  return [s[0], cy - hh, cy + hh, s[3] * k, s[4], s[5]];
36090
36760
  });
36091
- const m = c.add(fuseGeo(st2, { smooth: o.smooth || 48, seg: o.seg || 30 }), mat, 0, 0, 0, o.parent);
36761
+ const m = c.add(fuseGeo(stretchEnds(st2, -3e-3), { smooth: o.smooth || 48, seg: o.seg || 30 }), mat, 0, 0, 0, o.parent);
36092
36762
  m.castShadow = false;
36093
36763
  kit.cutMesh(m, [keep], 40);
36094
36764
  c.deform.push(m);
@@ -36359,7 +37029,7 @@ gl_Position = projectionMatrix * mvPosition;
36359
37029
  }
36360
37030
  ;
36361
37031
  (o.screens || []).forEach(function(s) {
36362
- const sc = c.roundBox(0.012, s[2], s[3], 8e-3, MT.screen, x - 0.085, y + s[0], s[1]);
37032
+ const sc = c.roundBox(0.012, s[2], s[3], 8e-3, MT.screen, x - 0.091, y + s[0], s[1]);
36363
37033
  sc.castShadow = false;
36364
37034
  });
36365
37035
  }
@@ -36399,7 +37069,7 @@ gl_Position = projectionMatrix * mvPosition;
36399
37069
  );
36400
37070
  c.roundBox(0.42 * k, 0.07 * k, 0.33 * k, 0.03 * k, CM(o.band || "#2a2c30", { roughness: 0.5 }), -0.2 * k - 0.05, -0.02 * k, 0, P);
36401
37071
  c.roundBox(0.17 * k, shaft, 0.11 * k, 0.04 * k, low, -0.16 * k, -shaft / 2 - 0.02, 0, P);
36402
- c.roundBox(0.36 * k, 0.018, 0.2 * k, 8e-3, low, -0.17 * k, -shaft - 0.01, 0, P);
37072
+ c.roundBox(0.36 * k, 0.018, 0.2 * k, 8e-3, low, -0.17 * k, -shaft - 6e-3, 0, P);
36403
37073
  c.cylinder(0.055 * k, 0.05 * k, 0.32 * k, low, -0.2 * k, -shaft - 0.09 * k, 0, "x", P);
36404
37074
  c.roundBox(0.16 * k, 0.12 * k, 0.025, 0.01, low, -0.18 * k, -shaft - 0.17 * k, 0, P);
36405
37075
  const pr = propeller(c, -0.38 * k, -shaft - 0.09 * k, 0, {
@@ -36431,7 +37101,11 @@ gl_Position = projectionMatrix * mvPosition;
36431
37101
  function skinOf(c, mesh2, keep, mat, o) {
36432
37102
  o = o || {};
36433
37103
  const g = mesh2.geometry.clone(), p = g.attributes.position, sz = o.sz || 1.006, dy = o.dy || 0;
37104
+ let reach = 0;
37105
+ for (let i = 0; i < p.count; i++) reach = Math.max(reach, Math.abs(p.getX(i)));
37106
+ const sx = o.ends === false ? 1 : 1 - 3e-3 / (reach || 1);
36434
37107
  for (let i = 0; i < p.count; i++) {
37108
+ p.setX(i, p.getX(i) * sx);
36435
37109
  p.setZ(i, p.getZ(i) * sz);
36436
37110
  p.setY(i, p.getY(i) + dy * Math.sign(p.getY(i)));
36437
37111
  }
@@ -36545,6 +37219,8 @@ gl_Position = projectionMatrix * mvPosition;
36545
37219
  foilGeo,
36546
37220
  fuseGeo,
36547
37221
  fuseGlass,
37222
+ nextPaneScale,
37223
+ nextSkinScale,
36548
37224
  fuseSkin,
36549
37225
  bandT,
36550
37226
  cutT,
@@ -36693,7 +37369,7 @@ gl_Position = projectionMatrix * mvPosition;
36693
37369
  const tank = c.roundBox(0.48, 0.24, 0.3, 0.06, CM("#a3241c", { roughness: 0.5 }), -2.05, 0.06, -0.38);
36694
37370
  c.rod(new V3(-2, 0.18, -0.38), new V3(-2.3, 0.4, -0.1), 0.01, CM("#1b1b1b"));
36695
37371
  c.roundBox(1.8, 0.03, 0.1, 0.01, MT.wood, -0.6, 0, 0.5, { rot: [0.3, 0, 0] });
36696
- c.roundBox(0.35, 0.03, 0.14, 0.02, MT.wood, 0.45, 0, 0.5, { rot: [0.3, 0, 0] });
37372
+ c.roundBox(0.35, 0.03, 0.14, 0.02, MT.wood, 0.45, 4e-3, 0.5, { rot: [0.3, 0, 0] });
36697
37373
  c.rod(new V3(-2.35, 0.42, 0.6), new V3(-2.35, 1.1, 0.6), 0.012, MT.chrome);
36698
37374
  EA.navLight(c, -2.35, 1.13, 0.6, "white", trl("labels.stern_light_mast"), { r: 0.035 });
36699
37375
  EA.navLight(c, 2.3, 0.53, 0.06, "green", trl("labels.starboard_bow_light_green"), { r: 0.03 });
@@ -36870,7 +37546,7 @@ gl_Position = projectionMatrix * mvPosition;
36870
37546
  c.roundBox(2.3, 0.22, 0.5, 0.07, vinyl, -2.3, 0.45, s * 0.75);
36871
37547
  c.roundBox(2.3, 0.4, 0.12, 0.05, vinyl, -2.3, 0.72, s * (H.half(-2.3, 0.7) - 0.08));
36872
37548
  });
36873
- c.roundBox(0.5, 0.22, 1.5, 0.07, vinyl, -3.35, 0.45, 0);
37549
+ c.roundBox(0.5, 0.22, 1.5, 0.07, vinyl, -3.35, 0.453, 0);
36874
37550
  c.roundBox(0.12, 0.42, 2.1, 0.05, vinyl, -3.52, 0.74, 0);
36875
37551
  c.seatTops.push(
36876
37552
  { x: -2.3, y: 0.57, z: 0.75, w: 0.5, l: 2.2 },
@@ -36878,8 +37554,8 @@ gl_Position = projectionMatrix * mvPosition;
36878
37554
  { x: 2, y: 0.57, z: 0, w: 1.2, l: 0.9 }
36879
37555
  );
36880
37556
  const cy = 0.22;
36881
- c.roundBox(0.85, 0.72, 0.78, 0.12, white, 0.75, cy + 0.36, 0.72);
36882
- c.roundBox(0.85, 0.72, 0.72, 0.12, white, 0.75, cy + 0.36, -0.74);
37557
+ c.roundBox(0.85, 0.72, 0.78, 0.12, white, 0.75, cy + 0.362, 0.72);
37558
+ c.roundBox(0.85, 0.72, 0.72, 0.12, white, 0.75, cy + 0.362, -0.74);
36883
37559
  c.roundBox(0.42, 0.04, 0.7, 0.015, CM("#18191b", { roughness: 0.7 }), 0.95, cy + 0.74, 0.72, { rot: [0, 0, -0.35] });
36884
37560
  [0.55, 0.72, 0.89].forEach(function(z, i) {
36885
37561
  c.cylinder(0.045, 0.045, 0.012, MT.gauge, 0.93 + (i === 1 ? 0.05 : 0), cy + 0.79, z, null, { seg: 16 }).rotation.set(0, 0, 1.22);
@@ -36890,8 +37566,8 @@ gl_Position = projectionMatrix * mvPosition;
36890
37566
  c.rod(new V3(0.62, cy + 0.72, 0.62), new V3(0.55, cy + 0.82, 0.62), 0.02, MT.chrome);
36891
37567
  c.rod(new V3(0.55, cy + 0.7, 0.98), new V3(0.42, cy + 0.88, 1), 0.015, MT.chrome);
36892
37568
  c.sphere(0.035, MT.plastic, 0.42, cy + 0.9, 1);
36893
- kit.seat(c, -0.1, cy, 0.72, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false });
36894
- kit.seat(c, -0.1, cy, -0.74, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false });
37569
+ kit.seat(c, -0.1, cy + 2e-3, 0.72, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false });
37570
+ kit.seat(c, -0.1, cy + 2e-3, -0.74, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false });
36895
37571
  [1, -1].forEach(function(s) {
36896
37572
  const pts = [];
36897
37573
  for (let i = 0; i <= 8; i++) {
@@ -37113,7 +37789,7 @@ gl_Position = projectionMatrix * mvPosition;
37113
37789
  [1.6, -0.55],
37114
37790
  [1.95, -1]
37115
37791
  ].forEach(function(q) {
37116
- c.roundBox(0.42, 0.24, 0.32, 0.03, CM("#3f6fa0", { roughness: 0.6 }), q[0], dk(q[0]) + 0.12, q[1]);
37792
+ c.roundBox(0.42, 0.24, 0.32, 0.03, CM("#3f6fa0", { roughness: 0.6 }), q[0], dk(q[0]) + 0.128 + (q[0] > 1.9 ? 4e-3 : 0), q[1]);
37117
37793
  });
37118
37794
  const hx = -2.7, hy0 = dk(hx), hh = 1.9, hw2 = 1.1, cas = c.roundBox(2, hh, hw2 * 2, 0.08, wht, hx, hy0 + hh / 2, 0, { def: true });
37119
37795
  const cutF = {
@@ -37202,11 +37878,11 @@ gl_Position = projectionMatrix * mvPosition;
37202
37878
  c.rod(new V3(0, 0, 0), new V3(0, Math.cos(a8) * 0.36, Math.sin(a8) * 0.36), 0.014, MT.wood, { parent: whl });
37203
37879
  }
37204
37880
  c.cylinder(0.05, 0.05, 0.14, MT.wood, 0.06, 0, 0, "x", { parent: whl });
37205
- kit.seat(c, hx - 0.05, hy0, 0, { w: 0.5, h: 0.55, back: 0.45, mat: inner2, headrest: false });
37881
+ kit.seat(c, hx - 0.05, hy0 + 2e-3, 0, { w: 0.5, h: 0.55, back: 0.45, mat: inner2, headrest: false });
37206
37882
  c.roundBox(1.8, 0.12, 0.65, 0.04, CM("#7c5a3b"), hx - 0.2, hy0 + 0.5, -0.72);
37207
37883
  c.roundBox(1.7, 0.08, 0.55, 0.04, CM("#6b7c8f", { roughness: 1 }), hx - 0.2, hy0 + 0.6, -0.72);
37208
37884
  c.roundBox(1.9, 0.02, 2.1, 0.01, inner2, hx, hy0 + hh - 0.06, 0).castShadow = false;
37209
- c.cylinder(0.1, 0.1, 1.2, MT.trim, hx - 0.75, hy0 + hh + 0.6, 0.65);
37885
+ c.cylinder(0.1, 0.1, 1.2, MT.trim, hx - 0.75, hy0 + hh + 0.596, 0.65);
37210
37886
  c.cylinder(0.13, 0.1, 0.1, MT.trim, hx - 0.75, hy0 + hh + 1.22, 0.65);
37211
37887
  c.rod(new V3(hx + 0.4, hy0 + hh + 0.1, 0), new V3(hx + 0.4, hy0 + hh + 1.6, 0), 0.04, wood);
37212
37888
  EA.navLight(c, hx + 0.4, hy0 + hh + 1.65, 0, "white", trl("labels.masthead_light"), { r: 0.05 });
@@ -37307,7 +37983,7 @@ gl_Position = projectionMatrix * mvPosition;
37307
37983
  const EA = shared2.EA, white = "#ecebe6";
37308
37984
  const paintW = c.paint(white);
37309
37985
  const ST = [
37310
- [2.3, 0.98, 1.46, 0.7, 2.4],
37986
+ [2.297, 0.98, 1.46, 0.7, 2.4],
37311
37987
  [2.15, 0.88, 1.55, 0.92, 2.6],
37312
37988
  [1.85, 0.8, 1.61, 1.02, 2.8],
37313
37989
  [1.45, 0.72, 1.65, 1.08, 3],
@@ -37436,7 +38112,7 @@ gl_Position = projectionMatrix * mvPosition;
37436
38112
  };
37437
38113
  const g = EA.foilGeo(
37438
38114
  [
37439
- { p: [0.66, dh(0), 0], c: 1.63, t: 0.12, cam: 0.02 },
38115
+ { p: [0.66, dh(0), s * 2e-3], c: 1.63, t: 0.12, cam: 0.02 },
37440
38116
  { p: [0.66, dh(2.6), s * 2.6], c: 1.63, t: 0.12, cam: 0.02 },
37441
38117
  { p: [0.62, dh(5.2), s * 5.2], c: 1.14, t: 0.11, cam: 0.02 },
37442
38118
  { p: [0.58, dh(5.5) + 0.02, s * 5.5], c: 0.98, t: 0.06, cam: 0.01 }
@@ -37475,7 +38151,7 @@ gl_Position = projectionMatrix * mvPosition;
37475
38151
  const hs = c.add(
37476
38152
  EA.foilGeo(
37477
38153
  [
37478
- { p: [-4.6, 1.42, 0], c: 1.2, t: 0.09 },
38154
+ { p: [-4.6, 1.42, s * 2e-3], c: 1.2, t: 0.09 },
37479
38155
  { p: [-4.95, 1.42, s * 1.72], c: 0.86, t: 0.08 }
37480
38156
  ],
37481
38157
  { up: "y", n: 10 }
@@ -37726,7 +38402,7 @@ gl_Position = projectionMatrix * mvPosition;
37726
38402
  const w = c.add(
37727
38403
  EA.foilGeo(
37728
38404
  [
37729
- { p: [1.18, dh(0), 0], c: 1.71, t: 0.15, cam: 0.02 },
38405
+ { p: [1.18, dh(0), s * 2e-3], c: 1.71, t: 0.15, cam: 0.02 },
37730
38406
  { p: [1.18, dh(5.6), s * 5.6], c: 1.71, t: 0.14, cam: 0.02 },
37731
38407
  { p: [1.12, dh(5.84) + 0.02, s * 5.84], c: 1.55, t: 0.07, cam: 0.01 }
37732
38408
  ],
@@ -37760,7 +38436,7 @@ gl_Position = projectionMatrix * mvPosition;
37760
38436
  const hs = c.add(
37761
38437
  EA.foilGeo(
37762
38438
  [
37763
- { p: [-2.95, 0.36, 0], c: 0.95, t: 0.09 },
38439
+ { p: [-2.95, 0.36, s * 2e-3], c: 0.95, t: 0.09 },
37764
38440
  { p: [-3.05, 0.36, s * 1.8], c: 0.8, t: 0.08 }
37765
38441
  ],
37766
38442
  { up: "y", n: 10 }
@@ -37792,8 +38468,8 @@ gl_Position = projectionMatrix * mvPosition;
37792
38468
  const finB = c.add(
37793
38469
  EA.foilGeo(
37794
38470
  [
37795
- { p: [-2.64, 0.42, 0], c: 1.27, t: 0.11 },
37796
- { p: [-3.24, 1.85, 0], c: 0.74, t: 0.1 }
38471
+ { p: [-2.64, 0.424, 0], c: 1.27, t: 0.11 },
38472
+ { p: [-3.24, 1.853, 0], c: 0.74, t: 0.1 }
37797
38473
  ],
37798
38474
  { up: "z", n: 10 }
37799
38475
  ),
@@ -38063,10 +38739,11 @@ gl_Position = projectionMatrix * mvPosition;
38063
38739
  EA.sideKeepP(fdP, 0.35, s),
38064
38740
  s > 0 ? lbl("front_right_door_window") : lbl("front_left_door_window"),
38065
38741
  "tempered",
38066
- { pos: new V3(0.4, 1.5, s * 0.64) }
38742
+ { pos: new V3(0.4, 1.5, s * 0.64), k: 0.988 }
38067
38743
  );
38068
38744
  EA.fuseGlass(c, ST, EA.sideKeepP(rdP, 0.35, s), s > 0 ? lbl("rear_right_door_window") : lbl("rear_left_door_window"), "tempered", {
38069
- pos: new V3(-0.5, 1.5, s * 0.63)
38745
+ pos: new V3(-0.5, 1.5, s * 0.63),
38746
+ k: 0.988
38070
38747
  });
38071
38748
  const df = EA.polySdf([
38072
38749
  [0.78, 0.72],
@@ -38162,7 +38839,7 @@ gl_Position = projectionMatrix * mvPosition;
38162
38839
  const hs = c.add(
38163
38840
  EA.foilGeo(
38164
38841
  [
38165
- { p: [-5.25, 1.76, 0], c: 0.45, t: 0.1 },
38842
+ { p: [-5.25, 1.76, s * 2e-3], c: 0.45, t: 0.1 },
38166
38843
  { p: [-5.32, 1.76, s * 0.62], c: 0.34, t: 0.09 }
38167
38844
  ],
38168
38845
  { up: "y", n: 8 }
@@ -38490,7 +39167,7 @@ gl_Position = projectionMatrix * mvPosition;
38490
39167
  const hs = c.add(
38491
39168
  EA.foilGeo(
38492
39169
  [
38493
- { p: [-5.3, 1.98, 0], c: 0.6, t: 0.11 },
39170
+ { p: [-5.3, 1.98, s * 2e-3], c: 0.6, t: 0.11 },
38494
39171
  { p: [-5.38, 1.98, s * 1], c: 0.52, t: 0.1 }
38495
39172
  ],
38496
39173
  { up: "y", n: 8 }
@@ -38688,7 +39365,10 @@ gl_Position = projectionMatrix * mvPosition;
38688
39365
  hasSunroof: (key) => !!options.sunroofs?.includes(key),
38689
39366
  register(spec, build) {
38690
39367
  if (!groups.has(spec.group) || only && !only.has(spec.key) || skip.has(spec.key)) return;
38691
- kit.register({ ...spec, seedKey: legacyVehicleSeeds[spec.key] }, build);
39368
+ kit.register({ ...spec, seedKey: legacyVehicleSeeds[spec.key] }, (context, vehicleKit) => {
39369
+ build(context, vehicleKit);
39370
+ separateSpokes(context);
39371
+ });
38692
39372
  }
38693
39373
  };
38694
39374
  }
@@ -38820,6 +39500,21 @@ gl_Position = projectionMatrix * mvPosition;
38820
39500
  };
38821
39501
  return allowance;
38822
39502
  }
39503
+ var UINT32 = 2 ** 32;
39504
+ var PHASE_SALT = 1597463007;
39505
+ var SEED_BITS = new DataView(new ArrayBuffer(8));
39506
+ var hashLamp = (seed, x, z) => {
39507
+ SEED_BITS.setFloat64(0, seed);
39508
+ let h = 2166136261;
39509
+ for (const value of [SEED_BITS.getUint32(0), SEED_BITS.getUint32(4), Math.round(x * 100), Math.round(z * 100)]) {
39510
+ h ^= value & 65535;
39511
+ h = Math.imul(h, 16777619);
39512
+ h ^= value >>> 16 & 65535;
39513
+ h = Math.imul(h, 16777619);
39514
+ }
39515
+ return (h >>> 0) / UINT32;
39516
+ };
39517
+ var flickerPhaseOf = (x, z) => hashLamp(PHASE_SALT, x, z) * 2 * Math.PI;
38823
39518
  var ROOT2 = -1;
38824
39519
  var DEFAULT_CYLINDER_SEGMENTS = 14;
38825
39520
  var DEFAULT_CONE_SEGMENTS = 6;
@@ -38836,6 +39531,7 @@ gl_Position = projectionMatrix * mvPosition;
38836
39531
  const box2 = (x, y, z, width, height, depth, color2, o = {}) => {
38837
39532
  const part = { shape: "box", parent: o.parent ?? ROOT2, x, y: y + height / 2, z, width, height, depth, color: color2, emissive: o.emissive ?? false, ry: o.ry ?? 0, rz: o.rz ?? 0, radius: boxRadius(width, height, depth) };
38838
39533
  if (o.style) part.style = o.style;
39534
+ if (o.flickerPhase !== void 0) part.flickerPhase = o.flickerPhase;
38839
39535
  parts.push(part);
38840
39536
  };
38841
39537
  const cylinder2 = (x, y, z, radiusTop, radiusBottom, height, color2, parent = ROOT2, segments = DEFAULT_CYLINDER_SEGMENTS, style) => {
@@ -38899,51 +39595,82 @@ gl_Position = projectionMatrix * mvPosition;
38899
39595
  const scene = () => ({ parts, items, windows });
38900
39596
  return { random, pick, lights, parts, items, windows, group, box: box2, cylinder: cylinder2, cone: cone2, prism, plane: plane2, vault, terrain, crown, line, label, light, spot, place, item, fence, add: add2, scene };
38901
39597
  }
39598
+ var DEFAULT_POLE_SLOTS = {
39599
+ height: 11,
39600
+ embedment: 1.7,
39601
+ bands: { mv: [9, 9.25], transformer: [7.7, 8.7], lv: [7.1, 7.4], lighting: [6.5, 6.8], telecom: [5.7, 6.1] }
39602
+ };
39603
+ var DISTRIBUTION = {
39604
+ mast: { radiusTop: 0.12, radiusBottom: 0.22, height: 9.3, color: 9079428, segments: 4 },
39605
+ arm: { reach: 1, y: 6.7, width: 2, height: 0.1, depth: 0.1, color: 6974054 },
39606
+ lamp: { reach: 2, y: 6.55, width: 0.5, height: 0.16, depth: 0.3 },
39607
+ lens: { lit: 16752704, unlit: 3815994 },
39608
+ light: { color: 16751168, intensity: 1.3, distance: 20, y: 6.4 },
39609
+ transformer: { offset: 0.45, y: 7.7, radius: 0.32, height: 1, color: 5922402, segments: 8 },
39610
+ slots: DEFAULT_POLE_SLOTS
39611
+ };
38902
39612
  var on = (o) => o.on ?? true;
39613
+ var lensOf = (o, parent) => ({
39614
+ emissive: on(o),
39615
+ ...parent === void 0 ? {} : { parent },
39616
+ ...on(o) && o.flicker ? { flickerPhase: flickerPhaseOf(o.x, o.z) } : {}
39617
+ });
39618
+ var along = (o, reach) => ({ x: o.x + reach * Math.cos(o.ry ?? 0), z: o.z - reach * Math.sin(o.ry ?? 0) });
38903
39619
  function drawMast(b, mast, x, z, parent = -1) {
38904
39620
  b.cylinder(x, 0, z, mast.radiusTop, mast.radiusBottom, mast.height, mast.color, parent, mast.segments, mast.style);
38905
39621
  }
38906
39622
  function spendLight(b, light, x, z, o) {
38907
- if (on(o) && b.lights.take()) b.light({ x: x + (light.reach ?? 0), y: light.y, z: z + (light.z ?? 0), color: light.color, intensity: light.intensity, distance: light.distance, flicker: o.flicker ?? false });
39623
+ const ry = o.ry ?? 0;
39624
+ const [reach, side] = [light.reach ?? 0, light.z ?? 0];
39625
+ if (on(o) && b.lights.take()) b.light({ x: x + reach * Math.cos(ry) + side * Math.sin(ry), y: light.y, z: z - reach * Math.sin(ry) + side * Math.cos(ry), color: light.color, intensity: light.intensity, distance: light.distance, flicker: o.flicker ?? false, ...o.flicker ? { flickerPhase: flickerPhaseOf(o.x, o.z) } : {} });
38908
39626
  }
38909
39627
  var doubleArm = (b, spec, o) => {
38910
39628
  const group = b.group(o.x, 0, o.z, o.ry ?? 0);
38911
39629
  drawMast(b, spec.mast, 0, 0, group);
38912
39630
  for (const side of [-1, 1]) {
38913
39631
  b.box(side * spec.arm.reach, spec.arm.y, 0, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color, { parent: group });
38914
- b.box(side * spec.lamp.reach, spec.lamp.y, 0, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { parent: group, emissive: on(o) });
39632
+ b.box(side * spec.lamp.reach, spec.lamp.y, 0, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, lensOf(o, group));
38915
39633
  }
38916
- spendLight(b, spec.light, o.x, o.z, o);
39634
+ spendLight(b, spec.light, o.x, o.z, { ...o, ry: 0 });
38917
39635
  };
38918
39636
  var singleArm = (b, spec, o) => {
38919
39637
  const dir = o.dir ?? 1;
39638
+ const ry = o.ry ?? 0;
39639
+ const arm = along(o, dir * spec.arm.reach);
39640
+ const lamp = along(o, dir * spec.lamp.reach);
39641
+ const drum = along(o, -dir * spec.transformer.offset);
38920
39642
  drawMast(b, spec.mast, o.x, o.z);
38921
- b.box(o.x + dir * spec.arm.reach, spec.arm.y, o.z, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color);
38922
- b.box(o.x + dir * spec.lamp.reach, spec.lamp.y, o.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) });
38923
- if (o.transformer) b.cylinder(o.x - dir * spec.transformer.offset, spec.transformer.y, o.z, spec.transformer.radius, spec.transformer.radius, spec.transformer.height, spec.transformer.color, -1, spec.transformer.segments);
39643
+ b.box(arm.x, spec.arm.y, arm.z, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color, { ry });
39644
+ b.box(lamp.x, spec.lamp.y, lamp.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { ...lensOf(o), ry });
39645
+ if (o.transformer) b.cylinder(drum.x, spec.transformer.y, drum.z, spec.transformer.radius, spec.transformer.radius, spec.transformer.height, spec.transformer.color, -1, spec.transformer.segments);
38924
39646
  spendLight(b, { ...spec.light, reach: dir * (spec.light.reach ?? spec.lamp.reach) }, o.x, o.z, o);
38925
39647
  };
38926
39648
  var lantern = (b, spec, o) => {
39649
+ const lamp = along(o, spec.lamp.reach);
38927
39650
  drawMast(b, spec.mast, o.x, o.z);
38928
- b.box(o.x + spec.lamp.reach, spec.lamp.y, o.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) });
39651
+ b.box(lamp.x, spec.lamp.y, lamp.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { ...lensOf(o), ry: o.ry ?? 0 });
38929
39652
  b.cone(o.x, spec.cap.y, o.z, spec.cap.radius, spec.cap.height, spec.cap.color, -1, spec.cap.segments);
38930
39653
  spendLight(b, spec.light, o.x, o.z, o);
38931
39654
  };
38932
39655
  var crossarm = (b, spec, o) => {
39656
+ const ry = o.ry ?? 0;
39657
+ const arm = along(o, spec.arm.reach);
39658
+ const lamp = along(o, spec.lamp.reach);
38933
39659
  drawMast(b, spec.mast, o.x, o.z);
38934
- b.box(o.x + spec.arm.reach, spec.arm.y, o.z, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color);
38935
- b.box(o.x + spec.lamp.reach, spec.lamp.y, o.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) });
39660
+ b.box(arm.x, spec.arm.y, arm.z, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color, { ry });
39661
+ b.box(lamp.x, spec.lamp.y, lamp.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { ...lensOf(o), ry });
38936
39662
  spendLight(b, { ...spec.light, reach: spec.light.reach ?? spec.lamp.reach }, o.x, o.z, o);
38937
39663
  };
38938
39664
  var floodTower = (b, spec, o) => {
38939
39665
  for (const a of [-1, 1]) for (const c of [-1, 1]) b.box(o.x + a * spec.legs.offset, 0, o.z + c * spec.legs.offset, spec.legs.size, spec.legs.height, spec.legs.size, spec.legs.color);
38940
39666
  b.box(o.x + spec.deck.reach, spec.deck.y, o.z, spec.deck.width, spec.deck.height, spec.deck.depth, spec.deck.color);
38941
39667
  for (let index = 0; index < spec.heads.count; index++) {
38942
- b.box(o.x + spec.heads.start + index * spec.heads.spacing, spec.heads.y, o.z + spec.heads.z, spec.heads.width, spec.heads.height, spec.heads.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) });
39668
+ b.box(o.x + spec.heads.start + index * spec.heads.spacing, spec.heads.y, o.z + spec.heads.z, spec.heads.width, spec.heads.height, spec.heads.depth, on(o) ? spec.lens.lit : spec.lens.unlit, lensOf(o));
38943
39669
  }
38944
39670
  spendLight(b, spec.light, o.x, o.z, o);
38945
39671
  };
38946
- var POLE_SHAPES = { double_arm: doubleArm, single_arm: singleArm, lantern, crossarm, flood_tower: floodTower };
39672
+ var distribution = (b, spec, o) => singleArm(b, spec, o);
39673
+ var POLE_SHAPES = { double_arm: doubleArm, single_arm: singleArm, lantern, crossarm, flood_tower: floodTower, distribution };
38947
39674
  var LED = {
38948
39675
  mast: { radiusTop: 0.1, radiusBottom: 0.14, height: 9, color: 5593438, style: { metalness: 0.6, roughness: 0.5 } },
38949
39676
  arm: { reach: 0.8, y: 8.8, width: 1.6, height: 0.1, depth: 0.12, color: 5593438 },
@@ -38985,7 +39712,8 @@ gl_Position = projectionMatrix * mvPosition;
38985
39712
  { id: "concrete_arm", shape: "single_arm", spec: CONCRETE },
38986
39713
  { id: "cast_iron", shape: "lantern", spec: IRON },
38987
39714
  { id: "wood_crossarm", shape: "crossarm", spec: WOOD },
38988
- { id: "flood_tower", shape: "flood_tower", spec: FLOOD }
39715
+ { id: "flood_tower", shape: "flood_tower", spec: FLOOD },
39716
+ { id: "concrete_distribution", shape: "distribution", spec: DISTRIBUTION }
38989
39717
  ];
38990
39718
  var DEFAULT_ROAD_STYLE = { color: 2237480, dash: { color: 9404239, every: 5, first: 2, length: 1.8, width: 0.16, height: 0.01, y: 0.025 } };
38991
39719
  var DEFAULT_WALK_STYLE = { color: 3816252, height: 0.15, castShadow: false };
@@ -38994,9 +39722,9 @@ gl_Position = projectionMatrix * mvPosition;
38994
39722
  var DEFAULT_GROUND_SIZE = 600;
38995
39723
  var roadStyle = (o) => ({ ...DEFAULT_ROAD_STYLE, ...o?.road, dash: { ...DEFAULT_ROAD_STYLE.dash, ...o?.road?.dash } });
38996
39724
  var walkStyle = (o) => ({ ...DEFAULT_WALK_STYLE, ...o?.walk });
38997
- function drawRoad(b, x, z, w, l, along, options) {
39725
+ function drawRoad(b, x, z, w, l, along2, options) {
38998
39726
  const style = roadStyle(options);
38999
- const alongX = along === "x";
39727
+ const alongX = along2 === "x";
39000
39728
  b.plane(x, ROAD_LEVEL, z, alongX ? l : w, alongX ? w : l, style.color);
39001
39729
  const { dash } = style;
39002
39730
  for (let u = -l / 2 + dash.first; u < l / 2; u += dash.every) {
@@ -39200,12 +39928,12 @@ gl_Position = projectionMatrix * mvPosition;
39200
39928
  for (const side of [-1.5, 1.5]) b.box(x + side, 8.2, z, 0.15, 1.6, 0.15, palette2.deck);
39201
39929
  if (searchlight) b.spot({ x, y: 9, z, color: 15134463, intensity: 2.4, distance: 70, decay: 1.2, angle: 0.35, penumbra: 0.5, target: { x: x + 20, y: 0, z: z + 20 }, sweep: { speed: 0.5, radius: 25 } });
39202
39930
  }
39203
- function drawSandbags(b, x, z, length, along, rows = 3, c) {
39931
+ function drawSandbags(b, x, z, length, along2, rows = 3, c) {
39204
39932
  const color2 = colors(c).sandbags;
39205
39933
  for (let r = 0; r < rows; r++) {
39206
39934
  for (let i = 0; i < length / SANDBAG_LENGTH; i++) {
39207
39935
  const u = -length / 2 + 0.28 + i * SANDBAG_LENGTH + r % 2 * 0.28;
39208
- b.item(along === "x" ? x + u : x, r * 0.21, along === "x" ? z : z + u, along === "x" ? 0.55 : 0.32, 0.22, along === "x" ? 0.32 : 0.55, color2);
39936
+ b.item(along2 === "x" ? x + u : x, r * 0.21, along2 === "x" ? z : z + u, along2 === "x" ? 0.55 : 0.32, 0.22, along2 === "x" ? 0.32 : 0.55, color2);
39209
39937
  }
39210
39938
  }
39211
39939
  }
@@ -40189,7 +40917,7 @@ gl_Position = projectionMatrix * mvPosition;
40189
40917
  const core = {
40190
40918
  poles,
40191
40919
  streets: {
40192
- road: (b, x, z, w, l, along) => drawRoad(b, x, z, w, l, along, options.streets),
40920
+ road: (b, x, z, w, l, along2) => drawRoad(b, x, z, w, l, along2, options.streets),
40193
40921
  walk: (b, x, z, w, d) => drawWalk(b, x, z, w, d, options.streets),
40194
40922
  ground: drawGround,
40195
40923
  grid: (b, g) => drawStreetGrid(b, g.block, g.count, g.width, options.streets)
@@ -40206,7 +40934,7 @@ gl_Position = projectionMatrix * mvPosition;
40206
40934
  tree: (b, x, z, scale) => drawTree(b, x, z, scale, propColors),
40207
40935
  container: drawContainer,
40208
40936
  watchtower: (b, x, z, searchlight) => drawWatchtower(b, x, z, searchlight, propColors),
40209
- sandbags: (b, x, z, length, along, rows) => drawSandbags(b, x, z, length, along, rows, propColors),
40937
+ sandbags: (b, x, z, length, along2, rows) => drawSandbags(b, x, z, length, along2, rows, propColors),
40210
40938
  label: (b, x, z, title, subtitle) => drawStripLabel(b, x, z, title, subtitle, propColors),
40211
40939
  wires: (b, points, y, color2) => drawWires(b, points, y, color2, propColors)
40212
40940
  }
@@ -40551,7 +41279,7 @@ gl_Position = projectionMatrix * mvPosition;
40551
41279
  var VIEW_FAR = 600;
40552
41280
  var GRID = { block: 36, count: 2, width: 10 };
40553
41281
  var LAMP_SHARES = { pattern: void 0, all: 1, half: 0.5, none: 0 };
40554
- var isMesh = (o) => o.isMesh === true;
41282
+ var isMesh2 = (o) => o.isMesh === true;
40555
41283
  function createUrbanTestModule(options = {}) {
40556
41284
  const locale = (options.locale ?? "pt-BR").toLowerCase().startsWith("en") ? "en" : "pt-BR";
40557
41285
  const text2 = TEXT[locale];
@@ -40746,7 +41474,7 @@ gl_Position = projectionMatrix * mvPosition;
40746
41474
  for (const entry of roots()) {
40747
41475
  entry.root.traverse((o) => {
40748
41476
  if (o.isLight) lights += 1;
40749
- if (!isMesh(o) || o.userData.helper) return;
41477
+ if (!isMesh2(o) || o.userData.helper) return;
40750
41478
  for (let p = o; p; p = p.parent) if (p.visible === false) return;
40751
41479
  drawCalls += 1;
40752
41480
  const instanced = o.isInstancedMesh === true;