@adatechnology/game-urban-three 0.5.7 → 0.5.9

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.
@@ -269,7 +269,7 @@ var GameUrbanThree = (() => {
269
269
  }
270
270
  var EFFECT_STEP_SECONDS = 1 / 50;
271
271
 
272
- // ../game-shapes/dist/chunk-E3X7UDDV.js
272
+ // ../game-shapes/dist/chunk-QETSTM6M.js
273
273
  function canonicalJson(value) {
274
274
  if (value === null) return "null";
275
275
  if (typeof value === "number") return Object.is(value, -0) ? "-0" : Number.isFinite(value) ? String(value) : JSON.stringify(String(value));
@@ -2368,8 +2368,8 @@ var GameUrbanThree = (() => {
2368
2368
 
2369
2369
  // src/text.ts
2370
2370
  var FIT = 0.92;
2371
- function createTextTexture(THREE, document, lines, o) {
2372
- const canvas = document.createElement("canvas");
2371
+ function createTextTexture(THREE, document2, lines, o) {
2372
+ const canvas = document2.createElement("canvas");
2373
2373
  canvas.width = o.width;
2374
2374
  canvas.height = o.height;
2375
2375
  const g = canvas.getContext("2d");
@@ -5145,6 +5145,242 @@ var GameUrbanThree = (() => {
5145
5145
  }
5146
5146
  var engine = defaultFloorplan();
5147
5147
 
5148
+ // ../game-vehicles/dist/index.js
5149
+ var DIVISION_HALF = 0.02;
5150
+ var GLASS_IN_FROM_EDGE = 0.03;
5151
+ var CUT_EPS = 1e-6;
5152
+ var PAST_EDGE_MIN = 0.01;
5153
+ var PANE_MIN_AREA = 8e-3;
5154
+ var PANE_MIN_WIDTH = 0.12;
5155
+ function carDoorEdges(fb, rb, pillars, xr, rr) {
5156
+ const doorF = fb - 0.03;
5157
+ const pil = pillars.slice().sort((a, b) => b - a);
5158
+ const first = pil[0];
5159
+ const B = first !== void 0 && first < doorF - 0.45 && first > rb + 0.2 ? first : Math.max(rb + 0.1, doorF - 1.1);
5160
+ const rearDoor = first !== void 0 && first < doorF - 0.45 && B - Math.max(rb, xr) > 0.5;
5161
+ const second = pil[1];
5162
+ const C = rearDoor ? Math.max(second !== void 0 && second < B - 0.4 ? second : rb, xr + rr * 0.2) : B;
5163
+ return { doorF, B, C, rearDoor };
5164
+ }
5165
+ function doorEdgesOf(gh, wheels) {
5166
+ let xr = Infinity;
5167
+ let rr = 0.3;
5168
+ for (const w of wheels) {
5169
+ const x = w[0];
5170
+ const r = w[1];
5171
+ if (typeof x === "number" && x < xr) {
5172
+ xr = x;
5173
+ rr = typeof r === "number" ? r : 0.3;
5174
+ }
5175
+ }
5176
+ if (!Number.isFinite(xr)) {
5177
+ if (gh.pillars.length) return null;
5178
+ xr = -Infinity;
5179
+ }
5180
+ return carDoorEdges(gh.fb, gh.rb, gh.pillars, xr, rr);
5181
+ }
5182
+ var SEAM_SNAP = 0.1;
5183
+ var SEAM_INSIDE = 4e-3;
5184
+ function seamOnDoorEdge(x, edges) {
5185
+ if (!edges) return x;
5186
+ let best = x;
5187
+ let gap = SEAM_SNAP;
5188
+ const lines = [edges.doorF - SEAM_INSIDE, edges.B, edges.C === edges.B ? edges.C : edges.C + SEAM_INSIDE];
5189
+ for (let i = 0; i < lines.length; i++) {
5190
+ const d = Math.abs([edges.doorF, edges.B, edges.C][i] - x);
5191
+ if (d <= gap) [best, gap] = [lines[i], d];
5192
+ }
5193
+ return best;
5194
+ }
5195
+ function doorGlassSplits(gh, wheels) {
5196
+ const edges = doorEdgesOf(gh, wheels);
5197
+ if (!edges) return [];
5198
+ return [{ at: edges.C + GLASS_IN_FROM_EDGE - DIVISION_HALF, front: edges.rearDoor ? edges.B : edges.doorF }];
5199
+ }
5200
+ function clipPoly(poly, at, keep) {
5201
+ const out = [];
5202
+ const inside = (p) => keep * ((p[0] ?? 0) - at) >= 0;
5203
+ for (let i = 0; i < poly.length; i++) {
5204
+ const a = poly[i];
5205
+ const b = poly[(i + 1) % poly.length];
5206
+ const ina = inside(a);
5207
+ const inb = inside(b);
5208
+ if (ina) out.push([a[0], a[1]]);
5209
+ if (ina !== inb) {
5210
+ const t = (at - a[0]) / (b[0] - a[0]);
5211
+ out.push([at, a[1] + t * (b[1] - a[1])]);
5212
+ }
5213
+ }
5214
+ return out;
5215
+ }
5216
+ function areaOf2(poly) {
5217
+ let a = 0;
5218
+ for (let i = 0; i < poly.length; i++) {
5219
+ const p = poly[i];
5220
+ const q = poly[(i + 1) % poly.length];
5221
+ a += p[0] * q[1] - q[0] * p[1];
5222
+ }
5223
+ return Math.abs(a) / 2;
5224
+ }
5225
+ function widthOf(poly) {
5226
+ const xs = poly.map((p) => p[0]);
5227
+ return Math.max(...xs) - Math.min(...xs);
5228
+ }
5229
+ function splitSidePolys(polys, splits) {
5230
+ let out = polys.map((p) => p.map((q) => [...q]));
5231
+ const used = [];
5232
+ for (const { at, front: doorFront } of splits) {
5233
+ const next = [];
5234
+ let cut = false;
5235
+ for (const poly of out) {
5236
+ const xs = poly.map((p) => p[0]);
5237
+ const edge = at + DIVISION_HALF - GLASS_IN_FROM_EDGE;
5238
+ const middle = (Math.min(...xs) + Math.max(...xs)) / 2;
5239
+ if (Math.min(...xs) >= edge - PAST_EDGE_MIN || Math.max(...xs) <= edge + CUT_EPS || middle <= edge || middle >= doorFront) {
5240
+ next.push(poly);
5241
+ continue;
5242
+ }
5243
+ cut = true;
5244
+ const rear = clipPoly(poly, at - DIVISION_HALF, -1);
5245
+ const front = clipPoly(poly, at + DIVISION_HALF, 1);
5246
+ if (rear.length >= 3 && areaOf2(rear) >= PANE_MIN_AREA && widthOf(rear) >= PANE_MIN_WIDTH) next.push(rear);
5247
+ if (front.length >= 3) next.push(front);
5248
+ }
5249
+ if (cut) used.push(at);
5250
+ out = next;
5251
+ }
5252
+ return { polys: out, used };
5253
+ }
5254
+ var SmokeCause = { STEAM: "steam", OIL: "oil", FIRE: "fire" };
5255
+ var SMOKE_LOOKS = {
5256
+ [SmokeCause.STEAM]: { color: 14870248, alpha: 0.18 },
5257
+ [SmokeCause.OIL]: { color: 11120306, alpha: 0.2 },
5258
+ [SmokeCause.FIRE]: { color: 2302756, alpha: 0.3 }
5259
+ };
5260
+ var CAUSE_OF_EMITTER = { white: SmokeCause.STEAM, oil: SmokeCause.OIL, black: SmokeCause.FIRE };
5261
+ var LIFT = { [SmokeCause.STEAM]: 0.5, [SmokeCause.OIL]: 0.45, [SmokeCause.FIRE]: 0.6 };
5262
+ var LID_OUTWARD = [-Math.SQRT1_2, Math.SQRT1_2, 0];
5263
+ var cabin_default = {
5264
+ source: "Spec 012 (R6, T0.2) \u2014 SAE J1100 interior packaging & ISO 7250-1 / NASA-STD-3000 adult anthropometry (1.80 m seated height = 0.936 m, buttock-knee = 0.612 m, shoulder = 0.468 m)",
5265
+ entryDuckFactor: 0.44,
5266
+ categories: {
5267
+ passenger_car: {
5268
+ frontHeadroomMetres: 0.95,
5269
+ rearHeadroomMetres: 0.9,
5270
+ frontLegroomMetres: 0.62,
5271
+ widthMetres: 0.52,
5272
+ door: { widthMetres: 0.65, heightMetres: 0.8 }
5273
+ },
5274
+ suv_pickup: {
5275
+ frontHeadroomMetres: 0.98,
5276
+ rearHeadroomMetres: 0.93,
5277
+ frontLegroomMetres: 0.64,
5278
+ widthMetres: 0.54,
5279
+ door: { widthMetres: 0.7, heightMetres: 0.82 }
5280
+ },
5281
+ van: {
5282
+ frontHeadroomMetres: 1.05,
5283
+ rearHeadroomMetres: 1.05,
5284
+ frontLegroomMetres: 0.65,
5285
+ widthMetres: 0.54,
5286
+ door: { widthMetres: 0.75, heightMetres: 0.95 }
5287
+ },
5288
+ truck: {
5289
+ frontHeadroomMetres: 1,
5290
+ rearHeadroomMetres: 1,
5291
+ frontLegroomMetres: 0.62,
5292
+ widthMetres: 0.52,
5293
+ door: { widthMetres: 0.65, heightMetres: 0.85 }
5294
+ },
5295
+ bus: {
5296
+ frontHeadroomMetres: 1.2,
5297
+ rearHeadroomMetres: 1.2,
5298
+ frontLegroomMetres: 0.62,
5299
+ widthMetres: 0.5,
5300
+ door: { widthMetres: 0.7, heightMetres: 1.75 }
5301
+ },
5302
+ agricultural: {
5303
+ frontHeadroomMetres: 1.05,
5304
+ rearHeadroomMetres: null,
5305
+ frontLegroomMetres: 0.62,
5306
+ widthMetres: 0.52,
5307
+ door: { widthMetres: 0.65, heightMetres: 0.9 }
5308
+ },
5309
+ military_light: {
5310
+ frontHeadroomMetres: 0.95,
5311
+ rearHeadroomMetres: 0.92,
5312
+ frontLegroomMetres: 0.62,
5313
+ widthMetres: 0.5,
5314
+ door: { widthMetres: 0.6, heightMetres: 0.8 }
5315
+ },
5316
+ military_armored: {
5317
+ frontHeadroomMetres: 0.88,
5318
+ rearHeadroomMetres: 0.88,
5319
+ frontLegroomMetres: 0.58,
5320
+ widthMetres: 0.46,
5321
+ door: { widthMetres: 0.5, heightMetres: 0.55 }
5322
+ },
5323
+ open_vehicle: {
5324
+ frontHeadroomMetres: null,
5325
+ rearHeadroomMetres: null,
5326
+ frontLegroomMetres: null,
5327
+ widthMetres: null,
5328
+ door: null
5329
+ },
5330
+ boat_cabin: {
5331
+ frontHeadroomMetres: 1.05,
5332
+ rearHeadroomMetres: 1.05,
5333
+ frontLegroomMetres: 0.62,
5334
+ widthMetres: 0.52,
5335
+ door: { widthMetres: 0.6, heightMetres: 0.9 }
5336
+ },
5337
+ aircraft_enclosed: {
5338
+ frontHeadroomMetres: 0.95,
5339
+ rearHeadroomMetres: 0.92,
5340
+ frontLegroomMetres: 0.62,
5341
+ widthMetres: 0.48,
5342
+ door: { widthMetres: 0.55, heightMetres: 0.8 }
5343
+ }
5344
+ }
5345
+ };
5346
+ var CABIN_CATEGORIES = [
5347
+ "passenger_car",
5348
+ "suv_pickup",
5349
+ "van",
5350
+ "truck",
5351
+ "bus",
5352
+ "agricultural",
5353
+ "military_light",
5354
+ "military_armored",
5355
+ "open_vehicle",
5356
+ "boat_cabin",
5357
+ "aircraft_enclosed"
5358
+ ];
5359
+ var toClearance = (value) => value === null ? Number.POSITIVE_INFINITY : value;
5360
+ var toCabinMinimum = (category, raw) => {
5361
+ if (category === "open_vehicle") {
5362
+ return {
5363
+ frontHeadroomMetres: Number.POSITIVE_INFINITY,
5364
+ rearHeadroomMetres: Number.POSITIVE_INFINITY,
5365
+ frontLegroomMetres: Number.POSITIVE_INFINITY,
5366
+ widthMetres: Number.POSITIVE_INFINITY,
5367
+ door: void 0
5368
+ };
5369
+ }
5370
+ return {
5371
+ frontHeadroomMetres: toClearance(raw.frontHeadroomMetres),
5372
+ rearHeadroomMetres: raw.rearHeadroomMetres === null ? void 0 : raw.rearHeadroomMetres,
5373
+ frontLegroomMetres: toClearance(raw.frontLegroomMetres),
5374
+ widthMetres: toClearance(raw.widthMetres),
5375
+ door: raw.door === null ? void 0 : { widthMetres: raw.door.widthMetres, heightMetres: raw.door.heightMetres }
5376
+ };
5377
+ };
5378
+ var CABIN_SOURCE = cabin_default.source;
5379
+ var ENTRY_DUCK_FACTOR = cabin_default.entryDuckFactor;
5380
+ var CABIN_MINIMUMS = Object.fromEntries(
5381
+ CABIN_CATEGORIES.map((category) => [category, toCabinMinimum(category, cabin_default.categories[category])])
5382
+ );
5383
+
5148
5384
  // ../game-vehicles-fleet/dist/index.js
5149
5385
  var cars = [
5150
5386
  "compact_hatch",
@@ -10731,6 +10967,7 @@ var GameUrbanThree = (() => {
10731
10967
  };
10732
10968
  return K;
10733
10969
  }
10970
+ const glassDivisions = /* @__PURE__ */ new WeakMap();
10734
10971
  function car(c, s) {
10735
10972
  const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
10736
10973
  m.color = s.col;
@@ -10765,6 +11002,9 @@ var GameUrbanThree = (() => {
10765
11002
  let polys = windows(gh);
10766
11003
  if (s.dropRear) polys = polys.slice(1);
10767
11004
  if (gh.polys) polys = gh.polys(polys);
11005
+ const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
11006
+ polys = divided.polys;
11007
+ glassDivisions.set(c, divided.used);
10768
11008
  const qf = kit.quadDef([gh.fb, gh.belt], [gh.ft, gh.roof], gh.Wg, T, "front", bev, { side: gh.qfSide }), qr = kit.quadDef([gh.rb, gh.belt], [gh.rt, roofR], gh.Wg, T, "rear", bev, { side: gh.qrSide });
10769
11009
  const gHoles = [];
10770
11010
  if (intr) {
@@ -10830,6 +11070,8 @@ var GameUrbanThree = (() => {
10830
11070
  rb: gh.rb,
10831
11071
  rt: gh.rt,
10832
11072
  roof: gh.roof + 0.02,
11073
+ roofRear: (gh.roofR || gh.roof) + 0.02,
11074
+ roofCrown: gh.crown || 0,
10833
11075
  belt: gh.belt,
10834
11076
  floor: s.bottomY + 0.02,
10835
11077
  seatH: 0.12,
@@ -10924,19 +11166,25 @@ var GameUrbanThree = (() => {
10924
11166
  K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
10925
11167
  const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
10926
11168
  [1, -1].forEach(function(sd) {
10927
- ;
10928
- (s.blackPillars || []).forEach(function(px) {
11169
+ const bar = function(px, width) {
10929
11170
  const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
10930
- c.roundBox(0.118, hh, 3e-3, 15e-4, GLOSS, px, yc, sd * (halfAt(gh.Wg, T, yc) + 4e-3), { rot: [-sd * tang, 0, 0] }).castShadow = false;
11171
+ const m2 = c.roundBox(width, hh, 3e-3, 15e-4, GLOSS, px, yc, sd * (halfAt(gh.Wg, T, yc) + 4e-3), { rot: [-sd * tang, 0, 0] });
11172
+ m2.castShadow = false;
11173
+ return m2;
11174
+ };
11175
+ (s.blackPillars || []).forEach((px) => bar(px, 0.118));
11176
+ (glassDivisions.get(c) ?? []).forEach((px) => {
11177
+ bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
10931
11178
  });
10932
11179
  const mx = gh.fb - 0.22, my = gh.belt + 0.09, mz0 = halfAt(gh.Wg, T, my), mcol = s.mirrorCol ? CM(s.mirrorCol, { roughness: 0.4, metalness: 0.3 }) : paint;
10933
11180
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
10934
11181
  c.roundBox(0.12, 0.12, 0.2, 0.05, mcol, mx, my + 0.02, sd * (mz0 + 0.14), { taper: { sx: 0.8, shift: -0.01 } });
10935
11182
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
10936
11183
  if (s.mirrorBlink !== false) c.roundBox(0.02, 0.012, 0.12, 5e-3, MT.amber, mx + 0.03, my - 0.025, sd * (mz0 + 0.17));
11184
+ const edges = doorEdgesOf(gh, s.wheels ?? []);
10937
11185
  (s.seams || []).forEach(function(q) {
10938
- const r = q, x = r.length ? r[0] : q, y0 = r.length ? r[1] : by + 0.09, y1 = r.length ? r[2] : gh.belt - 0.03;
10939
- c.roundBox(8e-3, y1 - y0, 6e-3, 3e-3, MT.dark, x, (y0 + y1) / 2, sd * (hw + 1e-3));
11186
+ const r = q, x = seamOnDoorEdge(r.length ? r[0] : q, edges), y0 = r.length ? r[1] : by + 0.09, y1 = r.length ? r[2] : gh.belt - 0.03;
11187
+ doorSeam(c, S, sd, x, y0, y1);
10940
11188
  });
10941
11189
  (s.handles || []).forEach(function(x) {
10942
11190
  c.roundBox(
@@ -11091,6 +11339,18 @@ var GameUrbanThree = (() => {
11091
11339
  c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
11092
11340
  c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
11093
11341
  }
11342
+ const SEAM_POINTS = 14;
11343
+ function doorSeam(c, S, sd, x, y0, y1) {
11344
+ const pts = [];
11345
+ for (let k = 0; k <= SEAM_POINTS; k++) {
11346
+ const y = y0 + (y1 - y0) * k / SEAM_POINTS, h = S.hit(new V3(x, y, sd * (S.hw + 1)), new V3(0, 0, -sd), "M");
11347
+ pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, y, sd * (S.hw + 1e-3)));
11348
+ }
11349
+ const t = c.tube(pts, 3e-3, MT.dark, { seg: SEAM_POINTS, rs: 4 });
11350
+ t.castShadow = false;
11351
+ t.userData.doorSeam = true;
11352
+ return t;
11353
+ }
11094
11354
  function sm(t) {
11095
11355
  t = clamp4(t, 0, 1);
11096
11356
  return t * t * (3 - 2 * t);
@@ -11678,7 +11938,8 @@ var GameUrbanThree = (() => {
11678
11938
  [1.75, 0.8],
11679
11939
  [0.6, 0.82],
11680
11940
  [-0.6, 0.835],
11681
- [-1.82, 0.85]
11941
+ // it ends where the taillight wraps onto the side, never running into the lamp
11942
+ [-1.6, 0.845]
11682
11943
  ],
11683
11944
  { col: hex, h: 0.024 }
11684
11945
  );
@@ -12655,7 +12916,7 @@ var GameUrbanThree = (() => {
12655
12916
  frameR: 9e-3
12656
12917
  });
12657
12918
  const e = K.grid(1, 0, { z1: 0.1, y0: 0.64, y1: 0.72, du: 0.03, dv: 0.03 }).at(0.5, 0.67);
12658
- kit.emblem(c2, e.p.x + 0.025, 0.67, 0, 0.045);
12919
+ kit.emblem(c2, e.p.x + 0.018, 0.67, 0, 0.045);
12659
12920
  const bg = c2.meta.frontBumper.userData.grid;
12660
12921
  c2.deform.push(K.skin(bg, MT.rubber, { u0: 0.02, u1: 0.98, yb: 0.37, yt: 0.405, off: 0.02, nv: 1 }));
12661
12922
  },
@@ -19817,6 +20078,7 @@ var GameUrbanThree = (() => {
19817
20078
  };
19818
20079
  return K;
19819
20080
  }
20081
+ const glassDivisions = /* @__PURE__ */ new WeakMap();
19820
20082
  function car(c, s) {
19821
20083
  const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
19822
20084
  m.color = s.col;
@@ -19850,6 +20112,9 @@ var GameUrbanThree = (() => {
19850
20112
  ghItems.push([gh.ft, gh.roof, gh.r2 || 0.2], [gh.fb, gh.belt - 0.1, 0]);
19851
20113
  let polys = windows(gh);
19852
20114
  if (s.dropRear) polys = polys.slice(1);
20115
+ const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
20116
+ polys = divided.polys;
20117
+ glassDivisions.set(c, divided.used);
19853
20118
  const qf = kit.quadDef([gh.fb, gh.belt], [gh.ft, gh.roof], gh.Wg, T, "front", bev), qr = kit.quadDef([gh.rb, gh.belt], [gh.rt, roofR], gh.Wg, T, "rear", bev);
19854
20119
  const gHoles = [];
19855
20120
  if (intr) {
@@ -19910,6 +20175,8 @@ var GameUrbanThree = (() => {
19910
20175
  rb: gh.rb,
19911
20176
  rt: gh.rt,
19912
20177
  roof: gh.roof + 0.02,
20178
+ roofRear: (gh.roofR || gh.roof) + 0.02,
20179
+ roofCrown: gh.crown || 0,
19913
20180
  belt: gh.belt,
19914
20181
  floor: s.bottomY + 0.02,
19915
20182
  seatH: 0.12,
@@ -20002,18 +20269,25 @@ var GameUrbanThree = (() => {
20002
20269
  K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
20003
20270
  const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
20004
20271
  [1, -1].forEach(function(sd) {
20005
- ;
20006
- (s.blackPillars || []).forEach(function(px) {
20272
+ const bar = function(px, width) {
20007
20273
  const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
20008
- c.roundBox(0.118, hh, 3e-3, 15e-4, GLOSS, px, yc, sd * (halfAt(gh.Wg, T, yc) + 4e-3), { rot: [-sd * tang, 0, 0] }).castShadow = false;
20274
+ const m2 = c.roundBox(width, hh, 3e-3, 15e-4, GLOSS, px, yc, sd * (halfAt(gh.Wg, T, yc) + 4e-3), { rot: [-sd * tang, 0, 0] });
20275
+ m2.castShadow = false;
20276
+ return m2;
20277
+ };
20278
+ (s.blackPillars || []).forEach((px) => bar(px, 0.118));
20279
+ (glassDivisions.get(c) ?? []).forEach((px) => {
20280
+ bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
20009
20281
  });
20010
20282
  const mx = gh.fb - 0.22, my = gh.belt + 0.09, mz0 = halfAt(gh.Wg, T, my), mcol = s.mirrorCol ? CM(s.mirrorCol, { roughness: 0.4, metalness: 0.3 }) : paint;
20011
20283
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
20012
20284
  c.roundBox(0.12, 0.12, 0.2, 0.05, mcol, mx, my + 0.02, sd * (mz0 + 0.14), { taper: { sx: 0.8, shift: -0.01 } });
20013
20285
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
20014
20286
  if (s.mirrorBlink !== false) c.roundBox(0.02, 0.012, 0.12, 5e-3, MT.amber, mx + 0.03, my - 0.025, sd * (mz0 + 0.17));
20015
- (s.seams || []).forEach(function(x) {
20016
- c.roundBox(8e-3, gh.belt - by - 0.12, 6e-3, 3e-3, MT.dark, x, (gh.belt + by) / 2 + 0.03, sd * (hw + 1e-3));
20287
+ const edges = doorEdgesOf(gh, s.wheels ?? []);
20288
+ (s.seams || []).forEach(function(x0) {
20289
+ const x = seamOnDoorEdge(x0, edges);
20290
+ doorSeam(c, S, sd, x, by + 0.09, gh.belt - 0.03);
20017
20291
  });
20018
20292
  (s.handles || []).forEach(function(x) {
20019
20293
  c.roundBox(
@@ -20155,6 +20429,18 @@ var GameUrbanThree = (() => {
20155
20429
  c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
20156
20430
  c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
20157
20431
  }
20432
+ const SEAM_POINTS = 14;
20433
+ function doorSeam(c, S, sd, x, y0, y1) {
20434
+ const pts = [];
20435
+ for (let k = 0; k <= SEAM_POINTS; k++) {
20436
+ const y = y0 + (y1 - y0) * k / SEAM_POINTS, h = S.hit(new V3(x, y, sd * (S.hw + 1)), new V3(0, 0, -sd), "M");
20437
+ pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, y, sd * (S.hw + 1e-3)));
20438
+ }
20439
+ const t = c.tube(pts, 3e-3, MT.dark, { seg: SEAM_POINTS, rs: 4 });
20440
+ t.castShadow = false;
20441
+ t.userData.doorSeam = true;
20442
+ return t;
20443
+ }
20158
20444
  function sm(t) {
20159
20445
  t = clamp4(t, 0, 1);
20160
20446
  return t * t * (3 - 2 * t);
@@ -23654,8 +23940,8 @@ var GameUrbanThree = (() => {
23654
23940
  return b;
23655
23941
  }
23656
23942
  function plateMoto(c, x, y, txt) {
23657
- c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 9e-3, y, 0);
23658
- c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 3e-3, y, 0, "-x", {
23943
+ c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 7e-3, y, 0);
23944
+ c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 5e-3, y, 0, "-x", {
23659
23945
  w: 300,
23660
23946
  h: 220,
23661
23947
  bg: "#f2f2ee",
@@ -23769,8 +24055,8 @@ var GameUrbanThree = (() => {
23769
24055
  d.position.z = s * hw * 0.72;
23770
24056
  g.add(d);
23771
24057
  for (let q = 0; q < 12; q++) {
23772
- 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 }));
23773
- sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.0105));
24058
+ const a2 = q / 12 * PI * 2, sl = new THREE.Mesh(G.roundedBox(rimR * 0.42, 0.016, 6e-3, 2e-3), o.slot || CM("#1c1e21", { metalness: 0.5, roughness: 0.4 }));
24059
+ sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.013));
23774
24060
  sl.rotation.z = a2;
23775
24061
  g.add(sl);
23776
24062
  }
@@ -28740,7 +29026,8 @@ var GameUrbanThree = (() => {
28740
29026
  tailLightY: 2.06,
28741
29027
  noAntenna: true,
28742
29028
  hl: { style: "round", w: 0.2, h: 0.2, y: 2.03, in: 0.12, yaw: 0 },
28743
- grille: { style: "bars", w: 1, h: 0.3, y: 2 },
29029
+ /* the badge is this truck's foremost point: 9 mm back, where it was before its layers grew 7 mm and the grille came 2 mm ahead (the length the team measured) */
29030
+ grille: { style: "bars", w: 1, h: 0.3, y: 2, emblemBack: 9e-3 },
28744
29031
  tl: { style: "vertical", w: 0.12, h: 0.28, y: 2.06, in: 0 },
28745
29032
  interior: { rows: 1, col: "#202224", trim: "#141516", front: "bench" },
28746
29033
  hood: { motor: "v8" },
@@ -38057,6 +38344,61 @@ var GameUrbanThree = (() => {
38057
38344
  made[0].position.y += lift;
38058
38345
  };
38059
38346
  };
38347
+ const sinkBottoms = (parts) => {
38348
+ const CELL2 = 4;
38349
+ const cells = /* @__PURE__ */ new Map();
38350
+ const near = (x, z, r, visit) => {
38351
+ for (let i = Math.floor((x - r) / CELL2); i <= Math.floor((x + r) / CELL2); i++) for (let k = Math.floor((z - r) / CELL2); k <= Math.floor((z + r) / CELL2); k++) if (visit(`${i},${k}`)) return true;
38352
+ return false;
38353
+ };
38354
+ return (part, made) => {
38355
+ let height, r, centred;
38356
+ if (part.shape === "box") {
38357
+ if (part.rz) return;
38358
+ height = part.height;
38359
+ r = Math.hypot(part.width, part.depth) / 2;
38360
+ centred = true;
38361
+ } else if (part.shape === "prism") {
38362
+ height = part.height;
38363
+ r = Math.hypot(part.width, part.depth) / 2;
38364
+ centred = false;
38365
+ } else if (part.shape === "cylinder") {
38366
+ height = part.height;
38367
+ r = Math.max(part.radiusTop, part.radiusBottom);
38368
+ centred = true;
38369
+ } else if (part.shape === "cone") {
38370
+ height = part.height;
38371
+ r = part.radius;
38372
+ centred = true;
38373
+ } else return;
38374
+ if (!(height > 0)) return;
38375
+ let x = part.x, y = part.y, z = part.z;
38376
+ for (let parent = part.parent; parent >= 0; parent = parts[parent].parent) {
38377
+ const group = parts[parent];
38378
+ if (group.shape !== "group") return;
38379
+ const c = Math.cos(group.ry || 0), sn = Math.sin(group.ry || 0);
38380
+ const rx = x * c + z * sn, rz = -x * sn + z * c;
38381
+ x = group.x + rx;
38382
+ y = group.y + y;
38383
+ z = group.z + rz;
38384
+ }
38385
+ const bottom = centred ? y - height / 2 : y;
38386
+ let sink = 0;
38387
+ const clash = (key) => (cells.get(key) ?? []).some((other) => Math.abs(other.y - (bottom - sink)) < PLANE_LAYER_GAP / 2 && Math.hypot(other.x - x, other.z - z) < other.r + r);
38388
+ while (near(x, z, r, clash)) sink += PLANE_LAYER_GAP;
38389
+ const entry = { y: bottom - sink, x, z, r };
38390
+ near(x, z, r, (key) => {
38391
+ const list2 = cells.get(key);
38392
+ if (list2) list2.push(entry);
38393
+ else cells.set(key, [entry]);
38394
+ return false;
38395
+ });
38396
+ if (!sink) return;
38397
+ const mesh2 = made[0];
38398
+ mesh2.scale.y *= (height + sink) / height;
38399
+ mesh2.position.y -= centred ? sink / 2 : sink;
38400
+ };
38401
+ };
38060
38402
  function draw(scene, drawOptions = {}) {
38061
38403
  const root = markKitOrigin(drawOptions.root ?? new THREE.Group(), { owner: "game-urban-three", kind: "urban" });
38062
38404
  const animators = [];
@@ -38064,9 +38406,11 @@ var GameUrbanThree = (() => {
38064
38406
  animatedLenses = /* @__PURE__ */ new Set();
38065
38407
  const objects = [];
38066
38408
  const layer = options.standOut === false ? () => void 0 : layerPlanes(scene.parts);
38409
+ const sink = options.standOut === false ? () => void 0 : sinkBottoms(scene.parts);
38067
38410
  for (const part of scene.parts) {
38068
38411
  const made = drawPart(part, animators, lights);
38069
38412
  layer(part, made);
38413
+ sink(part, made);
38070
38414
  objects.push(made);
38071
38415
  const parent = part.parent < 0 ? root : objects[part.parent][0];
38072
38416
  parent.add(...made);
@@ -42605,8 +42949,8 @@ gl_Position = projectionMatrix * mvPosition;
42605
42949
  const draw = (THREE, build, kit, buildSeed) => {
42606
42950
  const b = kit.builder({ seed: buildSeed });
42607
42951
  build(b, kit);
42608
- const document = options.document ?? globalThis.document;
42609
- const drawn = createUrbanThree(THREE, { ...document ? { document } : {}, resolvers: resolversFor(THREE), ...lightsOption() }).draw(b.scene());
42952
+ const document2 = options.document ?? globalThis.document;
42953
+ const drawn = createUrbanThree(THREE, { ...document2 ? { document: document2 } : {}, resolvers: resolversFor(THREE), ...lightsOption() }).draw(b.scene());
42610
42954
  return { root: drawn.root, drawn };
42611
42955
  };
42612
42956
  const sample = (THREE, key) => {
@@ -42663,8 +43007,8 @@ gl_Position = projectionMatrix * mvPosition;
42663
43007
  if ((settings.providers === "vehicles" || settings.providers === "both") && !options.vehicles) host.log(text2.log.no_vehicles);
42664
43008
  const b = kit.builder({ seed: settings.seed });
42665
43009
  const made = kit.neighbourhoods.get(settings.pattern).compose(b, { x: 0, z: 0 }, { locale, providers: providersOf(settings.providers) });
42666
- const document = options.document ?? globalThis.document;
42667
- const drawn = createUrbanThree(three, { ...document ? { document } : {}, resolvers: resolversFor(three), ...lightsOption() }).draw(b.scene());
43010
+ const document2 = options.document ?? globalThis.document;
43011
+ const drawn = createUrbanThree(three, { ...document2 ? { document: document2 } : {}, resolvers: resolversFor(three), ...lightsOption() }).draw(b.scene());
42668
43012
  drawn.root.position.set(benchOrigin[0], FLOOR_Y, benchOrigin[1]);
42669
43013
  host.scene.add(drawn.root);
42670
43014
  bench = { root: drawn.root, drawn, plan: made };