@adatechnology/game-urban-three 0.5.11 → 0.5.13
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 +203 -23
- package/dist/index.global.js.map +1 -1
- package/package.json +9 -9
package/dist/index.global.js
CHANGED
|
@@ -5146,6 +5146,11 @@ var GameUrbanThree = (() => {
|
|
|
5146
5146
|
var engine = defaultFloorplan();
|
|
5147
5147
|
|
|
5148
5148
|
// ../game-vehicles/dist/index.js
|
|
5149
|
+
var CABIN_PARTS = {
|
|
5150
|
+
seat: { id: "seats", material: "fabric" },
|
|
5151
|
+
trim: { id: "dashboard", material: "plastic" }
|
|
5152
|
+
};
|
|
5153
|
+
var CABIN_PART_IDS = new Set(Object.values(CABIN_PARTS).map((p) => p.id));
|
|
5149
5154
|
var SHUT_LINE_RADIUS = 2e-3;
|
|
5150
5155
|
var SHUT_LINE_LIFT = 8e-4;
|
|
5151
5156
|
var SHUT_LINE_STEPS = 36;
|
|
@@ -5271,6 +5276,28 @@ var GameUrbanThree = (() => {
|
|
|
5271
5276
|
}
|
|
5272
5277
|
return { polys: out, used };
|
|
5273
5278
|
}
|
|
5279
|
+
function crossingAt(polys, x) {
|
|
5280
|
+
let lo = Infinity;
|
|
5281
|
+
let hi = -Infinity;
|
|
5282
|
+
for (const poly of polys) {
|
|
5283
|
+
for (let i = 0; i < poly.length; i++) {
|
|
5284
|
+
const a = poly[i];
|
|
5285
|
+
const b = poly[(i + 1) % poly.length];
|
|
5286
|
+
if ((a[0] - x) * (b[0] - x) > 0 || a[0] === b[0]) continue;
|
|
5287
|
+
const y = a[1] + (x - a[0]) / (b[0] - a[0]) * (b[1] - a[1]);
|
|
5288
|
+
lo = Math.min(lo, y);
|
|
5289
|
+
hi = Math.max(hi, y);
|
|
5290
|
+
}
|
|
5291
|
+
}
|
|
5292
|
+
return hi >= lo ? [lo, hi] : null;
|
|
5293
|
+
}
|
|
5294
|
+
function divisionSpan(polys, at) {
|
|
5295
|
+
const rear = crossingAt(polys, at - DIVISION_HALF);
|
|
5296
|
+
const front = crossingAt(polys, at + DIVISION_HALF);
|
|
5297
|
+
if (!rear) return front;
|
|
5298
|
+
if (!front) return rear;
|
|
5299
|
+
return [Math.min(rear[0], front[0]), Math.max(rear[1], front[1])];
|
|
5300
|
+
}
|
|
5274
5301
|
var SmokeCause = { STEAM: "steam", OIL: "oil", FIRE: "fire" };
|
|
5275
5302
|
var SMOKE_LOOKS = {
|
|
5276
5303
|
[SmokeCause.STEAM]: { color: 14870248, alpha: 0.18 },
|
|
@@ -5279,6 +5306,7 @@ var GameUrbanThree = (() => {
|
|
|
5279
5306
|
};
|
|
5280
5307
|
var CAUSE_OF_EMITTER = { white: SmokeCause.STEAM, oil: SmokeCause.OIL, black: SmokeCause.FIRE };
|
|
5281
5308
|
var LIFT = { [SmokeCause.STEAM]: 0.5, [SmokeCause.OIL]: 0.45, [SmokeCause.FIRE]: 0.6 };
|
|
5309
|
+
var DROP_GATE_OPEN = Math.PI / 2;
|
|
5282
5310
|
var LID_OUTWARD = [-Math.SQRT1_2, Math.SQRT1_2, 0];
|
|
5283
5311
|
var cabin_default = {
|
|
5284
5312
|
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)",
|
|
@@ -10993,6 +11021,7 @@ var GameUrbanThree = (() => {
|
|
|
10993
11021
|
return pl;
|
|
10994
11022
|
};
|
|
10995
11023
|
K.lid = function(pts0) {
|
|
11024
|
+
c.meta.lidSeam = pts0;
|
|
10996
11025
|
const pts = [];
|
|
10997
11026
|
pts0.forEach(function(q, i) {
|
|
10998
11027
|
const n = pts0[i + 1];
|
|
@@ -11010,8 +11039,9 @@ var GameUrbanThree = (() => {
|
|
|
11010
11039
|
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
11040
|
return h ? h.p.addScaledVector(h.n, 3e-3) : null;
|
|
11012
11041
|
}).filter(Boolean);
|
|
11013
|
-
const t = c.tube(P,
|
|
11042
|
+
const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
|
|
11014
11043
|
t.castShadow = false;
|
|
11044
|
+
t.userData.gap = true;
|
|
11015
11045
|
c.deform.push(t);
|
|
11016
11046
|
return t;
|
|
11017
11047
|
};
|
|
@@ -11037,6 +11067,8 @@ var GameUrbanThree = (() => {
|
|
|
11037
11067
|
};
|
|
11038
11068
|
return K;
|
|
11039
11069
|
}
|
|
11070
|
+
const DIVISION_OVER = 0.012;
|
|
11071
|
+
const COWL_DROP = 0.012;
|
|
11040
11072
|
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
11041
11073
|
function car(c, s) {
|
|
11042
11074
|
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 +11106,10 @@ var GameUrbanThree = (() => {
|
|
|
11074
11106
|
if (gh.polys) polys = gh.polys(polys);
|
|
11075
11107
|
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
11076
11108
|
polys = divided.polys;
|
|
11077
|
-
glassDivisions.set(
|
|
11109
|
+
glassDivisions.set(
|
|
11110
|
+
c,
|
|
11111
|
+
divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
|
|
11112
|
+
);
|
|
11078
11113
|
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
11114
|
const gHoles = [];
|
|
11080
11115
|
if (intr) {
|
|
@@ -11095,6 +11130,7 @@ var GameUrbanThree = (() => {
|
|
|
11095
11130
|
side: THREE.DoubleSide
|
|
11096
11131
|
}) : null;
|
|
11097
11132
|
kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
|
|
11133
|
+
const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
|
|
11098
11134
|
kit.sideWindows(
|
|
11099
11135
|
c,
|
|
11100
11136
|
polys,
|
|
@@ -11103,7 +11139,14 @@ var GameUrbanThree = (() => {
|
|
|
11103
11139
|
function(i, n) {
|
|
11104
11140
|
return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
|
|
11105
11141
|
},
|
|
11106
|
-
{
|
|
11142
|
+
{
|
|
11143
|
+
see: !!intr,
|
|
11144
|
+
// a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
|
|
11145
|
+
seal: function(i) {
|
|
11146
|
+
const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
11147
|
+
return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
|
|
11148
|
+
}
|
|
11149
|
+
}
|
|
11107
11150
|
);
|
|
11108
11151
|
kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
|
|
11109
11152
|
kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? MT.tint : MT.glassDark });
|
|
@@ -11162,7 +11205,7 @@ var GameUrbanThree = (() => {
|
|
|
11162
11205
|
(s.arches || []).forEach(function(a) {
|
|
11163
11206
|
fa = Math.max(fa, a[0]);
|
|
11164
11207
|
});
|
|
11165
|
-
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
|
|
11208
|
+
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
|
|
11166
11209
|
if (hood)
|
|
11167
11210
|
kit.engineBay(c, {
|
|
11168
11211
|
x0: hx0 + 0.02,
|
|
@@ -11196,6 +11239,7 @@ var GameUrbanThree = (() => {
|
|
|
11196
11239
|
);
|
|
11197
11240
|
const Wf = mkWarp(wo);
|
|
11198
11241
|
const S = mkSurf(lowMesh, W);
|
|
11242
|
+
if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
|
|
11199
11243
|
details(c, s, Wf, S);
|
|
11200
11244
|
applyWarp(c, Wf);
|
|
11201
11245
|
return m;
|
|
@@ -11207,7 +11251,7 @@ var GameUrbanThree = (() => {
|
|
|
11207
11251
|
}, rx = function(y) {
|
|
11208
11252
|
return profX(it, y, false);
|
|
11209
11253
|
};
|
|
11210
|
-
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
|
|
11254
|
+
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
|
|
11211
11255
|
I.fxB = S.endX(1, by + 0.2);
|
|
11212
11256
|
I.rxB = S.endX(-1, by + 0.2);
|
|
11213
11257
|
const K = mkKit(c, S, I);
|
|
@@ -11236,21 +11280,22 @@ var GameUrbanThree = (() => {
|
|
|
11236
11280
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
11237
11281
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
11238
11282
|
[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;
|
|
11283
|
+
const bar = function(px, width, span) {
|
|
11284
|
+
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
11285
|
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
11286
|
m2.castShadow = false;
|
|
11243
11287
|
return m2;
|
|
11244
11288
|
};
|
|
11245
11289
|
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
11246
|
-
(glassDivisions.get(c) ?? []).forEach((
|
|
11247
|
-
bar(
|
|
11290
|
+
(glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
|
|
11291
|
+
bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
|
|
11248
11292
|
});
|
|
11249
11293
|
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
11294
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
11251
11295
|
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
11296
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
11253
11297
|
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));
|
|
11298
|
+
if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
|
|
11254
11299
|
(s.handles || []).forEach(function(x) {
|
|
11255
11300
|
c.roundBox(
|
|
11256
11301
|
0.15,
|
|
@@ -11278,16 +11323,25 @@ var GameUrbanThree = (() => {
|
|
|
11278
11323
|
c.roundBox(
|
|
11279
11324
|
gh.fb - gh.rb - 0.3,
|
|
11280
11325
|
0.012,
|
|
11281
|
-
|
|
11326
|
+
0.012,
|
|
11282
11327
|
4e-3,
|
|
11283
11328
|
MT.chrome,
|
|
11284
11329
|
(gh.fb + gh.rb) / 2 - 0.05,
|
|
11285
11330
|
gh.belt + 0.035,
|
|
11286
|
-
sd * (halfAt(gh.Wg, T, gh.belt + 0.035) +
|
|
11331
|
+
sd * (halfAt(gh.Wg, T, gh.belt + 0.035) + 6e-3)
|
|
11287
11332
|
);
|
|
11288
11333
|
});
|
|
11289
11334
|
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
|
-
|
|
11335
|
+
let cwz = gh.Wg / 2 - 0.03;
|
|
11336
|
+
for (let z = 0.3; z < cwz; z += 0.01) {
|
|
11337
|
+
const h = S.hit(new V3(gh.fb + 0.03, 3, z), new V3(0, -1, 0));
|
|
11338
|
+
if (!h || h.p.y < cwy - COWL_DROP) {
|
|
11339
|
+
cwz = z;
|
|
11340
|
+
break;
|
|
11341
|
+
}
|
|
11342
|
+
}
|
|
11343
|
+
cwz = Math.min(cwz, halfAt(gh.Wg, T, gh.belt + 0.05) - 0.072);
|
|
11344
|
+
c.roundBox(0.15, 0.02, 2 * cwz, 8e-3, PLASTIC, gh.fb + 0.02, cwy + 4e-3, 0).castShadow = false;
|
|
11291
11345
|
const wd = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize(), wn = new V3(wd.y, -wd.x, 0);
|
|
11292
11346
|
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
11347
|
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 +11394,10 @@ var GameUrbanThree = (() => {
|
|
|
11340
11394
|
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
11395
|
const pts = shutLinePoints(side, x, y0, y1);
|
|
11342
11396
|
if (pts.length < 3) return;
|
|
11343
|
-
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, MT.dark, { seg: 72, rs: 5 }));
|
|
11397
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
|
|
11344
11398
|
seam.castShadow = false;
|
|
11345
11399
|
seam.userData.doorSeam = true;
|
|
11400
|
+
seam.userData.gap = true;
|
|
11346
11401
|
c.deform.push(seam);
|
|
11347
11402
|
});
|
|
11348
11403
|
});
|
|
@@ -11419,6 +11474,59 @@ var GameUrbanThree = (() => {
|
|
|
11419
11474
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
11420
11475
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
11421
11476
|
}
|
|
11477
|
+
const GAP_R = 2e-3;
|
|
11478
|
+
const FIXED_SEAL_R = 4e-3;
|
|
11479
|
+
const DOOR_SEAL_R = 6e-3;
|
|
11480
|
+
const GAP_SHADE = 0.45;
|
|
11481
|
+
const gapMaterials = /* @__PURE__ */ new Map();
|
|
11482
|
+
function gapMaterial(col) {
|
|
11483
|
+
const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
|
|
11484
|
+
const known = gapMaterials.get(hex);
|
|
11485
|
+
if (known) return known;
|
|
11486
|
+
const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
|
|
11487
|
+
gapMaterials.set(hex, made);
|
|
11488
|
+
return made;
|
|
11489
|
+
}
|
|
11490
|
+
const HOOD_GAP = 4 * GAP_R;
|
|
11491
|
+
function hoodGap(c, S, x0, x1, zH, mat) {
|
|
11492
|
+
const onTop = (x, z) => {
|
|
11493
|
+
const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
|
|
11494
|
+
return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
|
|
11495
|
+
};
|
|
11496
|
+
const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
|
|
11497
|
+
const across = Math.max(4, Math.ceil(2 * zH / 0.04));
|
|
11498
|
+
const line = [];
|
|
11499
|
+
for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
|
|
11500
|
+
for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
|
|
11501
|
+
for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
|
|
11502
|
+
const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
|
|
11503
|
+
t.castShadow = false;
|
|
11504
|
+
t.userData.gap = true;
|
|
11505
|
+
return t;
|
|
11506
|
+
}
|
|
11507
|
+
const FUEL_DOOR_W = 0.13;
|
|
11508
|
+
const FUEL_DOOR_H = 0.11;
|
|
11509
|
+
const FUEL_DOOR_R = 0.02;
|
|
11510
|
+
function fuelDoorGap(c, S, sd, x, y, mat) {
|
|
11511
|
+
const pts = [];
|
|
11512
|
+
const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
|
|
11513
|
+
const corners = [
|
|
11514
|
+
[hx, hy, 0],
|
|
11515
|
+
[-hx, hy, 0.5 * PI],
|
|
11516
|
+
[-hx, -hy, PI],
|
|
11517
|
+
[hx, -hy, 1.5 * PI]
|
|
11518
|
+
];
|
|
11519
|
+
corners.forEach(function([cx, cy, a0]) {
|
|
11520
|
+
for (let k = 0; k <= 4; k++) {
|
|
11521
|
+
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");
|
|
11522
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
|
|
11523
|
+
}
|
|
11524
|
+
});
|
|
11525
|
+
const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
|
|
11526
|
+
t.castShadow = false;
|
|
11527
|
+
t.userData.gap = true;
|
|
11528
|
+
return t;
|
|
11529
|
+
}
|
|
11422
11530
|
function sm(t) {
|
|
11423
11531
|
t = clamp4(t, 0, 1);
|
|
11424
11532
|
return t * t * (3 - 2 * t);
|
|
@@ -11816,6 +11924,8 @@ var GameUrbanThree = (() => {
|
|
|
11816
11924
|
dropRear: true,
|
|
11817
11925
|
seams: [0.64, -0.5, [-1.27, 0.67, 0.93]],
|
|
11818
11926
|
handles: [0.12, -0.86],
|
|
11927
|
+
/* fuel door on the right rear fender, between the rear door and the taillight, over the wheel */
|
|
11928
|
+
fuelDoor: [-1.47, 0.71, 1],
|
|
11819
11929
|
blackPillars: [-0.5],
|
|
11820
11930
|
frontBumper: { y1: 0.6 },
|
|
11821
11931
|
rearBumper: { y1: 0.58 },
|
|
@@ -20103,12 +20213,14 @@ var GameUrbanThree = (() => {
|
|
|
20103
20213
|
return pl;
|
|
20104
20214
|
};
|
|
20105
20215
|
K.lid = function(pts) {
|
|
20216
|
+
c.meta.lidSeam = pts;
|
|
20106
20217
|
const P = pts.map(function(q) {
|
|
20107
20218
|
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
20219
|
return h ? h.p.addScaledVector(h.n, 3e-3) : null;
|
|
20109
20220
|
}).filter(Boolean);
|
|
20110
|
-
const t = c.tube(P,
|
|
20221
|
+
const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
|
|
20111
20222
|
t.castShadow = false;
|
|
20223
|
+
t.userData.gap = true;
|
|
20112
20224
|
c.deform.push(t);
|
|
20113
20225
|
return t;
|
|
20114
20226
|
};
|
|
@@ -20134,6 +20246,7 @@ var GameUrbanThree = (() => {
|
|
|
20134
20246
|
};
|
|
20135
20247
|
return K;
|
|
20136
20248
|
}
|
|
20249
|
+
const DIVISION_OVER = 0.012;
|
|
20137
20250
|
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
20138
20251
|
function car(c, s) {
|
|
20139
20252
|
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 +20283,10 @@ var GameUrbanThree = (() => {
|
|
|
20170
20283
|
if (s.dropRear) polys = polys.slice(1);
|
|
20171
20284
|
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
20172
20285
|
polys = divided.polys;
|
|
20173
|
-
glassDivisions.set(
|
|
20286
|
+
glassDivisions.set(
|
|
20287
|
+
c,
|
|
20288
|
+
divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
|
|
20289
|
+
);
|
|
20174
20290
|
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
20291
|
const gHoles = [];
|
|
20176
20292
|
if (intr) {
|
|
@@ -20191,6 +20307,7 @@ var GameUrbanThree = (() => {
|
|
|
20191
20307
|
side: THREE.DoubleSide
|
|
20192
20308
|
}) : null;
|
|
20193
20309
|
kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
|
|
20310
|
+
const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
|
|
20194
20311
|
kit.sideWindows(
|
|
20195
20312
|
c,
|
|
20196
20313
|
polys,
|
|
@@ -20199,7 +20316,14 @@ var GameUrbanThree = (() => {
|
|
|
20199
20316
|
function(i, n) {
|
|
20200
20317
|
return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
|
|
20201
20318
|
},
|
|
20202
|
-
{
|
|
20319
|
+
{
|
|
20320
|
+
see: !!intr,
|
|
20321
|
+
// a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
|
|
20322
|
+
seal: function(i) {
|
|
20323
|
+
const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
20324
|
+
return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
|
|
20325
|
+
}
|
|
20326
|
+
}
|
|
20203
20327
|
);
|
|
20204
20328
|
kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
|
|
20205
20329
|
kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? REARTINT : MT.glassDark });
|
|
@@ -20251,7 +20375,7 @@ var GameUrbanThree = (() => {
|
|
|
20251
20375
|
(s.arches || []).forEach(function(a) {
|
|
20252
20376
|
fa = Math.max(fa, a[0]);
|
|
20253
20377
|
});
|
|
20254
|
-
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
|
|
20378
|
+
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
|
|
20255
20379
|
if (hood)
|
|
20256
20380
|
kit.engineBay(c, {
|
|
20257
20381
|
x0: hx0 + 0.02,
|
|
@@ -20285,6 +20409,7 @@ var GameUrbanThree = (() => {
|
|
|
20285
20409
|
);
|
|
20286
20410
|
const Wf = mkWarp(wo);
|
|
20287
20411
|
const S = mkSurf(lowMesh, W);
|
|
20412
|
+
if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
|
|
20288
20413
|
details(c, s, Wf, S);
|
|
20289
20414
|
applyWarp(c, Wf);
|
|
20290
20415
|
return m;
|
|
@@ -20296,7 +20421,7 @@ var GameUrbanThree = (() => {
|
|
|
20296
20421
|
}, rx = function(y) {
|
|
20297
20422
|
return profX(it, y, false);
|
|
20298
20423
|
};
|
|
20299
|
-
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
|
|
20424
|
+
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
|
|
20300
20425
|
I.fxB = S.endX(1, by + 0.2);
|
|
20301
20426
|
I.rxB = S.endX(-1, by + 0.2);
|
|
20302
20427
|
const K = mkKit(c, S, I);
|
|
@@ -20325,21 +20450,22 @@ var GameUrbanThree = (() => {
|
|
|
20325
20450
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
20326
20451
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
20327
20452
|
[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;
|
|
20453
|
+
const bar = function(px, width, span) {
|
|
20454
|
+
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
20455
|
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
20456
|
m2.castShadow = false;
|
|
20332
20457
|
return m2;
|
|
20333
20458
|
};
|
|
20334
20459
|
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
20335
|
-
(glassDivisions.get(c) ?? []).forEach((
|
|
20336
|
-
bar(
|
|
20460
|
+
(glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
|
|
20461
|
+
bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
|
|
20337
20462
|
});
|
|
20338
20463
|
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
20464
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
20340
20465
|
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
20466
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
20342
20467
|
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));
|
|
20468
|
+
if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
|
|
20343
20469
|
(s.handles || []).forEach(function(x) {
|
|
20344
20470
|
c.roundBox(
|
|
20345
20471
|
0.15,
|
|
@@ -20415,9 +20541,10 @@ var GameUrbanThree = (() => {
|
|
|
20415
20541
|
(s.seams || []).forEach(function(x) {
|
|
20416
20542
|
const pts = shutLinePoints(side, seamOnDoorEdge(x, edges), by + 0.11, gh.belt - 0.03);
|
|
20417
20543
|
if (pts.length < 3) return;
|
|
20418
|
-
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, MT.dark, { seg: 72, rs: 5 }));
|
|
20544
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
|
|
20419
20545
|
seam.castShadow = false;
|
|
20420
20546
|
seam.userData.doorSeam = true;
|
|
20547
|
+
seam.userData.gap = true;
|
|
20421
20548
|
c.deform.push(seam);
|
|
20422
20549
|
});
|
|
20423
20550
|
});
|
|
@@ -20494,6 +20621,59 @@ var GameUrbanThree = (() => {
|
|
|
20494
20621
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
20495
20622
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
20496
20623
|
}
|
|
20624
|
+
const GAP_R = 2e-3;
|
|
20625
|
+
const FIXED_SEAL_R = 4e-3;
|
|
20626
|
+
const DOOR_SEAL_R = 6e-3;
|
|
20627
|
+
const GAP_SHADE = 0.45;
|
|
20628
|
+
const gapMaterials = /* @__PURE__ */ new Map();
|
|
20629
|
+
function gapMaterial(col) {
|
|
20630
|
+
const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
|
|
20631
|
+
const known = gapMaterials.get(hex);
|
|
20632
|
+
if (known) return known;
|
|
20633
|
+
const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
|
|
20634
|
+
gapMaterials.set(hex, made);
|
|
20635
|
+
return made;
|
|
20636
|
+
}
|
|
20637
|
+
const HOOD_GAP = 4 * GAP_R;
|
|
20638
|
+
function hoodGap(c, S, x0, x1, zH, mat) {
|
|
20639
|
+
const onTop = (x, z) => {
|
|
20640
|
+
const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
|
|
20641
|
+
return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
|
|
20642
|
+
};
|
|
20643
|
+
const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
|
|
20644
|
+
const across = Math.max(4, Math.ceil(2 * zH / 0.04));
|
|
20645
|
+
const line = [];
|
|
20646
|
+
for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
|
|
20647
|
+
for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
|
|
20648
|
+
for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
|
|
20649
|
+
const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
|
|
20650
|
+
t.castShadow = false;
|
|
20651
|
+
t.userData.gap = true;
|
|
20652
|
+
return t;
|
|
20653
|
+
}
|
|
20654
|
+
const FUEL_DOOR_W = 0.13;
|
|
20655
|
+
const FUEL_DOOR_H = 0.11;
|
|
20656
|
+
const FUEL_DOOR_R = 0.02;
|
|
20657
|
+
function fuelDoorGap(c, S, sd, x, y, mat) {
|
|
20658
|
+
const pts = [];
|
|
20659
|
+
const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
|
|
20660
|
+
const corners = [
|
|
20661
|
+
[hx, hy, 0],
|
|
20662
|
+
[-hx, hy, 0.5 * PI],
|
|
20663
|
+
[-hx, -hy, PI],
|
|
20664
|
+
[hx, -hy, 1.5 * PI]
|
|
20665
|
+
];
|
|
20666
|
+
corners.forEach(function([cx, cy, a0]) {
|
|
20667
|
+
for (let k = 0; k <= 4; k++) {
|
|
20668
|
+
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");
|
|
20669
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
|
|
20670
|
+
}
|
|
20671
|
+
});
|
|
20672
|
+
const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
|
|
20673
|
+
t.castShadow = false;
|
|
20674
|
+
t.userData.gap = true;
|
|
20675
|
+
return t;
|
|
20676
|
+
}
|
|
20497
20677
|
function sm(t) {
|
|
20498
20678
|
t = clamp4(t, 0, 1);
|
|
20499
20679
|
return t * t * (3 - 2 * t);
|