@adatechnology/game-urban-three 0.5.10 → 0.5.12
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 +8 -8
package/dist/index.global.js
CHANGED
|
@@ -5271,6 +5271,28 @@ var GameUrbanThree = (() => {
|
|
|
5271
5271
|
}
|
|
5272
5272
|
return { polys: out, used };
|
|
5273
5273
|
}
|
|
5274
|
+
function crossingAt(polys, x) {
|
|
5275
|
+
let lo = Infinity;
|
|
5276
|
+
let hi = -Infinity;
|
|
5277
|
+
for (const poly of polys) {
|
|
5278
|
+
for (let i = 0; i < poly.length; i++) {
|
|
5279
|
+
const a = poly[i];
|
|
5280
|
+
const b = poly[(i + 1) % poly.length];
|
|
5281
|
+
if ((a[0] - x) * (b[0] - x) > 0 || a[0] === b[0]) continue;
|
|
5282
|
+
const y = a[1] + (x - a[0]) / (b[0] - a[0]) * (b[1] - a[1]);
|
|
5283
|
+
lo = Math.min(lo, y);
|
|
5284
|
+
hi = Math.max(hi, y);
|
|
5285
|
+
}
|
|
5286
|
+
}
|
|
5287
|
+
return hi >= lo ? [lo, hi] : null;
|
|
5288
|
+
}
|
|
5289
|
+
function divisionSpan(polys, at) {
|
|
5290
|
+
const rear = crossingAt(polys, at - DIVISION_HALF);
|
|
5291
|
+
const front = crossingAt(polys, at + DIVISION_HALF);
|
|
5292
|
+
if (!rear) return front;
|
|
5293
|
+
if (!front) return rear;
|
|
5294
|
+
return [Math.min(rear[0], front[0]), Math.max(rear[1], front[1])];
|
|
5295
|
+
}
|
|
5274
5296
|
var SmokeCause = { STEAM: "steam", OIL: "oil", FIRE: "fire" };
|
|
5275
5297
|
var SMOKE_LOOKS = {
|
|
5276
5298
|
[SmokeCause.STEAM]: { color: 14870248, alpha: 0.18 },
|
|
@@ -11010,8 +11032,9 @@ var GameUrbanThree = (() => {
|
|
|
11010
11032
|
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");
|
|
11011
11033
|
return h ? h.p.addScaledVector(h.n, 3e-3) : null;
|
|
11012
11034
|
}).filter(Boolean);
|
|
11013
|
-
const t = c.tube(P,
|
|
11035
|
+
const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
|
|
11014
11036
|
t.castShadow = false;
|
|
11037
|
+
t.userData.gap = true;
|
|
11015
11038
|
c.deform.push(t);
|
|
11016
11039
|
return t;
|
|
11017
11040
|
};
|
|
@@ -11037,6 +11060,8 @@ var GameUrbanThree = (() => {
|
|
|
11037
11060
|
};
|
|
11038
11061
|
return K;
|
|
11039
11062
|
}
|
|
11063
|
+
const DIVISION_OVER = 0.012;
|
|
11064
|
+
const COWL_DROP = 0.012;
|
|
11040
11065
|
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
11041
11066
|
function car(c, s) {
|
|
11042
11067
|
const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
|
|
@@ -11074,7 +11099,10 @@ var GameUrbanThree = (() => {
|
|
|
11074
11099
|
if (gh.polys) polys = gh.polys(polys);
|
|
11075
11100
|
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
11076
11101
|
polys = divided.polys;
|
|
11077
|
-
glassDivisions.set(
|
|
11102
|
+
glassDivisions.set(
|
|
11103
|
+
c,
|
|
11104
|
+
divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
|
|
11105
|
+
);
|
|
11078
11106
|
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 });
|
|
11079
11107
|
const gHoles = [];
|
|
11080
11108
|
if (intr) {
|
|
@@ -11095,6 +11123,7 @@ var GameUrbanThree = (() => {
|
|
|
11095
11123
|
side: THREE.DoubleSide
|
|
11096
11124
|
}) : null;
|
|
11097
11125
|
kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
|
|
11126
|
+
const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
|
|
11098
11127
|
kit.sideWindows(
|
|
11099
11128
|
c,
|
|
11100
11129
|
polys,
|
|
@@ -11103,7 +11132,14 @@ var GameUrbanThree = (() => {
|
|
|
11103
11132
|
function(i, n) {
|
|
11104
11133
|
return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
|
|
11105
11134
|
},
|
|
11106
|
-
{
|
|
11135
|
+
{
|
|
11136
|
+
see: !!intr,
|
|
11137
|
+
// a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
|
|
11138
|
+
seal: function(i) {
|
|
11139
|
+
const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
11140
|
+
return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
|
|
11141
|
+
}
|
|
11142
|
+
}
|
|
11107
11143
|
);
|
|
11108
11144
|
kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
|
|
11109
11145
|
kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? MT.tint : MT.glassDark });
|
|
@@ -11162,7 +11198,7 @@ var GameUrbanThree = (() => {
|
|
|
11162
11198
|
(s.arches || []).forEach(function(a) {
|
|
11163
11199
|
fa = Math.max(fa, a[0]);
|
|
11164
11200
|
});
|
|
11165
|
-
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
|
|
11201
|
+
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
|
|
11166
11202
|
if (hood)
|
|
11167
11203
|
kit.engineBay(c, {
|
|
11168
11204
|
x0: hx0 + 0.02,
|
|
@@ -11196,6 +11232,7 @@ var GameUrbanThree = (() => {
|
|
|
11196
11232
|
);
|
|
11197
11233
|
const Wf = mkWarp(wo);
|
|
11198
11234
|
const S = mkSurf(lowMesh, W);
|
|
11235
|
+
if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
|
|
11199
11236
|
details(c, s, Wf, S);
|
|
11200
11237
|
applyWarp(c, Wf);
|
|
11201
11238
|
return m;
|
|
@@ -11207,7 +11244,7 @@ var GameUrbanThree = (() => {
|
|
|
11207
11244
|
}, rx = function(y) {
|
|
11208
11245
|
return profX(it, y, false);
|
|
11209
11246
|
};
|
|
11210
|
-
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
|
|
11247
|
+
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
|
|
11211
11248
|
I.fxB = S.endX(1, by + 0.2);
|
|
11212
11249
|
I.rxB = S.endX(-1, by + 0.2);
|
|
11213
11250
|
const K = mkKit(c, S, I);
|
|
@@ -11236,21 +11273,22 @@ var GameUrbanThree = (() => {
|
|
|
11236
11273
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
11237
11274
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
11238
11275
|
[1, -1].forEach(function(sd) {
|
|
11239
|
-
const bar = function(px, width) {
|
|
11240
|
-
const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
|
|
11276
|
+
const bar = function(px, width, span) {
|
|
11277
|
+
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;
|
|
11241
11278
|
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] });
|
|
11242
11279
|
m2.castShadow = false;
|
|
11243
11280
|
return m2;
|
|
11244
11281
|
};
|
|
11245
11282
|
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
11246
|
-
(glassDivisions.get(c) ?? []).forEach((
|
|
11247
|
-
bar(
|
|
11283
|
+
(glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
|
|
11284
|
+
bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
|
|
11248
11285
|
});
|
|
11249
11286
|
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;
|
|
11250
11287
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
11251
11288
|
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 } });
|
|
11252
11289
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
11253
11290
|
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));
|
|
11291
|
+
if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
|
|
11254
11292
|
(s.handles || []).forEach(function(x) {
|
|
11255
11293
|
c.roundBox(
|
|
11256
11294
|
0.15,
|
|
@@ -11278,16 +11316,25 @@ var GameUrbanThree = (() => {
|
|
|
11278
11316
|
c.roundBox(
|
|
11279
11317
|
gh.fb - gh.rb - 0.3,
|
|
11280
11318
|
0.012,
|
|
11281
|
-
|
|
11319
|
+
0.012,
|
|
11282
11320
|
4e-3,
|
|
11283
11321
|
MT.chrome,
|
|
11284
11322
|
(gh.fb + gh.rb) / 2 - 0.05,
|
|
11285
11323
|
gh.belt + 0.035,
|
|
11286
|
-
sd * (halfAt(gh.Wg, T, gh.belt + 0.035) +
|
|
11324
|
+
sd * (halfAt(gh.Wg, T, gh.belt + 0.035) + 6e-3)
|
|
11287
11325
|
);
|
|
11288
11326
|
});
|
|
11289
11327
|
const cwh = S.hit(new V3(gh.fb + 0.03, 3, 0), new V3(0, -1, 0)), cwy = cwh ? cwh.p.y : gh.belt;
|
|
11290
|
-
|
|
11328
|
+
let cwz = gh.Wg / 2 - 0.03;
|
|
11329
|
+
for (let z = 0.3; z < cwz; z += 0.01) {
|
|
11330
|
+
const h = S.hit(new V3(gh.fb + 0.03, 3, z), new V3(0, -1, 0));
|
|
11331
|
+
if (!h || h.p.y < cwy - COWL_DROP) {
|
|
11332
|
+
cwz = z;
|
|
11333
|
+
break;
|
|
11334
|
+
}
|
|
11335
|
+
}
|
|
11336
|
+
cwz = Math.min(cwz, halfAt(gh.Wg, T, gh.belt + 0.05) - 0.072);
|
|
11337
|
+
c.roundBox(0.15, 0.02, 2 * cwz, 8e-3, PLASTIC, gh.fb + 0.02, cwy + 4e-3, 0).castShadow = false;
|
|
11291
11338
|
const wd = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize(), wn = new V3(wd.y, -wd.x, 0);
|
|
11292
11339
|
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);
|
|
11293
11340
|
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;
|
|
@@ -11340,9 +11387,10 @@ var GameUrbanThree = (() => {
|
|
|
11340
11387
|
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;
|
|
11341
11388
|
const pts = shutLinePoints(side, x, y0, y1);
|
|
11342
11389
|
if (pts.length < 3) return;
|
|
11343
|
-
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, MT.dark, { seg: 72, rs: 5 }));
|
|
11390
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
|
|
11344
11391
|
seam.castShadow = false;
|
|
11345
11392
|
seam.userData.doorSeam = true;
|
|
11393
|
+
seam.userData.gap = true;
|
|
11346
11394
|
c.deform.push(seam);
|
|
11347
11395
|
});
|
|
11348
11396
|
});
|
|
@@ -11419,6 +11467,59 @@ var GameUrbanThree = (() => {
|
|
|
11419
11467
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
11420
11468
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
11421
11469
|
}
|
|
11470
|
+
const GAP_R = 2e-3;
|
|
11471
|
+
const FIXED_SEAL_R = 4e-3;
|
|
11472
|
+
const DOOR_SEAL_R = 6e-3;
|
|
11473
|
+
const GAP_SHADE = 0.45;
|
|
11474
|
+
const gapMaterials = /* @__PURE__ */ new Map();
|
|
11475
|
+
function gapMaterial(col) {
|
|
11476
|
+
const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
|
|
11477
|
+
const known = gapMaterials.get(hex);
|
|
11478
|
+
if (known) return known;
|
|
11479
|
+
const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
|
|
11480
|
+
gapMaterials.set(hex, made);
|
|
11481
|
+
return made;
|
|
11482
|
+
}
|
|
11483
|
+
const HOOD_GAP = 4 * GAP_R;
|
|
11484
|
+
function hoodGap(c, S, x0, x1, zH, mat) {
|
|
11485
|
+
const onTop = (x, z) => {
|
|
11486
|
+
const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
|
|
11487
|
+
return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
|
|
11488
|
+
};
|
|
11489
|
+
const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
|
|
11490
|
+
const across = Math.max(4, Math.ceil(2 * zH / 0.04));
|
|
11491
|
+
const line = [];
|
|
11492
|
+
for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
|
|
11493
|
+
for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
|
|
11494
|
+
for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
|
|
11495
|
+
const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
|
|
11496
|
+
t.castShadow = false;
|
|
11497
|
+
t.userData.gap = true;
|
|
11498
|
+
return t;
|
|
11499
|
+
}
|
|
11500
|
+
const FUEL_DOOR_W = 0.13;
|
|
11501
|
+
const FUEL_DOOR_H = 0.11;
|
|
11502
|
+
const FUEL_DOOR_R = 0.02;
|
|
11503
|
+
function fuelDoorGap(c, S, sd, x, y, mat) {
|
|
11504
|
+
const pts = [];
|
|
11505
|
+
const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
|
|
11506
|
+
const corners = [
|
|
11507
|
+
[hx, hy, 0],
|
|
11508
|
+
[-hx, hy, 0.5 * PI],
|
|
11509
|
+
[-hx, -hy, PI],
|
|
11510
|
+
[hx, -hy, 1.5 * PI]
|
|
11511
|
+
];
|
|
11512
|
+
corners.forEach(function([cx, cy, a0]) {
|
|
11513
|
+
for (let k = 0; k <= 4; k++) {
|
|
11514
|
+
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");
|
|
11515
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
|
|
11516
|
+
}
|
|
11517
|
+
});
|
|
11518
|
+
const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
|
|
11519
|
+
t.castShadow = false;
|
|
11520
|
+
t.userData.gap = true;
|
|
11521
|
+
return t;
|
|
11522
|
+
}
|
|
11422
11523
|
function sm(t) {
|
|
11423
11524
|
t = clamp4(t, 0, 1);
|
|
11424
11525
|
return t * t * (3 - 2 * t);
|
|
@@ -11816,6 +11917,8 @@ var GameUrbanThree = (() => {
|
|
|
11816
11917
|
dropRear: true,
|
|
11817
11918
|
seams: [0.64, -0.5, [-1.27, 0.67, 0.93]],
|
|
11818
11919
|
handles: [0.12, -0.86],
|
|
11920
|
+
/* fuel door on the right rear fender, between the rear door and the taillight, over the wheel */
|
|
11921
|
+
fuelDoor: [-1.47, 0.71, 1],
|
|
11819
11922
|
blackPillars: [-0.5],
|
|
11820
11923
|
frontBumper: { y1: 0.6 },
|
|
11821
11924
|
rearBumper: { y1: 0.58 },
|
|
@@ -20107,8 +20210,9 @@ var GameUrbanThree = (() => {
|
|
|
20107
20210
|
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");
|
|
20108
20211
|
return h ? h.p.addScaledVector(h.n, 3e-3) : null;
|
|
20109
20212
|
}).filter(Boolean);
|
|
20110
|
-
const t = c.tube(P,
|
|
20213
|
+
const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
|
|
20111
20214
|
t.castShadow = false;
|
|
20215
|
+
t.userData.gap = true;
|
|
20112
20216
|
c.deform.push(t);
|
|
20113
20217
|
return t;
|
|
20114
20218
|
};
|
|
@@ -20134,6 +20238,7 @@ var GameUrbanThree = (() => {
|
|
|
20134
20238
|
};
|
|
20135
20239
|
return K;
|
|
20136
20240
|
}
|
|
20241
|
+
const DIVISION_OVER = 0.012;
|
|
20137
20242
|
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
20138
20243
|
function car(c, s) {
|
|
20139
20244
|
const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
|
|
@@ -20170,7 +20275,10 @@ var GameUrbanThree = (() => {
|
|
|
20170
20275
|
if (s.dropRear) polys = polys.slice(1);
|
|
20171
20276
|
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
20172
20277
|
polys = divided.polys;
|
|
20173
|
-
glassDivisions.set(
|
|
20278
|
+
glassDivisions.set(
|
|
20279
|
+
c,
|
|
20280
|
+
divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
|
|
20281
|
+
);
|
|
20174
20282
|
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);
|
|
20175
20283
|
const gHoles = [];
|
|
20176
20284
|
if (intr) {
|
|
@@ -20191,6 +20299,7 @@ var GameUrbanThree = (() => {
|
|
|
20191
20299
|
side: THREE.DoubleSide
|
|
20192
20300
|
}) : null;
|
|
20193
20301
|
kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
|
|
20302
|
+
const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
|
|
20194
20303
|
kit.sideWindows(
|
|
20195
20304
|
c,
|
|
20196
20305
|
polys,
|
|
@@ -20199,7 +20308,14 @@ var GameUrbanThree = (() => {
|
|
|
20199
20308
|
function(i, n) {
|
|
20200
20309
|
return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
|
|
20201
20310
|
},
|
|
20202
|
-
{
|
|
20311
|
+
{
|
|
20312
|
+
see: !!intr,
|
|
20313
|
+
// a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
|
|
20314
|
+
seal: function(i) {
|
|
20315
|
+
const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
20316
|
+
return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
|
|
20317
|
+
}
|
|
20318
|
+
}
|
|
20203
20319
|
);
|
|
20204
20320
|
kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
|
|
20205
20321
|
kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? REARTINT : MT.glassDark });
|
|
@@ -20251,7 +20367,7 @@ var GameUrbanThree = (() => {
|
|
|
20251
20367
|
(s.arches || []).forEach(function(a) {
|
|
20252
20368
|
fa = Math.max(fa, a[0]);
|
|
20253
20369
|
});
|
|
20254
|
-
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
|
|
20370
|
+
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
|
|
20255
20371
|
if (hood)
|
|
20256
20372
|
kit.engineBay(c, {
|
|
20257
20373
|
x0: hx0 + 0.02,
|
|
@@ -20285,6 +20401,7 @@ var GameUrbanThree = (() => {
|
|
|
20285
20401
|
);
|
|
20286
20402
|
const Wf = mkWarp(wo);
|
|
20287
20403
|
const S = mkSurf(lowMesh, W);
|
|
20404
|
+
if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
|
|
20288
20405
|
details(c, s, Wf, S);
|
|
20289
20406
|
applyWarp(c, Wf);
|
|
20290
20407
|
return m;
|
|
@@ -20296,7 +20413,7 @@ var GameUrbanThree = (() => {
|
|
|
20296
20413
|
}, rx = function(y) {
|
|
20297
20414
|
return profX(it, y, false);
|
|
20298
20415
|
};
|
|
20299
|
-
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
|
|
20416
|
+
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
|
|
20300
20417
|
I.fxB = S.endX(1, by + 0.2);
|
|
20301
20418
|
I.rxB = S.endX(-1, by + 0.2);
|
|
20302
20419
|
const K = mkKit(c, S, I);
|
|
@@ -20325,21 +20442,22 @@ var GameUrbanThree = (() => {
|
|
|
20325
20442
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
20326
20443
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
20327
20444
|
[1, -1].forEach(function(sd) {
|
|
20328
|
-
const bar = function(px, width) {
|
|
20329
|
-
const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
|
|
20445
|
+
const bar = function(px, width, span) {
|
|
20446
|
+
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;
|
|
20330
20447
|
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] });
|
|
20331
20448
|
m2.castShadow = false;
|
|
20332
20449
|
return m2;
|
|
20333
20450
|
};
|
|
20334
20451
|
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
20335
|
-
(glassDivisions.get(c) ?? []).forEach((
|
|
20336
|
-
bar(
|
|
20452
|
+
(glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
|
|
20453
|
+
bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
|
|
20337
20454
|
});
|
|
20338
20455
|
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;
|
|
20339
20456
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
20340
20457
|
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 } });
|
|
20341
20458
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
20342
20459
|
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));
|
|
20460
|
+
if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
|
|
20343
20461
|
(s.handles || []).forEach(function(x) {
|
|
20344
20462
|
c.roundBox(
|
|
20345
20463
|
0.15,
|
|
@@ -20415,9 +20533,10 @@ var GameUrbanThree = (() => {
|
|
|
20415
20533
|
(s.seams || []).forEach(function(x) {
|
|
20416
20534
|
const pts = shutLinePoints(side, seamOnDoorEdge(x, edges), by + 0.11, gh.belt - 0.03);
|
|
20417
20535
|
if (pts.length < 3) return;
|
|
20418
|
-
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, MT.dark, { seg: 72, rs: 5 }));
|
|
20536
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
|
|
20419
20537
|
seam.castShadow = false;
|
|
20420
20538
|
seam.userData.doorSeam = true;
|
|
20539
|
+
seam.userData.gap = true;
|
|
20421
20540
|
c.deform.push(seam);
|
|
20422
20541
|
});
|
|
20423
20542
|
});
|
|
@@ -20494,6 +20613,59 @@ var GameUrbanThree = (() => {
|
|
|
20494
20613
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
20495
20614
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
20496
20615
|
}
|
|
20616
|
+
const GAP_R = 2e-3;
|
|
20617
|
+
const FIXED_SEAL_R = 4e-3;
|
|
20618
|
+
const DOOR_SEAL_R = 6e-3;
|
|
20619
|
+
const GAP_SHADE = 0.45;
|
|
20620
|
+
const gapMaterials = /* @__PURE__ */ new Map();
|
|
20621
|
+
function gapMaterial(col) {
|
|
20622
|
+
const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
|
|
20623
|
+
const known = gapMaterials.get(hex);
|
|
20624
|
+
if (known) return known;
|
|
20625
|
+
const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
|
|
20626
|
+
gapMaterials.set(hex, made);
|
|
20627
|
+
return made;
|
|
20628
|
+
}
|
|
20629
|
+
const HOOD_GAP = 4 * GAP_R;
|
|
20630
|
+
function hoodGap(c, S, x0, x1, zH, mat) {
|
|
20631
|
+
const onTop = (x, z) => {
|
|
20632
|
+
const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
|
|
20633
|
+
return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
|
|
20634
|
+
};
|
|
20635
|
+
const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
|
|
20636
|
+
const across = Math.max(4, Math.ceil(2 * zH / 0.04));
|
|
20637
|
+
const line = [];
|
|
20638
|
+
for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
|
|
20639
|
+
for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
|
|
20640
|
+
for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
|
|
20641
|
+
const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
|
|
20642
|
+
t.castShadow = false;
|
|
20643
|
+
t.userData.gap = true;
|
|
20644
|
+
return t;
|
|
20645
|
+
}
|
|
20646
|
+
const FUEL_DOOR_W = 0.13;
|
|
20647
|
+
const FUEL_DOOR_H = 0.11;
|
|
20648
|
+
const FUEL_DOOR_R = 0.02;
|
|
20649
|
+
function fuelDoorGap(c, S, sd, x, y, mat) {
|
|
20650
|
+
const pts = [];
|
|
20651
|
+
const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
|
|
20652
|
+
const corners = [
|
|
20653
|
+
[hx, hy, 0],
|
|
20654
|
+
[-hx, hy, 0.5 * PI],
|
|
20655
|
+
[-hx, -hy, PI],
|
|
20656
|
+
[hx, -hy, 1.5 * PI]
|
|
20657
|
+
];
|
|
20658
|
+
corners.forEach(function([cx, cy, a0]) {
|
|
20659
|
+
for (let k = 0; k <= 4; k++) {
|
|
20660
|
+
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");
|
|
20661
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
|
|
20662
|
+
}
|
|
20663
|
+
});
|
|
20664
|
+
const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
|
|
20665
|
+
t.castShadow = false;
|
|
20666
|
+
t.userData.gap = true;
|
|
20667
|
+
return t;
|
|
20668
|
+
}
|
|
20497
20669
|
function sm(t) {
|
|
20498
20670
|
t = clamp4(t, 0, 1);
|
|
20499
20671
|
return t * t * (3 - 2 * t);
|