@adatechnology/game-urban 0.7.4 → 0.7.5
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 +297 -11
- package/dist/index.global.js.map +1 -1
- package/package.json +4 -4
package/dist/index.global.js
CHANGED
|
@@ -4543,6 +4543,242 @@ 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 DIVISION_HALF = 0.02;
|
|
4548
|
+
var GLASS_IN_FROM_EDGE = 0.03;
|
|
4549
|
+
var CUT_EPS = 1e-6;
|
|
4550
|
+
var PAST_EDGE_MIN = 0.01;
|
|
4551
|
+
var PANE_MIN_AREA = 8e-3;
|
|
4552
|
+
var PANE_MIN_WIDTH = 0.12;
|
|
4553
|
+
function carDoorEdges(fb, rb, pillars, xr, rr) {
|
|
4554
|
+
const doorF = fb - 0.03;
|
|
4555
|
+
const pil = pillars.slice().sort((a, b) => b - a);
|
|
4556
|
+
const first = pil[0];
|
|
4557
|
+
const B = first !== void 0 && first < doorF - 0.45 && first > rb + 0.2 ? first : Math.max(rb + 0.1, doorF - 1.1);
|
|
4558
|
+
const rearDoor = first !== void 0 && first < doorF - 0.45 && B - Math.max(rb, xr) > 0.5;
|
|
4559
|
+
const second = pil[1];
|
|
4560
|
+
const C = rearDoor ? Math.max(second !== void 0 && second < B - 0.4 ? second : rb, xr + rr * 0.2) : B;
|
|
4561
|
+
return { doorF, B, C, rearDoor };
|
|
4562
|
+
}
|
|
4563
|
+
function doorEdgesOf(gh, wheels) {
|
|
4564
|
+
let xr = Infinity;
|
|
4565
|
+
let rr = 0.3;
|
|
4566
|
+
for (const w of wheels) {
|
|
4567
|
+
const x = w[0];
|
|
4568
|
+
const r = w[1];
|
|
4569
|
+
if (typeof x === "number" && x < xr) {
|
|
4570
|
+
xr = x;
|
|
4571
|
+
rr = typeof r === "number" ? r : 0.3;
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4574
|
+
if (!Number.isFinite(xr)) {
|
|
4575
|
+
if (gh.pillars.length) return null;
|
|
4576
|
+
xr = -Infinity;
|
|
4577
|
+
}
|
|
4578
|
+
return carDoorEdges(gh.fb, gh.rb, gh.pillars, xr, rr);
|
|
4579
|
+
}
|
|
4580
|
+
var SEAM_SNAP = 0.1;
|
|
4581
|
+
var SEAM_INSIDE = 4e-3;
|
|
4582
|
+
function seamOnDoorEdge(x, edges) {
|
|
4583
|
+
if (!edges) return x;
|
|
4584
|
+
let best = x;
|
|
4585
|
+
let gap = SEAM_SNAP;
|
|
4586
|
+
const lines = [edges.doorF - SEAM_INSIDE, edges.B, edges.C === edges.B ? edges.C : edges.C + SEAM_INSIDE];
|
|
4587
|
+
for (let i = 0; i < lines.length; i++) {
|
|
4588
|
+
const d = Math.abs([edges.doorF, edges.B, edges.C][i] - x);
|
|
4589
|
+
if (d <= gap) [best, gap] = [lines[i], d];
|
|
4590
|
+
}
|
|
4591
|
+
return best;
|
|
4592
|
+
}
|
|
4593
|
+
function doorGlassSplits(gh, wheels) {
|
|
4594
|
+
const edges = doorEdgesOf(gh, wheels);
|
|
4595
|
+
if (!edges) return [];
|
|
4596
|
+
return [{ at: edges.C + GLASS_IN_FROM_EDGE - DIVISION_HALF, front: edges.rearDoor ? edges.B : edges.doorF }];
|
|
4597
|
+
}
|
|
4598
|
+
function clipPoly(poly, at, keep) {
|
|
4599
|
+
const out = [];
|
|
4600
|
+
const inside = (p) => keep * ((p[0] ?? 0) - at) >= 0;
|
|
4601
|
+
for (let i = 0; i < poly.length; i++) {
|
|
4602
|
+
const a = poly[i];
|
|
4603
|
+
const b = poly[(i + 1) % poly.length];
|
|
4604
|
+
const ina = inside(a);
|
|
4605
|
+
const inb = inside(b);
|
|
4606
|
+
if (ina) out.push([a[0], a[1]]);
|
|
4607
|
+
if (ina !== inb) {
|
|
4608
|
+
const t = (at - a[0]) / (b[0] - a[0]);
|
|
4609
|
+
out.push([at, a[1] + t * (b[1] - a[1])]);
|
|
4610
|
+
}
|
|
4611
|
+
}
|
|
4612
|
+
return out;
|
|
4613
|
+
}
|
|
4614
|
+
function areaOf2(poly) {
|
|
4615
|
+
let a = 0;
|
|
4616
|
+
for (let i = 0; i < poly.length; i++) {
|
|
4617
|
+
const p = poly[i];
|
|
4618
|
+
const q = poly[(i + 1) % poly.length];
|
|
4619
|
+
a += p[0] * q[1] - q[0] * p[1];
|
|
4620
|
+
}
|
|
4621
|
+
return Math.abs(a) / 2;
|
|
4622
|
+
}
|
|
4623
|
+
function widthOf(poly) {
|
|
4624
|
+
const xs = poly.map((p) => p[0]);
|
|
4625
|
+
return Math.max(...xs) - Math.min(...xs);
|
|
4626
|
+
}
|
|
4627
|
+
function splitSidePolys(polys, splits) {
|
|
4628
|
+
let out = polys.map((p) => p.map((q) => [...q]));
|
|
4629
|
+
const used = [];
|
|
4630
|
+
for (const { at, front: doorFront } of splits) {
|
|
4631
|
+
const next = [];
|
|
4632
|
+
let cut = false;
|
|
4633
|
+
for (const poly of out) {
|
|
4634
|
+
const xs = poly.map((p) => p[0]);
|
|
4635
|
+
const edge = at + DIVISION_HALF - GLASS_IN_FROM_EDGE;
|
|
4636
|
+
const middle = (Math.min(...xs) + Math.max(...xs)) / 2;
|
|
4637
|
+
if (Math.min(...xs) >= edge - PAST_EDGE_MIN || Math.max(...xs) <= edge + CUT_EPS || middle <= edge || middle >= doorFront) {
|
|
4638
|
+
next.push(poly);
|
|
4639
|
+
continue;
|
|
4640
|
+
}
|
|
4641
|
+
cut = true;
|
|
4642
|
+
const rear = clipPoly(poly, at - DIVISION_HALF, -1);
|
|
4643
|
+
const front = clipPoly(poly, at + DIVISION_HALF, 1);
|
|
4644
|
+
if (rear.length >= 3 && areaOf2(rear) >= PANE_MIN_AREA && widthOf(rear) >= PANE_MIN_WIDTH) next.push(rear);
|
|
4645
|
+
if (front.length >= 3) next.push(front);
|
|
4646
|
+
}
|
|
4647
|
+
if (cut) used.push(at);
|
|
4648
|
+
out = next;
|
|
4649
|
+
}
|
|
4650
|
+
return { polys: out, used };
|
|
4651
|
+
}
|
|
4652
|
+
var SmokeCause = { STEAM: "steam", OIL: "oil", FIRE: "fire" };
|
|
4653
|
+
var SMOKE_LOOKS = {
|
|
4654
|
+
[SmokeCause.STEAM]: { color: 14870248, alpha: 0.18 },
|
|
4655
|
+
[SmokeCause.OIL]: { color: 11120306, alpha: 0.2 },
|
|
4656
|
+
[SmokeCause.FIRE]: { color: 2302756, alpha: 0.3 }
|
|
4657
|
+
};
|
|
4658
|
+
var CAUSE_OF_EMITTER = { white: SmokeCause.STEAM, oil: SmokeCause.OIL, black: SmokeCause.FIRE };
|
|
4659
|
+
var LIFT = { [SmokeCause.STEAM]: 0.5, [SmokeCause.OIL]: 0.45, [SmokeCause.FIRE]: 0.6 };
|
|
4660
|
+
var LID_OUTWARD = [-Math.SQRT1_2, Math.SQRT1_2, 0];
|
|
4661
|
+
var cabin_default = {
|
|
4662
|
+
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)",
|
|
4663
|
+
entryDuckFactor: 0.44,
|
|
4664
|
+
categories: {
|
|
4665
|
+
passenger_car: {
|
|
4666
|
+
frontHeadroomMetres: 0.95,
|
|
4667
|
+
rearHeadroomMetres: 0.9,
|
|
4668
|
+
frontLegroomMetres: 0.62,
|
|
4669
|
+
widthMetres: 0.52,
|
|
4670
|
+
door: { widthMetres: 0.65, heightMetres: 0.8 }
|
|
4671
|
+
},
|
|
4672
|
+
suv_pickup: {
|
|
4673
|
+
frontHeadroomMetres: 0.98,
|
|
4674
|
+
rearHeadroomMetres: 0.93,
|
|
4675
|
+
frontLegroomMetres: 0.64,
|
|
4676
|
+
widthMetres: 0.54,
|
|
4677
|
+
door: { widthMetres: 0.7, heightMetres: 0.82 }
|
|
4678
|
+
},
|
|
4679
|
+
van: {
|
|
4680
|
+
frontHeadroomMetres: 1.05,
|
|
4681
|
+
rearHeadroomMetres: 1.05,
|
|
4682
|
+
frontLegroomMetres: 0.65,
|
|
4683
|
+
widthMetres: 0.54,
|
|
4684
|
+
door: { widthMetres: 0.75, heightMetres: 0.95 }
|
|
4685
|
+
},
|
|
4686
|
+
truck: {
|
|
4687
|
+
frontHeadroomMetres: 1,
|
|
4688
|
+
rearHeadroomMetres: 1,
|
|
4689
|
+
frontLegroomMetres: 0.62,
|
|
4690
|
+
widthMetres: 0.52,
|
|
4691
|
+
door: { widthMetres: 0.65, heightMetres: 0.85 }
|
|
4692
|
+
},
|
|
4693
|
+
bus: {
|
|
4694
|
+
frontHeadroomMetres: 1.2,
|
|
4695
|
+
rearHeadroomMetres: 1.2,
|
|
4696
|
+
frontLegroomMetres: 0.62,
|
|
4697
|
+
widthMetres: 0.5,
|
|
4698
|
+
door: { widthMetres: 0.7, heightMetres: 1.75 }
|
|
4699
|
+
},
|
|
4700
|
+
agricultural: {
|
|
4701
|
+
frontHeadroomMetres: 1.05,
|
|
4702
|
+
rearHeadroomMetres: null,
|
|
4703
|
+
frontLegroomMetres: 0.62,
|
|
4704
|
+
widthMetres: 0.52,
|
|
4705
|
+
door: { widthMetres: 0.65, heightMetres: 0.9 }
|
|
4706
|
+
},
|
|
4707
|
+
military_light: {
|
|
4708
|
+
frontHeadroomMetres: 0.95,
|
|
4709
|
+
rearHeadroomMetres: 0.92,
|
|
4710
|
+
frontLegroomMetres: 0.62,
|
|
4711
|
+
widthMetres: 0.5,
|
|
4712
|
+
door: { widthMetres: 0.6, heightMetres: 0.8 }
|
|
4713
|
+
},
|
|
4714
|
+
military_armored: {
|
|
4715
|
+
frontHeadroomMetres: 0.88,
|
|
4716
|
+
rearHeadroomMetres: 0.88,
|
|
4717
|
+
frontLegroomMetres: 0.58,
|
|
4718
|
+
widthMetres: 0.46,
|
|
4719
|
+
door: { widthMetres: 0.5, heightMetres: 0.55 }
|
|
4720
|
+
},
|
|
4721
|
+
open_vehicle: {
|
|
4722
|
+
frontHeadroomMetres: null,
|
|
4723
|
+
rearHeadroomMetres: null,
|
|
4724
|
+
frontLegroomMetres: null,
|
|
4725
|
+
widthMetres: null,
|
|
4726
|
+
door: null
|
|
4727
|
+
},
|
|
4728
|
+
boat_cabin: {
|
|
4729
|
+
frontHeadroomMetres: 1.05,
|
|
4730
|
+
rearHeadroomMetres: 1.05,
|
|
4731
|
+
frontLegroomMetres: 0.62,
|
|
4732
|
+
widthMetres: 0.52,
|
|
4733
|
+
door: { widthMetres: 0.6, heightMetres: 0.9 }
|
|
4734
|
+
},
|
|
4735
|
+
aircraft_enclosed: {
|
|
4736
|
+
frontHeadroomMetres: 0.95,
|
|
4737
|
+
rearHeadroomMetres: 0.92,
|
|
4738
|
+
frontLegroomMetres: 0.62,
|
|
4739
|
+
widthMetres: 0.48,
|
|
4740
|
+
door: { widthMetres: 0.55, heightMetres: 0.8 }
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4743
|
+
};
|
|
4744
|
+
var CABIN_CATEGORIES = [
|
|
4745
|
+
"passenger_car",
|
|
4746
|
+
"suv_pickup",
|
|
4747
|
+
"van",
|
|
4748
|
+
"truck",
|
|
4749
|
+
"bus",
|
|
4750
|
+
"agricultural",
|
|
4751
|
+
"military_light",
|
|
4752
|
+
"military_armored",
|
|
4753
|
+
"open_vehicle",
|
|
4754
|
+
"boat_cabin",
|
|
4755
|
+
"aircraft_enclosed"
|
|
4756
|
+
];
|
|
4757
|
+
var toClearance = (value) => value === null ? Number.POSITIVE_INFINITY : value;
|
|
4758
|
+
var toCabinMinimum = (category, raw) => {
|
|
4759
|
+
if (category === "open_vehicle") {
|
|
4760
|
+
return {
|
|
4761
|
+
frontHeadroomMetres: Number.POSITIVE_INFINITY,
|
|
4762
|
+
rearHeadroomMetres: Number.POSITIVE_INFINITY,
|
|
4763
|
+
frontLegroomMetres: Number.POSITIVE_INFINITY,
|
|
4764
|
+
widthMetres: Number.POSITIVE_INFINITY,
|
|
4765
|
+
door: void 0
|
|
4766
|
+
};
|
|
4767
|
+
}
|
|
4768
|
+
return {
|
|
4769
|
+
frontHeadroomMetres: toClearance(raw.frontHeadroomMetres),
|
|
4770
|
+
rearHeadroomMetres: raw.rearHeadroomMetres === null ? void 0 : raw.rearHeadroomMetres,
|
|
4771
|
+
frontLegroomMetres: toClearance(raw.frontLegroomMetres),
|
|
4772
|
+
widthMetres: toClearance(raw.widthMetres),
|
|
4773
|
+
door: raw.door === null ? void 0 : { widthMetres: raw.door.widthMetres, heightMetres: raw.door.heightMetres }
|
|
4774
|
+
};
|
|
4775
|
+
};
|
|
4776
|
+
var CABIN_SOURCE = cabin_default.source;
|
|
4777
|
+
var ENTRY_DUCK_FACTOR = cabin_default.entryDuckFactor;
|
|
4778
|
+
var CABIN_MINIMUMS = Object.fromEntries(
|
|
4779
|
+
CABIN_CATEGORIES.map((category) => [category, toCabinMinimum(category, cabin_default.categories[category])])
|
|
4780
|
+
);
|
|
4781
|
+
|
|
4546
4782
|
// ../game-vehicles-fleet/dist/index.js
|
|
4547
4783
|
var cars = [
|
|
4548
4784
|
"compact_hatch",
|
|
@@ -10129,6 +10365,7 @@ var GameUrban = (() => {
|
|
|
10129
10365
|
};
|
|
10130
10366
|
return K;
|
|
10131
10367
|
}
|
|
10368
|
+
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
10132
10369
|
function car(c, s) {
|
|
10133
10370
|
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
10371
|
m.color = s.col;
|
|
@@ -10163,6 +10400,9 @@ var GameUrban = (() => {
|
|
|
10163
10400
|
let polys = windows(gh);
|
|
10164
10401
|
if (s.dropRear) polys = polys.slice(1);
|
|
10165
10402
|
if (gh.polys) polys = gh.polys(polys);
|
|
10403
|
+
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
10404
|
+
polys = divided.polys;
|
|
10405
|
+
glassDivisions.set(c, divided.used);
|
|
10166
10406
|
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
10407
|
const gHoles = [];
|
|
10168
10408
|
if (intr) {
|
|
@@ -10228,6 +10468,8 @@ var GameUrban = (() => {
|
|
|
10228
10468
|
rb: gh.rb,
|
|
10229
10469
|
rt: gh.rt,
|
|
10230
10470
|
roof: gh.roof + 0.02,
|
|
10471
|
+
roofRear: (gh.roofR || gh.roof) + 0.02,
|
|
10472
|
+
roofCrown: gh.crown || 0,
|
|
10231
10473
|
belt: gh.belt,
|
|
10232
10474
|
floor: s.bottomY + 0.02,
|
|
10233
10475
|
seatH: 0.12,
|
|
@@ -10322,19 +10564,25 @@ var GameUrban = (() => {
|
|
|
10322
10564
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
10323
10565
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
10324
10566
|
[1, -1].forEach(function(sd) {
|
|
10325
|
-
|
|
10326
|
-
(s.blackPillars || []).forEach(function(px) {
|
|
10567
|
+
const bar = function(px, width) {
|
|
10327
10568
|
const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
|
|
10328
|
-
c.roundBox(
|
|
10569
|
+
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] });
|
|
10570
|
+
m2.castShadow = false;
|
|
10571
|
+
return m2;
|
|
10572
|
+
};
|
|
10573
|
+
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
10574
|
+
(glassDivisions.get(c) ?? []).forEach((px) => {
|
|
10575
|
+
bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
|
|
10329
10576
|
});
|
|
10330
10577
|
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
10578
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
10332
10579
|
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
10580
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
10334
10581
|
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));
|
|
10582
|
+
const edges = doorEdgesOf(gh, s.wheels ?? []);
|
|
10335
10583
|
(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
|
|
10584
|
+
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;
|
|
10585
|
+
doorSeam(c, S, sd, x, y0, y1);
|
|
10338
10586
|
});
|
|
10339
10587
|
(s.handles || []).forEach(function(x) {
|
|
10340
10588
|
c.roundBox(
|
|
@@ -10489,6 +10737,18 @@ var GameUrban = (() => {
|
|
|
10489
10737
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
10490
10738
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
10491
10739
|
}
|
|
10740
|
+
const SEAM_POINTS = 14;
|
|
10741
|
+
function doorSeam(c, S, sd, x, y0, y1) {
|
|
10742
|
+
const pts = [];
|
|
10743
|
+
for (let k = 0; k <= SEAM_POINTS; k++) {
|
|
10744
|
+
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");
|
|
10745
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, y, sd * (S.hw + 1e-3)));
|
|
10746
|
+
}
|
|
10747
|
+
const t = c.tube(pts, 3e-3, MT.dark, { seg: SEAM_POINTS, rs: 4 });
|
|
10748
|
+
t.castShadow = false;
|
|
10749
|
+
t.userData.doorSeam = true;
|
|
10750
|
+
return t;
|
|
10751
|
+
}
|
|
10492
10752
|
function sm(t) {
|
|
10493
10753
|
t = clamp3(t, 0, 1);
|
|
10494
10754
|
return t * t * (3 - 2 * t);
|
|
@@ -11076,7 +11336,8 @@ var GameUrban = (() => {
|
|
|
11076
11336
|
[1.75, 0.8],
|
|
11077
11337
|
[0.6, 0.82],
|
|
11078
11338
|
[-0.6, 0.835],
|
|
11079
|
-
|
|
11339
|
+
// it ends where the taillight wraps onto the side, never running into the lamp
|
|
11340
|
+
[-1.6, 0.845]
|
|
11080
11341
|
],
|
|
11081
11342
|
{ col: hex, h: 0.024 }
|
|
11082
11343
|
);
|
|
@@ -19215,6 +19476,7 @@ var GameUrban = (() => {
|
|
|
19215
19476
|
};
|
|
19216
19477
|
return K;
|
|
19217
19478
|
}
|
|
19479
|
+
const glassDivisions = /* @__PURE__ */ new WeakMap();
|
|
19218
19480
|
function car(c, s) {
|
|
19219
19481
|
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
19482
|
m.color = s.col;
|
|
@@ -19248,6 +19510,9 @@ var GameUrban = (() => {
|
|
|
19248
19510
|
ghItems.push([gh.ft, gh.roof, gh.r2 || 0.2], [gh.fb, gh.belt - 0.1, 0]);
|
|
19249
19511
|
let polys = windows(gh);
|
|
19250
19512
|
if (s.dropRear) polys = polys.slice(1);
|
|
19513
|
+
const divided = splitSidePolys(polys, doorGlassSplits(gh, s.wheels ?? []));
|
|
19514
|
+
polys = divided.polys;
|
|
19515
|
+
glassDivisions.set(c, divided.used);
|
|
19251
19516
|
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
19517
|
const gHoles = [];
|
|
19253
19518
|
if (intr) {
|
|
@@ -19308,6 +19573,8 @@ var GameUrban = (() => {
|
|
|
19308
19573
|
rb: gh.rb,
|
|
19309
19574
|
rt: gh.rt,
|
|
19310
19575
|
roof: gh.roof + 0.02,
|
|
19576
|
+
roofRear: (gh.roofR || gh.roof) + 0.02,
|
|
19577
|
+
roofCrown: gh.crown || 0,
|
|
19311
19578
|
belt: gh.belt,
|
|
19312
19579
|
floor: s.bottomY + 0.02,
|
|
19313
19580
|
seatH: 0.12,
|
|
@@ -19400,18 +19667,25 @@ var GameUrban = (() => {
|
|
|
19400
19667
|
K.plate(-1, s.plateR || (bR.y0 + bR.y1) / 2 + 0.03, { off: s.plateROnBumper === false ? 4e-3 : 0.018 });
|
|
19401
19668
|
const tang = Math.atan(gh.Wg / 2 * gh.k / (T.top - T.belt));
|
|
19402
19669
|
[1, -1].forEach(function(sd) {
|
|
19403
|
-
|
|
19404
|
-
(s.blackPillars || []).forEach(function(px) {
|
|
19670
|
+
const bar = function(px, width) {
|
|
19405
19671
|
const ry = roofAt(gh, px), yc = (gh.belt + ry) / 2 + 5e-3, hh = ry - gh.belt - 0.1;
|
|
19406
|
-
c.roundBox(
|
|
19672
|
+
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] });
|
|
19673
|
+
m2.castShadow = false;
|
|
19674
|
+
return m2;
|
|
19675
|
+
};
|
|
19676
|
+
(s.blackPillars || []).forEach((px) => bar(px, 0.118));
|
|
19677
|
+
(glassDivisions.get(c) ?? []).forEach((px) => {
|
|
19678
|
+
bar(px, 2 * DIVISION_HALF - 2e-3).userData.doorChannel = true;
|
|
19407
19679
|
});
|
|
19408
19680
|
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
19681
|
c.roundBox(0.16, 0.05, 0.08, 0.02, MT.trim, mx + 0.03, my - 0.04, sd * (mz0 + 0.03));
|
|
19410
19682
|
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
19683
|
c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
|
|
19412
19684
|
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.
|
|
19414
|
-
|
|
19685
|
+
const edges = doorEdgesOf(gh, s.wheels ?? []);
|
|
19686
|
+
(s.seams || []).forEach(function(x0) {
|
|
19687
|
+
const x = seamOnDoorEdge(x0, edges);
|
|
19688
|
+
doorSeam(c, S, sd, x, by + 0.09, gh.belt - 0.03);
|
|
19415
19689
|
});
|
|
19416
19690
|
(s.handles || []).forEach(function(x) {
|
|
19417
19691
|
c.roundBox(
|
|
@@ -19553,6 +19827,18 @@ var GameUrban = (() => {
|
|
|
19553
19827
|
c.cylinder(0.07, 0.055, 0.1, MT.steel, x, y, z, "x");
|
|
19554
19828
|
c.cylinder(0.06, 0.06, 0.012, MT.head, x + 0.055, y, z, "x");
|
|
19555
19829
|
}
|
|
19830
|
+
const SEAM_POINTS = 14;
|
|
19831
|
+
function doorSeam(c, S, sd, x, y0, y1) {
|
|
19832
|
+
const pts = [];
|
|
19833
|
+
for (let k = 0; k <= SEAM_POINTS; k++) {
|
|
19834
|
+
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");
|
|
19835
|
+
pts.push(h ? h.p.clone().addScaledVector(h.n, 1e-3) : new V3(x, y, sd * (S.hw + 1e-3)));
|
|
19836
|
+
}
|
|
19837
|
+
const t = c.tube(pts, 3e-3, MT.dark, { seg: SEAM_POINTS, rs: 4 });
|
|
19838
|
+
t.castShadow = false;
|
|
19839
|
+
t.userData.doorSeam = true;
|
|
19840
|
+
return t;
|
|
19841
|
+
}
|
|
19556
19842
|
function sm(t) {
|
|
19557
19843
|
t = clamp3(t, 0, 1);
|
|
19558
19844
|
return t * t * (3 - 2 * t);
|