@adatechnology/game-vehicles-fleet 11.0.0 → 11.0.1

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.
@@ -5094,6 +5094,225 @@ var GameVehiclesFleet = (() => {
5094
5094
  );
5095
5095
  }
5096
5096
 
5097
+ // ../game-vehicles/dist/index.js
5098
+ var DIVISION_HALF = 0.02;
5099
+ var GLASS_IN_FROM_EDGE = 0.03;
5100
+ var CUT_EPS = 1e-6;
5101
+ var PAST_EDGE_MIN = 0.01;
5102
+ var PANE_MIN_AREA = 0.012;
5103
+ var PANE_MIN_WIDTH = 0.15;
5104
+ function carDoorEdges(fb, rb, pillars, xr, rr) {
5105
+ const doorF = fb - 0.03;
5106
+ const pil = pillars.slice().sort((a, b) => b - a);
5107
+ const first = pil[0];
5108
+ const B = first !== void 0 && first < doorF - 0.45 && first > rb + 0.2 ? first : Math.max(rb + 0.1, doorF - 1.1);
5109
+ const rearDoor = first !== void 0 && first < doorF - 0.45 && B - Math.max(rb, xr) > 0.5;
5110
+ const second = pil[1];
5111
+ const C = rearDoor ? Math.max(second !== void 0 && second < B - 0.4 ? second : rb, xr + rr * 0.2) : B;
5112
+ return { doorF, B, C, rearDoor };
5113
+ }
5114
+ function doorGlassSplits(gh, wheels) {
5115
+ let xr = Infinity;
5116
+ let rr = 0.3;
5117
+ for (const w of wheels) {
5118
+ const x = w[0];
5119
+ const r = w[1];
5120
+ if (typeof x === "number" && x < xr) {
5121
+ xr = x;
5122
+ rr = typeof r === "number" ? r : 0.3;
5123
+ }
5124
+ }
5125
+ if (!Number.isFinite(xr)) {
5126
+ if (gh.pillars.length) return [];
5127
+ xr = -Infinity;
5128
+ }
5129
+ const edges = carDoorEdges(gh.fb, gh.rb, gh.pillars, xr, rr);
5130
+ return [{ at: edges.C + GLASS_IN_FROM_EDGE - DIVISION_HALF, front: edges.rearDoor ? edges.B : edges.doorF }];
5131
+ }
5132
+ function clipPoly(poly, at, keep) {
5133
+ const out = [];
5134
+ const inside = (p) => keep * ((p[0] ?? 0) - at) >= 0;
5135
+ for (let i = 0; i < poly.length; i++) {
5136
+ const a = poly[i];
5137
+ const b = poly[(i + 1) % poly.length];
5138
+ const ina = inside(a);
5139
+ const inb = inside(b);
5140
+ if (ina) out.push([a[0], a[1]]);
5141
+ if (ina !== inb) {
5142
+ const t = (at - a[0]) / (b[0] - a[0]);
5143
+ out.push([at, a[1] + t * (b[1] - a[1])]);
5144
+ }
5145
+ }
5146
+ return out;
5147
+ }
5148
+ function areaOf(poly) {
5149
+ let a = 0;
5150
+ for (let i = 0; i < poly.length; i++) {
5151
+ const p = poly[i];
5152
+ const q = poly[(i + 1) % poly.length];
5153
+ a += p[0] * q[1] - q[0] * p[1];
5154
+ }
5155
+ return Math.abs(a) / 2;
5156
+ }
5157
+ function widthOf(poly) {
5158
+ const xs = poly.map((p) => p[0]);
5159
+ return Math.max(...xs) - Math.min(...xs);
5160
+ }
5161
+ function splitSidePolys(polys, splits) {
5162
+ let out = polys.map((p) => p.map((q) => [...q]));
5163
+ const used = [];
5164
+ for (const { at, front: doorFront } of splits) {
5165
+ const next = [];
5166
+ let cut = false;
5167
+ for (const poly of out) {
5168
+ const xs = poly.map((p) => p[0]);
5169
+ const edge = at + DIVISION_HALF - GLASS_IN_FROM_EDGE;
5170
+ const middle = (Math.min(...xs) + Math.max(...xs)) / 2;
5171
+ if (Math.min(...xs) >= edge - PAST_EDGE_MIN || Math.max(...xs) <= edge + CUT_EPS || middle <= edge || middle >= doorFront) {
5172
+ next.push(poly);
5173
+ continue;
5174
+ }
5175
+ cut = true;
5176
+ const rear = clipPoly(poly, at - DIVISION_HALF, -1);
5177
+ const front = clipPoly(poly, at + DIVISION_HALF, 1);
5178
+ if (rear.length >= 3 && areaOf(rear) >= PANE_MIN_AREA && widthOf(rear) >= PANE_MIN_WIDTH) next.push(rear);
5179
+ if (front.length >= 3) next.push(front);
5180
+ }
5181
+ if (cut) used.push(at);
5182
+ out = next;
5183
+ }
5184
+ return { polys: out, used };
5185
+ }
5186
+ var SmokeCause = { STEAM: "steam", OIL: "oil", FIRE: "fire" };
5187
+ var SMOKE_LOOKS = {
5188
+ [SmokeCause.STEAM]: { color: 14870248, alpha: 0.18 },
5189
+ [SmokeCause.OIL]: { color: 11120306, alpha: 0.2 },
5190
+ [SmokeCause.FIRE]: { color: 2302756, alpha: 0.3 }
5191
+ };
5192
+ var CAUSE_OF_EMITTER = { white: SmokeCause.STEAM, oil: SmokeCause.OIL, black: SmokeCause.FIRE };
5193
+ var LIFT = { [SmokeCause.STEAM]: 0.5, [SmokeCause.OIL]: 0.45, [SmokeCause.FIRE]: 0.6 };
5194
+ var LID_OUTWARD = [-Math.SQRT1_2, Math.SQRT1_2, 0];
5195
+ var cabin_default = {
5196
+ 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)",
5197
+ entryDuckFactor: 0.44,
5198
+ categories: {
5199
+ passenger_car: {
5200
+ frontHeadroomMetres: 0.95,
5201
+ rearHeadroomMetres: 0.9,
5202
+ frontLegroomMetres: 0.62,
5203
+ widthMetres: 0.52,
5204
+ door: { widthMetres: 0.65, heightMetres: 0.8 }
5205
+ },
5206
+ suv_pickup: {
5207
+ frontHeadroomMetres: 0.98,
5208
+ rearHeadroomMetres: 0.93,
5209
+ frontLegroomMetres: 0.64,
5210
+ widthMetres: 0.54,
5211
+ door: { widthMetres: 0.7, heightMetres: 0.82 }
5212
+ },
5213
+ van: {
5214
+ frontHeadroomMetres: 1.05,
5215
+ rearHeadroomMetres: 1.05,
5216
+ frontLegroomMetres: 0.65,
5217
+ widthMetres: 0.54,
5218
+ door: { widthMetres: 0.75, heightMetres: 0.95 }
5219
+ },
5220
+ truck: {
5221
+ frontHeadroomMetres: 1,
5222
+ rearHeadroomMetres: 1,
5223
+ frontLegroomMetres: 0.62,
5224
+ widthMetres: 0.52,
5225
+ door: { widthMetres: 0.65, heightMetres: 0.85 }
5226
+ },
5227
+ bus: {
5228
+ frontHeadroomMetres: 1.2,
5229
+ rearHeadroomMetres: 1.2,
5230
+ frontLegroomMetres: 0.62,
5231
+ widthMetres: 0.5,
5232
+ door: { widthMetres: 0.7, heightMetres: 1.75 }
5233
+ },
5234
+ agricultural: {
5235
+ frontHeadroomMetres: 1.05,
5236
+ rearHeadroomMetres: null,
5237
+ frontLegroomMetres: 0.62,
5238
+ widthMetres: 0.52,
5239
+ door: { widthMetres: 0.65, heightMetres: 0.9 }
5240
+ },
5241
+ military_light: {
5242
+ frontHeadroomMetres: 0.95,
5243
+ rearHeadroomMetres: 0.92,
5244
+ frontLegroomMetres: 0.62,
5245
+ widthMetres: 0.5,
5246
+ door: { widthMetres: 0.6, heightMetres: 0.8 }
5247
+ },
5248
+ military_armored: {
5249
+ frontHeadroomMetres: 0.88,
5250
+ rearHeadroomMetres: 0.88,
5251
+ frontLegroomMetres: 0.58,
5252
+ widthMetres: 0.46,
5253
+ door: { widthMetres: 0.5, heightMetres: 0.55 }
5254
+ },
5255
+ open_vehicle: {
5256
+ frontHeadroomMetres: null,
5257
+ rearHeadroomMetres: null,
5258
+ frontLegroomMetres: null,
5259
+ widthMetres: null,
5260
+ door: null
5261
+ },
5262
+ boat_cabin: {
5263
+ frontHeadroomMetres: 1.05,
5264
+ rearHeadroomMetres: 1.05,
5265
+ frontLegroomMetres: 0.62,
5266
+ widthMetres: 0.52,
5267
+ door: { widthMetres: 0.6, heightMetres: 0.9 }
5268
+ },
5269
+ aircraft_enclosed: {
5270
+ frontHeadroomMetres: 0.95,
5271
+ rearHeadroomMetres: 0.92,
5272
+ frontLegroomMetres: 0.62,
5273
+ widthMetres: 0.48,
5274
+ door: { widthMetres: 0.55, heightMetres: 0.8 }
5275
+ }
5276
+ }
5277
+ };
5278
+ var CABIN_CATEGORIES = [
5279
+ "passenger_car",
5280
+ "suv_pickup",
5281
+ "van",
5282
+ "truck",
5283
+ "bus",
5284
+ "agricultural",
5285
+ "military_light",
5286
+ "military_armored",
5287
+ "open_vehicle",
5288
+ "boat_cabin",
5289
+ "aircraft_enclosed"
5290
+ ];
5291
+ var toClearance = (value) => value === null ? Number.POSITIVE_INFINITY : value;
5292
+ var toCabinMinimum = (category, raw) => {
5293
+ if (category === "open_vehicle") {
5294
+ return {
5295
+ frontHeadroomMetres: Number.POSITIVE_INFINITY,
5296
+ rearHeadroomMetres: Number.POSITIVE_INFINITY,
5297
+ frontLegroomMetres: Number.POSITIVE_INFINITY,
5298
+ widthMetres: Number.POSITIVE_INFINITY,
5299
+ door: void 0
5300
+ };
5301
+ }
5302
+ return {
5303
+ frontHeadroomMetres: toClearance(raw.frontHeadroomMetres),
5304
+ rearHeadroomMetres: raw.rearHeadroomMetres === null ? void 0 : raw.rearHeadroomMetres,
5305
+ frontLegroomMetres: toClearance(raw.frontLegroomMetres),
5306
+ widthMetres: toClearance(raw.widthMetres),
5307
+ door: raw.door === null ? void 0 : { widthMetres: raw.door.widthMetres, heightMetres: raw.door.heightMetres }
5308
+ };
5309
+ };
5310
+ var CABIN_SOURCE = cabin_default.source;
5311
+ var ENTRY_DUCK_FACTOR = cabin_default.entryDuckFactor;
5312
+ var CABIN_MINIMUMS = Object.fromEntries(
5313
+ CABIN_CATEGORIES.map((category) => [category, toCabinMinimum(category, cabin_default.categories[category])])
5314
+ );
5315
+
5097
5316
  // src/vehicles/moving-parts.ts
5098
5317
  var WIPER_SWEEP = 1.5;
5099
5318
  function tagWiper(params) {
@@ -5780,6 +5999,7 @@ var GameVehiclesFleet = (() => {
5780
5999
  };
5781
6000
  return K;
5782
6001
  }
6002
+ const glassDivisions = /* @__PURE__ */ new WeakMap();
5783
6003
  function car(c, s) {
5784
6004
  const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
5785
6005
  m.color = s.col;
@@ -5814,6 +6034,9 @@ var GameVehiclesFleet = (() => {
5814
6034
  let polys = windows(gh);
5815
6035
  if (s.dropRear) polys = polys.slice(1);
5816
6036
  if (gh.polys) polys = gh.polys(polys);
6037
+ const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
6038
+ polys = divided.polys;
6039
+ glassDivisions.set(c, divided.used);
5817
6040
  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 });
5818
6041
  const gHoles = [];
5819
6042
  if (intr) {
@@ -5973,11 +6196,12 @@ var GameVehiclesFleet = (() => {
5973
6196
  K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
5974
6197
  const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
5975
6198
  [1, -1].forEach(function(sd) {
5976
- ;
5977
- (s.blackPillars || []).forEach(function(px) {
6199
+ const bar = function(px, width) {
5978
6200
  const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
5979
- 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;
5980
- });
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;
6202
+ };
6203
+ (s.blackPillars || []).forEach((px) => bar(px, 0.118));
6204
+ (glassDivisions.get(c) ?? []).forEach((px) => bar(px, 2 * DIVISION_HALF - 2e-3));
5981
6205
  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;
5982
6206
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
5983
6207
  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 } });
@@ -7704,7 +7928,7 @@ var GameVehiclesFleet = (() => {
7704
7928
  frameR: 9e-3
7705
7929
  });
7706
7930
  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);
7707
- kit.emblem(c2, e.p.x + 0.025, 0.67, 0, 0.045);
7931
+ kit.emblem(c2, e.p.x + 0.018, 0.67, 0, 0.045);
7708
7932
  const bg = c2.meta.frontBumper.userData.grid;
7709
7933
  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 }));
7710
7934
  },
@@ -14874,6 +15098,7 @@ var GameVehiclesFleet = (() => {
14874
15098
  };
14875
15099
  return K;
14876
15100
  }
15101
+ const glassDivisions = /* @__PURE__ */ new WeakMap();
14877
15102
  function car(c, s) {
14878
15103
  const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
14879
15104
  m.color = s.col;
@@ -14907,6 +15132,9 @@ var GameVehiclesFleet = (() => {
14907
15132
  ghItems.push([gh.ft, gh.roof, gh.r2 || 0.2], [gh.fb, gh.belt - 0.1, 0]);
14908
15133
  let polys = windows(gh);
14909
15134
  if (s.dropRear) polys = polys.slice(1);
15135
+ const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
15136
+ polys = divided.polys;
15137
+ glassDivisions.set(c, divided.used);
14910
15138
  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);
14911
15139
  const gHoles = [];
14912
15140
  if (intr) {
@@ -15059,11 +15287,12 @@ var GameVehiclesFleet = (() => {
15059
15287
  K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
15060
15288
  const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
15061
15289
  [1, -1].forEach(function(sd) {
15062
- ;
15063
- (s.blackPillars || []).forEach(function(px) {
15290
+ const bar = function(px, width) {
15064
15291
  const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
15065
- 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;
15066
- });
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;
15293
+ };
15294
+ (s.blackPillars || []).forEach((px) => bar(px, 0.118));
15295
+ (glassDivisions.get(c) ?? []).forEach((px) => bar(px, 2 * DIVISION_HALF - 2e-3));
15067
15296
  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;
15068
15297
  c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
15069
15298
  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 } });
@@ -18713,8 +18942,8 @@ var GameVehiclesFleet = (() => {
18713
18942
  return b;
18714
18943
  }
18715
18944
  function plateMoto(c, x, y, txt) {
18716
- c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 9e-3, y, 0);
18717
- c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 3e-3, y, 0, "-x", {
18945
+ c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 7e-3, y, 0);
18946
+ c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 5e-3, y, 0, "-x", {
18718
18947
  w: 300,
18719
18948
  h: 220,
18720
18949
  bg: "#f2f2ee",
@@ -18828,8 +19057,8 @@ var GameVehiclesFleet = (() => {
18828
19057
  d.position.z = s * hw * 0.72;
18829
19058
  g.add(d);
18830
19059
  for (let q = 0; q < 12; q++) {
18831
- 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 }));
18832
- sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.0105));
19060
+ 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 }));
19061
+ sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.013));
18833
19062
  sl.rotation.z = a2;
18834
19063
  g.add(sl);
18835
19064
  }
@@ -23803,7 +24032,8 @@ var GameVehiclesFleet = (() => {
23803
24032
  tailLightY: 2.06,
23804
24033
  noAntenna: true,
23805
24034
  hl: { style: "round", w: 0.2, h: 0.2, y: 2.03, in: 0.12, yaw: 0 },
23806
- grille: { style: "bars", w: 1, h: 0.3, y: 2 },
24035
+ /* 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) */
24036
+ grille: { style: "bars", w: 1, h: 0.3, y: 2, emblemBack: 9e-3 },
23807
24037
  tl: { style: "vertical", w: 0.12, h: 0.28, y: 2.06, in: 0 },
23808
24038
  interior: { rows: 1, col: "#202224", trim: "#141516", front: "bench" },
23809
24039
  hood: { motor: "v8" },