@adatechnology/game-vehicles-fleet 11.0.0 → 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.
package/dist/index.js CHANGED
@@ -5028,6 +5028,9 @@ function installBoatsExtra(fx) {
5028
5028
  );
5029
5029
  }
5030
5030
 
5031
+ // src/vehicles/cars-extra.ts
5032
+ import { DIVISION_HALF, doorEdgesOf, doorGlassSplits, seamOnDoorEdge, splitSidePolys } from "@adatechnology/game-vehicles";
5033
+
5031
5034
  // src/vehicles/moving-parts.ts
5032
5035
  var WIPER_SWEEP = 1.5;
5033
5036
  function tagWiper(params) {
@@ -5714,6 +5717,7 @@ function installCarsExtra(fx) {
5714
5717
  };
5715
5718
  return K;
5716
5719
  }
5720
+ const glassDivisions = /* @__PURE__ */ new WeakMap();
5717
5721
  function car(c, s) {
5718
5722
  const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
5719
5723
  m.color = s.col;
@@ -5748,6 +5752,9 @@ function installCarsExtra(fx) {
5748
5752
  let polys = windows(gh);
5749
5753
  if (s.dropRear) polys = polys.slice(1);
5750
5754
  if (gh.polys) polys = gh.polys(polys);
5755
+ const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
5756
+ polys = divided.polys;
5757
+ glassDivisions.set(c, divided.used);
5751
5758
  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 });
5752
5759
  const gHoles = [];
5753
5760
  if (intr) {
@@ -5813,6 +5820,8 @@ function installCarsExtra(fx) {
5813
5820
  rb: gh.rb,
5814
5821
  rt: gh.rt,
5815
5822
  roof: gh.roof + 0.02,
5823
+ roofRear: (gh.roofR || gh.roof) + 0.02,
5824
+ roofCrown: gh.crown || 0,
5816
5825
  belt: gh.belt,
5817
5826
  floor: s.bottomY + 0.02,
5818
5827
  seatH: 0.12,
@@ -5907,19 +5916,25 @@ function installCarsExtra(fx) {
5907
5916
  K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
5908
5917
  const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
5909
5918
  [1, -1].forEach(function(sd) {
5910
- ;
5911
- (s.blackPillars || []).forEach(function(px) {
5919
+ const bar = function(px, width) {
5912
5920
  const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
5913
- c.roundBox(0.118, hh, 3e-3, 15e-4, GLOSS, px, yc, sd * (halfAt(gh.Wg, T, yc) + 4e-3), { rot: [-sd * tang, 0, 0] }).castShadow = false;
5921
+ 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
+ m2.castShadow = false;
5923
+ return m2;
5924
+ };
5925
+ (s.blackPillars || []).forEach((px) => bar(px, 0.118));
5926
+ (glassDivisions.get(c) ?? []).forEach((px) => {
5927
+ bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
5914
5928
  });
5915
5929
  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;
5916
5930
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
5917
5931
  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 } });
5918
5932
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
5919
5933
  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
+ const edges = doorEdgesOf(gh, s.wheels ?? []);
5920
5935
  (s.seams || []).forEach(function(q) {
5921
- 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;
5922
- c.roundBox(8e-3, y1 - y0, 6e-3, 3e-3, MT.dark, x, (y0 + y1) / 2, sd * (hw + 1e-3));
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);
5923
5938
  });
5924
5939
  (s.handles || []).forEach(function(x) {
5925
5940
  c.roundBox(
@@ -6074,6 +6089,18 @@ function installCarsExtra(fx) {
6074
6089
  c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
6075
6090
  c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
6076
6091
  }
6092
+ const SEAM_POINTS = 14;
6093
+ function doorSeam(c, S, sd, x, y0, y1) {
6094
+ const pts = [];
6095
+ for (let k = 0; k <= SEAM_POINTS; k++) {
6096
+ 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");
6097
+ pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, y, sd * (S.hw + 1e-3)));
6098
+ }
6099
+ const t = c.tube(pts, 3e-3, MT.dark, { seg: SEAM_POINTS, rs: 4 });
6100
+ t.castShadow = false;
6101
+ t.userData.doorSeam = true;
6102
+ return t;
6103
+ }
6077
6104
  function sm(t) {
6078
6105
  t = clamp(t, 0, 1);
6079
6106
  return t * t * (3 - 2 * t);
@@ -6661,7 +6688,8 @@ function installCarsExtra(fx) {
6661
6688
  [1.75, 0.8],
6662
6689
  [0.6, 0.82],
6663
6690
  [-0.6, 0.835],
6664
- [-1.82, 0.85]
6691
+ // it ends where the taillight wraps onto the side, never running into the lamp
6692
+ [-1.6, 0.845]
6665
6693
  ],
6666
6694
  { col: hex, h: 0.024 }
6667
6695
  );
@@ -7638,7 +7666,7 @@ function installCarsExtra(fx) {
7638
7666
  frameR: 9e-3
7639
7667
  });
7640
7668
  const e = K.grid(1, 0, { z1: 0.1, y0: 0.64, y1: 0.72, du: 0.03, dv: 0.03 }).at(0.5, 0.67);
7641
- kit.emblem(c2, e.p.x + 0.025, 0.67, 0, 0.045);
7669
+ kit.emblem(c2, e.p.x + 0.018, 0.67, 0, 0.045);
7642
7670
  const bg = c2.meta.frontBumper.userData.grid;
7643
7671
  c2.deform.push(K.skin(bg, MT.rubber, { u0: 0.02, u1: 0.98, yb: 0.37, yt: 0.405, off: 0.02, nv: 1 }));
7644
7672
  },
@@ -14037,6 +14065,7 @@ function installMilitary(fx) {
14037
14065
  }
14038
14066
 
14039
14067
  // src/vehicles/motorcycles-cars.ts
14068
+ import { DIVISION_HALF as DIVISION_HALF2, doorEdgesOf as doorEdgesOf2, doorGlassSplits as doorGlassSplits2, seamOnDoorEdge as seamOnDoorEdge2, splitSidePolys as splitSidePolys2 } from "@adatechnology/game-vehicles";
14040
14069
  function installMotorcyclesCars(fx) {
14041
14070
  const kit = fx.kit;
14042
14071
  const THREE = kit.THREE;
@@ -14808,6 +14837,7 @@ function installMotorcyclesCars(fx) {
14808
14837
  };
14809
14838
  return K;
14810
14839
  }
14840
+ const glassDivisions = /* @__PURE__ */ new WeakMap();
14811
14841
  function car(c, s) {
14812
14842
  const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
14813
14843
  m.color = s.col;
@@ -14841,6 +14871,9 @@ function installMotorcyclesCars(fx) {
14841
14871
  ghItems.push([gh.ft, gh.roof, gh.r2 || 0.2], [gh.fb, gh.belt - 0.1, 0]);
14842
14872
  let polys = windows(gh);
14843
14873
  if (s.dropRear) polys = polys.slice(1);
14874
+ const divided = splitSidePolys2(polys, doorGlassSplits2(gh, s.wheels ?? []));
14875
+ polys = divided.polys;
14876
+ glassDivisions.set(c, divided.used);
14844
14877
  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);
14845
14878
  const gHoles = [];
14846
14879
  if (intr) {
@@ -14901,6 +14934,8 @@ function installMotorcyclesCars(fx) {
14901
14934
  rb: gh.rb,
14902
14935
  rt: gh.rt,
14903
14936
  roof: gh.roof + 0.02,
14937
+ roofRear: (gh.roofR || gh.roof) + 0.02,
14938
+ roofCrown: gh.crown || 0,
14904
14939
  belt: gh.belt,
14905
14940
  floor: s.bottomY + 0.02,
14906
14941
  seatH: 0.12,
@@ -14993,18 +15028,25 @@ function installMotorcyclesCars(fx) {
14993
15028
  K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
14994
15029
  const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
14995
15030
  [1, -1].forEach(function(sd) {
14996
- ;
14997
- (s.blackPillars || []).forEach(function(px) {
15031
+ const bar = function(px, width) {
14998
15032
  const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
14999
- c.roundBox(0.118, hh, 3e-3, 15e-4, GLOSS, px, yc, sd * (halfAt(gh.Wg, T, yc) + 4e-3), { rot: [-sd * tang, 0, 0] }).castShadow = false;
15033
+ 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
+ m2.castShadow = false;
15035
+ return m2;
15036
+ };
15037
+ (s.blackPillars || []).forEach((px) => bar(px, 0.118));
15038
+ (glassDivisions.get(c) ?? []).forEach((px) => {
15039
+ bar(px, 2 * DIVISION_HALF2 - 2e-3).userData.doorChannel = true;
15000
15040
  });
15001
15041
  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;
15002
15042
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
15003
15043
  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 } });
15004
15044
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
15005
15045
  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));
15006
- (s.seams || []).forEach(function(x) {
15007
- 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));
15046
+ const edges = doorEdgesOf2(gh, s.wheels ?? []);
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);
15008
15050
  });
15009
15051
  (s.handles || []).forEach(function(x) {
15010
15052
  c.roundBox(
@@ -15146,6 +15188,18 @@ function installMotorcyclesCars(fx) {
15146
15188
  c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
15147
15189
  c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
15148
15190
  }
15191
+ const SEAM_POINTS = 14;
15192
+ function doorSeam(c, S, sd, x, y0, y1) {
15193
+ const pts = [];
15194
+ for (let k = 0; k <= SEAM_POINTS; k++) {
15195
+ 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");
15196
+ pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, y, sd * (S.hw + 1e-3)));
15197
+ }
15198
+ const t = c.tube(pts, 3e-3, MT.dark, { seg: SEAM_POINTS, rs: 4 });
15199
+ t.castShadow = false;
15200
+ t.userData.doorSeam = true;
15201
+ return t;
15202
+ }
15149
15203
  function sm(t) {
15150
15204
  t = clamp(t, 0, 1);
15151
15205
  return t * t * (3 - 2 * t);
@@ -18647,8 +18701,8 @@ function installMotorcyclesExtra(fx) {
18647
18701
  return b;
18648
18702
  }
18649
18703
  function plateMoto(c, x, y, txt) {
18650
- c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 9e-3, y, 0);
18651
- c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 3e-3, y, 0, "-x", {
18704
+ c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 7e-3, y, 0);
18705
+ c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 5e-3, y, 0, "-x", {
18652
18706
  w: 300,
18653
18707
  h: 220,
18654
18708
  bg: "#f2f2ee",
@@ -18762,8 +18816,8 @@ function installMotorcyclesExtra(fx) {
18762
18816
  d.position.z = s * hw * 0.72;
18763
18817
  g.add(d);
18764
18818
  for (let q = 0; q < 12; q++) {
18765
- const a2 = q / 12 * PI * 2, sl = new THREE.Mesh(G.roundedBox(rimR * 0.42, 0.016, 6e-3, 5e-3), o.slot || CM("#1c1e21", { metalness: 0.5, roughness: 0.4 }));
18766
- sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.0105));
18819
+ const a2 = q / 12 * PI * 2, sl = new THREE.Mesh(G.roundedBox(rimR * 0.42, 0.016, 6e-3, 2e-3), o.slot || CM("#1c1e21", { metalness: 0.5, roughness: 0.4 }));
18820
+ sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.013));
18767
18821
  sl.rotation.z = a2;
18768
18822
  g.add(sl);
18769
18823
  }
@@ -23737,7 +23791,8 @@ function installSuvPickupVan(fx) {
23737
23791
  tailLightY: 2.06,
23738
23792
  noAntenna: true,
23739
23793
  hl: { style: "round", w: 0.2, h: 0.2, y: 2.03, in: 0.12, yaw: 0 },
23740
- grille: { style: "bars", w: 1, h: 0.3, y: 2 },
23794
+ /* the badge is this truck's foremost point: 9 mm back, where it was before its layers grew 7 mm and the grille came 2 mm ahead (the length the team measured) */
23795
+ grille: { style: "bars", w: 1, h: 0.3, y: 2, emblemBack: 9e-3 },
23741
23796
  tl: { style: "vertical", w: 0.12, h: 0.28, y: 2.06, in: 0 },
23742
23797
  interior: { rows: 1, col: "#202224", trim: "#141516", front: "bench" },
23743
23798
  hood: { motor: "v8" },