@adatechnology/game-vehicles-fleet 11.0.1 → 11.0.2

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.
@@ -5099,8 +5099,8 @@ var GameVehiclesFleet = (() => {
5099
5099
  var GLASS_IN_FROM_EDGE = 0.03;
5100
5100
  var CUT_EPS = 1e-6;
5101
5101
  var PAST_EDGE_MIN = 0.01;
5102
- var PANE_MIN_AREA = 0.012;
5103
- var PANE_MIN_WIDTH = 0.15;
5102
+ var PANE_MIN_AREA = 8e-3;
5103
+ var PANE_MIN_WIDTH = 0.12;
5104
5104
  function carDoorEdges(fb, rb, pillars, xr, rr) {
5105
5105
  const doorF = fb - 0.03;
5106
5106
  const pil = pillars.slice().sort((a, b) => b - a);
@@ -5111,7 +5111,7 @@ var GameVehiclesFleet = (() => {
5111
5111
  const C = rearDoor ? Math.max(second !== void 0 && second < B - 0.4 ? second : rb, xr + rr * 0.2) : B;
5112
5112
  return { doorF, B, C, rearDoor };
5113
5113
  }
5114
- function doorGlassSplits(gh, wheels) {
5114
+ function doorEdgesOf(gh, wheels) {
5115
5115
  let xr = Infinity;
5116
5116
  let rr = 0.3;
5117
5117
  for (const w of wheels) {
@@ -5123,10 +5123,27 @@ var GameVehiclesFleet = (() => {
5123
5123
  }
5124
5124
  }
5125
5125
  if (!Number.isFinite(xr)) {
5126
- if (gh.pillars.length) return [];
5126
+ if (gh.pillars.length) return null;
5127
5127
  xr = -Infinity;
5128
5128
  }
5129
- const edges = carDoorEdges(gh.fb, gh.rb, gh.pillars, xr, rr);
5129
+ return carDoorEdges(gh.fb, gh.rb, gh.pillars, xr, rr);
5130
+ }
5131
+ var SEAM_SNAP = 0.1;
5132
+ var SEAM_INSIDE = 4e-3;
5133
+ function seamOnDoorEdge(x, edges) {
5134
+ if (!edges) return x;
5135
+ let best = x;
5136
+ let gap = SEAM_SNAP;
5137
+ const lines = [edges.doorF - SEAM_INSIDE, edges.B, edges.C === edges.B ? edges.C : edges.C + SEAM_INSIDE];
5138
+ for (let i = 0; i < lines.length; i++) {
5139
+ const d = Math.abs([edges.doorF, edges.B, edges.C][i] - x);
5140
+ if (d <= gap) [best, gap] = [lines[i], d];
5141
+ }
5142
+ return best;
5143
+ }
5144
+ function doorGlassSplits(gh, wheels) {
5145
+ const edges = doorEdgesOf(gh, wheels);
5146
+ if (!edges) return [];
5130
5147
  return [{ at: edges.C + GLASS_IN_FROM_EDGE - DIVISION_HALF, front: edges.rearDoor ? edges.B : edges.doorF }];
5131
5148
  }
5132
5149
  function clipPoly(poly, at, keep) {
@@ -6102,6 +6119,8 @@ var GameVehiclesFleet = (() => {
6102
6119
  rb: gh.rb,
6103
6120
  rt: gh.rt,
6104
6121
  roof: gh.roof + 0.02,
6122
+ roofRear: (gh.roofR || gh.roof) + 0.02,
6123
+ roofCrown: gh.crown || 0,
6105
6124
  belt: gh.belt,
6106
6125
  floor: s.bottomY + 0.02,
6107
6126
  seatH: 0.12,
@@ -6198,18 +6217,23 @@ var GameVehiclesFleet = (() => {
6198
6217
  [1, -1].forEach(function(sd) {
6199
6218
  const bar = function(px, width) {
6200
6219
  const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
6201
- c.roundBox(width, hh, 3e-3, 15e-4, GLOSS, px, yc, sd * (halfAt(gh.Wg, T, yc) + 4e-3), { rot: [-sd * tang, 0, 0] }).castShadow = false;
6220
+ 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
+ m2.castShadow = false;
6222
+ return m2;
6202
6223
  };
6203
6224
  (s.blackPillars || []).forEach((px) => bar(px, 0.118));
6204
- (glassDivisions.get(c) ?? []).forEach((px) => bar(px, 2 * DIVISION_HALF - 2e-3));
6225
+ (glassDivisions.get(c) ?? []).forEach((px) => {
6226
+ bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
6227
+ });
6205
6228
  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;
6206
6229
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
6207
6230
  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 } });
6208
6231
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
6209
6232
  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
+ const edges = doorEdgesOf(gh, s.wheels ?? []);
6210
6234
  (s.seams || []).forEach(function(q) {
6211
- const r = q, x = r.length ? r[0] : q, y0 = r.length ? r[1] : by + 0.09, y1 = r.length ? r[2] : gh.belt - 0.03;
6212
- c.roundBox(8e-3, y1 - y0, 6e-3, 3e-3, MT.dark, x, (y0 + y1) / 2, sd * (hw + 1e-3));
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);
6213
6237
  });
6214
6238
  (s.handles || []).forEach(function(x) {
6215
6239
  c.roundBox(
@@ -6364,6 +6388,18 @@ var GameVehiclesFleet = (() => {
6364
6388
  c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
6365
6389
  c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
6366
6390
  }
6391
+ const SEAM_POINTS = 14;
6392
+ function doorSeam(c, S, sd, x, y0, y1) {
6393
+ const pts = [];
6394
+ for (let k = 0; k <= SEAM_POINTS; k++) {
6395
+ const y = y0 + (y1 - y0) * k / SEAM_POINTS, h = S.hit(new V3(x, y, sd * (S.hw + 1)), new V3(0, 0, -sd), "M");
6396
+ pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, y, sd * (S.hw + 1e-3)));
6397
+ }
6398
+ const t = c.tube(pts, 3e-3, MT.dark, { seg: SEAM_POINTS, rs: 4 });
6399
+ t.castShadow = false;
6400
+ t.userData.doorSeam = true;
6401
+ return t;
6402
+ }
6367
6403
  function sm(t) {
6368
6404
  t = clamp(t, 0, 1);
6369
6405
  return t * t * (3 - 2 * t);
@@ -6951,7 +6987,8 @@ var GameVehiclesFleet = (() => {
6951
6987
  [1.75, 0.8],
6952
6988
  [0.6, 0.82],
6953
6989
  [-0.6, 0.835],
6954
- [-1.82, 0.85]
6990
+ // it ends where the taillight wraps onto the side, never running into the lamp
6991
+ [-1.6, 0.845]
6955
6992
  ],
6956
6993
  { col: hex, h: 0.024 }
6957
6994
  );
@@ -15195,6 +15232,8 @@ var GameVehiclesFleet = (() => {
15195
15232
  rb: gh.rb,
15196
15233
  rt: gh.rt,
15197
15234
  roof: gh.roof + 0.02,
15235
+ roofRear: (gh.roofR || gh.roof) + 0.02,
15236
+ roofCrown: gh.crown || 0,
15198
15237
  belt: gh.belt,
15199
15238
  floor: s.bottomY + 0.02,
15200
15239
  seatH: 0.12,
@@ -15289,17 +15328,23 @@ var GameVehiclesFleet = (() => {
15289
15328
  [1, -1].forEach(function(sd) {
15290
15329
  const bar = function(px, width) {
15291
15330
  const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
15292
- c.roundBox(width, hh, 3e-3, 15e-4, GLOSS, px, yc, sd * (halfAt(gh.Wg, T, yc) + 4e-3), { rot: [-sd * tang, 0, 0] }).castShadow = false;
15331
+ 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
+ m2.castShadow = false;
15333
+ return m2;
15293
15334
  };
15294
15335
  (s.blackPillars || []).forEach((px) => bar(px, 0.118));
15295
- (glassDivisions.get(c) ?? []).forEach((px) => bar(px, 2 * DIVISION_HALF - 2e-3));
15336
+ (glassDivisions.get(c) ?? []).forEach((px) => {
15337
+ bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
15338
+ });
15296
15339
  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;
15297
15340
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
15298
15341
  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 } });
15299
15342
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
15300
15343
  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));
15301
- (s.seams || []).forEach(function(x) {
15302
- c.roundBox(8e-3, gh.belt - by - 0.12, 6e-3, 3e-3, MT.dark, x, (gh.belt + by) / 2 + 0.03, sd * (hw + 1e-3));
15344
+ const edges = doorEdgesOf(gh, s.wheels ?? []);
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);
15303
15348
  });
15304
15349
  (s.handles || []).forEach(function(x) {
15305
15350
  c.roundBox(
@@ -15441,6 +15486,18 @@ var GameVehiclesFleet = (() => {
15441
15486
  c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
15442
15487
  c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
15443
15488
  }
15489
+ const SEAM_POINTS = 14;
15490
+ function doorSeam(c, S, sd, x, y0, y1) {
15491
+ const pts = [];
15492
+ for (let k = 0; k <= SEAM_POINTS; k++) {
15493
+ const y = y0 + (y1 - y0) * k / SEAM_POINTS, h = S.hit(new V3(x, y, sd * (S.hw + 1)), new V3(0, 0, -sd), "M");
15494
+ pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, y, sd * (S.hw + 1e-3)));
15495
+ }
15496
+ const t = c.tube(pts, 3e-3, MT.dark, { seg: SEAM_POINTS, rs: 4 });
15497
+ t.castShadow = false;
15498
+ t.userData.doorSeam = true;
15499
+ return t;
15500
+ }
15444
15501
  function sm(t) {
15445
15502
  t = clamp(t, 0, 1);
15446
15503
  return t * t * (3 - 2 * t);