@adatechnology/game-vehicles-fleet 11.0.2 → 11.0.3
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 +309 -96
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +271 -98
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -5029,7 +5029,8 @@ function installBoatsExtra(fx) {
|
|
|
5029
5029
|
}
|
|
5030
5030
|
|
|
5031
5031
|
// src/vehicles/cars-extra.ts
|
|
5032
|
-
import { DIVISION_HALF, doorEdgesOf, doorGlassSplits, seamOnDoorEdge, splitSidePolys } from "@adatechnology/game-vehicles";
|
|
5032
|
+
import { DIVISION_HALF, divisionSpan, doorEdgesOf, doorGlassSplits, seamOnDoorEdge, splitSidePolys } from "@adatechnology/game-vehicles";
|
|
5033
|
+
import { SHUT_LINE_RADIUS, markFinishDetail, shutLinePoints } from "@adatechnology/game-vehicles";
|
|
5033
5034
|
|
|
5034
5035
|
// src/vehicles/moving-parts.ts
|
|
5035
5036
|
var WIPER_SWEEP = 1.5;
|
|
@@ -5045,6 +5046,57 @@ function markSunroof(pane, slide) {
|
|
|
5045
5046
|
return pane;
|
|
5046
5047
|
}
|
|
5047
5048
|
|
|
5049
|
+
// src/vehicles/side-design.ts
|
|
5050
|
+
var CREASE_FOLD_LIFT = 7e-3;
|
|
5051
|
+
var CREASE_FOLD_AT = 0.4;
|
|
5052
|
+
function creaseHeightAt(pts, x) {
|
|
5053
|
+
const n = pts.length;
|
|
5054
|
+
const slope = (i) => (pts[i + 1][1] - pts[i][1]) / (pts[i + 1][0] - pts[i][0] || 1);
|
|
5055
|
+
const tangent = (i) => {
|
|
5056
|
+
if (i === 0) return slope(0);
|
|
5057
|
+
if (i === n - 1) return slope(n - 2);
|
|
5058
|
+
const a = slope(i - 1), b = slope(i);
|
|
5059
|
+
return a * b <= 0 ? 0 : 2 * a * b / (a + b);
|
|
5060
|
+
};
|
|
5061
|
+
for (let i = 0; i < n - 1; i++) {
|
|
5062
|
+
const a = pts[i], b = pts[i + 1];
|
|
5063
|
+
if ((x - a[0]) * (x - b[0]) > 0) continue;
|
|
5064
|
+
const w = b[0] - a[0] || 1, t = (x - a[0]) / w, t2 = t * t, t3 = t2 * t;
|
|
5065
|
+
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);
|
|
5066
|
+
}
|
|
5067
|
+
return pts[n - 1][1];
|
|
5068
|
+
}
|
|
5069
|
+
var raised = /* @__PURE__ */ new WeakMap();
|
|
5070
|
+
function raisedOnSide(c) {
|
|
5071
|
+
let list = raised.get(c);
|
|
5072
|
+
if (!list) raised.set(c, list = []);
|
|
5073
|
+
return list;
|
|
5074
|
+
}
|
|
5075
|
+
function markRaised(c, mesh) {
|
|
5076
|
+
raisedOnSide(c).push(mesh);
|
|
5077
|
+
}
|
|
5078
|
+
function bodySide(THREE, c, S, sd) {
|
|
5079
|
+
const ray = new THREE.Raycaster();
|
|
5080
|
+
const world = c.vehicle.matrixWorld;
|
|
5081
|
+
const toVehicle = world.clone().invert();
|
|
5082
|
+
return function(x, y) {
|
|
5083
|
+
const origin = new THREE.Vector3(x, y, sd * (S.hw + 1));
|
|
5084
|
+
const best = S.hit(origin, new THREE.Vector3(0, 0, -sd), "M");
|
|
5085
|
+
ray.set(origin.clone().applyMatrix4(world), new THREE.Vector3(0, 0, -sd).transformDirection(world));
|
|
5086
|
+
raisedOnSide(c).forEach(function(m) {
|
|
5087
|
+
const h = ray.intersectObject(m, false)[0];
|
|
5088
|
+
if (!h || !h.face) return;
|
|
5089
|
+
const p = h.point.clone().applyMatrix4(toVehicle);
|
|
5090
|
+
if (!best || Math.abs(p.z) <= Math.abs(best.p.z)) return;
|
|
5091
|
+
const n = h.face.normal.clone().transformDirection(m.matrixWorld).transformDirection(toVehicle);
|
|
5092
|
+
if (n.z * sd < 0) n.negate();
|
|
5093
|
+
best.p = p;
|
|
5094
|
+
best.n = n;
|
|
5095
|
+
});
|
|
5096
|
+
return best;
|
|
5097
|
+
};
|
|
5098
|
+
}
|
|
5099
|
+
|
|
5048
5100
|
// src/vehicles/cars-extra.ts
|
|
5049
5101
|
function installCarsExtra(fx) {
|
|
5050
5102
|
const kit = fx.kit;
|
|
@@ -5384,7 +5436,8 @@ function installCarsExtra(fx) {
|
|
|
5384
5436
|
const u = u0 + (u1 - u0) * i / nu, b = yb(u), t = yt(u), row = [];
|
|
5385
5437
|
for (let j = 0; j <= nv; j++) {
|
|
5386
5438
|
const y = b + (t - b) * j / nv, s = G2.at(u, y);
|
|
5387
|
-
|
|
5439
|
+
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;
|
|
5440
|
+
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] });
|
|
5388
5441
|
}
|
|
5389
5442
|
Q.push(row);
|
|
5390
5443
|
}
|
|
@@ -5690,8 +5743,9 @@ function installCarsExtra(fx) {
|
|
|
5690
5743
|
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");
|
|
5691
5744
|
return h ? h.p.addScaledVector(h.n, 3e-3) : null;
|
|
5692
5745
|
}).filter(Boolean);
|
|
5693
|
-
const t = c.tube(P,
|
|
5746
|
+
const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
|
|
5694
5747
|
t.castShadow = false;
|
|
5748
|
+
t.userData.gap = true;
|
|
5695
5749
|
c.deform.push(t);
|
|
5696
5750
|
return t;
|
|
5697
5751
|
};
|
|
@@ -5717,6 +5771,8 @@ function installCarsExtra(fx) {
|
|
|
5717
5771
|
};
|
|
5718
5772
|
return K;
|
|
5719
5773
|
}
|
|
5774
|
+
const DIVISION_OVER = 0.012;
|
|
5775
|
+
const COWL_DROP = 0.012;
|
|
5720
5776
|
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
5721
5777
|
function car(c, s) {
|
|
5722
5778
|
const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
|
|
@@ -5754,7 +5810,10 @@ function installCarsExtra(fx) {
|
|
|
5754
5810
|
if (gh.polys) polys = gh.polys(polys);
|
|
5755
5811
|
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
5756
5812
|
polys = divided.polys;
|
|
5757
|
-
glassDivisions.set(
|
|
5813
|
+
glassDivisions.set(
|
|
5814
|
+
c,
|
|
5815
|
+
divided.used.map((at) => ({ at, span: divisionSpan(divided.polys, at) }))
|
|
5816
|
+
);
|
|
5758
5817
|
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 });
|
|
5759
5818
|
const gHoles = [];
|
|
5760
5819
|
if (intr) {
|
|
@@ -5775,6 +5834,7 @@ function installCarsExtra(fx) {
|
|
|
5775
5834
|
side: THREE.DoubleSide
|
|
5776
5835
|
}) : null;
|
|
5777
5836
|
kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
|
|
5837
|
+
const sealEdges = doorEdgesOf(gh, s.wheels ?? []);
|
|
5778
5838
|
kit.sideWindows(
|
|
5779
5839
|
c,
|
|
5780
5840
|
polys,
|
|
@@ -5783,7 +5843,14 @@ function installCarsExtra(fx) {
|
|
|
5783
5843
|
function(i, n) {
|
|
5784
5844
|
return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
|
|
5785
5845
|
},
|
|
5786
|
-
{
|
|
5846
|
+
{
|
|
5847
|
+
see: !!intr,
|
|
5848
|
+
// a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
|
|
5849
|
+
seal: function(i) {
|
|
5850
|
+
const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
5851
|
+
return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
|
|
5852
|
+
}
|
|
5853
|
+
}
|
|
5787
5854
|
);
|
|
5788
5855
|
kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
|
|
5789
5856
|
kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? MT.tint : MT.glassDark });
|
|
@@ -5842,7 +5909,7 @@ function installCarsExtra(fx) {
|
|
|
5842
5909
|
(s.arches || []).forEach(function(a) {
|
|
5843
5910
|
fa = Math.max(fa, a[0]);
|
|
5844
5911
|
});
|
|
5845
|
-
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
|
|
5912
|
+
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
|
|
5846
5913
|
if (hood)
|
|
5847
5914
|
kit.engineBay(c, {
|
|
5848
5915
|
x0: hx0 + 0.02,
|
|
@@ -5876,6 +5943,7 @@ function installCarsExtra(fx) {
|
|
|
5876
5943
|
);
|
|
5877
5944
|
const Wf = mkWarp(wo);
|
|
5878
5945
|
const S = mkSurf(lowMesh, W);
|
|
5946
|
+
if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
|
|
5879
5947
|
details(c, s, Wf, S);
|
|
5880
5948
|
applyWarp(c, Wf);
|
|
5881
5949
|
return m;
|
|
@@ -5887,7 +5955,7 @@ function installCarsExtra(fx) {
|
|
|
5887
5955
|
}, rx = function(y) {
|
|
5888
5956
|
return profX(it, y, false);
|
|
5889
5957
|
};
|
|
5890
|
-
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
|
|
5958
|
+
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
|
|
5891
5959
|
I.fxB = S.endX(1, by + 0.2);
|
|
5892
5960
|
I.rxB = S.endX(-1, by + 0.2);
|
|
5893
5961
|
const K = mkKit(c, S, I);
|
|
@@ -5916,26 +5984,22 @@ function installCarsExtra(fx) {
|
|
|
5916
5984
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
5917
5985
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
5918
5986
|
[1, -1].forEach(function(sd) {
|
|
5919
|
-
const bar = function(px, width) {
|
|
5920
|
-
const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
|
|
5987
|
+
const bar = function(px, width, span) {
|
|
5988
|
+
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;
|
|
5921
5989
|
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] });
|
|
5922
5990
|
m2.castShadow = false;
|
|
5923
5991
|
return m2;
|
|
5924
5992
|
};
|
|
5925
5993
|
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
5926
|
-
(glassDivisions.get(c) ?? []).forEach((
|
|
5927
|
-
bar(
|
|
5994
|
+
(glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
|
|
5995
|
+
bar(at, 2 * DIVISION_HALF - 2e-3, span).userData.doorChannel = true;
|
|
5928
5996
|
});
|
|
5929
5997
|
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;
|
|
5930
5998
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
5931
5999
|
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 } });
|
|
5932
6000
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
5933
6001
|
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));
|
|
5934
|
-
|
|
5935
|
-
(s.seams || []).forEach(function(q) {
|
|
5936
|
-
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;
|
|
5937
|
-
doorSeam(c, S, sd, x, y0, y1);
|
|
5938
|
-
});
|
|
6002
|
+
if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
|
|
5939
6003
|
(s.handles || []).forEach(function(x) {
|
|
5940
6004
|
c.roundBox(
|
|
5941
6005
|
0.15,
|
|
@@ -5950,7 +6014,8 @@ function installCarsExtra(fx) {
|
|
|
5950
6014
|
});
|
|
5951
6015
|
if (s.arches && s.arches.length > 1) {
|
|
5952
6016
|
const x0 = s.arches[1][0] + s.arches[1][2] + 0.02, x1 = s.arches[0][0] - s.arches[0][2] - 0.02;
|
|
5953
|
-
|
|
6017
|
+
const mouldingG = sideGrid(S, sd, { x0, x1, y0: by + 5e-3, y1: by + 0.12 });
|
|
6018
|
+
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 }));
|
|
5954
6019
|
if (s.clad)
|
|
5955
6020
|
s.arches.forEach(function(a) {
|
|
5956
6021
|
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));
|
|
@@ -5962,16 +6027,25 @@ function installCarsExtra(fx) {
|
|
|
5962
6027
|
c.roundBox(
|
|
5963
6028
|
gh.fb - gh.rb - 0.3,
|
|
5964
6029
|
0.012,
|
|
5965
|
-
|
|
6030
|
+
0.012,
|
|
5966
6031
|
4e-3,
|
|
5967
6032
|
MT.chrome,
|
|
5968
6033
|
(gh.fb + gh.rb) / 2 - 0.05,
|
|
5969
6034
|
gh.belt + 0.035,
|
|
5970
|
-
sd * (halfAt(gh.Wg, T, gh.belt + 0.035) +
|
|
6035
|
+
sd * (halfAt(gh.Wg, T, gh.belt + 0.035) + 6e-3)
|
|
5971
6036
|
);
|
|
5972
6037
|
});
|
|
5973
6038
|
const cwh = S.hit(new V3(gh.fb + 0.03, 3, 0), new V3(0, -1, 0)), cwy = cwh ? cwh.p.y : gh.belt;
|
|
5974
|
-
|
|
6039
|
+
let cwz = gh.Wg / 2 - 0.03;
|
|
6040
|
+
for (let z = 0.3; z < cwz; z += 0.01) {
|
|
6041
|
+
const h = S.hit(new V3(gh.fb + 0.03, 3, z), new V3(0, -1, 0));
|
|
6042
|
+
if (!h || h.p.y < cwy - COWL_DROP) {
|
|
6043
|
+
cwz = z;
|
|
6044
|
+
break;
|
|
6045
|
+
}
|
|
6046
|
+
}
|
|
6047
|
+
cwz = Math.min(cwz, halfAt(gh.Wg, T, gh.belt + 0.05) - 0.072);
|
|
6048
|
+
c.roundBox(0.15, 0.02, 2 * cwz, 8e-3, PLASTIC, gh.fb + 0.02, cwy + 4e-3, 0).castShadow = false;
|
|
5975
6049
|
const wd = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize(), wn = new V3(wd.y, -wd.x, 0);
|
|
5976
6050
|
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);
|
|
5977
6051
|
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;
|
|
@@ -6016,6 +6090,21 @@ function installCarsExtra(fx) {
|
|
|
6016
6090
|
});
|
|
6017
6091
|
underbody(c, s, I);
|
|
6018
6092
|
if (s.extra) s.extra(c, I);
|
|
6093
|
+
c.vehicle.updateMatrixWorld(true);
|
|
6094
|
+
[1, -1].forEach(function(sd) {
|
|
6095
|
+
const side = bodySide(THREE, c, S, sd);
|
|
6096
|
+
const edges = doorEdgesOf(gh, s.wheels ?? []);
|
|
6097
|
+
(s.seams || []).forEach(function(q) {
|
|
6098
|
+
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;
|
|
6099
|
+
const pts = shutLinePoints(side, x, y0, y1);
|
|
6100
|
+
if (pts.length < 3) return;
|
|
6101
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
|
|
6102
|
+
seam.castShadow = false;
|
|
6103
|
+
seam.userData.doorSeam = true;
|
|
6104
|
+
seam.userData.gap = true;
|
|
6105
|
+
c.deform.push(seam);
|
|
6106
|
+
});
|
|
6107
|
+
});
|
|
6019
6108
|
if (!c.parts.some(function(p) {
|
|
6020
6109
|
return p.kind === "engine";
|
|
6021
6110
|
}))
|
|
@@ -6089,16 +6178,57 @@ function installCarsExtra(fx) {
|
|
|
6089
6178
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
6090
6179
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
6091
6180
|
}
|
|
6092
|
-
const
|
|
6093
|
-
|
|
6181
|
+
const GAP_R = 2e-3;
|
|
6182
|
+
const FIXED_SEAL_R = 4e-3;
|
|
6183
|
+
const DOOR_SEAL_R = 6e-3;
|
|
6184
|
+
const GAP_SHADE = 0.45;
|
|
6185
|
+
const gapMaterials = /* @__PURE__ */ new Map();
|
|
6186
|
+
function gapMaterial(col) {
|
|
6187
|
+
const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
|
|
6188
|
+
const known = gapMaterials.get(hex);
|
|
6189
|
+
if (known) return known;
|
|
6190
|
+
const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
|
|
6191
|
+
gapMaterials.set(hex, made);
|
|
6192
|
+
return made;
|
|
6193
|
+
}
|
|
6194
|
+
const HOOD_GAP = 4 * GAP_R;
|
|
6195
|
+
function hoodGap(c, S, x0, x1, zH, mat) {
|
|
6196
|
+
const onTop = (x, z) => {
|
|
6197
|
+
const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
|
|
6198
|
+
return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
|
|
6199
|
+
};
|
|
6200
|
+
const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
|
|
6201
|
+
const across = Math.max(4, Math.ceil(2 * zH / 0.04));
|
|
6202
|
+
const line = [];
|
|
6203
|
+
for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
|
|
6204
|
+
for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
|
|
6205
|
+
for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
|
|
6206
|
+
const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
|
|
6207
|
+
t.castShadow = false;
|
|
6208
|
+
t.userData.gap = true;
|
|
6209
|
+
return t;
|
|
6210
|
+
}
|
|
6211
|
+
const FUEL_DOOR_W = 0.13;
|
|
6212
|
+
const FUEL_DOOR_H = 0.11;
|
|
6213
|
+
const FUEL_DOOR_R = 0.02;
|
|
6214
|
+
function fuelDoorGap(c, S, sd, x, y, mat) {
|
|
6094
6215
|
const pts = [];
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6216
|
+
const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
|
|
6217
|
+
const corners = [
|
|
6218
|
+
[hx, hy, 0],
|
|
6219
|
+
[-hx, hy, 0.5 * PI],
|
|
6220
|
+
[-hx, -hy, PI],
|
|
6221
|
+
[hx, -hy, 1.5 * PI]
|
|
6222
|
+
];
|
|
6223
|
+
corners.forEach(function([cx, cy, a0]) {
|
|
6224
|
+
for (let k = 0; k <= 4; k++) {
|
|
6225
|
+
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");
|
|
6226
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
|
|
6227
|
+
}
|
|
6228
|
+
});
|
|
6229
|
+
const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
|
|
6100
6230
|
t.castShadow = false;
|
|
6101
|
-
t.userData.
|
|
6231
|
+
t.userData.gap = true;
|
|
6102
6232
|
return t;
|
|
6103
6233
|
}
|
|
6104
6234
|
function sm(t) {
|
|
@@ -6147,36 +6277,23 @@ function installCarsExtra(fx) {
|
|
|
6147
6277
|
});
|
|
6148
6278
|
const h = o.h || 0.03, Gd = sideGrid(I.S, sd, { x0, x1, y0: lo - h - 0.03, y1: hi + 0.03 });
|
|
6149
6279
|
function yAt(u) {
|
|
6150
|
-
|
|
6151
|
-
for (let i = 0; i < pts.length - 1; i++) {
|
|
6152
|
-
const a = pts[i], b = pts[i + 1];
|
|
6153
|
-
if ((x - a[0]) * (x - b[0]) <= 0) {
|
|
6154
|
-
const t = (x - a[0]) / (b[0] - a[0] || 1);
|
|
6155
|
-
return a[1] + (b[1] - a[1]) * sm(t);
|
|
6156
|
-
}
|
|
6157
|
-
}
|
|
6158
|
-
return pts[pts.length - 1][1];
|
|
6280
|
+
return creaseHeightAt(pts, x0 + (x1 - x0) * u);
|
|
6159
6281
|
}
|
|
6160
|
-
I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
6282
|
+
const fold = I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
6161
6283
|
yb: function(u) {
|
|
6162
6284
|
return yAt(u) - h;
|
|
6163
6285
|
},
|
|
6164
6286
|
yt: yAt,
|
|
6165
|
-
off: o.off ||
|
|
6166
|
-
|
|
6167
|
-
|
|
6287
|
+
off: o.off || 2e-3,
|
|
6288
|
+
ridge: { at: CREASE_FOLD_AT, lift: CREASE_FOLD_LIFT },
|
|
6289
|
+
crease: 30,
|
|
6290
|
+
nv: 5,
|
|
6168
6291
|
u0: o.u0 || 0.01,
|
|
6169
6292
|
u1: o.u1 || 0.99
|
|
6170
6293
|
});
|
|
6171
|
-
|
|
6172
|
-
for (let k = 0; k <= 30; k++) {
|
|
6173
|
-
const u = (o.u0 || 0.01) + k / 30 * ((o.u1 || 0.99) - (o.u0 || 0.01));
|
|
6174
|
-
l.push([u, yAt(u) - h - 1e-3]);
|
|
6175
|
-
}
|
|
6176
|
-
lineOn(c, Gd, l, 3e-3, o.shade || SHADE, 3e-3);
|
|
6294
|
+
markRaised(c, markFinishDetail(fold));
|
|
6177
6295
|
return Gd;
|
|
6178
6296
|
}
|
|
6179
|
-
const SHADE = CM("#000000", { roughness: 1, transparent: true, opacity: 0.45, depthWrite: false });
|
|
6180
6297
|
const CHROMEH = CM("#c9cdd0", { metalness: 0.85, roughness: 0.25 });
|
|
6181
6298
|
const CHROMEB = CM("#d4d8db", { metalness: 0.5, roughness: 0.24 });
|
|
6182
6299
|
const VINYL = "#2e2622";
|
|
@@ -6511,6 +6628,8 @@ function installCarsExtra(fx) {
|
|
|
6511
6628
|
dropRear: true,
|
|
6512
6629
|
seams: [0.64, -0.5, [-1.27, 0.67, 0.93]],
|
|
6513
6630
|
handles: [0.12, -0.86],
|
|
6631
|
+
/* fuel door on the right rear fender, between the rear door and the taillight, over the wheel */
|
|
6632
|
+
fuelDoor: [-1.47, 0.71, 1],
|
|
6514
6633
|
blackPillars: [-0.5],
|
|
6515
6634
|
frontBumper: { y1: 0.6 },
|
|
6516
6635
|
rearBumper: { y1: 0.58 },
|
|
@@ -14065,7 +14184,8 @@ function installMilitary(fx) {
|
|
|
14065
14184
|
}
|
|
14066
14185
|
|
|
14067
14186
|
// src/vehicles/motorcycles-cars.ts
|
|
14068
|
-
import {
|
|
14187
|
+
import { SHUT_LINE_RADIUS as SHUT_LINE_RADIUS2, markFinishDetail as markFinishDetail2, shutLinePoints as shutLinePoints2 } from "@adatechnology/game-vehicles";
|
|
14188
|
+
import { DIVISION_HALF as DIVISION_HALF2, divisionSpan as divisionSpan2, doorEdgesOf as doorEdgesOf2, doorGlassSplits as doorGlassSplits2, seamOnDoorEdge as seamOnDoorEdge2, splitSidePolys as splitSidePolys2 } from "@adatechnology/game-vehicles";
|
|
14069
14189
|
function installMotorcyclesCars(fx) {
|
|
14070
14190
|
const kit = fx.kit;
|
|
14071
14191
|
const THREE = kit.THREE;
|
|
@@ -14517,7 +14637,8 @@ function installMotorcyclesCars(fx) {
|
|
|
14517
14637
|
const u = u0 + (u1 - u0) * i / nu, b = yb(u), t = yt(u), row = [];
|
|
14518
14638
|
for (let j = 0; j <= nv; j++) {
|
|
14519
14639
|
const y = b + (t - b) * j / nv, s = G2.at(u, y);
|
|
14520
|
-
|
|
14640
|
+
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;
|
|
14641
|
+
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] });
|
|
14521
14642
|
}
|
|
14522
14643
|
Q.push(row);
|
|
14523
14644
|
}
|
|
@@ -14810,8 +14931,9 @@ function installMotorcyclesCars(fx) {
|
|
|
14810
14931
|
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");
|
|
14811
14932
|
return h ? h.p.addScaledVector(h.n, 3e-3) : null;
|
|
14812
14933
|
}).filter(Boolean);
|
|
14813
|
-
const t = c.tube(P,
|
|
14934
|
+
const t = c.tube(P, GAP_R, I.gap ?? MT.dark, { seg: P.length * 8, rs: 4 });
|
|
14814
14935
|
t.castShadow = false;
|
|
14936
|
+
t.userData.gap = true;
|
|
14815
14937
|
c.deform.push(t);
|
|
14816
14938
|
return t;
|
|
14817
14939
|
};
|
|
@@ -14837,6 +14959,7 @@ function installMotorcyclesCars(fx) {
|
|
|
14837
14959
|
};
|
|
14838
14960
|
return K;
|
|
14839
14961
|
}
|
|
14962
|
+
const DIVISION_OVER = 0.012;
|
|
14840
14963
|
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
14841
14964
|
function car(c, s) {
|
|
14842
14965
|
const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
|
|
@@ -14873,7 +14996,10 @@ function installMotorcyclesCars(fx) {
|
|
|
14873
14996
|
if (s.dropRear) polys = polys.slice(1);
|
|
14874
14997
|
const divided = splitSidePolys2(polys, doorGlassSplits2(gh, s.wheels ?? []));
|
|
14875
14998
|
polys = divided.polys;
|
|
14876
|
-
glassDivisions.set(
|
|
14999
|
+
glassDivisions.set(
|
|
15000
|
+
c,
|
|
15001
|
+
divided.used.map((at) => ({ at, span: divisionSpan2(divided.polys, at) }))
|
|
15002
|
+
);
|
|
14877
15003
|
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);
|
|
14878
15004
|
const gHoles = [];
|
|
14879
15005
|
if (intr) {
|
|
@@ -14894,6 +15020,7 @@ function installMotorcyclesCars(fx) {
|
|
|
14894
15020
|
side: THREE.DoubleSide
|
|
14895
15021
|
}) : null;
|
|
14896
15022
|
kit.shell(c, { items: ghItems, W: gh.Wg, col: s.col, mat: roofMat, T, holes: gHoles, sub: intr ? 0.12 : 0.2 });
|
|
15023
|
+
const sealEdges = doorEdgesOf2(gh, s.wheels ?? []);
|
|
14897
15024
|
kit.sideWindows(
|
|
14898
15025
|
c,
|
|
14899
15026
|
polys,
|
|
@@ -14902,7 +15029,14 @@ function installMotorcyclesCars(fx) {
|
|
|
14902
15029
|
function(i, n) {
|
|
14903
15030
|
return i === 0 && n > 2 ? lbl("quarter_glass") : i === n - 1 ? lbl("window_front") : lbl("window_rear");
|
|
14904
15031
|
},
|
|
14905
|
-
{
|
|
15032
|
+
{
|
|
15033
|
+
see: !!intr,
|
|
15034
|
+
// a fixed pane sits in a thin rubber flush with the body; the window of a door runs in a channel round its frame
|
|
15035
|
+
seal: function(i) {
|
|
15036
|
+
const xs = polys[i].map((q) => q[0]), mid = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
15037
|
+
return sealEdges && mid > sealEdges.C && mid < sealEdges.doorF ? DOOR_SEAL_R : FIXED_SEAL_R;
|
|
15038
|
+
}
|
|
15039
|
+
}
|
|
14906
15040
|
);
|
|
14907
15041
|
kit.glassQuad(c, qf, lbl("windshield"), { see: !!intr });
|
|
14908
15042
|
kit.glassQuad(c, qr, lbl("rear_window"), { see: !!intr, mat: intr ? REARTINT : MT.glassDark });
|
|
@@ -14954,7 +15088,7 @@ function installMotorcyclesCars(fx) {
|
|
|
14954
15088
|
(s.arches || []).forEach(function(a) {
|
|
14955
15089
|
fa = Math.max(fa, a[0]);
|
|
14956
15090
|
});
|
|
14957
|
-
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col });
|
|
15091
|
+
const hood = kit.makeHood(c, lowMesh.userData.cut.hood, { x0: hx0, col: s.col, gap: HOOD_GAP });
|
|
14958
15092
|
if (hood)
|
|
14959
15093
|
kit.engineBay(c, {
|
|
14960
15094
|
x0: hx0 + 0.02,
|
|
@@ -14988,6 +15122,7 @@ function installMotorcyclesCars(fx) {
|
|
|
14988
15122
|
);
|
|
14989
15123
|
const Wf = mkWarp(wo);
|
|
14990
15124
|
const S = mkSurf(lowMesh, W);
|
|
15125
|
+
if (c.hood && hoodO) hoodGap(c, S, hx0, hx1, zH, gapMaterial(s.col));
|
|
14991
15126
|
details(c, s, Wf, S);
|
|
14992
15127
|
applyWarp(c, Wf);
|
|
14993
15128
|
return m;
|
|
@@ -14999,7 +15134,7 @@ function installMotorcyclesCars(fx) {
|
|
|
14999
15134
|
}, rx = function(y) {
|
|
15000
15135
|
return profX(it, y, false);
|
|
15001
15136
|
};
|
|
15002
|
-
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S };
|
|
15137
|
+
const I = { fx: fx2, rx, W, hw, by, gh, T, Wf, S, gap: gapMaterial(s.col) };
|
|
15003
15138
|
I.fxB = S.endX(1, by + 0.2);
|
|
15004
15139
|
I.rxB = S.endX(-1, by + 0.2);
|
|
15005
15140
|
const K = mkKit(c, S, I);
|
|
@@ -15028,26 +15163,22 @@ function installMotorcyclesCars(fx) {
|
|
|
15028
15163
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
15029
15164
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
15030
15165
|
[1, -1].forEach(function(sd) {
|
|
15031
|
-
const bar = function(px, width) {
|
|
15032
|
-
const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
|
|
15166
|
+
const bar = function(px, width, span) {
|
|
15167
|
+
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;
|
|
15033
15168
|
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] });
|
|
15034
15169
|
m2.castShadow = false;
|
|
15035
15170
|
return m2;
|
|
15036
15171
|
};
|
|
15037
15172
|
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
15038
|
-
(glassDivisions.get(c) ?? []).forEach((
|
|
15039
|
-
bar(
|
|
15173
|
+
(glassDivisions.get(c) ?? []).forEach(({ at, span }) => {
|
|
15174
|
+
bar(at, 2 * DIVISION_HALF2 - 2e-3, span).userData.doorChannel = true;
|
|
15040
15175
|
});
|
|
15041
15176
|
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;
|
|
15042
15177
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
15043
15178
|
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 } });
|
|
15044
15179
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
15045
15180
|
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));
|
|
15046
|
-
|
|
15047
|
-
(s.seams || []).forEach(function(x0) {
|
|
15048
|
-
const x = seamOnDoorEdge2(x0, edges);
|
|
15049
|
-
doorSeam(c, S, sd, x, by + 0.09, gh.belt - 0.03);
|
|
15050
|
-
});
|
|
15181
|
+
if (s.fuelDoor && sd === s.fuelDoor[2]) fuelDoorGap(c, S, sd, s.fuelDoor[0], s.fuelDoor[1], I.gap);
|
|
15051
15182
|
(s.handles || []).forEach(function(x) {
|
|
15052
15183
|
c.roundBox(
|
|
15053
15184
|
0.15,
|
|
@@ -15062,7 +15193,8 @@ function installMotorcyclesCars(fx) {
|
|
|
15062
15193
|
});
|
|
15063
15194
|
if (s.arches && s.arches.length > 1) {
|
|
15064
15195
|
const x0 = s.arches[1][0] + s.arches[1][2] + 0.02, x1 = s.arches[0][0] - s.arches[0][2] - 0.02;
|
|
15065
|
-
|
|
15196
|
+
const mouldingG = sideGrid(S, sd, { x0, x1, y0: by + 5e-3, y1: by + 0.12 });
|
|
15197
|
+
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 }));
|
|
15066
15198
|
if (s.clad)
|
|
15067
15199
|
s.arches.forEach(function(a) {
|
|
15068
15200
|
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));
|
|
@@ -15115,6 +15247,20 @@ function installMotorcyclesCars(fx) {
|
|
|
15115
15247
|
});
|
|
15116
15248
|
underbody(c, s, I);
|
|
15117
15249
|
if (s.extra) s.extra(c, I);
|
|
15250
|
+
c.vehicle.updateMatrixWorld(true);
|
|
15251
|
+
[1, -1].forEach(function(sd) {
|
|
15252
|
+
const side = bodySide(THREE, c, S, sd);
|
|
15253
|
+
const edges = doorEdgesOf2(gh, s.wheels ?? []);
|
|
15254
|
+
(s.seams || []).forEach(function(x) {
|
|
15255
|
+
const pts = shutLinePoints2(side, seamOnDoorEdge2(x, edges), by + 0.11, gh.belt - 0.03);
|
|
15256
|
+
if (pts.length < 3) return;
|
|
15257
|
+
const seam = markFinishDetail2(c.tube(pts, SHUT_LINE_RADIUS2, I.gap ?? MT.dark, { seg: 72, rs: 5 }));
|
|
15258
|
+
seam.castShadow = false;
|
|
15259
|
+
seam.userData.doorSeam = true;
|
|
15260
|
+
seam.userData.gap = true;
|
|
15261
|
+
c.deform.push(seam);
|
|
15262
|
+
});
|
|
15263
|
+
});
|
|
15118
15264
|
if (!c.parts.some(function(p) {
|
|
15119
15265
|
return p.kind === "engine";
|
|
15120
15266
|
}))
|
|
@@ -15188,16 +15334,57 @@ function installMotorcyclesCars(fx) {
|
|
|
15188
15334
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
15189
15335
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
15190
15336
|
}
|
|
15191
|
-
const
|
|
15192
|
-
|
|
15337
|
+
const GAP_R = 2e-3;
|
|
15338
|
+
const FIXED_SEAL_R = 4e-3;
|
|
15339
|
+
const DOOR_SEAL_R = 6e-3;
|
|
15340
|
+
const GAP_SHADE = 0.45;
|
|
15341
|
+
const gapMaterials = /* @__PURE__ */ new Map();
|
|
15342
|
+
function gapMaterial(col) {
|
|
15343
|
+
const hex = "#" + new THREE.Color(col).multiplyScalar(GAP_SHADE).getHexString();
|
|
15344
|
+
const known = gapMaterials.get(hex);
|
|
15345
|
+
if (known) return known;
|
|
15346
|
+
const made = CM(hex, { roughness: 0.6 }) ?? MT.dark;
|
|
15347
|
+
gapMaterials.set(hex, made);
|
|
15348
|
+
return made;
|
|
15349
|
+
}
|
|
15350
|
+
const HOOD_GAP = 4 * GAP_R;
|
|
15351
|
+
function hoodGap(c, S, x0, x1, zH, mat) {
|
|
15352
|
+
const onTop = (x, z) => {
|
|
15353
|
+
const h = S.hit(new V3(x, 3, z), new V3(0, -1, 0));
|
|
15354
|
+
return h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, 0, z);
|
|
15355
|
+
};
|
|
15356
|
+
const steps = Math.max(4, Math.ceil((x1 - x0) / 0.04));
|
|
15357
|
+
const across = Math.max(4, Math.ceil(2 * zH / 0.04));
|
|
15358
|
+
const line = [];
|
|
15359
|
+
for (let k = 0; k <= steps; k++) line.push(onTop(x0 + (x1 - x0) * k / steps, zH));
|
|
15360
|
+
for (let k = 1; k < across; k++) line.push(onTop(x1, zH - 2 * zH * k / across));
|
|
15361
|
+
for (let k = steps; k >= 0; k--) line.push(onTop(x0 + (x1 - x0) * k / steps, -zH));
|
|
15362
|
+
const t = c.tube(line, GAP_R, mat, { seg: line.length * 2, rs: 4 });
|
|
15363
|
+
t.castShadow = false;
|
|
15364
|
+
t.userData.gap = true;
|
|
15365
|
+
return t;
|
|
15366
|
+
}
|
|
15367
|
+
const FUEL_DOOR_W = 0.13;
|
|
15368
|
+
const FUEL_DOOR_H = 0.11;
|
|
15369
|
+
const FUEL_DOOR_R = 0.02;
|
|
15370
|
+
function fuelDoorGap(c, S, sd, x, y, mat) {
|
|
15193
15371
|
const pts = [];
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15372
|
+
const hx = FUEL_DOOR_W / 2 - FUEL_DOOR_R, hy = FUEL_DOOR_H / 2 - FUEL_DOOR_R;
|
|
15373
|
+
const corners = [
|
|
15374
|
+
[hx, hy, 0],
|
|
15375
|
+
[-hx, hy, 0.5 * PI],
|
|
15376
|
+
[-hx, -hy, PI],
|
|
15377
|
+
[hx, -hy, 1.5 * PI]
|
|
15378
|
+
];
|
|
15379
|
+
corners.forEach(function([cx, cy, a0]) {
|
|
15380
|
+
for (let k = 0; k <= 4; k++) {
|
|
15381
|
+
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");
|
|
15382
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(px, py, sd * S.hw));
|
|
15383
|
+
}
|
|
15384
|
+
});
|
|
15385
|
+
const t = c.tube(pts, GAP_R, mat, { closed: true, seg: pts.length * 2, rs: 4 });
|
|
15199
15386
|
t.castShadow = false;
|
|
15200
|
-
t.userData.
|
|
15387
|
+
t.userData.gap = true;
|
|
15201
15388
|
return t;
|
|
15202
15389
|
}
|
|
15203
15390
|
function sm(t) {
|
|
@@ -15246,36 +15433,23 @@ function installMotorcyclesCars(fx) {
|
|
|
15246
15433
|
});
|
|
15247
15434
|
const h = o.h || 0.03, Gd = sideGrid(I.S, sd, { x0, x1, y0: lo - h - 0.03, y1: hi + 0.03 });
|
|
15248
15435
|
function yAt(u) {
|
|
15249
|
-
|
|
15250
|
-
for (let i = 0; i < pts.length - 1; i++) {
|
|
15251
|
-
const a = pts[i], b = pts[i + 1];
|
|
15252
|
-
if ((x - a[0]) * (x - b[0]) <= 0) {
|
|
15253
|
-
const t = (x - a[0]) / (b[0] - a[0] || 1);
|
|
15254
|
-
return a[1] + (b[1] - a[1]) * sm(t);
|
|
15255
|
-
}
|
|
15256
|
-
}
|
|
15257
|
-
return pts[pts.length - 1][1];
|
|
15436
|
+
return creaseHeightAt(pts, x0 + (x1 - x0) * u);
|
|
15258
15437
|
}
|
|
15259
|
-
I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
15438
|
+
const fold = I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
15260
15439
|
yb: function(u) {
|
|
15261
15440
|
return yAt(u) - h;
|
|
15262
15441
|
},
|
|
15263
15442
|
yt: yAt,
|
|
15264
|
-
off: o.off ||
|
|
15265
|
-
|
|
15266
|
-
|
|
15443
|
+
off: o.off || 2e-3,
|
|
15444
|
+
ridge: { at: CREASE_FOLD_AT, lift: CREASE_FOLD_LIFT },
|
|
15445
|
+
crease: 30,
|
|
15446
|
+
nv: 5,
|
|
15267
15447
|
u0: o.u0 || 0.01,
|
|
15268
15448
|
u1: o.u1 || 0.99
|
|
15269
15449
|
});
|
|
15270
|
-
|
|
15271
|
-
for (let k = 0; k <= 30; k++) {
|
|
15272
|
-
const u = (o.u0 || 0.01) + k / 30 * ((o.u1 || 0.99) - (o.u0 || 0.01));
|
|
15273
|
-
l.push([u, yAt(u) - h - 1e-3]);
|
|
15274
|
-
}
|
|
15275
|
-
lineOn(c, Gd, l, 3e-3, o.shade || SHADE, 3e-3);
|
|
15450
|
+
markRaised(c, markFinishDetail2(fold));
|
|
15276
15451
|
return Gd;
|
|
15277
15452
|
}
|
|
15278
|
-
const SHADE = CM("#000000", { roughness: 1, transparent: true, opacity: 0.45, depthWrite: false });
|
|
15279
15453
|
function dloChrome(c, I, sd, pts, r) {
|
|
15280
15454
|
const gh = I.gh, T = I.T, P = pts.map(function(q) {
|
|
15281
15455
|
return [q[0], q[1], sd * (halfAt(gh.Wg, T, q[1]) + 0.012)];
|
|
@@ -16333,12 +16507,10 @@ function installMotorcyclesCars(fx) {
|
|
|
16333
16507
|
I,
|
|
16334
16508
|
sd,
|
|
16335
16509
|
[
|
|
16336
|
-
[
|
|
16337
|
-
[0, 0.
|
|
16338
|
-
[-0.9, 0.6],
|
|
16339
|
-
[-1.2, 0.66]
|
|
16510
|
+
[0.86, 0.52],
|
|
16511
|
+
[-0.98, 0.52]
|
|
16340
16512
|
],
|
|
16341
|
-
{ col: "#8b939a", h: 0.
|
|
16513
|
+
{ col: "#8b939a", h: 0.03 }
|
|
16342
16514
|
);
|
|
16343
16515
|
});
|
|
16344
16516
|
}
|
|
@@ -24166,6 +24338,7 @@ function installSuvPickupVan(fx) {
|
|
|
24166
24338
|
tl: P.tl,
|
|
24167
24339
|
grille: P.grille,
|
|
24168
24340
|
seams: P.seams,
|
|
24341
|
+
shell: shellM,
|
|
24169
24342
|
handles: P.handles,
|
|
24170
24343
|
wheels: [
|
|
24171
24344
|
[A.xf, P.wr, 0.24, { rim: P.rim }],
|