@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.
package/dist/index.js CHANGED
@@ -5029,7 +5029,7 @@ function installBoatsExtra(fx) {
5029
5029
  }
5030
5030
 
5031
5031
  // src/vehicles/cars-extra.ts
5032
- import { DIVISION_HALF, doorGlassSplits, splitSidePolys } from "@adatechnology/game-vehicles";
5032
+ import { DIVISION_HALF, doorEdgesOf, doorGlassSplits, seamOnDoorEdge, splitSidePolys } from "@adatechnology/game-vehicles";
5033
5033
 
5034
5034
  // src/vehicles/moving-parts.ts
5035
5035
  var WIPER_SWEEP = 1.5;
@@ -5820,6 +5820,8 @@ function installCarsExtra(fx) {
5820
5820
  rb: gh.rb,
5821
5821
  rt: gh.rt,
5822
5822
  roof: gh.roof + 0.02,
5823
+ roofRear: (gh.roofR || gh.roof) + 0.02,
5824
+ roofCrown: gh.crown || 0,
5823
5825
  belt: gh.belt,
5824
5826
  floor: s.bottomY + 0.02,
5825
5827
  seatH: 0.12,
@@ -5916,18 +5918,23 @@ function installCarsExtra(fx) {
5916
5918
  [1, -1].forEach(function(sd) {
5917
5919
  const bar = function(px, width) {
5918
5920
  const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
5919
- 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;
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;
5920
5924
  };
5921
5925
  (s.blackPillars || []).forEach((px) => bar(px, 0.118));
5922
- (glassDivisions.get(c) ?? []).forEach((px) => bar(px, 2 * DIVISION_HALF - 2e-3));
5926
+ (glassDivisions.get(c) ?? []).forEach((px) => {
5927
+ bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
5928
+ });
5923
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;
5924
5930
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
5925
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 } });
5926
5932
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
5927
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 ?? []);
5928
5935
  (s.seams || []).forEach(function(q) {
5929
- 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;
5930
- 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);
5931
5938
  });
5932
5939
  (s.handles || []).forEach(function(x) {
5933
5940
  c.roundBox(
@@ -6082,6 +6089,18 @@ function installCarsExtra(fx) {
6082
6089
  c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
6083
6090
  c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
6084
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
+ }
6085
6104
  function sm(t) {
6086
6105
  t = clamp(t, 0, 1);
6087
6106
  return t * t * (3 - 2 * t);
@@ -6669,7 +6688,8 @@ function installCarsExtra(fx) {
6669
6688
  [1.75, 0.8],
6670
6689
  [0.6, 0.82],
6671
6690
  [-0.6, 0.835],
6672
- [-1.82, 0.85]
6691
+ // it ends where the taillight wraps onto the side, never running into the lamp
6692
+ [-1.6, 0.845]
6673
6693
  ],
6674
6694
  { col: hex, h: 0.024 }
6675
6695
  );
@@ -14045,7 +14065,7 @@ function installMilitary(fx) {
14045
14065
  }
14046
14066
 
14047
14067
  // src/vehicles/motorcycles-cars.ts
14048
- import { DIVISION_HALF as DIVISION_HALF2, doorGlassSplits as doorGlassSplits2, splitSidePolys as splitSidePolys2 } from "@adatechnology/game-vehicles";
14068
+ import { DIVISION_HALF as DIVISION_HALF2, doorEdgesOf as doorEdgesOf2, doorGlassSplits as doorGlassSplits2, seamOnDoorEdge as seamOnDoorEdge2, splitSidePolys as splitSidePolys2 } from "@adatechnology/game-vehicles";
14049
14069
  function installMotorcyclesCars(fx) {
14050
14070
  const kit = fx.kit;
14051
14071
  const THREE = kit.THREE;
@@ -14914,6 +14934,8 @@ function installMotorcyclesCars(fx) {
14914
14934
  rb: gh.rb,
14915
14935
  rt: gh.rt,
14916
14936
  roof: gh.roof + 0.02,
14937
+ roofRear: (gh.roofR || gh.roof) + 0.02,
14938
+ roofCrown: gh.crown || 0,
14917
14939
  belt: gh.belt,
14918
14940
  floor: s.bottomY + 0.02,
14919
14941
  seatH: 0.12,
@@ -15008,17 +15030,23 @@ function installMotorcyclesCars(fx) {
15008
15030
  [1, -1].forEach(function(sd) {
15009
15031
  const bar = function(px, width) {
15010
15032
  const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
15011
- 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;
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;
15012
15036
  };
15013
15037
  (s.blackPillars || []).forEach((px) => bar(px, 0.118));
15014
- (glassDivisions.get(c) ?? []).forEach((px) => bar(px, 2 * DIVISION_HALF2 - 2e-3));
15038
+ (glassDivisions.get(c) ?? []).forEach((px) => {
15039
+ bar(px, 2 * DIVISION_HALF2 - 2e-3).userData.doorChannel = true;
15040
+ });
15015
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;
15016
15042
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
15017
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 } });
15018
15044
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
15019
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));
15020
- (s.seams || []).forEach(function(x) {
15021
- 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);
15022
15050
  });
15023
15051
  (s.handles || []).forEach(function(x) {
15024
15052
  c.roundBox(
@@ -15160,6 +15188,18 @@ function installMotorcyclesCars(fx) {
15160
15188
  c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
15161
15189
  c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
15162
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
+ }
15163
15203
  function sm(t) {
15164
15204
  t = clamp(t, 0, 1);
15165
15205
  return t * t * (3 - 2 * t);