@adatechnology/game-urban 0.7.7 → 0.7.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.
@@ -4544,6 +4544,11 @@ var GameUrban = (() => {
4544
4544
  }
4545
4545
 
4546
4546
  // ../game-vehicles/dist/index.js
4547
+ var CABIN_PARTS = {
4548
+ seat: { id: "seats", material: "fabric" },
4549
+ trim: { id: "dashboard", material: "plastic" }
4550
+ };
4551
+ var CABIN_PART_IDS = new Set(Object.values(CABIN_PARTS).map((p) => p.id));
4547
4552
  var SHUT_LINE_RADIUS = 2e-3;
4548
4553
  var SHUT_LINE_LIFT = 8e-4;
4549
4554
  var SHUT_LINE_STEPS = 36;
@@ -4669,6 +4674,28 @@ var GameUrban = (() => {
4669
4674
  }
4670
4675
  return { polys: out, used };
4671
4676
  }
4677
+ function crossingAt(polys, x) {
4678
+ let lo = Infinity;
4679
+ let hi = -Infinity;
4680
+ for (const poly of polys) {
4681
+ for (let i = 0; i < poly.length; i++) {
4682
+ const a = poly[i];
4683
+ const b = poly[(i + 1) % poly.length];
4684
+ if ((a[0] - x) * (b[0] - x) > 0 || a[0] === b[0]) continue;
4685
+ const y = a[1] + (x - a[0]) / (b[0] - a[0]) * (b[1] - a[1]);
4686
+ lo = Math.min(lo, y);
4687
+ hi = Math.max(hi, y);
4688
+ }
4689
+ }
4690
+ return hi >= lo ? [lo, hi] : null;
4691
+ }
4692
+ function divisionSpan(polys, at) {
4693
+ const rear = crossingAt(polys, at - DIVISION_HALF);
4694
+ const front = crossingAt(polys, at + DIVISION_HALF);
4695
+ if (!rear) return front;
4696
+ if (!front) return rear;
4697
+ return [Math.min(rear[0], front[0]), Math.max(rear[1], front[1])];
4698
+ }
4672
4699
  var SmokeCause = { STEAM: "steam", OIL: "oil", FIRE: "fire" };
4673
4700
  var SMOKE_LOOKS = {
4674
4701
  [SmokeCause.STEAM]: { color: 14870248, alpha: 0.18 },
@@ -4677,6 +4704,7 @@ var GameUrban = (() => {
4677
4704
  };
4678
4705
  var CAUSE_OF_EMITTER = { white: SmokeCause.STEAM, oil: SmokeCause.OIL, black: SmokeCause.FIRE };
4679
4706
  var LIFT = { [SmokeCause.STEAM]: 0.5, [SmokeCause.OIL]: 0.45, [SmokeCause.FIRE]: 0.6 };
4707
+ var DROP_GATE_OPEN = Math.PI / 2;
4680
4708
  var LID_OUTWARD = [-Math.SQRT1_2, Math.SQRT1_2, 0];
4681
4709
  var cabin_default = {
4682
4710
  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)",
@@ -10391,6 +10419,7 @@ var GameUrban = (() => {
10391
10419
  return pl;
10392
10420
  };
10393
10421
  K.lid = function(pts0) {
10422
+ c.meta.lidSeam = pts0;
10394
10423
  const pts = [];
10395
10424
  pts0.forEach(function(q, i) {
10396
10425
  const n = pts0[i + 1];
@@ -10408,8 +10437,9 @@ var GameUrban = (() => {
10408
10437
  const h = q.top ? S.hit(new V3(q.x, 3, q.z), new V3(0, -1, 0), "R") : S.hit(new V3(S.endX(-1, q.y) - 1, q.y, q.z), new V3(1, 0, 0), "R");
10409
10438
  return h ? h.p.addScaledVector(h.n, 3e-3) : null;
10410
10439
  }).filter(Boolean);
10411
- const t = c.tube(P, 38e-4, MT.dark, { seg: P.length * 8, rs: 4 });
10440
+ const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
10412
10441
  t.castShadow = false;
10442
+ t.userData.gap = true;
10413
10443
  c.deform.push(t);
10414
10444
  return t;
10415
10445
  };
@@ -10435,6 +10465,8 @@ var GameUrban = (() => {
10435
10465
  };
10436
10466
  return K;
10437
10467
  }
10468
+ const DIVISION_OVER = 0.012;
10469
+ const COWL_DROP = 0.012;
10438
10470
  const glassDivisions = /* @__PURE__ */ new WeakMap();
10439
10471
  function car(c, s) {
10440
10472
  const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
@@ -10472,7 +10504,10 @@ var GameUrban = (() => {
10472
10504
  if (gh.polys) polys = gh.polys(polys);
10473
10505
  const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
10474
10506
  polys = divided.polys;
10475
- glassDivisions.set(c, divided.used);
10507
+ glassDivisions.set(
10508
+ c,
10509
+ divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
10510
+ );
10476
10511
  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 });
10477
10512
  const gHoles = [];
10478
10513
  if (intr) {
@@ -10493,6 +10528,7 @@ var GameUrban = (() => {
10493
10528
  side: THREE.DoubleSide
10494
10529
  }) : null;
10495
10530
  kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
10531
+ const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
10496
10532
  kit.sideWindows(
10497
10533
  c,
10498
10534
  polys,
@@ -10501,7 +10537,14 @@ var GameUrban = (() => {
10501
10537
  function(i, n) {
10502
10538
  return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
10503
10539
  },
10504
- { see: !!intr }
10540
+ {
10541
+ see: !!intr,
10542
+ // a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
10543
+ seal: function(i) {
10544
+ const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
10545
+ return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
10546
+ }
10547
+ }
10505
10548
  );
10506
10549
  kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
10507
10550
  kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? MT.tint : MT.glassDark });
@@ -10560,7 +10603,7 @@ var GameUrban = (() => {
10560
10603
  (s.arches || []).forEach(function(a) {
10561
10604
  fa = Math.max(fa, a[0]);
10562
10605
  });
10563
- const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
10606
+ const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
10564
10607
  if (hood)
10565
10608
  kit.engineBay(c, {
10566
10609
  x0: hx0 + 0.02,
@@ -10594,6 +10637,7 @@ var GameUrban = (() => {
10594
10637
  );
10595
10638
  const Wf = mkWarp(wo);
10596
10639
  const S = mkSurf(lowMesh, W);
10640
+ if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
10597
10641
  details(c, s, Wf, S);
10598
10642
  applyWarp(c, Wf);
10599
10643
  return m;
@@ -10605,7 +10649,7 @@ var GameUrban = (() => {
10605
10649
  }, rx = function(y) {
10606
10650
  return profX(it, y, false);
10607
10651
  };
10608
- const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
10652
+ const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
10609
10653
  I.fxB = S.endX(1, by + 0.2);
10610
10654
  I.rxB = S.endX(-1, by + 0.2);
10611
10655
  const K = mkKit(c, S, I);
@@ -10634,21 +10678,22 @@ var GameUrban = (() => {
10634
10678
  K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
10635
10679
  const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
10636
10680
  [1, -1].forEach(function(sd) {
10637
- const bar = function(px, width) {
10638
- const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
10681
+ const bar = function(px, width, span) {
10682
+ const ry = roofAt(gh, px), yc = span ? (span[0] + span[1]) / 2 : (gh.belt + ry) / 2 + 5e-3, hh = span ? span[1] - span[0] + 2 * DIVISION_OVER : ry - gh.belt - 0.1;
10639
10683
  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] });
10640
10684
  m2.castShadow = false;
10641
10685
  return m2;
10642
10686
  };
10643
10687
  (s.blackPillars || []).forEach((px) => bar(px, 0.118));
10644
- (glassDivisions.get(c) ?? []).forEach((px) => {
10645
- bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
10688
+ (glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
10689
+ bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
10646
10690
  });
10647
10691
  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;
10648
10692
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
10649
10693
  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 } });
10650
10694
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
10651
10695
  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));
10696
+ if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
10652
10697
  (s.handles || []).forEach(function(x) {
10653
10698
  c.roundBox(
10654
10699
  0.15,
@@ -10676,16 +10721,25 @@ var GameUrban = (() => {
10676
10721
  c.roundBox(
10677
10722
  gh.fb - gh.rb - 0.3,
10678
10723
  0.012,
10679
- 8e-3,
10724
+ 0.012,
10680
10725
  4e-3,
10681
10726
  MT.chrome,
10682
10727
  (gh.fb + gh.rb) / 2 - 0.05,
10683
10728
  gh.belt + 0.035,
10684
- sd * (halfAt(gh.Wg, T, gh.belt + 0.035) + 4e-3)
10729
+ sd * (halfAt(gh.Wg, T, gh.belt + 0.035) + 6e-3)
10685
10730
  );
10686
10731
  });
10687
10732
  const cwh = S.hit(new V3(gh.fb + 0.03, 3, 0), new V3(0, -1, 0)), cwy = cwh ? cwh.p.y : gh.belt;
10688
- c.roundBox(0.15, 0.02, gh.Wg - 0.06, 8e-3, PLASTIC, gh.fb + 0.02, cwy + 4e-3, 0).castShadow = false;
10733
+ let cwz = gh.Wg / 2 - 0.03;
10734
+ for (let z = 0.3; z < cwz; z += 0.01) {
10735
+ const h = S.hit(new V3(gh.fb + 0.03, 3, z), new V3(0, -1, 0));
10736
+ if (!h || h.p.y < cwy - COWL_DROP) {
10737
+ cwz = z;
10738
+ break;
10739
+ }
10740
+ }
10741
+ cwz = Math.min(cwz, halfAt(gh.Wg, T, gh.belt + 0.05) - 0.072);
10742
+ c.roundBox(0.15, 0.02, 2 * cwz, 8e-3, PLASTIC, gh.fb + 0.02, cwy + 4e-3, 0).castShadow = false;
10689
10743
  const wd = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize(), wn = new V3(wd.y, -wd.x, 0);
10690
10744
  const fr = new V3(gh.fb, gh.belt, 0).addScaledVector(wd, 0.065).addScaledVector(wn, 0.047), frw = 2 * (halfAt(gh.Wg, T, gh.belt + 0.05) - 0.07);
10691
10745
  c.roundBox(0.14, 6e-3, frw, 3e-3, PLASTIC, fr.x, fr.y, 0, { rot: [0, 0, Math.atan2(wd.y, wd.x)] }).castShadow = false;
@@ -10738,9 +10792,10 @@ var GameUrban = (() => {
10738
10792
  const r = q, x = seamOnDoorEdge(r.length ? r[0] : q, edges), y0 = r.length ? r[1] : by + 0.11, y1 = r.length ? r[2] : gh.belt - 0.03;
10739
10793
  const pts = shutLinePoints(side, x, y0, y1);
10740
10794
  if (pts.length < 3) return;
10741
- const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, MT.dark, { seg: 72, rs: 5 }));
10795
+ const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
10742
10796
  seam.castShadow = false;
10743
10797
  seam.userData.doorSeam = true;
10798
+ seam.userData.gap = true;
10744
10799
  c.deform.push(seam);
10745
10800
  });
10746
10801
  });
@@ -10817,6 +10872,59 @@ var GameUrban = (() => {
10817
10872
  c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
10818
10873
  c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
10819
10874
  }
10875
+ const GAP_R = 2e-3;
10876
+ const FIXED_SEAL_R = 4e-3;
10877
+ const DOOR_SEAL_R = 6e-3;
10878
+ const GAP_SHADE = 0.45;
10879
+ const gapMaterials = /* @__PURE__ */ new Map();
10880
+ function gapMaterial(col) {
10881
+ const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
10882
+ const known = gapMaterials.get(hex);
10883
+ if (known) return known;
10884
+ const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
10885
+ gapMaterials.set(hex, made);
10886
+ return made;
10887
+ }
10888
+ const HOOD_GAP = 4 * GAP_R;
10889
+ function hoodGap(c, S, x0, x1, zH, mat) {
10890
+ const onTop = (x, z) => {
10891
+ const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
10892
+ return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
10893
+ };
10894
+ const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
10895
+ const across = Math.max(4, Math.ceil(2 * zH / 0.04));
10896
+ const line = [];
10897
+ for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
10898
+ for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
10899
+ for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
10900
+ const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
10901
+ t.castShadow = false;
10902
+ t.userData.gap = true;
10903
+ return t;
10904
+ }
10905
+ const FUEL_DOOR_W = 0.13;
10906
+ const FUEL_DOOR_H = 0.11;
10907
+ const FUEL_DOOR_R = 0.02;
10908
+ function fuelDoorGap(c, S, sd, x, y, mat) {
10909
+ const pts = [];
10910
+ const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
10911
+ const corners = [
10912
+ [hx, hy, 0],
10913
+ [-hx, hy, 0.5 * PI],
10914
+ [-hx, -hy, PI],
10915
+ [hx, -hy, 1.5 * PI]
10916
+ ];
10917
+ corners.forEach(function([cx, cy, a0]) {
10918
+ for (let k = 0; k <= 4; k++) {
10919
+ const a = a0 + k / 4 * 0.5 * PI, px = x + cx + FUEL_DOOR_R * Math.cos(a), py = y + cy + FUEL_DOOR_R * Math.sin(a), h = S.hit(new V3(px, py, sd * (S.hw + 1)), new V3(0, 0, -sd), "M");
10920
+ pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
10921
+ }
10922
+ });
10923
+ const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
10924
+ t.castShadow = false;
10925
+ t.userData.gap = true;
10926
+ return t;
10927
+ }
10820
10928
  function sm(t) {
10821
10929
  t = clamp3(t, 0, 1);
10822
10930
  return t * t * (3 - 2 * t);
@@ -11214,6 +11322,8 @@ var GameUrban = (() => {
11214
11322
  dropRear: true,
11215
11323
  seams: [0.64, -0.5, [-1.27, 0.67, 0.93]],
11216
11324
  handles: [0.12, -0.86],
11325
+ /* fuel door on the right rear fender, between the rear door and the taillight, over the wheel */
11326
+ fuelDoor: [-1.47, 0.71, 1],
11217
11327
  blackPillars: [-0.5],
11218
11328
  frontBumper: { y1: 0.6 },
11219
11329
  rearBumper: { y1: 0.58 },
@@ -19501,12 +19611,14 @@ var GameUrban = (() => {
19501
19611
  return pl;
19502
19612
  };
19503
19613
  K.lid = function(pts) {
19614
+ c.meta.lidSeam = pts;
19504
19615
  const P = pts.map(function(q) {
19505
19616
  const h = q.top ? S.hit(new V3(q.x, 3, q.z), new V3(0, -1, 0), "R") : S.hit(new V3(S.endX(-1, q.y) - 1, q.y, q.z), new V3(1, 0, 0), "R");
19506
19617
  return h ? h.p.addScaledVector(h.n, 3e-3) : null;
19507
19618
  }).filter(Boolean);
19508
- const t = c.tube(P, 38e-4, MT.dark, { seg: P.length * 8, rs: 4 });
19619
+ const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
19509
19620
  t.castShadow = false;
19621
+ t.userData.gap = true;
19510
19622
  c.deform.push(t);
19511
19623
  return t;
19512
19624
  };
@@ -19532,6 +19644,7 @@ var GameUrban = (() => {
19532
19644
  };
19533
19645
  return K;
19534
19646
  }
19647
+ const DIVISION_OVER = 0.012;
19535
19648
  const glassDivisions = /* @__PURE__ */ new WeakMap();
19536
19649
  function car(c, s) {
19537
19650
  const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
@@ -19568,7 +19681,10 @@ var GameUrban = (() => {
19568
19681
  if (s.dropRear) polys = polys.slice(1);
19569
19682
  const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
19570
19683
  polys = divided.polys;
19571
- glassDivisions.set(c, divided.used);
19684
+ glassDivisions.set(
19685
+ c,
19686
+ divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
19687
+ );
19572
19688
  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);
19573
19689
  const gHoles = [];
19574
19690
  if (intr) {
@@ -19589,6 +19705,7 @@ var GameUrban = (() => {
19589
19705
  side: THREE.DoubleSide
19590
19706
  }) : null;
19591
19707
  kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
19708
+ const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
19592
19709
  kit.sideWindows(
19593
19710
  c,
19594
19711
  polys,
@@ -19597,7 +19714,14 @@ var GameUrban = (() => {
19597
19714
  function(i, n) {
19598
19715
  return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
19599
19716
  },
19600
- { see: !!intr }
19717
+ {
19718
+ see: !!intr,
19719
+ // a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
19720
+ seal: function(i) {
19721
+ const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
19722
+ return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
19723
+ }
19724
+ }
19601
19725
  );
19602
19726
  kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
19603
19727
  kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? REARTINT : MT.glassDark });
@@ -19649,7 +19773,7 @@ var GameUrban = (() => {
19649
19773
  (s.arches || []).forEach(function(a) {
19650
19774
  fa = Math.max(fa, a[0]);
19651
19775
  });
19652
- const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
19776
+ const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
19653
19777
  if (hood)
19654
19778
  kit.engineBay(c, {
19655
19779
  x0: hx0 + 0.02,
@@ -19683,6 +19807,7 @@ var GameUrban = (() => {
19683
19807
  );
19684
19808
  const Wf = mkWarp(wo);
19685
19809
  const S = mkSurf(lowMesh, W);
19810
+ if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
19686
19811
  details(c, s, Wf, S);
19687
19812
  applyWarp(c, Wf);
19688
19813
  return m;
@@ -19694,7 +19819,7 @@ var GameUrban = (() => {
19694
19819
  }, rx = function(y) {
19695
19820
  return profX(it, y, false);
19696
19821
  };
19697
- const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
19822
+ const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
19698
19823
  I.fxB = S.endX(1, by + 0.2);
19699
19824
  I.rxB = S.endX(-1, by + 0.2);
19700
19825
  const K = mkKit(c, S, I);
@@ -19723,21 +19848,22 @@ var GameUrban = (() => {
19723
19848
  K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
19724
19849
  const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
19725
19850
  [1, -1].forEach(function(sd) {
19726
- const bar = function(px, width) {
19727
- const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
19851
+ const bar = function(px, width, span) {
19852
+ const ry = roofAt(gh, px), yc = span ? (span[0] + span[1]) / 2 : (gh.belt + ry) / 2 + 5e-3, hh = span ? span[1] - span[0] + 2 * DIVISION_OVER : ry - gh.belt - 0.1;
19728
19853
  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] });
19729
19854
  m2.castShadow = false;
19730
19855
  return m2;
19731
19856
  };
19732
19857
  (s.blackPillars || []).forEach((px) => bar(px, 0.118));
19733
- (glassDivisions.get(c) ?? []).forEach((px) => {
19734
- bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
19858
+ (glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
19859
+ bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
19735
19860
  });
19736
19861
  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;
19737
19862
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
19738
19863
  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 } });
19739
19864
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
19740
19865
  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));
19866
+ if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
19741
19867
  (s.handles || []).forEach(function(x) {
19742
19868
  c.roundBox(
19743
19869
  0.15,
@@ -19813,9 +19939,10 @@ var GameUrban = (() => {
19813
19939
  (s.seams || []).forEach(function(x) {
19814
19940
  const pts = shutLinePoints(side, seamOnDoorEdge(x, edges), by + 0.11, gh.belt - 0.03);
19815
19941
  if (pts.length < 3) return;
19816
- const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, MT.dark, { seg: 72, rs: 5 }));
19942
+ const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
19817
19943
  seam.castShadow = false;
19818
19944
  seam.userData.doorSeam = true;
19945
+ seam.userData.gap = true;
19819
19946
  c.deform.push(seam);
19820
19947
  });
19821
19948
  });
@@ -19892,6 +20019,59 @@ var GameUrban = (() => {
19892
20019
  c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
19893
20020
  c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
19894
20021
  }
20022
+ const GAP_R = 2e-3;
20023
+ const FIXED_SEAL_R = 4e-3;
20024
+ const DOOR_SEAL_R = 6e-3;
20025
+ const GAP_SHADE = 0.45;
20026
+ const gapMaterials = /* @__PURE__ */ new Map();
20027
+ function gapMaterial(col) {
20028
+ const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
20029
+ const known = gapMaterials.get(hex);
20030
+ if (known) return known;
20031
+ const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
20032
+ gapMaterials.set(hex, made);
20033
+ return made;
20034
+ }
20035
+ const HOOD_GAP = 4 * GAP_R;
20036
+ function hoodGap(c, S, x0, x1, zH, mat) {
20037
+ const onTop = (x, z) => {
20038
+ const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
20039
+ return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
20040
+ };
20041
+ const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
20042
+ const across = Math.max(4, Math.ceil(2 * zH / 0.04));
20043
+ const line = [];
20044
+ for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
20045
+ for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
20046
+ for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
20047
+ const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
20048
+ t.castShadow = false;
20049
+ t.userData.gap = true;
20050
+ return t;
20051
+ }
20052
+ const FUEL_DOOR_W = 0.13;
20053
+ const FUEL_DOOR_H = 0.11;
20054
+ const FUEL_DOOR_R = 0.02;
20055
+ function fuelDoorGap(c, S, sd, x, y, mat) {
20056
+ const pts = [];
20057
+ const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
20058
+ const corners = [
20059
+ [hx, hy, 0],
20060
+ [-hx, hy, 0.5 * PI],
20061
+ [-hx, -hy, PI],
20062
+ [hx, -hy, 1.5 * PI]
20063
+ ];
20064
+ corners.forEach(function([cx, cy, a0]) {
20065
+ for (let k = 0; k <= 4; k++) {
20066
+ const a = a0 + k / 4 * 0.5 * PI, px = x + cx + FUEL_DOOR_R * Math.cos(a), py = y + cy + FUEL_DOOR_R * Math.sin(a), h = S.hit(new V3(px, py, sd * (S.hw + 1)), new V3(0, 0, -sd), "M");
20067
+ pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
20068
+ }
20069
+ });
20070
+ const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
20071
+ t.castShadow = false;
20072
+ t.userData.gap = true;
20073
+ return t;
20074
+ }
19895
20075
  function sm(t) {
19896
20076
  t = clamp3(t, 0, 1);
19897
20077
  return t * t * (3 - 2 * t);