@adatechnology/game-vehicles-fleet 11.0.2 → 12.0.0
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 +317 -96
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +273 -98
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.global.js
CHANGED
|
@@ -5095,6 +5095,31 @@ var GameVehiclesFleet = (() => {
|
|
|
5095
5095
|
}
|
|
5096
5096
|
|
|
5097
5097
|
// ../game-vehicles/dist/index.js
|
|
5098
|
+
var CABIN_PARTS = {
|
|
5099
|
+
seat: { id: "seats", material: "fabric" },
|
|
5100
|
+
trim: { id: "dashboard", material: "plastic" }
|
|
5101
|
+
};
|
|
5102
|
+
var CABIN_PART_IDS = new Set(Object.values(CABIN_PARTS).map((p) => p.id));
|
|
5103
|
+
var SHUT_LINE_RADIUS = 2e-3;
|
|
5104
|
+
var SHUT_LINE_LIFT = 8e-4;
|
|
5105
|
+
var SHUT_LINE_STEPS = 36;
|
|
5106
|
+
var SHUT_LINE_STRAY = 0.04;
|
|
5107
|
+
function shutLinePoints(hit, x, y0, y1) {
|
|
5108
|
+
const out = [];
|
|
5109
|
+
for (let k = 0; k <= SHUT_LINE_STEPS; k++) {
|
|
5110
|
+
const h = hit(x, y0 + (y1 - y0) * k / SHUT_LINE_STEPS);
|
|
5111
|
+
if (h) out.push([h.p.x + h.n.x * SHUT_LINE_LIFT, h.p.y + h.n.y * SHUT_LINE_LIFT, h.p.z + h.n.z * SHUT_LINE_LIFT]);
|
|
5112
|
+
}
|
|
5113
|
+
if (out.length < 3) return out;
|
|
5114
|
+
const depths = out.map((q) => q[2]).sort((a, b) => a - b);
|
|
5115
|
+
const median = depths[Math.floor(depths.length / 2)];
|
|
5116
|
+
return out.filter((q) => Math.abs(q[2] - median) < SHUT_LINE_STRAY);
|
|
5117
|
+
}
|
|
5118
|
+
var FINISH_DETAIL = "finishDetail";
|
|
5119
|
+
function markFinishDetail(object) {
|
|
5120
|
+
object.userData[FINISH_DETAIL] = true;
|
|
5121
|
+
return object;
|
|
5122
|
+
}
|
|
5098
5123
|
var DIVISION_HALF = 0.02;
|
|
5099
5124
|
var GLASS_IN_FROM_EDGE = 0.03;
|
|
5100
5125
|
var CUT_EPS = 1e-6;
|
|
@@ -5200,6 +5225,28 @@ var GameVehiclesFleet = (() => {
|
|
|
5200
5225
|
}
|
|
5201
5226
|
return { polys: out, used };
|
|
5202
5227
|
}
|
|
5228
|
+
function crossingAt(polys, x) {
|
|
5229
|
+
let lo = Infinity;
|
|
5230
|
+
let hi = -Infinity;
|
|
5231
|
+
for (const poly of polys) {
|
|
5232
|
+
for (let i = 0; i < poly.length; i++) {
|
|
5233
|
+
const a = poly[i];
|
|
5234
|
+
const b = poly[(i + 1) % poly.length];
|
|
5235
|
+
if ((a[0] - x) * (b[0] - x) > 0 || a[0] === b[0]) continue;
|
|
5236
|
+
const y = a[1] + (x - a[0]) / (b[0] - a[0]) * (b[1] - a[1]);
|
|
5237
|
+
lo = Math.min(lo, y);
|
|
5238
|
+
hi = Math.max(hi, y);
|
|
5239
|
+
}
|
|
5240
|
+
}
|
|
5241
|
+
return hi >= lo ? [lo, hi] : null;
|
|
5242
|
+
}
|
|
5243
|
+
function divisionSpan(polys, at) {
|
|
5244
|
+
const rear = crossingAt(polys, at - DIVISION_HALF);
|
|
5245
|
+
const front = crossingAt(polys, at + DIVISION_HALF);
|
|
5246
|
+
if (!rear) return front;
|
|
5247
|
+
if (!front) return rear;
|
|
5248
|
+
return [Math.min(rear[0], front[0]), Math.max(rear[1], front[1])];
|
|
5249
|
+
}
|
|
5203
5250
|
var SmokeCause = { STEAM: "steam", OIL: "oil", FIRE: "fire" };
|
|
5204
5251
|
var SMOKE_LOOKS = {
|
|
5205
5252
|
[SmokeCause.STEAM]: { color: 14870248, alpha: 0.18 },
|
|
@@ -5208,6 +5255,7 @@ var GameVehiclesFleet = (() => {
|
|
|
5208
5255
|
};
|
|
5209
5256
|
var CAUSE_OF_EMITTER = { white: SmokeCause.STEAM, oil: SmokeCause.OIL, black: SmokeCause.FIRE };
|
|
5210
5257
|
var LIFT = { [SmokeCause.STEAM]: 0.5, [SmokeCause.OIL]: 0.45, [SmokeCause.FIRE]: 0.6 };
|
|
5258
|
+
var DROP_GATE_OPEN = Math.PI / 2;
|
|
5211
5259
|
var LID_OUTWARD = [-Math.SQRT1_2, Math.SQRT1_2, 0];
|
|
5212
5260
|
var cabin_default = {
|
|
5213
5261
|
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)",
|
|
@@ -5344,6 +5392,57 @@ var GameVehiclesFleet = (() => {
|
|
|
5344
5392
|
return pane;
|
|
5345
5393
|
}
|
|
5346
5394
|
|
|
5395
|
+
// src/vehicles/side-design.ts
|
|
5396
|
+
var CREASE_FOLD_LIFT = 7e-3;
|
|
5397
|
+
var CREASE_FOLD_AT = 0.4;
|
|
5398
|
+
function creaseHeightAt(pts, x) {
|
|
5399
|
+
const n = pts.length;
|
|
5400
|
+
const slope = (i) => (pts[i + 1][1] - pts[i][1]) / (pts[i + 1][0] - pts[i][0] || 1);
|
|
5401
|
+
const tangent = (i) => {
|
|
5402
|
+
if (i === 0) return slope(0);
|
|
5403
|
+
if (i === n - 1) return slope(n - 2);
|
|
5404
|
+
const a = slope(i - 1), b = slope(i);
|
|
5405
|
+
return a * b <= 0 ? 0 : 2 * a * b / (a + b);
|
|
5406
|
+
};
|
|
5407
|
+
for (let i = 0; i < n - 1; i++) {
|
|
5408
|
+
const a = pts[i], b = pts[i + 1];
|
|
5409
|
+
if ((x - a[0]) * (x - b[0]) > 0) continue;
|
|
5410
|
+
const w = b[0] - a[0] || 1, t = (x - a[0]) / w, t2 = t * t, t3 = t2 * t;
|
|
5411
|
+
return (2 * t3 - 3 * t2 + 1) * a[1] + (t3 - 2 * t2 + t) * w * tangent(i) + (-2 * t3 + 3 * t2) * b[1] + (t3 - t2) * w * tangent(i + 1);
|
|
5412
|
+
}
|
|
5413
|
+
return pts[n - 1][1];
|
|
5414
|
+
}
|
|
5415
|
+
var raised = /* @__PURE__ */ new WeakMap();
|
|
5416
|
+
function raisedOnSide(c) {
|
|
5417
|
+
let list = raised.get(c);
|
|
5418
|
+
if (!list) raised.set(c, list = []);
|
|
5419
|
+
return list;
|
|
5420
|
+
}
|
|
5421
|
+
function markRaised(c, mesh) {
|
|
5422
|
+
raisedOnSide(c).push(mesh);
|
|
5423
|
+
}
|
|
5424
|
+
function bodySide(THREE, c, S, sd) {
|
|
5425
|
+
const ray = new THREE.Raycaster();
|
|
5426
|
+
const world = c.vehicle.matrixWorld;
|
|
5427
|
+
const toVehicle = world.clone().invert();
|
|
5428
|
+
return function(x, y) {
|
|
5429
|
+
const origin = new THREE.Vector3(x, y, sd * (S.hw + 1));
|
|
5430
|
+
const best = S.hit(origin, new THREE.Vector3(0, 0, -sd), "M");
|
|
5431
|
+
ray.set(origin.clone().applyMatrix4(world), new THREE.Vector3(0, 0, -sd).transformDirection(world));
|
|
5432
|
+
raisedOnSide(c).forEach(function(m) {
|
|
5433
|
+
const h = ray.intersectObject(m, false)[0];
|
|
5434
|
+
if (!h || !h.face) return;
|
|
5435
|
+
const p = h.point.clone().applyMatrix4(toVehicle);
|
|
5436
|
+
if (!best || Math.abs(p.z) <= Math.abs(best.p.z)) return;
|
|
5437
|
+
const n = h.face.normal.clone().transformDirection(m.matrixWorld).transformDirection(toVehicle);
|
|
5438
|
+
if (n.z * sd < 0) n.negate();
|
|
5439
|
+
best.p = p;
|
|
5440
|
+
best.n = n;
|
|
5441
|
+
});
|
|
5442
|
+
return best;
|
|
5443
|
+
};
|
|
5444
|
+
}
|
|
5445
|
+
|
|
5347
5446
|
// src/vehicles/cars-extra.ts
|
|
5348
5447
|
function installCarsExtra(fx) {
|
|
5349
5448
|
const kit = fx.kit;
|
|
@@ -5683,7 +5782,8 @@ var GameVehiclesFleet = (() => {
|
|
|
5683
5782
|
const u = u0 + (u1 - u0) * i / nu, b = yb(u), t = yt(u), row = [];
|
|
5684
5783
|
for (let j = 0; j <= nv; j++) {
|
|
5685
5784
|
const y = b + (t - b) * j / nv, s = G2.at(u, y);
|
|
5686
|
-
|
|
5785
|
+
const lift = o.ridge ? o.ridge.lift * (j / nv < o.ridge.at ? j / nv / o.ridge.at : (1 - j / nv) / (1 - o.ridge.at)) : 0;
|
|
5786
|
+
row.push({ p: s.p.addScaledVector(s.n, of + lift), n: s.n, uv: [i / nu * su, o.tile ? (y - G2.y0) * sv0 : j / nv] });
|
|
5687
5787
|
}
|
|
5688
5788
|
Q.push(row);
|
|
5689
5789
|
}
|
|
@@ -5972,6 +6072,7 @@ var GameVehiclesFleet = (() => {
|
|
|
5972
6072
|
return pl;
|
|
5973
6073
|
};
|
|
5974
6074
|
K.lid = function(pts0) {
|
|
6075
|
+
c.meta.lidSeam = pts0;
|
|
5975
6076
|
const pts = [];
|
|
5976
6077
|
pts0.forEach(function(q, i) {
|
|
5977
6078
|
const n = pts0[i + 1];
|
|
@@ -5989,8 +6090,9 @@ var GameVehiclesFleet = (() => {
|
|
|
5989
6090
|
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");
|
|
5990
6091
|
return h ? h.p.addScaledVector(h.n, 3e-3) : null;
|
|
5991
6092
|
}).filter(Boolean);
|
|
5992
|
-
const t = c.tube(P,
|
|
6093
|
+
const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
|
|
5993
6094
|
t.castShadow = false;
|
|
6095
|
+
t.userData.gap = true;
|
|
5994
6096
|
c.deform.push(t);
|
|
5995
6097
|
return t;
|
|
5996
6098
|
};
|
|
@@ -6016,6 +6118,8 @@ var GameVehiclesFleet = (() => {
|
|
|
6016
6118
|
};
|
|
6017
6119
|
return K;
|
|
6018
6120
|
}
|
|
6121
|
+
const DIVISION_OVER = 0.012;
|
|
6122
|
+
const COWL_DROP = 0.012;
|
|
6019
6123
|
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
6020
6124
|
function car(c, s) {
|
|
6021
6125
|
const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
|
|
@@ -6053,7 +6157,10 @@ var GameVehiclesFleet = (() => {
|
|
|
6053
6157
|
if (gh.polys) polys = gh.polys(polys);
|
|
6054
6158
|
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
6055
6159
|
polys = divided.polys;
|
|
6056
|
-
glassDivisions.set(
|
|
6160
|
+
glassDivisions.set(
|
|
6161
|
+
c,
|
|
6162
|
+
divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
|
|
6163
|
+
);
|
|
6057
6164
|
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 });
|
|
6058
6165
|
const gHoles = [];
|
|
6059
6166
|
if (intr) {
|
|
@@ -6074,6 +6181,7 @@ var GameVehiclesFleet = (() => {
|
|
|
6074
6181
|
side: THREE.DoubleSide
|
|
6075
6182
|
}) : null;
|
|
6076
6183
|
kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
|
|
6184
|
+
const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
|
|
6077
6185
|
kit.sideWindows(
|
|
6078
6186
|
c,
|
|
6079
6187
|
polys,
|
|
@@ -6082,7 +6190,14 @@ var GameVehiclesFleet = (() => {
|
|
|
6082
6190
|
function(i, n) {
|
|
6083
6191
|
return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
|
|
6084
6192
|
},
|
|
6085
|
-
{
|
|
6193
|
+
{
|
|
6194
|
+
see: !!intr,
|
|
6195
|
+
// a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
|
|
6196
|
+
seal: function(i) {
|
|
6197
|
+
const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
6198
|
+
return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
|
|
6199
|
+
}
|
|
6200
|
+
}
|
|
6086
6201
|
);
|
|
6087
6202
|
kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
|
|
6088
6203
|
kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? MT.tint : MT.glassDark });
|
|
@@ -6141,7 +6256,7 @@ var GameVehiclesFleet = (() => {
|
|
|
6141
6256
|
(s.arches || []).forEach(function(a) {
|
|
6142
6257
|
fa = Math.max(fa, a[0]);
|
|
6143
6258
|
});
|
|
6144
|
-
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
|
|
6259
|
+
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
|
|
6145
6260
|
if (hood)
|
|
6146
6261
|
kit.engineBay(c, {
|
|
6147
6262
|
x0: hx0 + 0.02,
|
|
@@ -6175,6 +6290,7 @@ var GameVehiclesFleet = (() => {
|
|
|
6175
6290
|
);
|
|
6176
6291
|
const Wf = mkWarp(wo);
|
|
6177
6292
|
const S = mkSurf(lowMesh, W);
|
|
6293
|
+
if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
|
|
6178
6294
|
details(c, s, Wf, S);
|
|
6179
6295
|
applyWarp(c, Wf);
|
|
6180
6296
|
return m;
|
|
@@ -6186,7 +6302,7 @@ var GameVehiclesFleet = (() => {
|
|
|
6186
6302
|
}, rx = function(y) {
|
|
6187
6303
|
return profX(it, y, false);
|
|
6188
6304
|
};
|
|
6189
|
-
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
|
|
6305
|
+
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
|
|
6190
6306
|
I.fxB = S.endX(1, by + 0.2);
|
|
6191
6307
|
I.rxB = S.endX(-1, by + 0.2);
|
|
6192
6308
|
const K = mkKit(c, S, I);
|
|
@@ -6215,26 +6331,22 @@ var GameVehiclesFleet = (() => {
|
|
|
6215
6331
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
6216
6332
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
6217
6333
|
[1, -1].forEach(function(sd) {
|
|
6218
|
-
const bar = function(px, width) {
|
|
6219
|
-
const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
|
|
6334
|
+
const bar = function(px, width, span) {
|
|
6335
|
+
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;
|
|
6220
6336
|
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] });
|
|
6221
6337
|
m2.castShadow = false;
|
|
6222
6338
|
return m2;
|
|
6223
6339
|
};
|
|
6224
6340
|
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
6225
|
-
(glassDivisions.get(c) ?? []).forEach((
|
|
6226
|
-
bar(
|
|
6341
|
+
(glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
|
|
6342
|
+
bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
|
|
6227
6343
|
});
|
|
6228
6344
|
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;
|
|
6229
6345
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
6230
6346
|
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 } });
|
|
6231
6347
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
6232
6348
|
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));
|
|
6233
|
-
|
|
6234
|
-
(s.seams || []).forEach(function(q) {
|
|
6235
|
-
const r = q, x = seamOnDoorEdge(r.length ? r[0] : q, edges), y0 = r.length ? r[1] : by + 0.09, y1 = r.length ? r[2] : gh.belt - 0.03;
|
|
6236
|
-
doorSeam(c, S, sd, x, y0, y1);
|
|
6237
|
-
});
|
|
6349
|
+
if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
|
|
6238
6350
|
(s.handles || []).forEach(function(x) {
|
|
6239
6351
|
c.roundBox(
|
|
6240
6352
|
0.15,
|
|
@@ -6249,7 +6361,8 @@ var GameVehiclesFleet = (() => {
|
|
|
6249
6361
|
});
|
|
6250
6362
|
if (s.arches && s.arches.length > 1) {
|
|
6251
6363
|
const x0 = s.arches[1][0] + s.arches[1][2] + 0.02, x1 = s.arches[0][0] - s.arches[0][2] - 0.02;
|
|
6252
|
-
|
|
6364
|
+
const mouldingG = sideGrid(S, sd, { x0, x1, y0: by + 5e-3, y1: by + 0.12 });
|
|
6365
|
+
markRaised(c, K.skin(mouldingG, MT.trim, { yb: by + 0.01, yt: by + 0.09, off: 0.012, thick: 0.03, nv: 2, crease: 30, shadow: true }));
|
|
6253
6366
|
if (s.clad)
|
|
6254
6367
|
s.arches.forEach(function(a) {
|
|
6255
6368
|
const a0 = Math.asin(clamp((by - a[1]) / a[2], -1, 1)), tor = c.add(new THREE.TorusGeometry(a[2] + 0.02, 0.035, 6, 26, PI - 2 * a0), MT.trim, a[0], a[1], sd * (hw - 0.01));
|
|
@@ -6261,16 +6374,25 @@ var GameVehiclesFleet = (() => {
|
|
|
6261
6374
|
c.roundBox(
|
|
6262
6375
|
gh.fb - gh.rb - 0.3,
|
|
6263
6376
|
0.012,
|
|
6264
|
-
|
|
6377
|
+
0.012,
|
|
6265
6378
|
4e-3,
|
|
6266
6379
|
MT.chrome,
|
|
6267
6380
|
(gh.fb + gh.rb) / 2 - 0.05,
|
|
6268
6381
|
gh.belt + 0.035,
|
|
6269
|
-
sd * (halfAt(gh.Wg, T, gh.belt + 0.035) +
|
|
6382
|
+
sd * (halfAt(gh.Wg, T, gh.belt + 0.035) + 6e-3)
|
|
6270
6383
|
);
|
|
6271
6384
|
});
|
|
6272
6385
|
const cwh = S.hit(new V3(gh.fb + 0.03, 3, 0), new V3(0, -1, 0)), cwy = cwh ? cwh.p.y : gh.belt;
|
|
6273
|
-
|
|
6386
|
+
let cwz = gh.Wg / 2 - 0.03;
|
|
6387
|
+
for (let z = 0.3; z < cwz; z += 0.01) {
|
|
6388
|
+
const h = S.hit(new V3(gh.fb + 0.03, 3, z), new V3(0, -1, 0));
|
|
6389
|
+
if (!h || h.p.y < cwy - COWL_DROP) {
|
|
6390
|
+
cwz = z;
|
|
6391
|
+
break;
|
|
6392
|
+
}
|
|
6393
|
+
}
|
|
6394
|
+
cwz = Math.min(cwz, halfAt(gh.Wg, T, gh.belt + 0.05) - 0.072);
|
|
6395
|
+
c.roundBox(0.15, 0.02, 2 * cwz, 8e-3, PLASTIC, gh.fb + 0.02, cwy + 4e-3, 0).castShadow = false;
|
|
6274
6396
|
const wd = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize(), wn = new V3(wd.y, -wd.x, 0);
|
|
6275
6397
|
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);
|
|
6276
6398
|
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;
|
|
@@ -6315,6 +6437,21 @@ var GameVehiclesFleet = (() => {
|
|
|
6315
6437
|
});
|
|
6316
6438
|
underbody(c, s, I);
|
|
6317
6439
|
if (s.extra) s.extra(c, I);
|
|
6440
|
+
c.vehicle.updateMatrixWorld(true);
|
|
6441
|
+
[1, -1].forEach(function(sd) {
|
|
6442
|
+
const side = bodySide(THREE, c, S, sd);
|
|
6443
|
+
const edges = doorEdgesOf(gh, s.wheels ?? []);
|
|
6444
|
+
(s.seams || []).forEach(function(q) {
|
|
6445
|
+
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;
|
|
6446
|
+
const pts = shutLinePoints(side, x, y0, y1);
|
|
6447
|
+
if (pts.length < 3) return;
|
|
6448
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
|
|
6449
|
+
seam.castShadow = false;
|
|
6450
|
+
seam.userData.doorSeam = true;
|
|
6451
|
+
seam.userData.gap = true;
|
|
6452
|
+
c.deform.push(seam);
|
|
6453
|
+
});
|
|
6454
|
+
});
|
|
6318
6455
|
if (!c.parts.some(function(p) {
|
|
6319
6456
|
return p.kind === "engine";
|
|
6320
6457
|
}))
|
|
@@ -6388,16 +6525,57 @@ var GameVehiclesFleet = (() => {
|
|
|
6388
6525
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
6389
6526
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
6390
6527
|
}
|
|
6391
|
-
const
|
|
6392
|
-
|
|
6528
|
+
const GAP_R = 2e-3;
|
|
6529
|
+
const FIXED_SEAL_R = 4e-3;
|
|
6530
|
+
const DOOR_SEAL_R = 6e-3;
|
|
6531
|
+
const GAP_SHADE = 0.45;
|
|
6532
|
+
const gapMaterials = /* @__PURE__ */ new Map();
|
|
6533
|
+
function gapMaterial(col) {
|
|
6534
|
+
const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
|
|
6535
|
+
const known = gapMaterials.get(hex);
|
|
6536
|
+
if (known) return known;
|
|
6537
|
+
const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
|
|
6538
|
+
gapMaterials.set(hex, made);
|
|
6539
|
+
return made;
|
|
6540
|
+
}
|
|
6541
|
+
const HOOD_GAP = 4 * GAP_R;
|
|
6542
|
+
function hoodGap(c, S, x0, x1, zH, mat) {
|
|
6543
|
+
const onTop = (x, z) => {
|
|
6544
|
+
const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
|
|
6545
|
+
return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
|
|
6546
|
+
};
|
|
6547
|
+
const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
|
|
6548
|
+
const across = Math.max(4, Math.ceil(2 * zH / 0.04));
|
|
6549
|
+
const line = [];
|
|
6550
|
+
for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
|
|
6551
|
+
for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
|
|
6552
|
+
for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
|
|
6553
|
+
const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
|
|
6554
|
+
t.castShadow = false;
|
|
6555
|
+
t.userData.gap = true;
|
|
6556
|
+
return t;
|
|
6557
|
+
}
|
|
6558
|
+
const FUEL_DOOR_W = 0.13;
|
|
6559
|
+
const FUEL_DOOR_H = 0.11;
|
|
6560
|
+
const FUEL_DOOR_R = 0.02;
|
|
6561
|
+
function fuelDoorGap(c, S, sd, x, y, mat) {
|
|
6393
6562
|
const pts = [];
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6563
|
+
const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
|
|
6564
|
+
const corners = [
|
|
6565
|
+
[hx, hy, 0],
|
|
6566
|
+
[-hx, hy, 0.5 * PI],
|
|
6567
|
+
[-hx, -hy, PI],
|
|
6568
|
+
[hx, -hy, 1.5 * PI]
|
|
6569
|
+
];
|
|
6570
|
+
corners.forEach(function([cx, cy, a0]) {
|
|
6571
|
+
for (let k = 0; k <= 4; k++) {
|
|
6572
|
+
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");
|
|
6573
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
|
|
6574
|
+
}
|
|
6575
|
+
});
|
|
6576
|
+
const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
|
|
6399
6577
|
t.castShadow = false;
|
|
6400
|
-
t.userData.
|
|
6578
|
+
t.userData.gap = true;
|
|
6401
6579
|
return t;
|
|
6402
6580
|
}
|
|
6403
6581
|
function sm(t) {
|
|
@@ -6446,36 +6624,23 @@ var GameVehiclesFleet = (() => {
|
|
|
6446
6624
|
});
|
|
6447
6625
|
const h = o.h || 0.03, Gd = sideGrid(I.S, sd, { x0, x1, y0: lo - h - 0.03, y1: hi + 0.03 });
|
|
6448
6626
|
function yAt(u) {
|
|
6449
|
-
|
|
6450
|
-
for (let i = 0; i < pts.length - 1; i++) {
|
|
6451
|
-
const a = pts[i], b = pts[i + 1];
|
|
6452
|
-
if ((x - a[0]) * (x - b[0]) <= 0) {
|
|
6453
|
-
const t = (x - a[0]) / (b[0] - a[0] || 1);
|
|
6454
|
-
return a[1] + (b[1] - a[1]) * sm(t);
|
|
6455
|
-
}
|
|
6456
|
-
}
|
|
6457
|
-
return pts[pts.length - 1][1];
|
|
6627
|
+
return creaseHeightAt(pts, x0 + (x1 - x0) * u);
|
|
6458
6628
|
}
|
|
6459
|
-
I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
6629
|
+
const fold = I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
6460
6630
|
yb: function(u) {
|
|
6461
6631
|
return yAt(u) - h;
|
|
6462
6632
|
},
|
|
6463
6633
|
yt: yAt,
|
|
6464
|
-
off: o.off ||
|
|
6465
|
-
|
|
6466
|
-
|
|
6634
|
+
off: o.off || 2e-3,
|
|
6635
|
+
ridge: { at: CREASE_FOLD_AT, lift: CREASE_FOLD_LIFT },
|
|
6636
|
+
crease: 30,
|
|
6637
|
+
nv: 5,
|
|
6467
6638
|
u0: o.u0 || 0.01,
|
|
6468
6639
|
u1: o.u1 || 0.99
|
|
6469
6640
|
});
|
|
6470
|
-
|
|
6471
|
-
for (let k = 0; k <= 30; k++) {
|
|
6472
|
-
const u = (o.u0 || 0.01) + k / 30 * ((o.u1 || 0.99) - (o.u0 || 0.01));
|
|
6473
|
-
l.push([u, yAt(u) - h - 1e-3]);
|
|
6474
|
-
}
|
|
6475
|
-
lineOn(c, Gd, l, 3e-3, o.shade || SHADE, 3e-3);
|
|
6641
|
+
markRaised(c, markFinishDetail(fold));
|
|
6476
6642
|
return Gd;
|
|
6477
6643
|
}
|
|
6478
|
-
const SHADE = CM("#000000", { roughness: 1, transparent: true, opacity: 0.45, depthWrite: false });
|
|
6479
6644
|
const CHROMEH = CM("#c9cdd0", { metalness: 0.85, roughness: 0.25 });
|
|
6480
6645
|
const CHROMEB = CM("#d4d8db", { metalness: 0.5, roughness: 0.24 });
|
|
6481
6646
|
const VINYL = "#2e2622";
|
|
@@ -6810,6 +6975,8 @@ var GameVehiclesFleet = (() => {
|
|
|
6810
6975
|
dropRear: true,
|
|
6811
6976
|
seams: [0.64, -0.5, [-1.27, 0.67, 0.93]],
|
|
6812
6977
|
handles: [0.12, -0.86],
|
|
6978
|
+
/* fuel door on the right rear fender, between the rear door and the taillight, over the wheel */
|
|
6979
|
+
fuelDoor: [-1.47, 0.71, 1],
|
|
6813
6980
|
blackPillars: [-0.5],
|
|
6814
6981
|
frontBumper: { y1: 0.6 },
|
|
6815
6982
|
rearBumper: { y1: 0.58 },
|
|
@@ -14815,7 +14982,8 @@ var GameVehiclesFleet = (() => {
|
|
|
14815
14982
|
const u = u0 + (u1 - u0) * i / nu, b = yb(u), t = yt(u), row = [];
|
|
14816
14983
|
for (let j = 0; j <= nv; j++) {
|
|
14817
14984
|
const y = b + (t - b) * j / nv, s = G2.at(u, y);
|
|
14818
|
-
|
|
14985
|
+
const lift = o.ridge ? o.ridge.lift * (j / nv < o.ridge.at ? j / nv / o.ridge.at : (1 - j / nv) / (1 - o.ridge.at)) : 0;
|
|
14986
|
+
row.push({ p: s.p.addScaledVector(s.n, of + lift), n: s.n, uv: [i / nu * su, o.tile ? (y - G2.y0) * sv0 : j / nv] });
|
|
14819
14987
|
}
|
|
14820
14988
|
Q.push(row);
|
|
14821
14989
|
}
|
|
@@ -15104,12 +15272,14 @@ var GameVehiclesFleet = (() => {
|
|
|
15104
15272
|
return pl;
|
|
15105
15273
|
};
|
|
15106
15274
|
K.lid = function(pts) {
|
|
15275
|
+
c.meta.lidSeam = pts;
|
|
15107
15276
|
const P = pts.map(function(q) {
|
|
15108
15277
|
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");
|
|
15109
15278
|
return h ? h.p.addScaledVector(h.n, 3e-3) : null;
|
|
15110
15279
|
}).filter(Boolean);
|
|
15111
|
-
const t = c.tube(P,
|
|
15280
|
+
const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
|
|
15112
15281
|
t.castShadow = false;
|
|
15282
|
+
t.userData.gap = true;
|
|
15113
15283
|
c.deform.push(t);
|
|
15114
15284
|
return t;
|
|
15115
15285
|
};
|
|
@@ -15135,6 +15305,7 @@ var GameVehiclesFleet = (() => {
|
|
|
15135
15305
|
};
|
|
15136
15306
|
return K;
|
|
15137
15307
|
}
|
|
15308
|
+
const DIVISION_OVER = 0.012;
|
|
15138
15309
|
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
15139
15310
|
function car(c, s) {
|
|
15140
15311
|
const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
|
|
@@ -15171,7 +15342,10 @@ var GameVehiclesFleet = (() => {
|
|
|
15171
15342
|
if (s.dropRear) polys = polys.slice(1);
|
|
15172
15343
|
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
15173
15344
|
polys = divided.polys;
|
|
15174
|
-
glassDivisions.set(
|
|
15345
|
+
glassDivisions.set(
|
|
15346
|
+
c,
|
|
15347
|
+
divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
|
|
15348
|
+
);
|
|
15175
15349
|
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);
|
|
15176
15350
|
const gHoles = [];
|
|
15177
15351
|
if (intr) {
|
|
@@ -15192,6 +15366,7 @@ var GameVehiclesFleet = (() => {
|
|
|
15192
15366
|
side: THREE.DoubleSide
|
|
15193
15367
|
}) : null;
|
|
15194
15368
|
kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
|
|
15369
|
+
const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
|
|
15195
15370
|
kit.sideWindows(
|
|
15196
15371
|
c,
|
|
15197
15372
|
polys,
|
|
@@ -15200,7 +15375,14 @@ var GameVehiclesFleet = (() => {
|
|
|
15200
15375
|
function(i, n) {
|
|
15201
15376
|
return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
|
|
15202
15377
|
},
|
|
15203
|
-
{
|
|
15378
|
+
{
|
|
15379
|
+
see: !!intr,
|
|
15380
|
+
// a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
|
|
15381
|
+
seal: function(i) {
|
|
15382
|
+
const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
15383
|
+
return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
|
|
15384
|
+
}
|
|
15385
|
+
}
|
|
15204
15386
|
);
|
|
15205
15387
|
kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
|
|
15206
15388
|
kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? REARTINT : MT.glassDark });
|
|
@@ -15252,7 +15434,7 @@ var GameVehiclesFleet = (() => {
|
|
|
15252
15434
|
(s.arches || []).forEach(function(a) {
|
|
15253
15435
|
fa = Math.max(fa, a[0]);
|
|
15254
15436
|
});
|
|
15255
|
-
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
|
|
15437
|
+
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
|
|
15256
15438
|
if (hood)
|
|
15257
15439
|
kit.engineBay(c, {
|
|
15258
15440
|
x0: hx0 + 0.02,
|
|
@@ -15286,6 +15468,7 @@ var GameVehiclesFleet = (() => {
|
|
|
15286
15468
|
);
|
|
15287
15469
|
const Wf = mkWarp(wo);
|
|
15288
15470
|
const S = mkSurf(lowMesh, W);
|
|
15471
|
+
if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
|
|
15289
15472
|
details(c, s, Wf, S);
|
|
15290
15473
|
applyWarp(c, Wf);
|
|
15291
15474
|
return m;
|
|
@@ -15297,7 +15480,7 @@ var GameVehiclesFleet = (() => {
|
|
|
15297
15480
|
}, rx = function(y) {
|
|
15298
15481
|
return profX(it, y, false);
|
|
15299
15482
|
};
|
|
15300
|
-
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
|
|
15483
|
+
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
|
|
15301
15484
|
I.fxB = S.endX(1, by + 0.2);
|
|
15302
15485
|
I.rxB = S.endX(-1, by + 0.2);
|
|
15303
15486
|
const K = mkKit(c, S, I);
|
|
@@ -15326,26 +15509,22 @@ var GameVehiclesFleet = (() => {
|
|
|
15326
15509
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
15327
15510
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
15328
15511
|
[1, -1].forEach(function(sd) {
|
|
15329
|
-
const bar = function(px, width) {
|
|
15330
|
-
const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
|
|
15512
|
+
const bar = function(px, width, span) {
|
|
15513
|
+
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;
|
|
15331
15514
|
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] });
|
|
15332
15515
|
m2.castShadow = false;
|
|
15333
15516
|
return m2;
|
|
15334
15517
|
};
|
|
15335
15518
|
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
15336
|
-
(glassDivisions.get(c) ?? []).forEach((
|
|
15337
|
-
bar(
|
|
15519
|
+
(glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
|
|
15520
|
+
bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
|
|
15338
15521
|
});
|
|
15339
15522
|
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;
|
|
15340
15523
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
15341
15524
|
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 } });
|
|
15342
15525
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
15343
15526
|
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));
|
|
15344
|
-
|
|
15345
|
-
(s.seams || []).forEach(function(x0) {
|
|
15346
|
-
const x = seamOnDoorEdge(x0, edges);
|
|
15347
|
-
doorSeam(c, S, sd, x, by + 0.09, gh.belt - 0.03);
|
|
15348
|
-
});
|
|
15527
|
+
if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
|
|
15349
15528
|
(s.handles || []).forEach(function(x) {
|
|
15350
15529
|
c.roundBox(
|
|
15351
15530
|
0.15,
|
|
@@ -15360,7 +15539,8 @@ var GameVehiclesFleet = (() => {
|
|
|
15360
15539
|
});
|
|
15361
15540
|
if (s.arches && s.arches.length > 1) {
|
|
15362
15541
|
const x0 = s.arches[1][0] + s.arches[1][2] + 0.02, x1 = s.arches[0][0] - s.arches[0][2] - 0.02;
|
|
15363
|
-
|
|
15542
|
+
const mouldingG = sideGrid(S, sd, { x0, x1, y0: by + 5e-3, y1: by + 0.12 });
|
|
15543
|
+
markRaised(c, K.skin(mouldingG, MT.trim, { yb: by + 0.01, yt: by + 0.09, off: 0.012, thick: 0.03, nv: 2, crease: 30, shadow: true }));
|
|
15364
15544
|
if (s.clad)
|
|
15365
15545
|
s.arches.forEach(function(a) {
|
|
15366
15546
|
const a0 = Math.asin(clamp((by - a[1]) / a[2], -1, 1)), tor = c.add(new THREE.TorusGeometry(a[2] + 0.02, 0.035, 6, 26, PI - 2 * a0), MT.trim, a[0], a[1], sd * (hw - 0.01));
|
|
@@ -15413,6 +15593,20 @@ var GameVehiclesFleet = (() => {
|
|
|
15413
15593
|
});
|
|
15414
15594
|
underbody(c, s, I);
|
|
15415
15595
|
if (s.extra) s.extra(c, I);
|
|
15596
|
+
c.vehicle.updateMatrixWorld(true);
|
|
15597
|
+
[1, -1].forEach(function(sd) {
|
|
15598
|
+
const side = bodySide(THREE, c, S, sd);
|
|
15599
|
+
const edges = doorEdgesOf(gh, s.wheels ?? []);
|
|
15600
|
+
(s.seams || []).forEach(function(x) {
|
|
15601
|
+
const pts = shutLinePoints(side, seamOnDoorEdge(x, edges), by + 0.11, gh.belt - 0.03);
|
|
15602
|
+
if (pts.length < 3) return;
|
|
15603
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
|
|
15604
|
+
seam.castShadow = false;
|
|
15605
|
+
seam.userData.doorSeam = true;
|
|
15606
|
+
seam.userData.gap = true;
|
|
15607
|
+
c.deform.push(seam);
|
|
15608
|
+
});
|
|
15609
|
+
});
|
|
15416
15610
|
if (!c.parts.some(function(p) {
|
|
15417
15611
|
return p.kind === "engine";
|
|
15418
15612
|
}))
|
|
@@ -15486,16 +15680,57 @@ var GameVehiclesFleet = (() => {
|
|
|
15486
15680
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
15487
15681
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
15488
15682
|
}
|
|
15489
|
-
const
|
|
15490
|
-
|
|
15683
|
+
const GAP_R = 2e-3;
|
|
15684
|
+
const FIXED_SEAL_R = 4e-3;
|
|
15685
|
+
const DOOR_SEAL_R = 6e-3;
|
|
15686
|
+
const GAP_SHADE = 0.45;
|
|
15687
|
+
const gapMaterials = /* @__PURE__ */ new Map();
|
|
15688
|
+
function gapMaterial(col) {
|
|
15689
|
+
const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
|
|
15690
|
+
const known = gapMaterials.get(hex);
|
|
15691
|
+
if (known) return known;
|
|
15692
|
+
const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
|
|
15693
|
+
gapMaterials.set(hex, made);
|
|
15694
|
+
return made;
|
|
15695
|
+
}
|
|
15696
|
+
const HOOD_GAP = 4 * GAP_R;
|
|
15697
|
+
function hoodGap(c, S, x0, x1, zH, mat) {
|
|
15698
|
+
const onTop = (x, z) => {
|
|
15699
|
+
const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
|
|
15700
|
+
return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
|
|
15701
|
+
};
|
|
15702
|
+
const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
|
|
15703
|
+
const across = Math.max(4, Math.ceil(2 * zH / 0.04));
|
|
15704
|
+
const line = [];
|
|
15705
|
+
for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
|
|
15706
|
+
for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
|
|
15707
|
+
for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
|
|
15708
|
+
const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
|
|
15709
|
+
t.castShadow = false;
|
|
15710
|
+
t.userData.gap = true;
|
|
15711
|
+
return t;
|
|
15712
|
+
}
|
|
15713
|
+
const FUEL_DOOR_W = 0.13;
|
|
15714
|
+
const FUEL_DOOR_H = 0.11;
|
|
15715
|
+
const FUEL_DOOR_R = 0.02;
|
|
15716
|
+
function fuelDoorGap(c, S, sd, x, y, mat) {
|
|
15491
15717
|
const pts = [];
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
|
|
15718
|
+
const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
|
|
15719
|
+
const corners = [
|
|
15720
|
+
[hx, hy, 0],
|
|
15721
|
+
[-hx, hy, 0.5 * PI],
|
|
15722
|
+
[-hx, -hy, PI],
|
|
15723
|
+
[hx, -hy, 1.5 * PI]
|
|
15724
|
+
];
|
|
15725
|
+
corners.forEach(function([cx, cy, a0]) {
|
|
15726
|
+
for (let k = 0; k <= 4; k++) {
|
|
15727
|
+
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");
|
|
15728
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
|
|
15729
|
+
}
|
|
15730
|
+
});
|
|
15731
|
+
const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
|
|
15497
15732
|
t.castShadow = false;
|
|
15498
|
-
t.userData.
|
|
15733
|
+
t.userData.gap = true;
|
|
15499
15734
|
return t;
|
|
15500
15735
|
}
|
|
15501
15736
|
function sm(t) {
|
|
@@ -15544,36 +15779,23 @@ var GameVehiclesFleet = (() => {
|
|
|
15544
15779
|
});
|
|
15545
15780
|
const h = o.h || 0.03, Gd = sideGrid(I.S, sd, { x0, x1, y0: lo - h - 0.03, y1: hi + 0.03 });
|
|
15546
15781
|
function yAt(u) {
|
|
15547
|
-
|
|
15548
|
-
for (let i = 0; i < pts.length - 1; i++) {
|
|
15549
|
-
const a = pts[i], b = pts[i + 1];
|
|
15550
|
-
if ((x - a[0]) * (x - b[0]) <= 0) {
|
|
15551
|
-
const t = (x - a[0]) / (b[0] - a[0] || 1);
|
|
15552
|
-
return a[1] + (b[1] - a[1]) * sm(t);
|
|
15553
|
-
}
|
|
15554
|
-
}
|
|
15555
|
-
return pts[pts.length - 1][1];
|
|
15782
|
+
return creaseHeightAt(pts, x0 + (x1 - x0) * u);
|
|
15556
15783
|
}
|
|
15557
|
-
I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
15784
|
+
const fold = I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
15558
15785
|
yb: function(u) {
|
|
15559
15786
|
return yAt(u) - h;
|
|
15560
15787
|
},
|
|
15561
15788
|
yt: yAt,
|
|
15562
|
-
off: o.off ||
|
|
15563
|
-
|
|
15564
|
-
|
|
15789
|
+
off: o.off || 2e-3,
|
|
15790
|
+
ridge: { at: CREASE_FOLD_AT, lift: CREASE_FOLD_LIFT },
|
|
15791
|
+
crease: 30,
|
|
15792
|
+
nv: 5,
|
|
15565
15793
|
u0: o.u0 || 0.01,
|
|
15566
15794
|
u1: o.u1 || 0.99
|
|
15567
15795
|
});
|
|
15568
|
-
|
|
15569
|
-
for (let k = 0; k <= 30; k++) {
|
|
15570
|
-
const u = (o.u0 || 0.01) + k / 30 * ((o.u1 || 0.99) - (o.u0 || 0.01));
|
|
15571
|
-
l.push([u, yAt(u) - h - 1e-3]);
|
|
15572
|
-
}
|
|
15573
|
-
lineOn(c, Gd, l, 3e-3, o.shade || SHADE, 3e-3);
|
|
15796
|
+
markRaised(c, markFinishDetail(fold));
|
|
15574
15797
|
return Gd;
|
|
15575
15798
|
}
|
|
15576
|
-
const SHADE = CM("#000000", { roughness: 1, transparent: true, opacity: 0.45, depthWrite: false });
|
|
15577
15799
|
function dloChrome(c, I, sd, pts, r) {
|
|
15578
15800
|
const gh = I.gh, T = I.T, P = pts.map(function(q) {
|
|
15579
15801
|
return [q[0], q[1], sd * (halfAt(gh.Wg, T, q[1]) + 0.012)];
|
|
@@ -16631,12 +16853,10 @@ var GameVehiclesFleet = (() => {
|
|
|
16631
16853
|
I,
|
|
16632
16854
|
sd,
|
|
16633
16855
|
[
|
|
16634
|
-
[
|
|
16635
|
-
[0, 0.
|
|
16636
|
-
[-0.9, 0.6],
|
|
16637
|
-
[-1.2, 0.66]
|
|
16856
|
+
[0.86, 0.52],
|
|
16857
|
+
[-0.98, 0.52]
|
|
16638
16858
|
],
|
|
16639
|
-
{ col: "#8b939a", h: 0.
|
|
16859
|
+
{ col: "#8b939a", h: 0.03 }
|
|
16640
16860
|
);
|
|
16641
16861
|
});
|
|
16642
16862
|
}
|
|
@@ -24464,6 +24684,7 @@ var GameVehiclesFleet = (() => {
|
|
|
24464
24684
|
tl: P.tl,
|
|
24465
24685
|
grille: P.grille,
|
|
24466
24686
|
seams: P.seams,
|
|
24687
|
+
shell: shellM,
|
|
24467
24688
|
handles: P.handles,
|
|
24468
24689
|
wheels: [
|
|
24469
24690
|
[A.xf, P.wr, 0.24, { rim: P.rim }],
|