@adatechnology/game-urban 0.7.4 → 0.7.6
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.global.js +388 -63
- package/dist/index.global.js.map +1 -1
- package/package.json +4 -4
package/dist/index.global.js
CHANGED
|
@@ -4543,6 +4543,262 @@ var GameUrban = (() => {
|
|
|
4543
4543
|
return { ...core, poles, cities, builder, neighbourhoods, terrain, drawTerrain, towers: { enabled: towers !== null, options: towers } };
|
|
4544
4544
|
}
|
|
4545
4545
|
|
|
4546
|
+
// ../game-vehicles/dist/index.js
|
|
4547
|
+
var SHUT_LINE_RADIUS = 2e-3;
|
|
4548
|
+
var SHUT_LINE_LIFT = 8e-4;
|
|
4549
|
+
var SHUT_LINE_STEPS = 36;
|
|
4550
|
+
var SHUT_LINE_STRAY = 0.04;
|
|
4551
|
+
function shutLinePoints(hit, x, y0, y1) {
|
|
4552
|
+
const out = [];
|
|
4553
|
+
for (let k = 0; k <= SHUT_LINE_STEPS; k++) {
|
|
4554
|
+
const h = hit(x, y0 + (y1 - y0) * k / SHUT_LINE_STEPS);
|
|
4555
|
+
if (h) out.push([h.p.x + h.n.x * SHUT_LINE_LIFT, h.p.y + h.n.y * SHUT_LINE_LIFT, h.p.z + h.n.z * SHUT_LINE_LIFT]);
|
|
4556
|
+
}
|
|
4557
|
+
if (out.length < 3) return out;
|
|
4558
|
+
const depths = out.map((q) => q[2]).sort((a, b) => a - b);
|
|
4559
|
+
const median = depths[Math.floor(depths.length / 2)];
|
|
4560
|
+
return out.filter((q) => Math.abs(q[2] - median) < SHUT_LINE_STRAY);
|
|
4561
|
+
}
|
|
4562
|
+
var FINISH_DETAIL = "finishDetail";
|
|
4563
|
+
function markFinishDetail(object) {
|
|
4564
|
+
object.userData[FINISH_DETAIL] = true;
|
|
4565
|
+
return object;
|
|
4566
|
+
}
|
|
4567
|
+
var DIVISION_HALF = 0.02;
|
|
4568
|
+
var GLASS_IN_FROM_EDGE = 0.03;
|
|
4569
|
+
var CUT_EPS = 1e-6;
|
|
4570
|
+
var PAST_EDGE_MIN = 0.01;
|
|
4571
|
+
var PANE_MIN_AREA = 8e-3;
|
|
4572
|
+
var PANE_MIN_WIDTH = 0.12;
|
|
4573
|
+
function carDoorEdges(fb, rb, pillars, xr, rr) {
|
|
4574
|
+
const doorF = fb - 0.03;
|
|
4575
|
+
const pil = pillars.slice().sort((a, b) => b - a);
|
|
4576
|
+
const first = pil[0];
|
|
4577
|
+
const B = first !== void 0 && first < doorF - 0.45 && first > rb + 0.2 ? first : Math.max(rb + 0.1, doorF - 1.1);
|
|
4578
|
+
const rearDoor = first !== void 0 && first < doorF - 0.45 && B - Math.max(rb, xr) > 0.5;
|
|
4579
|
+
const second = pil[1];
|
|
4580
|
+
const C = rearDoor ? Math.max(second !== void 0 && second < B - 0.4 ? second : rb, xr + rr * 0.2) : B;
|
|
4581
|
+
return { doorF, B, C, rearDoor };
|
|
4582
|
+
}
|
|
4583
|
+
function doorEdgesOf(gh, wheels) {
|
|
4584
|
+
let xr = Infinity;
|
|
4585
|
+
let rr = 0.3;
|
|
4586
|
+
for (const w of wheels) {
|
|
4587
|
+
const x = w[0];
|
|
4588
|
+
const r = w[1];
|
|
4589
|
+
if (typeof x === "number" && x < xr) {
|
|
4590
|
+
xr = x;
|
|
4591
|
+
rr = typeof r === "number" ? r : 0.3;
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
4594
|
+
if (!Number.isFinite(xr)) {
|
|
4595
|
+
if (gh.pillars.length) return null;
|
|
4596
|
+
xr = -Infinity;
|
|
4597
|
+
}
|
|
4598
|
+
return carDoorEdges(gh.fb, gh.rb, gh.pillars, xr, rr);
|
|
4599
|
+
}
|
|
4600
|
+
var SEAM_SNAP = 0.1;
|
|
4601
|
+
var SEAM_INSIDE = 4e-3;
|
|
4602
|
+
function seamOnDoorEdge(x, edges) {
|
|
4603
|
+
if (!edges) return x;
|
|
4604
|
+
let best = x;
|
|
4605
|
+
let gap = SEAM_SNAP;
|
|
4606
|
+
const lines = [edges.doorF - SEAM_INSIDE, edges.B, edges.C === edges.B ? edges.C : edges.C + SEAM_INSIDE];
|
|
4607
|
+
for (let i = 0; i < lines.length; i++) {
|
|
4608
|
+
const d = Math.abs([edges.doorF, edges.B, edges.C][i] - x);
|
|
4609
|
+
if (d <= gap) [best, gap] = [lines[i], d];
|
|
4610
|
+
}
|
|
4611
|
+
return best;
|
|
4612
|
+
}
|
|
4613
|
+
function doorGlassSplits(gh, wheels) {
|
|
4614
|
+
const edges = doorEdgesOf(gh, wheels);
|
|
4615
|
+
if (!edges) return [];
|
|
4616
|
+
return [{ at: edges.C + GLASS_IN_FROM_EDGE - DIVISION_HALF, front: edges.rearDoor ? edges.B : edges.doorF }];
|
|
4617
|
+
}
|
|
4618
|
+
function clipPoly(poly, at, keep) {
|
|
4619
|
+
const out = [];
|
|
4620
|
+
const inside = (p) => keep * ((p[0] ?? 0) - at) >= 0;
|
|
4621
|
+
for (let i = 0; i < poly.length; i++) {
|
|
4622
|
+
const a = poly[i];
|
|
4623
|
+
const b = poly[(i + 1) % poly.length];
|
|
4624
|
+
const ina = inside(a);
|
|
4625
|
+
const inb = inside(b);
|
|
4626
|
+
if (ina) out.push([a[0], a[1]]);
|
|
4627
|
+
if (ina !== inb) {
|
|
4628
|
+
const t = (at - a[0]) / (b[0] - a[0]);
|
|
4629
|
+
out.push([at, a[1] + t * (b[1] - a[1])]);
|
|
4630
|
+
}
|
|
4631
|
+
}
|
|
4632
|
+
return out;
|
|
4633
|
+
}
|
|
4634
|
+
function areaOf2(poly) {
|
|
4635
|
+
let a = 0;
|
|
4636
|
+
for (let i = 0; i < poly.length; i++) {
|
|
4637
|
+
const p = poly[i];
|
|
4638
|
+
const q = poly[(i + 1) % poly.length];
|
|
4639
|
+
a += p[0] * q[1] - q[0] * p[1];
|
|
4640
|
+
}
|
|
4641
|
+
return Math.abs(a) / 2;
|
|
4642
|
+
}
|
|
4643
|
+
function widthOf(poly) {
|
|
4644
|
+
const xs = poly.map((p) => p[0]);
|
|
4645
|
+
return Math.max(...xs) - Math.min(...xs);
|
|
4646
|
+
}
|
|
4647
|
+
function splitSidePolys(polys, splits) {
|
|
4648
|
+
let out = polys.map((p) => p.map((q) => [...q]));
|
|
4649
|
+
const used = [];
|
|
4650
|
+
for (const { at, front: doorFront } of splits) {
|
|
4651
|
+
const next = [];
|
|
4652
|
+
let cut = false;
|
|
4653
|
+
for (const poly of out) {
|
|
4654
|
+
const xs = poly.map((p) => p[0]);
|
|
4655
|
+
const edge = at + DIVISION_HALF - GLASS_IN_FROM_EDGE;
|
|
4656
|
+
const middle = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
4657
|
+
if (Math.min(...xs) >= edge - PAST_EDGE_MIN || Math.max(...xs) <= edge + CUT_EPS || middle <= edge || middle >= doorFront) {
|
|
4658
|
+
next.push(poly);
|
|
4659
|
+
continue;
|
|
4660
|
+
}
|
|
4661
|
+
cut = true;
|
|
4662
|
+
const rear = clipPoly(poly, at - DIVISION_HALF, -1);
|
|
4663
|
+
const front = clipPoly(poly, at + DIVISION_HALF, 1);
|
|
4664
|
+
if (rear.length >= 3 && areaOf2(rear) >= PANE_MIN_AREA && widthOf(rear) >= PANE_MIN_WIDTH) next.push(rear);
|
|
4665
|
+
if (front.length >= 3) next.push(front);
|
|
4666
|
+
}
|
|
4667
|
+
if (cut) used.push(at);
|
|
4668
|
+
out = next;
|
|
4669
|
+
}
|
|
4670
|
+
return { polys: out, used };
|
|
4671
|
+
}
|
|
4672
|
+
var SmokeCause = { STEAM: "steam", OIL: "oil", FIRE: "fire" };
|
|
4673
|
+
var SMOKE_LOOKS = {
|
|
4674
|
+
[SmokeCause.STEAM]: { color: 14870248, alpha: 0.18 },
|
|
4675
|
+
[SmokeCause.OIL]: { color: 11120306, alpha: 0.2 },
|
|
4676
|
+
[SmokeCause.FIRE]: { color: 2302756, alpha: 0.3 }
|
|
4677
|
+
};
|
|
4678
|
+
var CAUSE_OF_EMITTER = { white: SmokeCause.STEAM, oil: SmokeCause.OIL, black: SmokeCause.FIRE };
|
|
4679
|
+
var LIFT = { [SmokeCause.STEAM]: 0.5, [SmokeCause.OIL]: 0.45, [SmokeCause.FIRE]: 0.6 };
|
|
4680
|
+
var LID_OUTWARD = [-Math.SQRT1_2, Math.SQRT1_2, 0];
|
|
4681
|
+
var cabin_default = {
|
|
4682
|
+
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)",
|
|
4683
|
+
entryDuckFactor: 0.44,
|
|
4684
|
+
categories: {
|
|
4685
|
+
passenger_car: {
|
|
4686
|
+
frontHeadroomMetres: 0.95,
|
|
4687
|
+
rearHeadroomMetres: 0.9,
|
|
4688
|
+
frontLegroomMetres: 0.62,
|
|
4689
|
+
widthMetres: 0.52,
|
|
4690
|
+
door: { widthMetres: 0.65, heightMetres: 0.8 }
|
|
4691
|
+
},
|
|
4692
|
+
suv_pickup: {
|
|
4693
|
+
frontHeadroomMetres: 0.98,
|
|
4694
|
+
rearHeadroomMetres: 0.93,
|
|
4695
|
+
frontLegroomMetres: 0.64,
|
|
4696
|
+
widthMetres: 0.54,
|
|
4697
|
+
door: { widthMetres: 0.7, heightMetres: 0.82 }
|
|
4698
|
+
},
|
|
4699
|
+
van: {
|
|
4700
|
+
frontHeadroomMetres: 1.05,
|
|
4701
|
+
rearHeadroomMetres: 1.05,
|
|
4702
|
+
frontLegroomMetres: 0.65,
|
|
4703
|
+
widthMetres: 0.54,
|
|
4704
|
+
door: { widthMetres: 0.75, heightMetres: 0.95 }
|
|
4705
|
+
},
|
|
4706
|
+
truck: {
|
|
4707
|
+
frontHeadroomMetres: 1,
|
|
4708
|
+
rearHeadroomMetres: 1,
|
|
4709
|
+
frontLegroomMetres: 0.62,
|
|
4710
|
+
widthMetres: 0.52,
|
|
4711
|
+
door: { widthMetres: 0.65, heightMetres: 0.85 }
|
|
4712
|
+
},
|
|
4713
|
+
bus: {
|
|
4714
|
+
frontHeadroomMetres: 1.2,
|
|
4715
|
+
rearHeadroomMetres: 1.2,
|
|
4716
|
+
frontLegroomMetres: 0.62,
|
|
4717
|
+
widthMetres: 0.5,
|
|
4718
|
+
door: { widthMetres: 0.7, heightMetres: 1.75 }
|
|
4719
|
+
},
|
|
4720
|
+
agricultural: {
|
|
4721
|
+
frontHeadroomMetres: 1.05,
|
|
4722
|
+
rearHeadroomMetres: null,
|
|
4723
|
+
frontLegroomMetres: 0.62,
|
|
4724
|
+
widthMetres: 0.52,
|
|
4725
|
+
door: { widthMetres: 0.65, heightMetres: 0.9 }
|
|
4726
|
+
},
|
|
4727
|
+
military_light: {
|
|
4728
|
+
frontHeadroomMetres: 0.95,
|
|
4729
|
+
rearHeadroomMetres: 0.92,
|
|
4730
|
+
frontLegroomMetres: 0.62,
|
|
4731
|
+
widthMetres: 0.5,
|
|
4732
|
+
door: { widthMetres: 0.6, heightMetres: 0.8 }
|
|
4733
|
+
},
|
|
4734
|
+
military_armored: {
|
|
4735
|
+
frontHeadroomMetres: 0.88,
|
|
4736
|
+
rearHeadroomMetres: 0.88,
|
|
4737
|
+
frontLegroomMetres: 0.58,
|
|
4738
|
+
widthMetres: 0.46,
|
|
4739
|
+
door: { widthMetres: 0.5, heightMetres: 0.55 }
|
|
4740
|
+
},
|
|
4741
|
+
open_vehicle: {
|
|
4742
|
+
frontHeadroomMetres: null,
|
|
4743
|
+
rearHeadroomMetres: null,
|
|
4744
|
+
frontLegroomMetres: null,
|
|
4745
|
+
widthMetres: null,
|
|
4746
|
+
door: null
|
|
4747
|
+
},
|
|
4748
|
+
boat_cabin: {
|
|
4749
|
+
frontHeadroomMetres: 1.05,
|
|
4750
|
+
rearHeadroomMetres: 1.05,
|
|
4751
|
+
frontLegroomMetres: 0.62,
|
|
4752
|
+
widthMetres: 0.52,
|
|
4753
|
+
door: { widthMetres: 0.6, heightMetres: 0.9 }
|
|
4754
|
+
},
|
|
4755
|
+
aircraft_enclosed: {
|
|
4756
|
+
frontHeadroomMetres: 0.95,
|
|
4757
|
+
rearHeadroomMetres: 0.92,
|
|
4758
|
+
frontLegroomMetres: 0.62,
|
|
4759
|
+
widthMetres: 0.48,
|
|
4760
|
+
door: { widthMetres: 0.55, heightMetres: 0.8 }
|
|
4761
|
+
}
|
|
4762
|
+
}
|
|
4763
|
+
};
|
|
4764
|
+
var CABIN_CATEGORIES = [
|
|
4765
|
+
"passenger_car",
|
|
4766
|
+
"suv_pickup",
|
|
4767
|
+
"van",
|
|
4768
|
+
"truck",
|
|
4769
|
+
"bus",
|
|
4770
|
+
"agricultural",
|
|
4771
|
+
"military_light",
|
|
4772
|
+
"military_armored",
|
|
4773
|
+
"open_vehicle",
|
|
4774
|
+
"boat_cabin",
|
|
4775
|
+
"aircraft_enclosed"
|
|
4776
|
+
];
|
|
4777
|
+
var toClearance = (value) => value === null ? Number.POSITIVE_INFINITY : value;
|
|
4778
|
+
var toCabinMinimum = (category, raw) => {
|
|
4779
|
+
if (category === "open_vehicle") {
|
|
4780
|
+
return {
|
|
4781
|
+
frontHeadroomMetres: Number.POSITIVE_INFINITY,
|
|
4782
|
+
rearHeadroomMetres: Number.POSITIVE_INFINITY,
|
|
4783
|
+
frontLegroomMetres: Number.POSITIVE_INFINITY,
|
|
4784
|
+
widthMetres: Number.POSITIVE_INFINITY,
|
|
4785
|
+
door: void 0
|
|
4786
|
+
};
|
|
4787
|
+
}
|
|
4788
|
+
return {
|
|
4789
|
+
frontHeadroomMetres: toClearance(raw.frontHeadroomMetres),
|
|
4790
|
+
rearHeadroomMetres: raw.rearHeadroomMetres === null ? void 0 : raw.rearHeadroomMetres,
|
|
4791
|
+
frontLegroomMetres: toClearance(raw.frontLegroomMetres),
|
|
4792
|
+
widthMetres: toClearance(raw.widthMetres),
|
|
4793
|
+
door: raw.door === null ? void 0 : { widthMetres: raw.door.widthMetres, heightMetres: raw.door.heightMetres }
|
|
4794
|
+
};
|
|
4795
|
+
};
|
|
4796
|
+
var CABIN_SOURCE = cabin_default.source;
|
|
4797
|
+
var ENTRY_DUCK_FACTOR = cabin_default.entryDuckFactor;
|
|
4798
|
+
var CABIN_MINIMUMS = Object.fromEntries(
|
|
4799
|
+
CABIN_CATEGORIES.map((category) => [category, toCabinMinimum(category, cabin_default.categories[category])])
|
|
4800
|
+
);
|
|
4801
|
+
|
|
4546
4802
|
// ../game-vehicles-fleet/dist/index.js
|
|
4547
4803
|
var cars = [
|
|
4548
4804
|
"compact_hatch",
|
|
@@ -9458,6 +9714,55 @@ var GameUrban = (() => {
|
|
|
9458
9714
|
pane2.userData.sunroof = { slide };
|
|
9459
9715
|
return pane2;
|
|
9460
9716
|
}
|
|
9717
|
+
var CREASE_FOLD_LIFT = 7e-3;
|
|
9718
|
+
var CREASE_FOLD_AT = 0.4;
|
|
9719
|
+
function creaseHeightAt(pts, x) {
|
|
9720
|
+
const n = pts.length;
|
|
9721
|
+
const slope = (i) => (pts[i + 1][1] - pts[i][1]) / (pts[i + 1][0] - pts[i][0] || 1);
|
|
9722
|
+
const tangent = (i) => {
|
|
9723
|
+
if (i === 0) return slope(0);
|
|
9724
|
+
if (i === n - 1) return slope(n - 2);
|
|
9725
|
+
const a = slope(i - 1), b = slope(i);
|
|
9726
|
+
return a * b <= 0 ? 0 : 2 * a * b / (a + b);
|
|
9727
|
+
};
|
|
9728
|
+
for (let i = 0; i < n - 1; i++) {
|
|
9729
|
+
const a = pts[i], b = pts[i + 1];
|
|
9730
|
+
if ((x - a[0]) * (x - b[0]) > 0) continue;
|
|
9731
|
+
const w = b[0] - a[0] || 1, t = (x - a[0]) / w, t2 = t * t, t3 = t2 * t;
|
|
9732
|
+
return (2 * t3 - 3 * t2 + 1) * a[1] + (t3 - 2 * t2 + t) * w * tangent(i) + (-2 * t3 + 3 * t2) * b[1] + (t3 - t2) * w * tangent(i + 1);
|
|
9733
|
+
}
|
|
9734
|
+
return pts[n - 1][1];
|
|
9735
|
+
}
|
|
9736
|
+
var raised = /* @__PURE__ */ new WeakMap();
|
|
9737
|
+
function raisedOnSide(c) {
|
|
9738
|
+
let list = raised.get(c);
|
|
9739
|
+
if (!list) raised.set(c, list = []);
|
|
9740
|
+
return list;
|
|
9741
|
+
}
|
|
9742
|
+
function markRaised(c, mesh) {
|
|
9743
|
+
raisedOnSide(c).push(mesh);
|
|
9744
|
+
}
|
|
9745
|
+
function bodySide(THREE, c, S, sd) {
|
|
9746
|
+
const ray = new THREE.Raycaster();
|
|
9747
|
+
const world = c.vehicle.matrixWorld;
|
|
9748
|
+
const toVehicle = world.clone().invert();
|
|
9749
|
+
return function(x, y) {
|
|
9750
|
+
const origin = new THREE.Vector3(x, y, sd * (S.hw + 1));
|
|
9751
|
+
const best = S.hit(origin, new THREE.Vector3(0, 0, -sd), "M");
|
|
9752
|
+
ray.set(origin.clone().applyMatrix4(world), new THREE.Vector3(0, 0, -sd).transformDirection(world));
|
|
9753
|
+
raisedOnSide(c).forEach(function(m) {
|
|
9754
|
+
const h = ray.intersectObject(m, false)[0];
|
|
9755
|
+
if (!h || !h.face) return;
|
|
9756
|
+
const p = h.point.clone().applyMatrix4(toVehicle);
|
|
9757
|
+
if (!best || Math.abs(p.z) <= Math.abs(best.p.z)) return;
|
|
9758
|
+
const n = h.face.normal.clone().transformDirection(m.matrixWorld).transformDirection(toVehicle);
|
|
9759
|
+
if (n.z * sd < 0) n.negate();
|
|
9760
|
+
best.p = p;
|
|
9761
|
+
best.n = n;
|
|
9762
|
+
});
|
|
9763
|
+
return best;
|
|
9764
|
+
};
|
|
9765
|
+
}
|
|
9461
9766
|
function installCarsExtra(fx) {
|
|
9462
9767
|
const kit = fx.kit;
|
|
9463
9768
|
const THREE = kit.THREE;
|
|
@@ -9796,7 +10101,8 @@ var GameUrban = (() => {
|
|
|
9796
10101
|
const u = u0 + (u1 - u0) * i / nu, b = yb(u), t = yt(u), row = [];
|
|
9797
10102
|
for (let j = 0; j <= nv; j++) {
|
|
9798
10103
|
const y = b + (t - b) * j / nv, s = G2.at(u, y);
|
|
9799
|
-
|
|
10104
|
+
const lift = o.ridge ? o.ridge.lift * (j / nv < o.ridge.at ? j / nv / o.ridge.at : (1 - j / nv) / (1 - o.ridge.at)) : 0;
|
|
10105
|
+
row.push({ p: s.p.addScaledVector(s.n, of + lift), n: s.n, uv: [i / nu * su, o.tile ? (y - G2.y0) * sv0 : j / nv] });
|
|
9800
10106
|
}
|
|
9801
10107
|
Q.push(row);
|
|
9802
10108
|
}
|
|
@@ -10129,6 +10435,7 @@ var GameUrban = (() => {
|
|
|
10129
10435
|
};
|
|
10130
10436
|
return K;
|
|
10131
10437
|
}
|
|
10438
|
+
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
10132
10439
|
function car(c, s) {
|
|
10133
10440
|
const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
|
|
10134
10441
|
m.color = s.col;
|
|
@@ -10163,6 +10470,9 @@ var GameUrban = (() => {
|
|
|
10163
10470
|
let polys = windows(gh);
|
|
10164
10471
|
if (s.dropRear) polys = polys.slice(1);
|
|
10165
10472
|
if (gh.polys) polys = gh.polys(polys);
|
|
10473
|
+
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
10474
|
+
polys = divided.polys;
|
|
10475
|
+
glassDivisions.set(c, divided.used);
|
|
10166
10476
|
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 });
|
|
10167
10477
|
const gHoles = [];
|
|
10168
10478
|
if (intr) {
|
|
@@ -10228,6 +10538,8 @@ var GameUrban = (() => {
|
|
|
10228
10538
|
rb: gh.rb,
|
|
10229
10539
|
rt: gh.rt,
|
|
10230
10540
|
roof: gh.roof + 0.02,
|
|
10541
|
+
roofRear: (gh.roofR || gh.roof) + 0.02,
|
|
10542
|
+
roofCrown: gh.crown || 0,
|
|
10231
10543
|
belt: gh.belt,
|
|
10232
10544
|
floor: s.bottomY + 0.02,
|
|
10233
10545
|
seatH: 0.12,
|
|
@@ -10322,20 +10634,21 @@ var GameUrban = (() => {
|
|
|
10322
10634
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
10323
10635
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
10324
10636
|
[1, -1].forEach(function(sd) {
|
|
10325
|
-
|
|
10326
|
-
(s.blackPillars || []).forEach(function(px) {
|
|
10637
|
+
const bar = function(px, width) {
|
|
10327
10638
|
const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
|
|
10328
|
-
c.roundBox(
|
|
10639
|
+
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] });
|
|
10640
|
+
m2.castShadow = false;
|
|
10641
|
+
return m2;
|
|
10642
|
+
};
|
|
10643
|
+
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
10644
|
+
(glassDivisions.get(c) ?? []).forEach((px) => {
|
|
10645
|
+
bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
|
|
10329
10646
|
});
|
|
10330
10647
|
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;
|
|
10331
10648
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
10332
10649
|
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 } });
|
|
10333
10650
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
10334
10651
|
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));
|
|
10335
|
-
(s.seams || []).forEach(function(q) {
|
|
10336
|
-
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;
|
|
10337
|
-
c.roundBox(8e-3, y1 - y0, 6e-3, 3e-3, MT.dark, x, (y0 + y1) / 2, sd * (hw + 1e-3));
|
|
10338
|
-
});
|
|
10339
10652
|
(s.handles || []).forEach(function(x) {
|
|
10340
10653
|
c.roundBox(
|
|
10341
10654
|
0.15,
|
|
@@ -10350,7 +10663,8 @@ var GameUrban = (() => {
|
|
|
10350
10663
|
});
|
|
10351
10664
|
if (s.arches && s.arches.length > 1) {
|
|
10352
10665
|
const x0 = s.arches[1][0] + s.arches[1][2] + 0.02, x1 = s.arches[0][0] - s.arches[0][2] - 0.02;
|
|
10353
|
-
|
|
10666
|
+
const mouldingG = sideGrid(S, sd, { x0, x1, y0: by + 5e-3, y1: by + 0.12 });
|
|
10667
|
+
markRaised(c, K.skin(mouldingG, MT.trim, { yb: by + 0.01, yt: by + 0.09, off: 0.012, thick: 0.03, nv: 2, crease: 30, shadow: true }));
|
|
10354
10668
|
if (s.clad)
|
|
10355
10669
|
s.arches.forEach(function(a) {
|
|
10356
10670
|
const a0 = Math.asin(clamp3((by - a[1]) / a[2], -1, 1)), tor = c.add(new THREE.TorusGeometry(a[2] + 0.02, 0.035, 6, 26, PI - 2 * a0), MT.trim, a[0], a[1], sd * (hw - 0.01));
|
|
@@ -10416,6 +10730,20 @@ var GameUrban = (() => {
|
|
|
10416
10730
|
});
|
|
10417
10731
|
underbody(c, s, I);
|
|
10418
10732
|
if (s.extra) s.extra(c, I);
|
|
10733
|
+
c.vehicle.updateMatrixWorld(true);
|
|
10734
|
+
[1, -1].forEach(function(sd) {
|
|
10735
|
+
const side = bodySide(THREE, c, S, sd);
|
|
10736
|
+
const edges = doorEdgesOf(gh, s.wheels ?? []);
|
|
10737
|
+
(s.seams || []).forEach(function(q) {
|
|
10738
|
+
const r = q, x = seamOnDoorEdge(r.length ? r[0] : q, edges), y0 = r.length ? r[1] : by + 0.11, y1 = r.length ? r[2] : gh.belt - 0.03;
|
|
10739
|
+
const pts = shutLinePoints(side, x, y0, y1);
|
|
10740
|
+
if (pts.length < 3) return;
|
|
10741
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, MT.dark, { seg: 72, rs: 5 }));
|
|
10742
|
+
seam.castShadow = false;
|
|
10743
|
+
seam.userData.doorSeam = true;
|
|
10744
|
+
c.deform.push(seam);
|
|
10745
|
+
});
|
|
10746
|
+
});
|
|
10419
10747
|
if (!c.parts.some(function(p) {
|
|
10420
10748
|
return p.kind === "engine";
|
|
10421
10749
|
}))
|
|
@@ -10535,36 +10863,23 @@ var GameUrban = (() => {
|
|
|
10535
10863
|
});
|
|
10536
10864
|
const h = o.h || 0.03, Gd = sideGrid(I.S, sd, { x0, x1, y0: lo - h - 0.03, y1: hi + 0.03 });
|
|
10537
10865
|
function yAt(u) {
|
|
10538
|
-
|
|
10539
|
-
for (let i = 0; i < pts.length - 1; i++) {
|
|
10540
|
-
const a = pts[i], b = pts[i + 1];
|
|
10541
|
-
if ((x - a[0]) * (x - b[0]) <= 0) {
|
|
10542
|
-
const t = (x - a[0]) / (b[0] - a[0] || 1);
|
|
10543
|
-
return a[1] + (b[1] - a[1]) * sm(t);
|
|
10544
|
-
}
|
|
10545
|
-
}
|
|
10546
|
-
return pts[pts.length - 1][1];
|
|
10866
|
+
return creaseHeightAt(pts, x0 + (x1 - x0) * u);
|
|
10547
10867
|
}
|
|
10548
|
-
I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
10868
|
+
const fold = I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
10549
10869
|
yb: function(u) {
|
|
10550
10870
|
return yAt(u) - h;
|
|
10551
10871
|
},
|
|
10552
10872
|
yt: yAt,
|
|
10553
|
-
off: o.off ||
|
|
10554
|
-
|
|
10555
|
-
|
|
10873
|
+
off: o.off || 2e-3,
|
|
10874
|
+
ridge: { at: CREASE_FOLD_AT, lift: CREASE_FOLD_LIFT },
|
|
10875
|
+
crease: 30,
|
|
10876
|
+
nv: 5,
|
|
10556
10877
|
u0: o.u0 || 0.01,
|
|
10557
10878
|
u1: o.u1 || 0.99
|
|
10558
10879
|
});
|
|
10559
|
-
|
|
10560
|
-
for (let k = 0; k <= 30; k++) {
|
|
10561
|
-
const u = (o.u0 || 0.01) + k / 30 * ((o.u1 || 0.99) - (o.u0 || 0.01));
|
|
10562
|
-
l.push([u, yAt(u) - h - 1e-3]);
|
|
10563
|
-
}
|
|
10564
|
-
lineOn(c, Gd, l, 3e-3, o.shade || SHADE, 3e-3);
|
|
10880
|
+
markRaised(c, markFinishDetail(fold));
|
|
10565
10881
|
return Gd;
|
|
10566
10882
|
}
|
|
10567
|
-
const SHADE = CM("#000000", { roughness: 1, transparent: true, opacity: 0.45, depthWrite: false });
|
|
10568
10883
|
const CHROMEH = CM("#c9cdd0", { metalness: 0.85, roughness: 0.25 });
|
|
10569
10884
|
const CHROMEB = CM("#d4d8db", { metalness: 0.5, roughness: 0.24 });
|
|
10570
10885
|
const VINYL = "#2e2622";
|
|
@@ -11076,7 +11391,8 @@ var GameUrban = (() => {
|
|
|
11076
11391
|
[1.75, 0.8],
|
|
11077
11392
|
[0.6, 0.82],
|
|
11078
11393
|
[-0.6, 0.835],
|
|
11079
|
-
|
|
11394
|
+
// it ends where the taillight wraps onto the side, never running into the lamp
|
|
11395
|
+
[-1.6, 0.845]
|
|
11080
11396
|
],
|
|
11081
11397
|
{ col: hex, h: 0.024 }
|
|
11082
11398
|
);
|
|
@@ -18895,7 +19211,8 @@ var GameUrban = (() => {
|
|
|
18895
19211
|
const u = u0 + (u1 - u0) * i / nu, b = yb(u), t = yt(u), row = [];
|
|
18896
19212
|
for (let j = 0; j <= nv; j++) {
|
|
18897
19213
|
const y = b + (t - b) * j / nv, s = G2.at(u, y);
|
|
18898
|
-
|
|
19214
|
+
const lift = o.ridge ? o.ridge.lift * (j / nv < o.ridge.at ? j / nv / o.ridge.at : (1 - j / nv) / (1 - o.ridge.at)) : 0;
|
|
19215
|
+
row.push({ p: s.p.addScaledVector(s.n, of + lift), n: s.n, uv: [i / nu * su, o.tile ? (y - G2.y0) * sv0 : j / nv] });
|
|
18899
19216
|
}
|
|
18900
19217
|
Q.push(row);
|
|
18901
19218
|
}
|
|
@@ -19215,6 +19532,7 @@ var GameUrban = (() => {
|
|
|
19215
19532
|
};
|
|
19216
19533
|
return K;
|
|
19217
19534
|
}
|
|
19535
|
+
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
19218
19536
|
function car(c, s) {
|
|
19219
19537
|
const W = s.W, gh = s.gh, bev = 0.05, T = { belt: gh.belt, top: gh.roof + bev, k: gh.k }, m = c.meta;
|
|
19220
19538
|
m.color = s.col;
|
|
@@ -19248,6 +19566,9 @@ var GameUrban = (() => {
|
|
|
19248
19566
|
ghItems.push([gh.ft, gh.roof, gh.r2 || 0.2], [gh.fb, gh.belt - 0.1, 0]);
|
|
19249
19567
|
let polys = windows(gh);
|
|
19250
19568
|
if (s.dropRear) polys = polys.slice(1);
|
|
19569
|
+
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
19570
|
+
polys = divided.polys;
|
|
19571
|
+
glassDivisions.set(c, divided.used);
|
|
19251
19572
|
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);
|
|
19252
19573
|
const gHoles = [];
|
|
19253
19574
|
if (intr) {
|
|
@@ -19308,6 +19629,8 @@ var GameUrban = (() => {
|
|
|
19308
19629
|
rb: gh.rb,
|
|
19309
19630
|
rt: gh.rt,
|
|
19310
19631
|
roof: gh.roof + 0.02,
|
|
19632
|
+
roofRear: (gh.roofR || gh.roof) + 0.02,
|
|
19633
|
+
roofCrown: gh.crown || 0,
|
|
19311
19634
|
belt: gh.belt,
|
|
19312
19635
|
floor: s.bottomY + 0.02,
|
|
19313
19636
|
seatH: 0.12,
|
|
@@ -19400,19 +19723,21 @@ var GameUrban = (() => {
|
|
|
19400
19723
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
19401
19724
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
19402
19725
|
[1, -1].forEach(function(sd) {
|
|
19403
|
-
|
|
19404
|
-
(s.blackPillars || []).forEach(function(px) {
|
|
19726
|
+
const bar = function(px, width) {
|
|
19405
19727
|
const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
|
|
19406
|
-
c.roundBox(
|
|
19728
|
+
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] });
|
|
19729
|
+
m2.castShadow = false;
|
|
19730
|
+
return m2;
|
|
19731
|
+
};
|
|
19732
|
+
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
19733
|
+
(glassDivisions.get(c) ?? []).forEach((px) => {
|
|
19734
|
+
bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
|
|
19407
19735
|
});
|
|
19408
19736
|
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;
|
|
19409
19737
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
19410
19738
|
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 } });
|
|
19411
19739
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
19412
19740
|
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));
|
|
19413
|
-
(s.seams || []).forEach(function(x) {
|
|
19414
|
-
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));
|
|
19415
|
-
});
|
|
19416
19741
|
(s.handles || []).forEach(function(x) {
|
|
19417
19742
|
c.roundBox(
|
|
19418
19743
|
0.15,
|
|
@@ -19427,7 +19752,8 @@ var GameUrban = (() => {
|
|
|
19427
19752
|
});
|
|
19428
19753
|
if (s.arches && s.arches.length > 1) {
|
|
19429
19754
|
const x0 = s.arches[1][0] + s.arches[1][2] + 0.02, x1 = s.arches[0][0] - s.arches[0][2] - 0.02;
|
|
19430
|
-
|
|
19755
|
+
const mouldingG = sideGrid(S, sd, { x0, x1, y0: by + 5e-3, y1: by + 0.12 });
|
|
19756
|
+
markRaised(c, K.skin(mouldingG, MT.trim, { yb: by + 0.01, yt: by + 0.09, off: 0.012, thick: 0.03, nv: 2, crease: 30, shadow: true }));
|
|
19431
19757
|
if (s.clad)
|
|
19432
19758
|
s.arches.forEach(function(a) {
|
|
19433
19759
|
const a0 = Math.asin(clamp3((by - a[1]) / a[2], -1, 1)), tor = c.add(new THREE.TorusGeometry(a[2] + 0.02, 0.035, 6, 26, PI - 2 * a0), MT.trim, a[0], a[1], sd * (hw - 0.01));
|
|
@@ -19480,6 +19806,19 @@ var GameUrban = (() => {
|
|
|
19480
19806
|
});
|
|
19481
19807
|
underbody(c, s, I);
|
|
19482
19808
|
if (s.extra) s.extra(c, I);
|
|
19809
|
+
c.vehicle.updateMatrixWorld(true);
|
|
19810
|
+
[1, -1].forEach(function(sd) {
|
|
19811
|
+
const side = bodySide(THREE, c, S, sd);
|
|
19812
|
+
const edges = doorEdgesOf(gh, s.wheels ?? []);
|
|
19813
|
+
(s.seams || []).forEach(function(x) {
|
|
19814
|
+
const pts = shutLinePoints(side, seamOnDoorEdge(x, edges), by + 0.11, gh.belt - 0.03);
|
|
19815
|
+
if (pts.length < 3) return;
|
|
19816
|
+
const seam = markFinishDetail(c.tube(pts, SHUT_LINE_RADIUS, MT.dark, { seg: 72, rs: 5 }));
|
|
19817
|
+
seam.castShadow = false;
|
|
19818
|
+
seam.userData.doorSeam = true;
|
|
19819
|
+
c.deform.push(seam);
|
|
19820
|
+
});
|
|
19821
|
+
});
|
|
19483
19822
|
if (!c.parts.some(function(p) {
|
|
19484
19823
|
return p.kind === "engine";
|
|
19485
19824
|
}))
|
|
@@ -19599,36 +19938,23 @@ var GameUrban = (() => {
|
|
|
19599
19938
|
});
|
|
19600
19939
|
const h = o.h || 0.03, Gd = sideGrid(I.S, sd, { x0, x1, y0: lo - h - 0.03, y1: hi + 0.03 });
|
|
19601
19940
|
function yAt(u) {
|
|
19602
|
-
|
|
19603
|
-
for (let i = 0; i < pts.length - 1; i++) {
|
|
19604
|
-
const a = pts[i], b = pts[i + 1];
|
|
19605
|
-
if ((x - a[0]) * (x - b[0]) <= 0) {
|
|
19606
|
-
const t = (x - a[0]) / (b[0] - a[0] || 1);
|
|
19607
|
-
return a[1] + (b[1] - a[1]) * sm(t);
|
|
19608
|
-
}
|
|
19609
|
-
}
|
|
19610
|
-
return pts[pts.length - 1][1];
|
|
19941
|
+
return creaseHeightAt(pts, x0 + (x1 - x0) * u);
|
|
19611
19942
|
}
|
|
19612
|
-
I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
19943
|
+
const fold = I.K.skin(Gd, o.mat || c.paint(o.col), {
|
|
19613
19944
|
yb: function(u) {
|
|
19614
19945
|
return yAt(u) - h;
|
|
19615
19946
|
},
|
|
19616
19947
|
yt: yAt,
|
|
19617
|
-
off: o.off ||
|
|
19618
|
-
|
|
19619
|
-
|
|
19948
|
+
off: o.off || 2e-3,
|
|
19949
|
+
ridge: { at: CREASE_FOLD_AT, lift: CREASE_FOLD_LIFT },
|
|
19950
|
+
crease: 30,
|
|
19951
|
+
nv: 5,
|
|
19620
19952
|
u0: o.u0 || 0.01,
|
|
19621
19953
|
u1: o.u1 || 0.99
|
|
19622
19954
|
});
|
|
19623
|
-
|
|
19624
|
-
for (let k = 0; k <= 30; k++) {
|
|
19625
|
-
const u = (o.u0 || 0.01) + k / 30 * ((o.u1 || 0.99) - (o.u0 || 0.01));
|
|
19626
|
-
l.push([u, yAt(u) - h - 1e-3]);
|
|
19627
|
-
}
|
|
19628
|
-
lineOn(c, Gd, l, 3e-3, o.shade || SHADE, 3e-3);
|
|
19955
|
+
markRaised(c, markFinishDetail(fold));
|
|
19629
19956
|
return Gd;
|
|
19630
19957
|
}
|
|
19631
|
-
const SHADE = CM("#000000", { roughness: 1, transparent: true, opacity: 0.45, depthWrite: false });
|
|
19632
19958
|
function dloChrome(c, I, sd, pts, r) {
|
|
19633
19959
|
const gh = I.gh, T = I.T, P = pts.map(function(q) {
|
|
19634
19960
|
return [q[0], q[1], sd * (halfAt(gh.Wg, T, q[1]) + 0.012)];
|
|
@@ -20686,12 +21012,10 @@ var GameUrban = (() => {
|
|
|
20686
21012
|
I,
|
|
20687
21013
|
sd,
|
|
20688
21014
|
[
|
|
20689
|
-
[
|
|
20690
|
-
[0, 0.
|
|
20691
|
-
[-0.9, 0.6],
|
|
20692
|
-
[-1.2, 0.66]
|
|
21015
|
+
[0.86, 0.52],
|
|
21016
|
+
[-0.98, 0.52]
|
|
20693
21017
|
],
|
|
20694
|
-
{ col: "#8b939a", h: 0.
|
|
21018
|
+
{ col: "#8b939a", h: 0.03 }
|
|
20695
21019
|
);
|
|
20696
21020
|
});
|
|
20697
21021
|
}
|
|
@@ -28513,6 +28837,7 @@ var GameUrban = (() => {
|
|
|
28513
28837
|
tl: P.tl,
|
|
28514
28838
|
grille: P.grille,
|
|
28515
28839
|
seams: P.seams,
|
|
28840
|
+
shell: shellM,
|
|
28516
28841
|
handles: P.handles,
|
|
28517
28842
|
wheels: [
|
|
28518
28843
|
[A.xf, P.wr, 0.24, { rim: P.rim }],
|