@adatechnology/game-urban 0.7.7 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.global.js +195 -23
- package/dist/index.global.js.map +1 -1
- package/package.json +4 -4
package/dist/index.global.js
CHANGED
|
@@ -4669,6 +4669,28 @@ var GameUrban = (() => {
|
|
|
4669
4669
|
}
|
|
4670
4670
|
return { polys: out, used };
|
|
4671
4671
|
}
|
|
4672
|
+
function crossingAt(polys, x) {
|
|
4673
|
+
let lo = Infinity;
|
|
4674
|
+
let hi = -Infinity;
|
|
4675
|
+
for (const poly of polys) {
|
|
4676
|
+
for (let i = 0; i < poly.length; i++) {
|
|
4677
|
+
const a = poly[i];
|
|
4678
|
+
const b = poly[(i + 1) % poly.length];
|
|
4679
|
+
if ((a[0] - x) * (b[0] - x) > 0 || a[0] === b[0]) continue;
|
|
4680
|
+
const y = a[1] + (x - a[0]) / (b[0] - a[0]) * (b[1] - a[1]);
|
|
4681
|
+
lo = Math.min(lo, y);
|
|
4682
|
+
hi = Math.max(hi, y);
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
return hi >= lo ? [lo, hi] : null;
|
|
4686
|
+
}
|
|
4687
|
+
function divisionSpan(polys, at) {
|
|
4688
|
+
const rear = crossingAt(polys, at - DIVISION_HALF);
|
|
4689
|
+
const front = crossingAt(polys, at + DIVISION_HALF);
|
|
4690
|
+
if (!rear) return front;
|
|
4691
|
+
if (!front) return rear;
|
|
4692
|
+
return [Math.min(rear[0], front[0]), Math.max(rear[1], front[1])];
|
|
4693
|
+
}
|
|
4672
4694
|
var SmokeCause = { STEAM: "steam", OIL: "oil", FIRE: "fire" };
|
|
4673
4695
|
var SMOKE_LOOKS = {
|
|
4674
4696
|
[SmokeCause.STEAM]: { color: 14870248, alpha: 0.18 },
|
|
@@ -10408,8 +10430,9 @@ var GameUrban = (() => {
|
|
|
10408
10430
|
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
10431
|
return h ? h.p.addScaledVector(h.n, 3e-3) : null;
|
|
10410
10432
|
}).filter(Boolean);
|
|
10411
|
-
const t = c.tube(P,
|
|
10433
|
+
const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
|
|
10412
10434
|
t.castShadow = false;
|
|
10435
|
+
t.userData.gap = true;
|
|
10413
10436
|
c.deform.push(t);
|
|
10414
10437
|
return t;
|
|
10415
10438
|
};
|
|
@@ -10435,6 +10458,8 @@ var GameUrban = (() => {
|
|
|
10435
10458
|
};
|
|
10436
10459
|
return K;
|
|
10437
10460
|
}
|
|
10461
|
+
const DIVISION_OVER = 0.012;
|
|
10462
|
+
const COWL_DROP = 0.012;
|
|
10438
10463
|
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
10439
10464
|
function car(c, s) {
|
|
10440
10465
|
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 +10497,10 @@ var GameUrban = (() => {
|
|
|
10472
10497
|
if (gh.polys) polys = gh.polys(polys);
|
|
10473
10498
|
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
10474
10499
|
polys = divided.polys;
|
|
10475
|
-
glassDivisions.set(
|
|
10500
|
+
glassDivisions.set(
|
|
10501
|
+
c,
|
|
10502
|
+
divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
|
|
10503
|
+
);
|
|
10476
10504
|
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
10505
|
const gHoles = [];
|
|
10478
10506
|
if (intr) {
|
|
@@ -10493,6 +10521,7 @@ var GameUrban = (() => {
|
|
|
10493
10521
|
side: THREE.DoubleSide
|
|
10494
10522
|
}) : null;
|
|
10495
10523
|
kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
|
|
10524
|
+
const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
|
|
10496
10525
|
kit.sideWindows(
|
|
10497
10526
|
c,
|
|
10498
10527
|
polys,
|
|
@@ -10501,7 +10530,14 @@ var GameUrban = (() => {
|
|
|
10501
10530
|
function(i, n) {
|
|
10502
10531
|
return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
|
|
10503
10532
|
},
|
|
10504
|
-
{
|
|
10533
|
+
{
|
|
10534
|
+
see: !!intr,
|
|
10535
|
+
// a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
|
|
10536
|
+
seal: function(i) {
|
|
10537
|
+
const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
10538
|
+
return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
|
|
10539
|
+
}
|
|
10540
|
+
}
|
|
10505
10541
|
);
|
|
10506
10542
|
kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
|
|
10507
10543
|
kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? MT.tint : MT.glassDark });
|
|
@@ -10560,7 +10596,7 @@ var GameUrban = (() => {
|
|
|
10560
10596
|
(s.arches || []).forEach(function(a) {
|
|
10561
10597
|
fa = Math.max(fa, a[0]);
|
|
10562
10598
|
});
|
|
10563
|
-
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
|
|
10599
|
+
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
|
|
10564
10600
|
if (hood)
|
|
10565
10601
|
kit.engineBay(c, {
|
|
10566
10602
|
x0: hx0 + 0.02,
|
|
@@ -10594,6 +10630,7 @@ var GameUrban = (() => {
|
|
|
10594
10630
|
);
|
|
10595
10631
|
const Wf = mkWarp(wo);
|
|
10596
10632
|
const S = mkSurf(lowMesh, W);
|
|
10633
|
+
if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
|
|
10597
10634
|
details(c, s, Wf, S);
|
|
10598
10635
|
applyWarp(c, Wf);
|
|
10599
10636
|
return m;
|
|
@@ -10605,7 +10642,7 @@ var GameUrban = (() => {
|
|
|
10605
10642
|
}, rx = function(y) {
|
|
10606
10643
|
return profX(it, y, false);
|
|
10607
10644
|
};
|
|
10608
|
-
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
|
|
10645
|
+
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
|
|
10609
10646
|
I.fxB = S.endX(1, by + 0.2);
|
|
10610
10647
|
I.rxB = S.endX(-1, by + 0.2);
|
|
10611
10648
|
const K = mkKit(c, S, I);
|
|
@@ -10634,21 +10671,22 @@ var GameUrban = (() => {
|
|
|
10634
10671
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
10635
10672
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
10636
10673
|
[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;
|
|
10674
|
+
const bar = function(px, width, span) {
|
|
10675
|
+
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
10676
|
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
10677
|
m2.castShadow = false;
|
|
10641
10678
|
return m2;
|
|
10642
10679
|
};
|
|
10643
10680
|
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
10644
|
-
(glassDivisions.get(c) ?? []).forEach((
|
|
10645
|
-
bar(
|
|
10681
|
+
(glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
|
|
10682
|
+
bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
|
|
10646
10683
|
});
|
|
10647
10684
|
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
10685
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
10649
10686
|
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
10687
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
10651
10688
|
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));
|
|
10689
|
+
if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
|
|
10652
10690
|
(s.handles || []).forEach(function(x) {
|
|
10653
10691
|
c.roundBox(
|
|
10654
10692
|
0.15,
|
|
@@ -10676,16 +10714,25 @@ var GameUrban = (() => {
|
|
|
10676
10714
|
c.roundBox(
|
|
10677
10715
|
gh.fb - gh.rb - 0.3,
|
|
10678
10716
|
0.012,
|
|
10679
|
-
|
|
10717
|
+
0.012,
|
|
10680
10718
|
4e-3,
|
|
10681
10719
|
MT.chrome,
|
|
10682
10720
|
(gh.fb + gh.rb) / 2 - 0.05,
|
|
10683
10721
|
gh.belt + 0.035,
|
|
10684
|
-
sd * (halfAt(gh.Wg, T, gh.belt + 0.035) +
|
|
10722
|
+
sd * (halfAt(gh.Wg, T, gh.belt + 0.035) + 6e-3)
|
|
10685
10723
|
);
|
|
10686
10724
|
});
|
|
10687
10725
|
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
|
-
|
|
10726
|
+
let cwz = gh.Wg / 2 - 0.03;
|
|
10727
|
+
for (let z = 0.3; z < cwz; z += 0.01) {
|
|
10728
|
+
const h = S.hit(new V3(gh.fb + 0.03, 3, z), new V3(0, -1, 0));
|
|
10729
|
+
if (!h || h.p.y < cwy - COWL_DROP) {
|
|
10730
|
+
cwz = z;
|
|
10731
|
+
break;
|
|
10732
|
+
}
|
|
10733
|
+
}
|
|
10734
|
+
cwz = Math.min(cwz, halfAt(gh.Wg, T, gh.belt + 0.05) - 0.072);
|
|
10735
|
+
c.roundBox(0.15, 0.02, 2 * cwz, 8e-3, PLASTIC, gh.fb + 0.02, cwy + 4e-3, 0).castShadow = false;
|
|
10689
10736
|
const wd = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize(), wn = new V3(wd.y, -wd.x, 0);
|
|
10690
10737
|
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
10738
|
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 +10785,10 @@ var GameUrban = (() => {
|
|
|
10738
10785
|
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
10786
|
const pts = shutLinePoints(side, x, y0, y1);
|
|
10740
10787
|
if (pts.length < 3) return;
|
|
10741
|
-
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, MT.dark, { seg: 72, rs: 5 }));
|
|
10788
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
|
|
10742
10789
|
seam.castShadow = false;
|
|
10743
10790
|
seam.userData.doorSeam = true;
|
|
10791
|
+
seam.userData.gap = true;
|
|
10744
10792
|
c.deform.push(seam);
|
|
10745
10793
|
});
|
|
10746
10794
|
});
|
|
@@ -10817,6 +10865,59 @@ var GameUrban = (() => {
|
|
|
10817
10865
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
10818
10866
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
10819
10867
|
}
|
|
10868
|
+
const GAP_R = 2e-3;
|
|
10869
|
+
const FIXED_SEAL_R = 4e-3;
|
|
10870
|
+
const DOOR_SEAL_R = 6e-3;
|
|
10871
|
+
const GAP_SHADE = 0.45;
|
|
10872
|
+
const gapMaterials = /* @__PURE__ */ new Map();
|
|
10873
|
+
function gapMaterial(col) {
|
|
10874
|
+
const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
|
|
10875
|
+
const known = gapMaterials.get(hex);
|
|
10876
|
+
if (known) return known;
|
|
10877
|
+
const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
|
|
10878
|
+
gapMaterials.set(hex, made);
|
|
10879
|
+
return made;
|
|
10880
|
+
}
|
|
10881
|
+
const HOOD_GAP = 4 * GAP_R;
|
|
10882
|
+
function hoodGap(c, S, x0, x1, zH, mat) {
|
|
10883
|
+
const onTop = (x, z) => {
|
|
10884
|
+
const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
|
|
10885
|
+
return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
|
|
10886
|
+
};
|
|
10887
|
+
const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
|
|
10888
|
+
const across = Math.max(4, Math.ceil(2 * zH / 0.04));
|
|
10889
|
+
const line = [];
|
|
10890
|
+
for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
|
|
10891
|
+
for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
|
|
10892
|
+
for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
|
|
10893
|
+
const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
|
|
10894
|
+
t.castShadow = false;
|
|
10895
|
+
t.userData.gap = true;
|
|
10896
|
+
return t;
|
|
10897
|
+
}
|
|
10898
|
+
const FUEL_DOOR_W = 0.13;
|
|
10899
|
+
const FUEL_DOOR_H = 0.11;
|
|
10900
|
+
const FUEL_DOOR_R = 0.02;
|
|
10901
|
+
function fuelDoorGap(c, S, sd, x, y, mat) {
|
|
10902
|
+
const pts = [];
|
|
10903
|
+
const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
|
|
10904
|
+
const corners = [
|
|
10905
|
+
[hx, hy, 0],
|
|
10906
|
+
[-hx, hy, 0.5 * PI],
|
|
10907
|
+
[-hx, -hy, PI],
|
|
10908
|
+
[hx, -hy, 1.5 * PI]
|
|
10909
|
+
];
|
|
10910
|
+
corners.forEach(function([cx, cy, a0]) {
|
|
10911
|
+
for (let k = 0; k <= 4; k++) {
|
|
10912
|
+
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");
|
|
10913
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
|
|
10914
|
+
}
|
|
10915
|
+
});
|
|
10916
|
+
const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
|
|
10917
|
+
t.castShadow = false;
|
|
10918
|
+
t.userData.gap = true;
|
|
10919
|
+
return t;
|
|
10920
|
+
}
|
|
10820
10921
|
function sm(t) {
|
|
10821
10922
|
t = clamp3(t, 0, 1);
|
|
10822
10923
|
return t * t * (3 - 2 * t);
|
|
@@ -11214,6 +11315,8 @@ var GameUrban = (() => {
|
|
|
11214
11315
|
dropRear: true,
|
|
11215
11316
|
seams: [0.64, -0.5, [-1.27, 0.67, 0.93]],
|
|
11216
11317
|
handles: [0.12, -0.86],
|
|
11318
|
+
/* fuel door on the right rear fender, between the rear door and the taillight, over the wheel */
|
|
11319
|
+
fuelDoor: [-1.47, 0.71, 1],
|
|
11217
11320
|
blackPillars: [-0.5],
|
|
11218
11321
|
frontBumper: { y1: 0.6 },
|
|
11219
11322
|
rearBumper: { y1: 0.58 },
|
|
@@ -19505,8 +19608,9 @@ var GameUrban = (() => {
|
|
|
19505
19608
|
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
19609
|
return h ? h.p.addScaledVector(h.n, 3e-3) : null;
|
|
19507
19610
|
}).filter(Boolean);
|
|
19508
|
-
const t = c.tube(P,
|
|
19611
|
+
const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
|
|
19509
19612
|
t.castShadow = false;
|
|
19613
|
+
t.userData.gap = true;
|
|
19510
19614
|
c.deform.push(t);
|
|
19511
19615
|
return t;
|
|
19512
19616
|
};
|
|
@@ -19532,6 +19636,7 @@ var GameUrban = (() => {
|
|
|
19532
19636
|
};
|
|
19533
19637
|
return K;
|
|
19534
19638
|
}
|
|
19639
|
+
const DIVISION_OVER = 0.012;
|
|
19535
19640
|
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
19536
19641
|
function car(c, s) {
|
|
19537
19642
|
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 +19673,10 @@ var GameUrban = (() => {
|
|
|
19568
19673
|
if (s.dropRear) polys = polys.slice(1);
|
|
19569
19674
|
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
19570
19675
|
polys = divided.polys;
|
|
19571
|
-
glassDivisions.set(
|
|
19676
|
+
glassDivisions.set(
|
|
19677
|
+
c,
|
|
19678
|
+
divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
|
|
19679
|
+
);
|
|
19572
19680
|
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
19681
|
const gHoles = [];
|
|
19574
19682
|
if (intr) {
|
|
@@ -19589,6 +19697,7 @@ var GameUrban = (() => {
|
|
|
19589
19697
|
side: THREE.DoubleSide
|
|
19590
19698
|
}) : null;
|
|
19591
19699
|
kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
|
|
19700
|
+
const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
|
|
19592
19701
|
kit.sideWindows(
|
|
19593
19702
|
c,
|
|
19594
19703
|
polys,
|
|
@@ -19597,7 +19706,14 @@ var GameUrban = (() => {
|
|
|
19597
19706
|
function(i, n) {
|
|
19598
19707
|
return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
|
|
19599
19708
|
},
|
|
19600
|
-
{
|
|
19709
|
+
{
|
|
19710
|
+
see: !!intr,
|
|
19711
|
+
// a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
|
|
19712
|
+
seal: function(i) {
|
|
19713
|
+
const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
19714
|
+
return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
|
|
19715
|
+
}
|
|
19716
|
+
}
|
|
19601
19717
|
);
|
|
19602
19718
|
kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
|
|
19603
19719
|
kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? REARTINT : MT.glassDark });
|
|
@@ -19649,7 +19765,7 @@ var GameUrban = (() => {
|
|
|
19649
19765
|
(s.arches || []).forEach(function(a) {
|
|
19650
19766
|
fa = Math.max(fa, a[0]);
|
|
19651
19767
|
});
|
|
19652
|
-
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
|
|
19768
|
+
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
|
|
19653
19769
|
if (hood)
|
|
19654
19770
|
kit.engineBay(c, {
|
|
19655
19771
|
x0: hx0 + 0.02,
|
|
@@ -19683,6 +19799,7 @@ var GameUrban = (() => {
|
|
|
19683
19799
|
);
|
|
19684
19800
|
const Wf = mkWarp(wo);
|
|
19685
19801
|
const S = mkSurf(lowMesh, W);
|
|
19802
|
+
if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
|
|
19686
19803
|
details(c, s, Wf, S);
|
|
19687
19804
|
applyWarp(c, Wf);
|
|
19688
19805
|
return m;
|
|
@@ -19694,7 +19811,7 @@ var GameUrban = (() => {
|
|
|
19694
19811
|
}, rx = function(y) {
|
|
19695
19812
|
return profX(it, y, false);
|
|
19696
19813
|
};
|
|
19697
|
-
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
|
|
19814
|
+
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
|
|
19698
19815
|
I.fxB = S.endX(1, by + 0.2);
|
|
19699
19816
|
I.rxB = S.endX(-1, by + 0.2);
|
|
19700
19817
|
const K = mkKit(c, S, I);
|
|
@@ -19723,21 +19840,22 @@ var GameUrban = (() => {
|
|
|
19723
19840
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
19724
19841
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
19725
19842
|
[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;
|
|
19843
|
+
const bar = function(px, width, span) {
|
|
19844
|
+
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
19845
|
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
19846
|
m2.castShadow = false;
|
|
19730
19847
|
return m2;
|
|
19731
19848
|
};
|
|
19732
19849
|
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
19733
|
-
(glassDivisions.get(c) ?? []).forEach((
|
|
19734
|
-
bar(
|
|
19850
|
+
(glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
|
|
19851
|
+
bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
|
|
19735
19852
|
});
|
|
19736
19853
|
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
19854
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
19738
19855
|
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
19856
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
19740
19857
|
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));
|
|
19858
|
+
if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
|
|
19741
19859
|
(s.handles || []).forEach(function(x) {
|
|
19742
19860
|
c.roundBox(
|
|
19743
19861
|
0.15,
|
|
@@ -19813,9 +19931,10 @@ var GameUrban = (() => {
|
|
|
19813
19931
|
(s.seams || []).forEach(function(x) {
|
|
19814
19932
|
const pts = shutLinePoints(side, seamOnDoorEdge(x, edges), by + 0.11, gh.belt - 0.03);
|
|
19815
19933
|
if (pts.length < 3) return;
|
|
19816
|
-
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, MT.dark, { seg: 72, rs: 5 }));
|
|
19934
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
|
|
19817
19935
|
seam.castShadow = false;
|
|
19818
19936
|
seam.userData.doorSeam = true;
|
|
19937
|
+
seam.userData.gap = true;
|
|
19819
19938
|
c.deform.push(seam);
|
|
19820
19939
|
});
|
|
19821
19940
|
});
|
|
@@ -19892,6 +20011,59 @@ var GameUrban = (() => {
|
|
|
19892
20011
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
19893
20012
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
19894
20013
|
}
|
|
20014
|
+
const GAP_R = 2e-3;
|
|
20015
|
+
const FIXED_SEAL_R = 4e-3;
|
|
20016
|
+
const DOOR_SEAL_R = 6e-3;
|
|
20017
|
+
const GAP_SHADE = 0.45;
|
|
20018
|
+
const gapMaterials = /* @__PURE__ */ new Map();
|
|
20019
|
+
function gapMaterial(col) {
|
|
20020
|
+
const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
|
|
20021
|
+
const known = gapMaterials.get(hex);
|
|
20022
|
+
if (known) return known;
|
|
20023
|
+
const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
|
|
20024
|
+
gapMaterials.set(hex, made);
|
|
20025
|
+
return made;
|
|
20026
|
+
}
|
|
20027
|
+
const HOOD_GAP = 4 * GAP_R;
|
|
20028
|
+
function hoodGap(c, S, x0, x1, zH, mat) {
|
|
20029
|
+
const onTop = (x, z) => {
|
|
20030
|
+
const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
|
|
20031
|
+
return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
|
|
20032
|
+
};
|
|
20033
|
+
const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
|
|
20034
|
+
const across = Math.max(4, Math.ceil(2 * zH / 0.04));
|
|
20035
|
+
const line = [];
|
|
20036
|
+
for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
|
|
20037
|
+
for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
|
|
20038
|
+
for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
|
|
20039
|
+
const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
|
|
20040
|
+
t.castShadow = false;
|
|
20041
|
+
t.userData.gap = true;
|
|
20042
|
+
return t;
|
|
20043
|
+
}
|
|
20044
|
+
const FUEL_DOOR_W = 0.13;
|
|
20045
|
+
const FUEL_DOOR_H = 0.11;
|
|
20046
|
+
const FUEL_DOOR_R = 0.02;
|
|
20047
|
+
function fuelDoorGap(c, S, sd, x, y, mat) {
|
|
20048
|
+
const pts = [];
|
|
20049
|
+
const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
|
|
20050
|
+
const corners = [
|
|
20051
|
+
[hx, hy, 0],
|
|
20052
|
+
[-hx, hy, 0.5 * PI],
|
|
20053
|
+
[-hx, -hy, PI],
|
|
20054
|
+
[hx, -hy, 1.5 * PI]
|
|
20055
|
+
];
|
|
20056
|
+
corners.forEach(function([cx, cy, a0]) {
|
|
20057
|
+
for (let k = 0; k <= 4; k++) {
|
|
20058
|
+
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");
|
|
20059
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
|
|
20060
|
+
}
|
|
20061
|
+
});
|
|
20062
|
+
const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
|
|
20063
|
+
t.castShadow = false;
|
|
20064
|
+
t.userData.gap = true;
|
|
20065
|
+
return t;
|
|
20066
|
+
}
|
|
19895
20067
|
function sm(t) {
|
|
19896
20068
|
t = clamp3(t, 0, 1);
|
|
19897
20069
|
return t * t * (3 - 2 * t);
|