@adatechnology/game-urban-three 0.3.2 → 0.3.4

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.
@@ -16427,6 +16427,18 @@ gl_Position = projectionMatrix * mvPosition;
16427
16427
  }
16428
16428
  );
16429
16429
  }
16430
+ var WIPER_SWEEP = 1.5;
16431
+ function tagWiper(params) {
16432
+ var _a;
16433
+ const tag = { arm: params.index, sweep: WIPER_SWEEP, spindle: [params.spindle.x, params.spindle.y, params.spindle.z], axis: [params.normal.x, params.normal.y, params.normal.z] };
16434
+ (_a = params.context).wipers ?? (_a.wipers = []);
16435
+ for (const part of params.parts) params.context.wipers.push({ part, tag });
16436
+ }
16437
+ function markSunroof(pane2, slide) {
16438
+ pane2.name = "sunroof";
16439
+ pane2.userData.sunroof = { slide };
16440
+ return pane2;
16441
+ }
16430
16442
  function installCarsExtra(fx) {
16431
16443
  const kit = fx.kit;
16432
16444
  const THREE = kit.THREE;
@@ -16923,7 +16935,7 @@ gl_Position = projectionMatrix * mvPosition;
16923
16935
  off: 3e-3,
16924
16936
  nv: 4
16925
16937
  });
16926
- skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
16938
+ const reflector = skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
16927
16939
  (o.proj || []).forEach(function(q) {
16928
16940
  const r = sh(q[0]), y = (r[0] + r[1]) / 2 + (q[1] || 0), s = Gd.at(q[0], y), rad = q[2] || Math.min(0.034, (r[1] - r[0]) * 0.4);
16929
16941
  const cup = onSurf(c.cylinder(rad * 1.35, rad * 1.2, 0.012, LH, 0, 0, 0), s, 8e-3);
@@ -16954,7 +16966,7 @@ gl_Position = projectionMatrix * mvPosition;
16954
16966
  lens.push(ln);
16955
16967
  if (!inner2.length) inner2.push(ln);
16956
16968
  const cs = Gd.at(0.5, (rg[0] + rg[1]) / 2).p;
16957
- regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner2, lens, cs);
16969
+ Object.assign(regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner2, lens, cs), { reflector: [reflector] });
16958
16970
  return Gd;
16959
16971
  };
16960
16972
  K.tail = function(sd, o) {
@@ -17340,12 +17352,18 @@ gl_Position = projectionMatrix * mvPosition;
17340
17352
  (s.wiper === 1 ? [[0.12, 0.66, -0.5]] : [
17341
17353
  [-0.3, 0.42, -0.36],
17342
17354
  [0.2, 0.42, -0.36]
17343
- ]).forEach(function(q) {
17355
+ ]).forEach(function(q, index) {
17344
17356
  const p0 = new V3(gh.fb, gh.belt, q[0]).addScaledVector(wd, 0.07).addScaledVector(wn, 0.035), p1 = p0.clone().addScaledVector(wd, q[1] * 0.42);
17345
17357
  p1.z += q[2];
17346
- c.rod(p0, p1, 9e-3, MT.trim);
17347
- c.cylinder(0.018, 0.018, 0.03, MT.trim, p0.x, p0.y, p0.z);
17358
+ const blade2 = c.rod(p0, p1, 9e-3, MT.trim);
17359
+ const cap = c.cylinder(0.018, 0.018, 0.03, MT.trim, p0.x, p0.y, p0.z);
17360
+ tagWiper({ context: c, parts: [blade2, cap], spindle: p0, normal: wn, index });
17348
17361
  });
17362
+ if (s.sunroof) {
17363
+ const sx = gh.rt + (gh.ft - gh.rt) * 0.62, sl = 0.62, sw = 2 * (halfAt(gh.Wg, T, gh.roof) - 0.24), sy = roofAt(gh, sx), tilt = Math.atan2(roofAt(gh, sx + 0.3) - roofAt(gh, sx - 0.3), 0.6);
17364
+ c.roundBox(sl, 8e-3, sw, 0.01, PLASTIC, sx, sy + 4e-3, 0, { rot: [0, 0, tilt] }).castShadow = false;
17365
+ markSunroof(c.roundBox(sl + 0.03, 0.012, sw + 0.03, 0.01, MT.tint, sx, sy + 0.013, 0, { rot: [0, 0, tilt] }), sl * 0.85);
17366
+ }
17349
17367
  if (s.fin !== false)
17350
17368
  c.sphere(0.1, s.roofCol ? c.paint(s.roofCol) : GLOSS, gh.rt + 0.2, roofAt(gh, gh.rt + 0.2) + 0.045, 0, 1, 0.45, 0.28, {
17351
17369
  tl: PI / 2
@@ -18321,6 +18339,7 @@ gl_Position = projectionMatrix * mvPosition;
18321
18339
  function(c) {
18322
18340
  const hex = "#8c2b2b";
18323
18341
  car(c, {
18342
+ sunroof: fx.hasSunroof("turbo_hatch"),
18324
18343
  W: 1.751,
18325
18344
  col: hex,
18326
18345
  shelf: 0.42,
@@ -18598,6 +18617,7 @@ gl_Position = projectionMatrix * mvPosition;
18598
18617
  function(c) {
18599
18618
  const hex = "#5a5f66";
18600
18619
  car(c, {
18620
+ sunroof: fx.hasSunroof("fastback_sedan"),
18601
18621
  W: 1.799,
18602
18622
  col: hex,
18603
18623
  bottomY: 0.2,
@@ -18892,6 +18912,8 @@ gl_Position = projectionMatrix * mvPosition;
18892
18912
  fx.register(
18893
18913
  {
18894
18914
  key: "classic_six_sedan",
18915
+ // glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
18916
+ headlightLens: "glass",
18895
18917
  group: "cars",
18896
18918
  name: trl("vehicles.classic_six_sedan.name"),
18897
18919
  inspired: trl("vehicles.classic_six_sedan.inspired"),
@@ -26347,8 +26369,11 @@ gl_Position = projectionMatrix * mvPosition;
26347
26369
  );
26348
26370
  });
26349
26371
  const wy = gh.belt + 0.06, wx = gh.fb - 0.03;
26350
- [-0.3, 0.2].forEach(function(z) {
26351
- c.rod(new V3(wx + 0.02, wy, z + 0.02), new V3(wx - 0.13, wy + 0.13, z - 0.36), 9e-3, MT.trim);
26372
+ [-0.3, 0.2].forEach(function(z, index) {
26373
+ const spindle = new V3(wx + 0.02, wy, z + 0.02);
26374
+ const blade2 = c.rod(spindle, new V3(wx - 0.13, wy + 0.13, z - 0.36), 9e-3, MT.trim);
26375
+ const along = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize();
26376
+ tagWiper({ context: c, parts: [blade2], spindle, normal: new V3(along.y, -along.x, 0), index });
26352
26377
  });
26353
26378
  if (s.fin !== false)
26354
26379
  c.sphere(0.1, s.roofCol ? c.paint(s.roofCol) : GLOSS, gh.rt + 0.2, roofAt(gh, gh.rt + 0.2) + 0.045, 0, 1, 0.45, 0.28, {
@@ -29424,6 +29449,8 @@ gl_Position = projectionMatrix * mvPosition;
29424
29449
  fx.register(
29425
29450
  {
29426
29451
  key: "beetle",
29452
+ // glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
29453
+ headlightLens: "glass",
29427
29454
  group: "cars",
29428
29455
  name: trl("vehicles.beetle.name"),
29429
29456
  inspired: trl("vehicles.beetle.inspired"),
@@ -38625,6 +38652,7 @@ gl_Position = projectionMatrix * mvPosition;
38625
38652
  shared: shared2,
38626
38653
  t,
38627
38654
  label: (key) => ({ key, label: t("labels." + key) }),
38655
+ hasSunroof: (key) => !!options.sunroofs?.includes(key),
38628
38656
  register(spec, build) {
38629
38657
  if (!groups.has(spec.group) || only && !only.has(spec.key) || skip.has(spec.key)) return;
38630
38658
  kit.register({ ...spec, seedKey: legacyVehicleSeeds[spec.key] }, build);