@adatechnology/game-weapons-three 0.29.9 → 0.30.0
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/assets/weapon-svg/CREDITS.md +1 -1
- package/assets/weapon-svg/credits.html +1 -1
- package/assets/weapon-svg/generated/beretta_92fs.svg +1 -1
- package/assets/weapon-svg/generated/colt_m1911.svg +1 -1
- package/assets/weapon-svg/generated/colt_python.svg +1 -1
- package/assets/weapon-svg/generated/cz_75.svg +1 -1
- package/assets/weapon-svg/generated/desert_eagle_mark_xix.svg +1 -1
- package/assets/weapon-svg/generated/fists.svg +1 -0
- package/assets/weapon-svg/generated/fn_five_seven.svg +1 -1
- package/assets/weapon-svg/generated/glock_17.svg +1 -1
- package/assets/weapon-svg/generated/glock_18.svg +1 -1
- package/assets/weapon-svg/generated/glock_19.svg +1 -1
- package/assets/weapon-svg/generated/hand.svg +1 -0
- package/assets/weapon-svg/generated/hk_usp.svg +1 -1
- package/assets/weapon-svg/generated/kel_tec_ksg.svg +1 -1
- package/assets/weapon-svg/generated/kick.svg +1 -0
- package/assets/weapon-svg/generated/kriss_vector.svg +1 -1
- package/assets/weapon-svg/generated/makarov_pm.svg +1 -1
- package/assets/weapon-svg/generated/pistol_45.svg +1 -1
- package/assets/weapon-svg/generated/pistol_9mm.svg +1 -1
- package/assets/weapon-svg/generated/revolver_357.svg +1 -1
- package/assets/weapon-svg/generated/revolver_38.svg +1 -1
- package/assets/weapon-svg/generated/shove.svg +1 -0
- package/assets/weapon-svg/generated/sig_sauer_p226.svg +1 -1
- package/assets/weapon-svg/generated/sig_sauer_p320.svg +1 -1
- package/assets/weapon-svg/generated/sw_686.svg +1 -1
- package/assets/weapon-svg/generated/sw_model_29.svg +1 -1
- package/assets/weapon-svg/generated/taurus_82.svg +1 -1
- package/assets/weapon-svg/generated/taurus_g2c.svg +1 -1
- package/assets/weapon-svg/generated/taurus_pt100.svg +1 -1
- package/assets/weapon-svg/generated/taurus_th380.svg +1 -1
- package/assets/weapon-svg/generated/taurus_ts9.svg +1 -1
- package/assets/weapon-svg/generated/walther_p99.svg +1 -1
- package/assets/weapon-svg/manifest.json +16 -0
- package/dist/{chunk-5IW5LQG6.js → chunk-RAWW6JTZ.js} +334 -96
- package/dist/chunk-RAWW6JTZ.js.map +1 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.global.js +1473 -664
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +47 -1
- package/dist/index.js.map +1 -1
- package/dist/{testing-Bk34V-6X.d.ts → testing-44lDo2Cx.d.ts} +34 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +15 -14
- package/dist/chunk-5IW5LQG6.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -62,6 +62,7 @@ var GameWeaponsThree = (() => {
|
|
|
62
62
|
WORLD_EXPLOSIVE_IDS: () => WORLD_EXPLOSIVE_IDS,
|
|
63
63
|
WORLD_EXPLOSIVE_PREFIX: () => WORLD_EXPLOSIVE_PREFIX,
|
|
64
64
|
applyCondition: () => applyCondition,
|
|
65
|
+
buildBodyActionModel: () => buildBodyActionModel,
|
|
65
66
|
buildCartridge: () => buildCartridge,
|
|
66
67
|
buildCasing: () => buildCasing,
|
|
67
68
|
buildExplosiveModel: () => buildExplosiveModel,
|
|
@@ -365,6 +366,7 @@ var GameWeaponsThree = (() => {
|
|
|
365
366
|
return void 0;
|
|
366
367
|
};
|
|
367
368
|
var FIRST_PERSON_LAYER = 9;
|
|
369
|
+
var CARRY_HANDLE_TAG = "carryHandle";
|
|
368
370
|
var TOOL_CLIP = {
|
|
369
371
|
DRAW: "draw",
|
|
370
372
|
SHOT: "shot",
|
|
@@ -19349,28 +19351,29 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19349
19351
|
}
|
|
19350
19352
|
function catenary(a, b, sag, n = 12) {
|
|
19351
19353
|
const count = Math.max(2, Math.floor(n));
|
|
19352
|
-
const span =
|
|
19353
|
-
const depth = Math.max(0, sag);
|
|
19354
|
+
const { span, c } = catenaryOf(a[0], a[1], a[2], b[0], b[1], b[2], sag);
|
|
19354
19355
|
const out = [];
|
|
19355
|
-
let shape = () => 0;
|
|
19356
|
-
if (depth > 1e-6 && span > 1e-6) {
|
|
19357
|
-
let lo = 1e-4;
|
|
19358
|
-
let hi = span * 1e3;
|
|
19359
|
-
for (let i = 0; i < 80; i++) {
|
|
19360
|
-
const c2 = (lo + hi) / 2;
|
|
19361
|
-
const d = c2 * (Math.cosh(span / (2 * c2)) - 1);
|
|
19362
|
-
if (d > depth) lo = c2;
|
|
19363
|
-
else hi = c2;
|
|
19364
|
-
}
|
|
19365
|
-
const c = (lo + hi) / 2;
|
|
19366
|
-
shape = (s) => c * (Math.cosh((s - 0.5) * span / c) - Math.cosh(span / (2 * c)));
|
|
19367
|
-
}
|
|
19368
19356
|
for (let i = 0; i < count; i++) {
|
|
19369
19357
|
const s = i / (count - 1);
|
|
19370
|
-
out.push([a[0] + (b[0] - a[0]) * s, a[1] + (b[1] - a[1]) * s +
|
|
19358
|
+
out.push([a[0] + (b[0] - a[0]) * s, a[1] + (b[1] - a[1]) * s + catenaryDrop(span, c, s), a[2] + (b[2] - a[2]) * s]);
|
|
19371
19359
|
}
|
|
19372
19360
|
return out;
|
|
19373
19361
|
}
|
|
19362
|
+
var catenaryOf = (ax, ay, az, bx, by, bz, sag) => {
|
|
19363
|
+
const span = Math.hypot(bx - ax, bz - az) || Math.hypot(bx - ax, by - ay, bz - az);
|
|
19364
|
+
const depth = Math.max(0, sag);
|
|
19365
|
+
if (depth <= 1e-6 || span <= 1e-6) return { span, c: 0 };
|
|
19366
|
+
let lo = 1e-4;
|
|
19367
|
+
let hi = span * 1e3;
|
|
19368
|
+
for (let i = 0; i < 80; i++) {
|
|
19369
|
+
const c = (lo + hi) / 2;
|
|
19370
|
+
const d = c * (Math.cosh(span / (2 * c)) - 1);
|
|
19371
|
+
if (d > depth) lo = c;
|
|
19372
|
+
else hi = c;
|
|
19373
|
+
}
|
|
19374
|
+
return { span, c: (lo + hi) / 2 };
|
|
19375
|
+
};
|
|
19376
|
+
var catenaryDrop = (span, c, s) => c > 0 ? c * (Math.cosh((s - 0.5) * span / c) - Math.cosh(span / (2 * c))) : 0;
|
|
19374
19377
|
function createCord(THREE, points, radius, material, radialSegments = 5) {
|
|
19375
19378
|
if (points.length < 2) throw new Error("createCord needs at least two points");
|
|
19376
19379
|
const curve = new THREE.CatmullRomCurve3(points.map((p) => new THREE.Vector3(p[0], p[1], p[2])), false, "centripetal");
|
|
@@ -19380,6 +19383,96 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19380
19383
|
mesh3.castShadow = true;
|
|
19381
19384
|
return mesh3;
|
|
19382
19385
|
}
|
|
19386
|
+
function createHangingCord(THREE, options) {
|
|
19387
|
+
const segments = Math.max(1, Math.floor(options.segments));
|
|
19388
|
+
const radial = Math.max(3, Math.floor(options.radialSegments ?? 5));
|
|
19389
|
+
const ring22 = radial + 1;
|
|
19390
|
+
const positions2 = new Float32Array((segments + 1) * ring22 * 3);
|
|
19391
|
+
const normals = new Float32Array((segments + 1) * ring22 * 3);
|
|
19392
|
+
const index = [];
|
|
19393
|
+
for (let i = 0; i < segments; i++) {
|
|
19394
|
+
for (let j = 0; j < radial; j++) {
|
|
19395
|
+
const a = i * ring22 + j;
|
|
19396
|
+
const b = (i + 1) * ring22 + j;
|
|
19397
|
+
index.push(a, b, a + 1, b, b + 1, a + 1);
|
|
19398
|
+
}
|
|
19399
|
+
}
|
|
19400
|
+
const geometry = new THREE.BufferGeometry();
|
|
19401
|
+
const positionAttribute = new THREE.BufferAttribute(positions2, 3);
|
|
19402
|
+
const normalAttribute = new THREE.BufferAttribute(normals, 3);
|
|
19403
|
+
geometry.setAttribute("position", positionAttribute);
|
|
19404
|
+
geometry.setAttribute("normal", normalAttribute);
|
|
19405
|
+
geometry.setIndex(index);
|
|
19406
|
+
const sphere2 = new THREE.Sphere();
|
|
19407
|
+
geometry.boundingSphere = sphere2;
|
|
19408
|
+
const mesh3 = new THREE.Mesh(geometry, options.material);
|
|
19409
|
+
mesh3.name = "cord";
|
|
19410
|
+
mesh3.castShadow = true;
|
|
19411
|
+
const centre = new Float64Array((segments + 1) * 3);
|
|
19412
|
+
const tangent = new THREE.Vector3();
|
|
19413
|
+
const normal = new THREE.Vector3();
|
|
19414
|
+
const binormal = new THREE.Vector3();
|
|
19415
|
+
const previous = new THREE.Vector3();
|
|
19416
|
+
const low = new THREE.Vector3();
|
|
19417
|
+
const high = new THREE.Vector3();
|
|
19418
|
+
const tangentAt = (i) => {
|
|
19419
|
+
const from = Math.max(0, i - 1);
|
|
19420
|
+
const to = Math.min(segments, i + 1);
|
|
19421
|
+
tangent.set(centre[to * 3] - centre[from * 3], centre[to * 3 + 1] - centre[from * 3 + 1], centre[to * 3 + 2] - centre[from * 3 + 2]).normalize();
|
|
19422
|
+
};
|
|
19423
|
+
return {
|
|
19424
|
+
mesh: mesh3,
|
|
19425
|
+
hang(a, b, sag) {
|
|
19426
|
+
const { span, c } = catenaryOf(a.x, a.y, a.z, b.x, b.y, b.z, sag);
|
|
19427
|
+
for (let i = 0; i <= segments; i++) {
|
|
19428
|
+
const s = i / segments;
|
|
19429
|
+
centre[i * 3] = a.x + (b.x - a.x) * s;
|
|
19430
|
+
centre[i * 3 + 1] = a.y + (b.y - a.y) * s + catenaryDrop(span, c, s);
|
|
19431
|
+
centre[i * 3 + 2] = a.z + (b.z - a.z) * s;
|
|
19432
|
+
}
|
|
19433
|
+
low.set(Infinity, Infinity, Infinity);
|
|
19434
|
+
high.set(-Infinity, -Infinity, -Infinity);
|
|
19435
|
+
for (let i = 0; i <= segments; i++) {
|
|
19436
|
+
tangentAt(i);
|
|
19437
|
+
if (i === 0) {
|
|
19438
|
+
const ax = Math.abs(tangent.x);
|
|
19439
|
+
const ay = Math.abs(tangent.y);
|
|
19440
|
+
const az = Math.abs(tangent.z);
|
|
19441
|
+
normal.set(ax <= ay && ax <= az ? 1 : 0, ay < ax && ay <= az ? 1 : 0, az < ax && az < ay ? 1 : 0);
|
|
19442
|
+
normal.sub(binormal.copy(tangent).multiplyScalar(normal.dot(tangent))).normalize();
|
|
19443
|
+
} else {
|
|
19444
|
+
normal.copy(previous).sub(binormal.copy(tangent).multiplyScalar(previous.dot(tangent))).normalize();
|
|
19445
|
+
}
|
|
19446
|
+
previous.copy(normal);
|
|
19447
|
+
binormal.crossVectors(tangent, normal);
|
|
19448
|
+
const px = centre[i * 3];
|
|
19449
|
+
const py = centre[i * 3 + 1];
|
|
19450
|
+
const pz = centre[i * 3 + 2];
|
|
19451
|
+
for (let j = 0; j <= radial; j++) {
|
|
19452
|
+
const angle = j / radial * Math.PI * 2;
|
|
19453
|
+
const cos2 = Math.cos(angle);
|
|
19454
|
+
const sin2 = -Math.sin(angle);
|
|
19455
|
+
const nx = cos2 * normal.x + sin2 * binormal.x;
|
|
19456
|
+
const ny = cos2 * normal.y + sin2 * binormal.y;
|
|
19457
|
+
const nz = cos2 * normal.z + sin2 * binormal.z;
|
|
19458
|
+
const at4 = (i * ring22 + j) * 3;
|
|
19459
|
+
normals[at4] = nx;
|
|
19460
|
+
normals[at4 + 1] = ny;
|
|
19461
|
+
normals[at4 + 2] = nz;
|
|
19462
|
+
positions2[at4] = px + options.radius * nx;
|
|
19463
|
+
positions2[at4 + 1] = py + options.radius * ny;
|
|
19464
|
+
positions2[at4 + 2] = pz + options.radius * nz;
|
|
19465
|
+
}
|
|
19466
|
+
low.set(Math.min(low.x, px), Math.min(low.y, py), Math.min(low.z, pz));
|
|
19467
|
+
high.set(Math.max(high.x, px), Math.max(high.y, py), Math.max(high.z, pz));
|
|
19468
|
+
}
|
|
19469
|
+
positionAttribute.needsUpdate = true;
|
|
19470
|
+
normalAttribute.needsUpdate = true;
|
|
19471
|
+
sphere2.center.addVectors(low, high).multiplyScalar(0.5);
|
|
19472
|
+
sphere2.radius = sphere2.center.distanceTo(high) + options.radius;
|
|
19473
|
+
}
|
|
19474
|
+
};
|
|
19475
|
+
}
|
|
19383
19476
|
var isTexture = (v) => !!v && typeof v === "object" && v.isTexture === true;
|
|
19384
19477
|
function texturesOf(material, out) {
|
|
19385
19478
|
for (const value of Object.values(material)) if (isTexture(value)) out.add(value);
|
|
@@ -21440,63 +21533,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21440
21533
|
}
|
|
21441
21534
|
|
|
21442
21535
|
// ../game-destruction/dist/index.js
|
|
21443
|
-
var AIR_DENSITY = 1.2;
|
|
21444
|
-
var DRAG_AREA_FACTOR = 1.5;
|
|
21445
|
-
var STEEL_DENSITY = 7850;
|
|
21446
|
-
var FRAGMENT_MIN_SPEED = 30;
|
|
21447
|
-
var GLASS_STIFFENING = 2.5;
|
|
21448
|
-
var PLATE_COEFFICIENT = 0.2874;
|
|
21449
|
-
var BEAM_COEFFICIENT = 0.75;
|
|
21450
|
-
var TNT_PER_JOULE = DEFAULT_BLAST_IMPULSE.tntPerJoule;
|
|
21451
|
-
function projectedArea(shape, toward2) {
|
|
21452
|
-
const [dx, dy, dz] = [Math.abs(toward2[0]), Math.abs(toward2[1]), Math.abs(toward2[2])];
|
|
21453
|
-
if (shape.kind === "box") return dx * shape.size[1] * shape.size[2] + dy * shape.size[0] * shape.size[2] + dz * shape.size[0] * shape.size[1];
|
|
21454
|
-
if (shape.kind === "cylinder") return Math.PI * shape.radius ** 2 * dy + 2 * shape.radius * shape.height * Math.sqrt(Math.max(0, 1 - dy * dy));
|
|
21455
|
-
return Math.PI * shape.radius ** 2;
|
|
21456
|
-
}
|
|
21457
|
-
function failureWork(input) {
|
|
21458
|
-
const ratio = input.thickness / Math.max(input.span, input.thickness);
|
|
21459
|
-
const stiffening = input.isGlass ? GLASS_STIFFENING : 1;
|
|
21460
|
-
const pressure = stiffening * input.failureMPa * 1e6 * ratio * ratio / (input.isBeam ? BEAM_COEFFICIENT : PLATE_COEFFICIENT);
|
|
21461
|
-
const deflection = input.thickness * (1 + 25 * input.ductility * input.ductility);
|
|
21462
|
-
return { pressure, work: (0.5 + 0.5 * input.ductility) * pressure * input.loaded * deflection };
|
|
21463
|
-
}
|
|
21464
|
-
function casingFlight(casing2) {
|
|
21465
|
-
const k = casing2.geometry === "cylinder" ? 0.5 : 0.6;
|
|
21466
|
-
return {
|
|
21467
|
-
mottScale: casing2.mass / (2 * Math.max(1, casing2.fragments)),
|
|
21468
|
-
speed: casing2.gurneyVelocity / Math.sqrt(casing2.mass / Math.max(casing2.chargeMass, 1e-6) + k)
|
|
21469
|
-
};
|
|
21470
|
-
}
|
|
21471
|
-
function mottMass(u, scale, fragments) {
|
|
21472
|
-
const lowest = 1 / Math.max(1, fragments);
|
|
21473
|
-
return scale * Math.log(1 / Math.max(u, lowest)) ** 2;
|
|
21474
|
-
}
|
|
21475
|
-
function fragmentCaliberMm(mass) {
|
|
21476
|
-
return 2e3 * Math.cbrt(3 * mass / (4 * Math.PI * STEEL_DENSITY));
|
|
21477
|
-
}
|
|
21478
|
-
function fragmentDrag(mass) {
|
|
21479
|
-
const sphereArea = Math.PI * Math.cbrt(3 * mass / (4 * Math.PI * STEEL_DENSITY)) ** 2;
|
|
21480
|
-
return AIR_DENSITY * DRAG_AREA_FACTOR * sphereArea / (2 * mass);
|
|
21481
|
-
}
|
|
21482
|
-
var BLUNT_FRAGMENT_NOSE = 0.84;
|
|
21483
|
-
var NDRC_CONSTANT = 38e-6;
|
|
21484
|
-
function concretePerforation(input) {
|
|
21485
|
-
const { mass, caliber, speed } = input;
|
|
21486
|
-
if (!(mass > 0) || !(caliber > 0) || !(speed > 0)) return { depth: 0, perforation: 0 };
|
|
21487
|
-
const g = NDRC_CONSTANT * (input.nose ?? BLUNT_FRAGMENT_NOSE) * mass / (caliber * Math.sqrt(input.compressiveMPa * 1e6)) * (speed / caliber) ** 1.8;
|
|
21488
|
-
const relative = g <= 1 ? 2 * Math.sqrt(g) : g + 1;
|
|
21489
|
-
const through = relative <= 1.35 ? 3.19 * relative - 0.718 * relative * relative : 1.32 + 1.24 * relative;
|
|
21490
|
-
return { depth: relative * caliber, perforation: through * caliber };
|
|
21491
|
-
}
|
|
21492
|
-
var FIRE_PRIME_C = 300;
|
|
21493
|
-
var drawChainDelay = (delay, random) => {
|
|
21494
|
-
if (typeof delay === "number") return delay;
|
|
21495
|
-
const [min2, max2] = delay;
|
|
21496
|
-
return min2 + random() * (max2 - min2);
|
|
21497
|
-
};
|
|
21498
|
-
var chainDelayOf = (spec, trigger) => spec.explodes?.chain?.[trigger];
|
|
21499
|
-
var shotDamageFractionOf = (spec) => spec.explodes?.chain?.shotDamageFraction ?? 0;
|
|
21500
21536
|
var EPS4 = 1e-9;
|
|
21501
21537
|
var vec = {
|
|
21502
21538
|
add: (a, b) => [a[0] + b[0], a[1] + b[1], a[2] + b[2]],
|
|
@@ -21778,6 +21814,342 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21778
21814
|
}
|
|
21779
21815
|
};
|
|
21780
21816
|
};
|
|
21817
|
+
var planeAxes = (thin) => thin === 1 ? [0, 2] : [thin === 0 ? 2 : 0, 1];
|
|
21818
|
+
var BREACH_GRID_CAP = 4096;
|
|
21819
|
+
var unitGrid = (dims, thin, units, cap) => {
|
|
21820
|
+
const [u, v] = planeAxes(thin);
|
|
21821
|
+
let unitU = Math.min(units.size[0], dims[u]), unitV = Math.min(units.size[1], dims[v]);
|
|
21822
|
+
const rowsFor = (h) => Math.ceil(dims[v] / h - 1e-9);
|
|
21823
|
+
const colsFor = (w) => Math.ceil(dims[u] / w - 1e-9) + (units.bond === "running" ? 1 : 0);
|
|
21824
|
+
const merge = Math.ceil(Math.sqrt(rowsFor(unitV) * colsFor(unitU) / cap));
|
|
21825
|
+
if (merge > 1) {
|
|
21826
|
+
unitU = Math.min(unitU * merge, dims[u]);
|
|
21827
|
+
unitV = Math.min(unitV * merge, dims[v]);
|
|
21828
|
+
}
|
|
21829
|
+
const cells = [];
|
|
21830
|
+
for (let row = 0; row < rowsFor(unitV); row++) {
|
|
21831
|
+
const v0 = -dims[v] / 2 + row * unitV, v1 = Math.min(v0 + unitV, dims[v] / 2);
|
|
21832
|
+
const shift = units.bond === "running" && row % 2 === 1 ? unitU / 2 : 0;
|
|
21833
|
+
for (let col = 0; col < colsFor(unitU); col++) {
|
|
21834
|
+
const u0 = Math.max(-dims[u] / 2 + col * unitU - shift, -dims[u] / 2), u1 = Math.min(-dims[u] / 2 + (col + 1) * unitU - shift, dims[u] / 2);
|
|
21835
|
+
if (u1 - u0 < 0.01) continue;
|
|
21836
|
+
const center = [0, 0, 0], size = [0, 0, 0];
|
|
21837
|
+
center[u] = (u0 + u1) / 2;
|
|
21838
|
+
center[v] = (v0 + v1) / 2;
|
|
21839
|
+
size[u] = u1 - u0;
|
|
21840
|
+
size[v] = v1 - v0;
|
|
21841
|
+
size[thin] = dims[thin];
|
|
21842
|
+
cells.push({ center, size });
|
|
21843
|
+
}
|
|
21844
|
+
}
|
|
21845
|
+
return cells;
|
|
21846
|
+
};
|
|
21847
|
+
var rowsOfGrid = /* @__PURE__ */ new WeakMap();
|
|
21848
|
+
var unitRowsWithin = (cells, thin, point, radius) => {
|
|
21849
|
+
const [u, v] = planeAxes(thin);
|
|
21850
|
+
if (!Number.isFinite(point[u]) || !Number.isFinite(point[v]) || !Number.isFinite(radius)) return [[0, cells.length]];
|
|
21851
|
+
let rows = rowsOfGrid.get(cells);
|
|
21852
|
+
if (!rows) {
|
|
21853
|
+
const found = [];
|
|
21854
|
+
cells.forEach((cell, i) => {
|
|
21855
|
+
const last = found[found.length - 1];
|
|
21856
|
+
if (last && last.center === cell.center[v] && last.size === cell.size[v]) last.to = i + 1;
|
|
21857
|
+
else found.push({ from: i, to: i + 1, center: cell.center[v], size: cell.size[v] });
|
|
21858
|
+
});
|
|
21859
|
+
rowsOfGrid.set(cells, rows = found);
|
|
21860
|
+
}
|
|
21861
|
+
const ranges = [];
|
|
21862
|
+
for (const row of rows) {
|
|
21863
|
+
if (Math.max(0, Math.abs(point[v] - row.center) - row.size / 2) > radius) continue;
|
|
21864
|
+
const last = ranges[ranges.length - 1];
|
|
21865
|
+
if (last && last[1] === row.from) last[1] = row.to;
|
|
21866
|
+
else ranges.push([row.from, row.to]);
|
|
21867
|
+
}
|
|
21868
|
+
return ranges;
|
|
21869
|
+
};
|
|
21870
|
+
var planeDistance = (cell, thin, point) => {
|
|
21871
|
+
const [u, v] = planeAxes(thin);
|
|
21872
|
+
const du = cell.center[u] - point[u], dv = cell.center[v] - point[v];
|
|
21873
|
+
return Math.sqrt(du * du + dv * dv);
|
|
21874
|
+
};
|
|
21875
|
+
var cellsWithin = (cells, thin, point, radius) => {
|
|
21876
|
+
const inside3 = cells.filter((c) => planeDistance(c, thin, point) <= radius);
|
|
21877
|
+
if (inside3.length > 0 || cells.length === 0) return inside3;
|
|
21878
|
+
return [cells.reduce((best, c) => planeDistance(c, thin, point) < planeDistance(best, thin, point) ? c : best)];
|
|
21879
|
+
};
|
|
21880
|
+
var cellsOutside = (cells, thin, point, radius) => cells.filter((c) => planeDistance(c, thin, point) > radius);
|
|
21881
|
+
var MAX_MARKS_PER_FRAGMENT = 12;
|
|
21882
|
+
var marksInBox = (center, size, rotation2, holes) => {
|
|
21883
|
+
const inverse = rotation2 ? quat.conjugate(rotation2) : void 0;
|
|
21884
|
+
const marks = [];
|
|
21885
|
+
for (const hole of holes) {
|
|
21886
|
+
const offset = [hole.point[0] - center[0], hole.point[1] - center[1], hole.point[2] - center[2]];
|
|
21887
|
+
const point = inverse ? rotateVec(inverse, offset) : offset;
|
|
21888
|
+
const inside3 = point.every((value, k) => Math.abs(value) <= size[k] / 2 + hole.diameter / 2);
|
|
21889
|
+
if (!inside3) continue;
|
|
21890
|
+
marks.push({ point, normal: inverse ? rotateVec(inverse, hole.normal) : hole.normal, diameter: hole.diameter });
|
|
21891
|
+
if (marks.length >= MAX_MARKS_PER_FRAGMENT) break;
|
|
21892
|
+
}
|
|
21893
|
+
return marks;
|
|
21894
|
+
};
|
|
21895
|
+
var rowLayouts = /* @__PURE__ */ new WeakMap();
|
|
21896
|
+
var rowLayoutOf = (cells, thin, bottom) => {
|
|
21897
|
+
const known = rowLayouts.get(cells);
|
|
21898
|
+
if (known && known.thin === thin && known.bottom === bottom && known.count === cells.length) return known;
|
|
21899
|
+
const [u, v] = planeAxes(thin);
|
|
21900
|
+
const keys = cells.map((cell) => Math.round((cell.center[v] - cell.size[v] / 2 - bottom) * 1e4));
|
|
21901
|
+
const alongOrder = cells.map((_, i) => i).sort((a, b) => cells[a].center[u] - cells[b].center[u]);
|
|
21902
|
+
const layout = { thin, bottom, count: cells.length, keys, alongOrder };
|
|
21903
|
+
rowLayouts.set(cells, layout);
|
|
21904
|
+
return layout;
|
|
21905
|
+
};
|
|
21906
|
+
var holeInBox = (center, size, hole) => {
|
|
21907
|
+
for (let k = 0; k < 3; k++) if (!(Math.abs(hole.point[k] - center[k]) <= size[k] / 2 + hole.diameter / 2)) return false;
|
|
21908
|
+
return true;
|
|
21909
|
+
};
|
|
21910
|
+
var JOINT_GAP = 1e-4;
|
|
21911
|
+
var MIN_BEARING_SHARE = 0.25;
|
|
21912
|
+
var unsupportedCells = (cells, thin, dims, standing) => {
|
|
21913
|
+
if (thin === 1) return unheldSlabCells(cells, dims, standing);
|
|
21914
|
+
const [u, v] = planeAxes(thin);
|
|
21915
|
+
const bottom = -dims[v] / 2;
|
|
21916
|
+
const layout = rowLayoutOf(cells, thin, bottom);
|
|
21917
|
+
const rows = /* @__PURE__ */ new Map();
|
|
21918
|
+
const isStanding = new Uint8Array(cells.length);
|
|
21919
|
+
for (let i = 0; i < cells.length; i++) {
|
|
21920
|
+
if (!standing(i)) continue;
|
|
21921
|
+
isStanding[i] = 1;
|
|
21922
|
+
const key2 = layout.keys[i];
|
|
21923
|
+
if (!rows.has(key2)) rows.set(key2, []);
|
|
21924
|
+
}
|
|
21925
|
+
for (const i of layout.alongOrder) if (isStanding[i] === 1) rows.get(layout.keys[i]).push(i);
|
|
21926
|
+
const rowOf = (y) => Math.round((y - bottom) * 1e4);
|
|
21927
|
+
const held = /* @__PURE__ */ new Set();
|
|
21928
|
+
const queue = [];
|
|
21929
|
+
for (const i of rows.get(0) ?? []) {
|
|
21930
|
+
held.add(i);
|
|
21931
|
+
queue.push(i);
|
|
21932
|
+
}
|
|
21933
|
+
const overlap = (a, b) => Math.min(a.center[u] + a.size[u] / 2, b.center[u] + b.size[u] / 2) - Math.max(a.center[u] - a.size[u] / 2, b.center[u] - b.size[u] / 2);
|
|
21934
|
+
const climb = () => {
|
|
21935
|
+
while (queue.length > 0) {
|
|
21936
|
+
const cell = cells[queue.pop()];
|
|
21937
|
+
for (const j of rows.get(rowOf(cell.center[v] + cell.size[v] / 2)) ?? []) {
|
|
21938
|
+
const other = cells[j];
|
|
21939
|
+
if (held.has(j) || overlap(cell, other) <= Math.max(JOINT_GAP, MIN_BEARING_SHARE * Math.min(cell.size[u], other.size[u]))) continue;
|
|
21940
|
+
held.add(j);
|
|
21941
|
+
queue.push(j);
|
|
21942
|
+
}
|
|
21943
|
+
}
|
|
21944
|
+
};
|
|
21945
|
+
const touching = (a, b) => Math.abs(a.center[u] + a.size[u] / 2 - (b.center[u] - b.size[u] / 2)) <= 1e-3;
|
|
21946
|
+
for (let wedged = true; wedged; ) {
|
|
21947
|
+
climb();
|
|
21948
|
+
wedged = false;
|
|
21949
|
+
for (const row of rows.values()) {
|
|
21950
|
+
for (let k = 1; k < row.length - 1; k++) {
|
|
21951
|
+
const i = row[k];
|
|
21952
|
+
if (held.has(i) || !held.has(row[k - 1]) || !held.has(row[k + 1])) continue;
|
|
21953
|
+
if (!touching(cells[row[k - 1]], cells[i]) || !touching(cells[i], cells[row[k + 1]])) continue;
|
|
21954
|
+
held.add(i);
|
|
21955
|
+
queue.push(i);
|
|
21956
|
+
wedged = true;
|
|
21957
|
+
}
|
|
21958
|
+
}
|
|
21959
|
+
}
|
|
21960
|
+
const loose = [];
|
|
21961
|
+
for (const row of rows.values()) for (const i of row) if (!held.has(i)) loose.push(i);
|
|
21962
|
+
return loose;
|
|
21963
|
+
};
|
|
21964
|
+
var slabGrids = /* @__PURE__ */ new WeakMap();
|
|
21965
|
+
function slabGridOf(cells) {
|
|
21966
|
+
const known = slabGrids.get(cells);
|
|
21967
|
+
if (known && known.place.length === cells.length * 2) return known;
|
|
21968
|
+
const [u, v] = planeAxes(1);
|
|
21969
|
+
const round5 = (x) => Math.round(x * 1e4);
|
|
21970
|
+
const columns = [...new Set(cells.map((cell) => round5(cell.center[u])))].sort((a, b) => a - b);
|
|
21971
|
+
const rows = [...new Set(cells.map((cell) => round5(cell.center[v])))].sort((a, b) => a - b);
|
|
21972
|
+
const columnOf = new Map(columns.map((c, k) => [c, k])), rowOf = new Map(rows.map((r, k) => [r, k]));
|
|
21973
|
+
const place = new Int32Array(cells.length * 2);
|
|
21974
|
+
cells.forEach((cell, i) => {
|
|
21975
|
+
place[i * 2] = columnOf.get(round5(cell.center[u]));
|
|
21976
|
+
place[i * 2 + 1] = rowOf.get(round5(cell.center[v]));
|
|
21977
|
+
});
|
|
21978
|
+
const grid = { columns: columns.length, rows: rows.length, place };
|
|
21979
|
+
slabGrids.set(cells, grid);
|
|
21980
|
+
return grid;
|
|
21981
|
+
}
|
|
21982
|
+
var unheldSlabCells = (cells, dims, standing) => {
|
|
21983
|
+
const [u, v] = planeAxes(1);
|
|
21984
|
+
const edge = (cell) => cell.center[u] - cell.size[u] / 2 <= -dims[u] / 2 + JOINT_GAP || cell.center[u] + cell.size[u] / 2 >= dims[u] / 2 - JOINT_GAP || cell.center[v] - cell.size[v] / 2 <= -dims[v] / 2 + JOINT_GAP || cell.center[v] + cell.size[v] / 2 >= dims[v] / 2 - JOINT_GAP;
|
|
21985
|
+
const { columns, rows, place } = slabGridOf(cells);
|
|
21986
|
+
const at4 = /* @__PURE__ */ new Map();
|
|
21987
|
+
for (let i = 0; i < cells.length; i++) if (standing(i)) at4.set(place[i * 2 + 1] * columns + place[i * 2], i);
|
|
21988
|
+
const held = new Uint8Array(cells.length);
|
|
21989
|
+
const queue = [];
|
|
21990
|
+
for (const i of at4.values()) if (edge(cells[i])) {
|
|
21991
|
+
held[i] = 1;
|
|
21992
|
+
queue.push(i);
|
|
21993
|
+
}
|
|
21994
|
+
while (queue.length > 0) {
|
|
21995
|
+
const i = queue.pop();
|
|
21996
|
+
const c = place[i * 2], r = place[i * 2 + 1];
|
|
21997
|
+
for (const [nc, nr] of [[c - 1, r], [c + 1, r], [c, r - 1], [c, r + 1]]) {
|
|
21998
|
+
if (nc < 0 || nr < 0 || nc >= columns || nr >= rows) continue;
|
|
21999
|
+
const j = at4.get(nr * columns + nc);
|
|
22000
|
+
if (j === void 0 || held[j] === 1) continue;
|
|
22001
|
+
held[j] = 1;
|
|
22002
|
+
queue.push(j);
|
|
22003
|
+
}
|
|
22004
|
+
}
|
|
22005
|
+
const loose = [];
|
|
22006
|
+
for (const i of at4.values()) if (held[i] !== 1) loose.push(i);
|
|
22007
|
+
return loose.sort((a, b) => a - b);
|
|
22008
|
+
};
|
|
22009
|
+
var clumpUnits = (cells, thin, unit, cap) => {
|
|
22010
|
+
if (cells.length <= cap) return [...cells];
|
|
22011
|
+
const [u, v] = planeAxes(thin);
|
|
22012
|
+
let lo0 = Infinity, lo1 = Infinity;
|
|
22013
|
+
for (const cell of cells) {
|
|
22014
|
+
lo0 = Math.min(lo0, cell.center[u] - cell.size[u] / 2);
|
|
22015
|
+
lo1 = Math.min(lo1, cell.center[v] - cell.size[v] / 2);
|
|
22016
|
+
}
|
|
22017
|
+
let along3 = 1, up = 1;
|
|
22018
|
+
for (let grow2 = 0; ; grow2++) {
|
|
22019
|
+
const bins = /* @__PURE__ */ new Map();
|
|
22020
|
+
for (const cell of cells) {
|
|
22021
|
+
const key2 = `${Math.floor((cell.center[u] - lo0) / (along3 * unit[0]))}:${Math.floor((cell.center[v] - lo1) / (up * unit[1]))}`;
|
|
22022
|
+
const bin2 = bins.get(key2) ?? { lo: [Infinity, Infinity, Infinity], hi: [-Infinity, -Infinity, -Infinity] };
|
|
22023
|
+
for (let k = 0; k < 3; k++) {
|
|
22024
|
+
bin2.lo[k] = Math.min(bin2.lo[k], cell.center[k] - cell.size[k] / 2);
|
|
22025
|
+
bin2.hi[k] = Math.max(bin2.hi[k], cell.center[k] + cell.size[k] / 2);
|
|
22026
|
+
}
|
|
22027
|
+
bins.set(key2, bin2);
|
|
22028
|
+
}
|
|
22029
|
+
if (bins.size <= cap) {
|
|
22030
|
+
return [...bins.values()].map(({ lo, hi }) => ({ center: [(lo[0] + hi[0]) / 2, (lo[1] + hi[1]) / 2, (lo[2] + hi[2]) / 2], size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]] }));
|
|
22031
|
+
}
|
|
22032
|
+
if (grow2 % 2 === 0) up++;
|
|
22033
|
+
else along3++;
|
|
22034
|
+
}
|
|
22035
|
+
};
|
|
22036
|
+
var MAX_SPALLS = 64;
|
|
22037
|
+
var thinAxisOf = (dims) => dims[0] <= dims[1] && dims[0] <= dims[2] ? 0 : dims[1] <= dims[2] ? 1 : 2;
|
|
22038
|
+
var resolveLayer = (def, index, mat) => ({ index, def, mat, energy: mat.penetration * def.thickness * 1e3 });
|
|
22039
|
+
var faceCode = (thin, axis2, sign2) => {
|
|
22040
|
+
const [u] = planeAxes(thin);
|
|
22041
|
+
return (sign2 >= 0 ? 1 : -1) * (axis2 === thin ? 1 : axis2 === u ? 2 : 3);
|
|
22042
|
+
};
|
|
22043
|
+
var faceAxis = (thin, face) => {
|
|
22044
|
+
const k = Math.abs(face);
|
|
22045
|
+
return k === 1 ? thin : planeAxes(thin)[k - 2];
|
|
22046
|
+
};
|
|
22047
|
+
var faceOfNormal = (layers, thin, localNormal) => {
|
|
22048
|
+
if (!layers.some((l) => l.def.faces === "all")) return localNormal[thin] >= 0 ? 1 : -1;
|
|
22049
|
+
let axis2 = thin;
|
|
22050
|
+
for (let k = 0; k < 3; k++) if (Math.abs(localNormal[k]) > Math.abs(localNormal[axis2])) axis2 = k;
|
|
22051
|
+
return faceCode(thin, axis2, localNormal[axis2]);
|
|
22052
|
+
};
|
|
22053
|
+
var onFace = (layer3, face) => {
|
|
22054
|
+
const faces = layer3.def.faces;
|
|
22055
|
+
if (faces === "all") return true;
|
|
22056
|
+
if (Math.abs(face) !== 1) return false;
|
|
22057
|
+
return faces === "both" || faces === (face > 0 ? "+" : "-");
|
|
22058
|
+
};
|
|
22059
|
+
var thinSidesOf = (def) => def.faces === "both" || def.faces === "all" ? [1, -1] : [def.faces === "+" ? 1 : -1];
|
|
22060
|
+
var isSpalled = (spalls, layer3, face, point) => {
|
|
22061
|
+
for (const s of spalls ?? []) {
|
|
22062
|
+
if (s[0] !== layer3 || s[1] !== face) continue;
|
|
22063
|
+
const dx = s[2] - point[0], dy = s[3] - point[1], dz = s[4] - point[2];
|
|
22064
|
+
if (dx * dx + dy * dy + dz * dz <= s[5] * s[5]) return true;
|
|
22065
|
+
}
|
|
22066
|
+
return false;
|
|
22067
|
+
};
|
|
22068
|
+
var outerLayer = (layers, spalls, face, point) => layers.find((l) => onFace(l, face) && !isSpalled(spalls, l.index, face, point));
|
|
22069
|
+
var layersEnergy = (layers, spalls, face, point) => {
|
|
22070
|
+
let sum2 = 0;
|
|
22071
|
+
for (const l of layers) if (onFace(l, face) && !isSpalled(spalls, l.index, face, point)) sum2 += l.energy;
|
|
22072
|
+
return sum2;
|
|
22073
|
+
};
|
|
22074
|
+
var layersThickness = (layers, face) => {
|
|
22075
|
+
let sum2 = 0;
|
|
22076
|
+
for (const l of layers) if (onFace(l, face)) sum2 += l.def.thickness;
|
|
22077
|
+
return sum2;
|
|
22078
|
+
};
|
|
22079
|
+
var tornPatchAt = (layers, spalls, face, point, radius) => {
|
|
22080
|
+
for (const l of layers) {
|
|
22081
|
+
if (!onFace(l, face)) continue;
|
|
22082
|
+
if (l.mat.fracture === "tear") {
|
|
22083
|
+
let best = -1;
|
|
22084
|
+
(spalls ?? []).forEach((s, i) => {
|
|
22085
|
+
if (s[0] !== l.index || s[1] !== face) return;
|
|
22086
|
+
const dx = s[2] - point[0], dy = s[3] - point[1], dz = s[4] - point[2];
|
|
22087
|
+
const reach2 = s[5] + radius;
|
|
22088
|
+
if (dx * dx + dy * dy + dz * dz <= reach2 * reach2 && (best < 0 || s[5] > spalls[best][5])) best = i;
|
|
22089
|
+
});
|
|
22090
|
+
if (best >= 0) return { layer: l, spall: best };
|
|
22091
|
+
}
|
|
22092
|
+
if (!isSpalled(spalls, l.index, face, point)) return void 0;
|
|
22093
|
+
}
|
|
22094
|
+
return void 0;
|
|
22095
|
+
};
|
|
22096
|
+
var AIR_DENSITY = 1.2;
|
|
22097
|
+
var DRAG_AREA_FACTOR = 1.5;
|
|
22098
|
+
var STEEL_DENSITY = 7850;
|
|
22099
|
+
var FRAGMENT_MIN_SPEED = 30;
|
|
22100
|
+
var GLASS_STIFFENING = 2.5;
|
|
22101
|
+
var PLATE_COEFFICIENT = 0.2874;
|
|
22102
|
+
var BEAM_COEFFICIENT = 0.75;
|
|
22103
|
+
var TNT_PER_JOULE = DEFAULT_BLAST_IMPULSE.tntPerJoule;
|
|
22104
|
+
function projectedArea(shape, toward2) {
|
|
22105
|
+
const [dx, dy, dz] = [Math.abs(toward2[0]), Math.abs(toward2[1]), Math.abs(toward2[2])];
|
|
22106
|
+
if (shape.kind === "box") return dx * shape.size[1] * shape.size[2] + dy * shape.size[0] * shape.size[2] + dz * shape.size[0] * shape.size[1];
|
|
22107
|
+
if (shape.kind === "cylinder") return Math.PI * shape.radius ** 2 * dy + 2 * shape.radius * shape.height * Math.sqrt(Math.max(0, 1 - dy * dy));
|
|
22108
|
+
return Math.PI * shape.radius ** 2;
|
|
22109
|
+
}
|
|
22110
|
+
function failureWork(input) {
|
|
22111
|
+
const ratio = input.thickness / Math.max(input.span, input.thickness);
|
|
22112
|
+
const stiffening = input.isGlass ? GLASS_STIFFENING : 1;
|
|
22113
|
+
const pressure = stiffening * input.failureMPa * 1e6 * ratio * ratio / (input.isBeam ? BEAM_COEFFICIENT : PLATE_COEFFICIENT);
|
|
22114
|
+
const deflection = input.thickness * (1 + 25 * input.ductility * input.ductility);
|
|
22115
|
+
return { pressure, work: (0.5 + 0.5 * input.ductility) * pressure * input.loaded * deflection };
|
|
22116
|
+
}
|
|
22117
|
+
function casingFlight(casing2) {
|
|
22118
|
+
const k = casing2.geometry === "cylinder" ? 0.5 : 0.6;
|
|
22119
|
+
return {
|
|
22120
|
+
mottScale: casing2.mass / (2 * Math.max(1, casing2.fragments)),
|
|
22121
|
+
speed: casing2.gurneyVelocity / Math.sqrt(casing2.mass / Math.max(casing2.chargeMass, 1e-6) + k)
|
|
22122
|
+
};
|
|
22123
|
+
}
|
|
22124
|
+
function mottMass(u, scale, fragments) {
|
|
22125
|
+
const lowest = 1 / Math.max(1, fragments);
|
|
22126
|
+
return scale * Math.log(1 / Math.max(u, lowest)) ** 2;
|
|
22127
|
+
}
|
|
22128
|
+
function fragmentCaliberMm(mass) {
|
|
22129
|
+
return 2e3 * Math.cbrt(3 * mass / (4 * Math.PI * STEEL_DENSITY));
|
|
22130
|
+
}
|
|
22131
|
+
function fragmentDrag(mass) {
|
|
22132
|
+
const sphereArea = Math.PI * Math.cbrt(3 * mass / (4 * Math.PI * STEEL_DENSITY)) ** 2;
|
|
22133
|
+
return AIR_DENSITY * DRAG_AREA_FACTOR * sphereArea / (2 * mass);
|
|
22134
|
+
}
|
|
22135
|
+
var BLUNT_FRAGMENT_NOSE = 0.84;
|
|
22136
|
+
var NDRC_CONSTANT = 38e-6;
|
|
22137
|
+
function concretePerforation(input) {
|
|
22138
|
+
const { mass, caliber, speed } = input;
|
|
22139
|
+
if (!(mass > 0) || !(caliber > 0) || !(speed > 0)) return { depth: 0, perforation: 0 };
|
|
22140
|
+
const g = NDRC_CONSTANT * (input.nose ?? BLUNT_FRAGMENT_NOSE) * mass / (caliber * Math.sqrt(input.compressiveMPa * 1e6)) * (speed / caliber) ** 1.8;
|
|
22141
|
+
const relative = g <= 1 ? 2 * Math.sqrt(g) : g + 1;
|
|
22142
|
+
const through = relative <= 1.35 ? 3.19 * relative - 0.718 * relative * relative : 1.32 + 1.24 * relative;
|
|
22143
|
+
return { depth: relative * caliber, perforation: through * caliber };
|
|
22144
|
+
}
|
|
22145
|
+
var FIRE_PRIME_C = 300;
|
|
22146
|
+
var drawChainDelay = (delay, random) => {
|
|
22147
|
+
if (typeof delay === "number") return delay;
|
|
22148
|
+
const [min2, max2] = delay;
|
|
22149
|
+
return min2 + random() * (max2 - min2);
|
|
22150
|
+
};
|
|
22151
|
+
var chainDelayOf = (spec, trigger) => spec.explodes?.chain?.[trigger];
|
|
22152
|
+
var shotDamageFractionOf = (spec) => spec.explodes?.chain?.shotDamageFraction ?? 0;
|
|
21781
22153
|
var bsp = (root, count, axes, rnd2) => {
|
|
21782
22154
|
const pieces = [root];
|
|
21783
22155
|
const vol = (b) => axes.reduce((v, a) => v * b.s[a], 1);
|
|
@@ -22058,179 +22430,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22058
22430
|
const n = clamp(Math.round(dims[u] * dims[v] / (mean * mean)), 6, maxFragments);
|
|
22059
22431
|
return radialPlates(inp, root, { t, u, v }, n, Math.min(inp.thickness, dims[t]), fmax * 1.5);
|
|
22060
22432
|
};
|
|
22061
|
-
|
|
22062
|
-
|
|
22063
|
-
|
|
22064
|
-
|
|
22065
|
-
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
const cells = [];
|
|
22073
|
-
for (let row = 0; row < rowsFor(unitV); row++) {
|
|
22074
|
-
const v0 = -dims[v] / 2 + row * unitV, v1 = Math.min(v0 + unitV, dims[v] / 2);
|
|
22075
|
-
const shift = units.bond === "running" && row % 2 === 1 ? unitU / 2 : 0;
|
|
22076
|
-
for (let col = 0; col < colsFor(unitU); col++) {
|
|
22077
|
-
const u0 = Math.max(-dims[u] / 2 + col * unitU - shift, -dims[u] / 2), u1 = Math.min(-dims[u] / 2 + (col + 1) * unitU - shift, dims[u] / 2);
|
|
22078
|
-
if (u1 - u0 < 0.01) continue;
|
|
22079
|
-
const center = [0, 0, 0], size = [0, 0, 0];
|
|
22080
|
-
center[u] = (u0 + u1) / 2;
|
|
22081
|
-
center[v] = (v0 + v1) / 2;
|
|
22082
|
-
size[u] = u1 - u0;
|
|
22083
|
-
size[v] = v1 - v0;
|
|
22084
|
-
size[thin] = dims[thin];
|
|
22085
|
-
cells.push({ center, size });
|
|
22086
|
-
}
|
|
22087
|
-
}
|
|
22088
|
-
return cells;
|
|
22089
|
-
};
|
|
22090
|
-
var rowsOfGrid = /* @__PURE__ */ new WeakMap();
|
|
22091
|
-
var unitRowsWithin = (cells, thin, point, radius) => {
|
|
22092
|
-
const [u, v] = planeAxes(thin);
|
|
22093
|
-
if (!Number.isFinite(point[u]) || !Number.isFinite(point[v]) || !Number.isFinite(radius)) return [[0, cells.length]];
|
|
22094
|
-
let rows = rowsOfGrid.get(cells);
|
|
22095
|
-
if (!rows) {
|
|
22096
|
-
const found = [];
|
|
22097
|
-
cells.forEach((cell, i) => {
|
|
22098
|
-
const last = found[found.length - 1];
|
|
22099
|
-
if (last && last.center === cell.center[v] && last.size === cell.size[v]) last.to = i + 1;
|
|
22100
|
-
else found.push({ from: i, to: i + 1, center: cell.center[v], size: cell.size[v] });
|
|
22101
|
-
});
|
|
22102
|
-
rowsOfGrid.set(cells, rows = found);
|
|
22103
|
-
}
|
|
22104
|
-
const ranges = [];
|
|
22105
|
-
for (const row of rows) {
|
|
22106
|
-
if (Math.max(0, Math.abs(point[v] - row.center) - row.size / 2) > radius) continue;
|
|
22107
|
-
const last = ranges[ranges.length - 1];
|
|
22108
|
-
if (last && last[1] === row.from) last[1] = row.to;
|
|
22109
|
-
else ranges.push([row.from, row.to]);
|
|
22110
|
-
}
|
|
22111
|
-
return ranges;
|
|
22112
|
-
};
|
|
22113
|
-
var planeDistance = (cell, thin, point) => {
|
|
22114
|
-
const [u, v] = planeAxes(thin);
|
|
22115
|
-
const du = cell.center[u] - point[u], dv = cell.center[v] - point[v];
|
|
22116
|
-
return Math.sqrt(du * du + dv * dv);
|
|
22117
|
-
};
|
|
22118
|
-
var cellsWithin = (cells, thin, point, radius) => {
|
|
22119
|
-
const inside3 = cells.filter((c) => planeDistance(c, thin, point) <= radius);
|
|
22120
|
-
if (inside3.length > 0 || cells.length === 0) return inside3;
|
|
22121
|
-
return [cells.reduce((best, c) => planeDistance(c, thin, point) < planeDistance(best, thin, point) ? c : best)];
|
|
22122
|
-
};
|
|
22123
|
-
var cellsOutside = (cells, thin, point, radius) => cells.filter((c) => planeDistance(c, thin, point) > radius);
|
|
22124
|
-
var MAX_MARKS_PER_FRAGMENT = 12;
|
|
22125
|
-
var marksInBox = (center, size, rotation2, holes) => {
|
|
22126
|
-
const inverse = rotation2 ? quat.conjugate(rotation2) : void 0;
|
|
22127
|
-
const marks = [];
|
|
22128
|
-
for (const hole of holes) {
|
|
22129
|
-
const offset = [hole.point[0] - center[0], hole.point[1] - center[1], hole.point[2] - center[2]];
|
|
22130
|
-
const point = inverse ? rotateVec(inverse, offset) : offset;
|
|
22131
|
-
const inside3 = point.every((value, k) => Math.abs(value) <= size[k] / 2 + hole.diameter / 2);
|
|
22132
|
-
if (!inside3) continue;
|
|
22133
|
-
marks.push({ point, normal: inverse ? rotateVec(inverse, hole.normal) : hole.normal, diameter: hole.diameter });
|
|
22134
|
-
if (marks.length >= MAX_MARKS_PER_FRAGMENT) break;
|
|
22135
|
-
}
|
|
22136
|
-
return marks;
|
|
22137
|
-
};
|
|
22138
|
-
var rowLayouts = /* @__PURE__ */ new WeakMap();
|
|
22139
|
-
var rowLayoutOf = (cells, thin, bottom) => {
|
|
22140
|
-
const known = rowLayouts.get(cells);
|
|
22141
|
-
if (known && known.thin === thin && known.bottom === bottom && known.count === cells.length) return known;
|
|
22142
|
-
const [u, v] = planeAxes(thin);
|
|
22143
|
-
const keys = cells.map((cell) => Math.round((cell.center[v] - cell.size[v] / 2 - bottom) * 1e4));
|
|
22144
|
-
const alongOrder = cells.map((_, i) => i).sort((a, b) => cells[a].center[u] - cells[b].center[u]);
|
|
22145
|
-
const layout = { thin, bottom, count: cells.length, keys, alongOrder };
|
|
22146
|
-
rowLayouts.set(cells, layout);
|
|
22147
|
-
return layout;
|
|
22148
|
-
};
|
|
22149
|
-
var holeInBox = (center, size, hole) => {
|
|
22150
|
-
for (let k = 0; k < 3; k++) if (!(Math.abs(hole.point[k] - center[k]) <= size[k] / 2 + hole.diameter / 2)) return false;
|
|
22151
|
-
return true;
|
|
22152
|
-
};
|
|
22153
|
-
var JOINT_GAP = 1e-4;
|
|
22154
|
-
var MIN_BEARING_SHARE = 0.25;
|
|
22155
|
-
var unsupportedCells = (cells, thin, dims, standing) => {
|
|
22156
|
-
if (thin === 1) return [];
|
|
22157
|
-
const [u, v] = planeAxes(thin);
|
|
22158
|
-
const bottom = -dims[v] / 2;
|
|
22159
|
-
const layout = rowLayoutOf(cells, thin, bottom);
|
|
22160
|
-
const rows = /* @__PURE__ */ new Map();
|
|
22161
|
-
const isStanding = new Uint8Array(cells.length);
|
|
22162
|
-
for (let i = 0; i < cells.length; i++) {
|
|
22163
|
-
if (!standing(i)) continue;
|
|
22164
|
-
isStanding[i] = 1;
|
|
22165
|
-
const key2 = layout.keys[i];
|
|
22166
|
-
if (!rows.has(key2)) rows.set(key2, []);
|
|
22167
|
-
}
|
|
22168
|
-
for (const i of layout.alongOrder) if (isStanding[i] === 1) rows.get(layout.keys[i]).push(i);
|
|
22169
|
-
const rowOf = (y) => Math.round((y - bottom) * 1e4);
|
|
22170
|
-
const held = /* @__PURE__ */ new Set();
|
|
22171
|
-
const queue = [];
|
|
22172
|
-
for (const i of rows.get(0) ?? []) {
|
|
22173
|
-
held.add(i);
|
|
22174
|
-
queue.push(i);
|
|
22175
|
-
}
|
|
22176
|
-
const overlap = (a, b) => Math.min(a.center[u] + a.size[u] / 2, b.center[u] + b.size[u] / 2) - Math.max(a.center[u] - a.size[u] / 2, b.center[u] - b.size[u] / 2);
|
|
22177
|
-
const climb = () => {
|
|
22178
|
-
while (queue.length > 0) {
|
|
22179
|
-
const cell = cells[queue.pop()];
|
|
22180
|
-
for (const j of rows.get(rowOf(cell.center[v] + cell.size[v] / 2)) ?? []) {
|
|
22181
|
-
const other = cells[j];
|
|
22182
|
-
if (held.has(j) || overlap(cell, other) <= Math.max(JOINT_GAP, MIN_BEARING_SHARE * Math.min(cell.size[u], other.size[u]))) continue;
|
|
22183
|
-
held.add(j);
|
|
22184
|
-
queue.push(j);
|
|
22185
|
-
}
|
|
22186
|
-
}
|
|
22187
|
-
};
|
|
22188
|
-
const touching = (a, b) => Math.abs(a.center[u] + a.size[u] / 2 - (b.center[u] - b.size[u] / 2)) <= 1e-3;
|
|
22189
|
-
for (let wedged = true; wedged; ) {
|
|
22190
|
-
climb();
|
|
22191
|
-
wedged = false;
|
|
22192
|
-
for (const row of rows.values()) {
|
|
22193
|
-
for (let k = 1; k < row.length - 1; k++) {
|
|
22194
|
-
const i = row[k];
|
|
22195
|
-
if (held.has(i) || !held.has(row[k - 1]) || !held.has(row[k + 1])) continue;
|
|
22196
|
-
if (!touching(cells[row[k - 1]], cells[i]) || !touching(cells[i], cells[row[k + 1]])) continue;
|
|
22197
|
-
held.add(i);
|
|
22198
|
-
queue.push(i);
|
|
22199
|
-
wedged = true;
|
|
22200
|
-
}
|
|
22201
|
-
}
|
|
22202
|
-
}
|
|
22203
|
-
const loose = [];
|
|
22204
|
-
for (const row of rows.values()) for (const i of row) if (!held.has(i)) loose.push(i);
|
|
22205
|
-
return loose;
|
|
22206
|
-
};
|
|
22207
|
-
var clumpUnits = (cells, thin, unit, cap) => {
|
|
22208
|
-
if (cells.length <= cap) return [...cells];
|
|
22209
|
-
const [u, v] = planeAxes(thin);
|
|
22210
|
-
let lo0 = Infinity, lo1 = Infinity;
|
|
22211
|
-
for (const cell of cells) {
|
|
22212
|
-
lo0 = Math.min(lo0, cell.center[u] - cell.size[u] / 2);
|
|
22213
|
-
lo1 = Math.min(lo1, cell.center[v] - cell.size[v] / 2);
|
|
22214
|
-
}
|
|
22215
|
-
let along3 = 1, up = 1;
|
|
22216
|
-
for (let grow2 = 0; ; grow2++) {
|
|
22217
|
-
const bins = /* @__PURE__ */ new Map();
|
|
22218
|
-
for (const cell of cells) {
|
|
22219
|
-
const key2 = `${Math.floor((cell.center[u] - lo0) / (along3 * unit[0]))}:${Math.floor((cell.center[v] - lo1) / (up * unit[1]))}`;
|
|
22220
|
-
const bin2 = bins.get(key2) ?? { lo: [Infinity, Infinity, Infinity], hi: [-Infinity, -Infinity, -Infinity] };
|
|
22221
|
-
for (let k = 0; k < 3; k++) {
|
|
22222
|
-
bin2.lo[k] = Math.min(bin2.lo[k], cell.center[k] - cell.size[k] / 2);
|
|
22223
|
-
bin2.hi[k] = Math.max(bin2.hi[k], cell.center[k] + cell.size[k] / 2);
|
|
22224
|
-
}
|
|
22225
|
-
bins.set(key2, bin2);
|
|
22226
|
-
}
|
|
22227
|
-
if (bins.size <= cap) {
|
|
22228
|
-
return [...bins.values()].map(({ lo, hi }) => ({ center: [(lo[0] + hi[0]) / 2, (lo[1] + hi[1]) / 2, (lo[2] + hi[2]) / 2], size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]] }));
|
|
22433
|
+
function put(out, at4, value) {
|
|
22434
|
+
if (at4 < out.length) out[at4] = value;
|
|
22435
|
+
else out.push(value);
|
|
22436
|
+
}
|
|
22437
|
+
function sortFirst(out, count) {
|
|
22438
|
+
for (let i = 1; i < count; i++) {
|
|
22439
|
+
const value = out[i];
|
|
22440
|
+
let j = i - 1;
|
|
22441
|
+
while (j >= 0 && out[j] > value) {
|
|
22442
|
+
out[j + 1] = out[j];
|
|
22443
|
+
j--;
|
|
22229
22444
|
}
|
|
22230
|
-
|
|
22231
|
-
else along3++;
|
|
22445
|
+
out[j + 1] = value;
|
|
22232
22446
|
}
|
|
22233
|
-
}
|
|
22447
|
+
}
|
|
22234
22448
|
var PART_GRID_MIN_PARTS = 64;
|
|
22235
22449
|
var MAX_CELLS_PER_AXIS = 64;
|
|
22236
22450
|
var PAD = 1e-4;
|
|
@@ -22247,8 +22461,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22247
22461
|
if (![...min2, ...max2].every(Number.isFinite)) {
|
|
22248
22462
|
return {
|
|
22249
22463
|
candidates(_origin, _direction, _maxDistance, out) {
|
|
22250
|
-
|
|
22251
|
-
|
|
22464
|
+
for (let index = 0; index < parts2.length; index++) put(out, index, index);
|
|
22465
|
+
return parts2.length;
|
|
22252
22466
|
}
|
|
22253
22467
|
};
|
|
22254
22468
|
}
|
|
@@ -22288,20 +22502,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22288
22502
|
let stamp = 0;
|
|
22289
22503
|
return {
|
|
22290
22504
|
candidates(origin, direction, maxDistance, out) {
|
|
22291
|
-
|
|
22505
|
+
let count = 0;
|
|
22292
22506
|
let t0 = 0;
|
|
22293
22507
|
let t1 = maxDistance;
|
|
22294
22508
|
for (let k = 0; k < 3; k++) {
|
|
22295
22509
|
const d = direction[k];
|
|
22296
22510
|
if (Math.abs(d) < 1e-12) {
|
|
22297
|
-
if (origin[k] < min2[k] || origin[k] > max2[k]) return;
|
|
22511
|
+
if (origin[k] < min2[k] || origin[k] > max2[k]) return 0;
|
|
22298
22512
|
continue;
|
|
22299
22513
|
}
|
|
22300
22514
|
const a = (min2[k] - origin[k]) / d;
|
|
22301
22515
|
const b = (max2[k] - origin[k]) / d;
|
|
22302
22516
|
t0 = Math.max(t0, Math.min(a, b));
|
|
22303
22517
|
t1 = Math.min(t1, Math.max(a, b));
|
|
22304
|
-
if (t0 > t1) return;
|
|
22518
|
+
if (t0 > t1) return 0;
|
|
22305
22519
|
}
|
|
22306
22520
|
stamp++;
|
|
22307
22521
|
if (stamp === 4294967295) {
|
|
@@ -22321,7 +22535,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22321
22535
|
const index = items[k];
|
|
22322
22536
|
if (seen[index] === stamp) continue;
|
|
22323
22537
|
seen[index] = stamp;
|
|
22324
|
-
out
|
|
22538
|
+
put(out, count++, index);
|
|
22325
22539
|
}
|
|
22326
22540
|
if (nx <= ny && nx <= nz) {
|
|
22327
22541
|
if (nx > t1) break;
|
|
@@ -22340,70 +22554,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22340
22554
|
nz += ez;
|
|
22341
22555
|
}
|
|
22342
22556
|
}
|
|
22343
|
-
|
|
22557
|
+
sortFirst(out, count);
|
|
22558
|
+
return count;
|
|
22344
22559
|
}
|
|
22345
22560
|
};
|
|
22346
22561
|
}
|
|
22347
|
-
var MAX_SPALLS = 64;
|
|
22348
|
-
var thinAxisOf = (dims) => dims[0] <= dims[1] && dims[0] <= dims[2] ? 0 : dims[1] <= dims[2] ? 1 : 2;
|
|
22349
|
-
var resolveLayer = (def, index, mat) => ({ index, def, mat, energy: mat.penetration * def.thickness * 1e3 });
|
|
22350
|
-
var faceCode = (thin, axis2, sign2) => {
|
|
22351
|
-
const [u] = planeAxes(thin);
|
|
22352
|
-
return (sign2 >= 0 ? 1 : -1) * (axis2 === thin ? 1 : axis2 === u ? 2 : 3);
|
|
22353
|
-
};
|
|
22354
|
-
var faceAxis = (thin, face) => {
|
|
22355
|
-
const k = Math.abs(face);
|
|
22356
|
-
return k === 1 ? thin : planeAxes(thin)[k - 2];
|
|
22357
|
-
};
|
|
22358
|
-
var faceOfNormal = (layers, thin, localNormal) => {
|
|
22359
|
-
if (!layers.some((l) => l.def.faces === "all")) return localNormal[thin] >= 0 ? 1 : -1;
|
|
22360
|
-
let axis2 = thin;
|
|
22361
|
-
for (let k = 0; k < 3; k++) if (Math.abs(localNormal[k]) > Math.abs(localNormal[axis2])) axis2 = k;
|
|
22362
|
-
return faceCode(thin, axis2, localNormal[axis2]);
|
|
22363
|
-
};
|
|
22364
|
-
var onFace = (layer3, face) => {
|
|
22365
|
-
const faces = layer3.def.faces;
|
|
22366
|
-
if (faces === "all") return true;
|
|
22367
|
-
if (Math.abs(face) !== 1) return false;
|
|
22368
|
-
return faces === "both" || faces === (face > 0 ? "+" : "-");
|
|
22369
|
-
};
|
|
22370
|
-
var thinSidesOf = (def) => def.faces === "both" || def.faces === "all" ? [1, -1] : [def.faces === "+" ? 1 : -1];
|
|
22371
|
-
var isSpalled = (spalls, layer3, face, point) => {
|
|
22372
|
-
for (const s of spalls ?? []) {
|
|
22373
|
-
if (s[0] !== layer3 || s[1] !== face) continue;
|
|
22374
|
-
const dx = s[2] - point[0], dy = s[3] - point[1], dz = s[4] - point[2];
|
|
22375
|
-
if (dx * dx + dy * dy + dz * dz <= s[5] * s[5]) return true;
|
|
22376
|
-
}
|
|
22377
|
-
return false;
|
|
22378
|
-
};
|
|
22379
|
-
var outerLayer = (layers, spalls, face, point) => layers.find((l) => onFace(l, face) && !isSpalled(spalls, l.index, face, point));
|
|
22380
|
-
var layersEnergy = (layers, spalls, face, point) => {
|
|
22381
|
-
let sum2 = 0;
|
|
22382
|
-
for (const l of layers) if (onFace(l, face) && !isSpalled(spalls, l.index, face, point)) sum2 += l.energy;
|
|
22383
|
-
return sum2;
|
|
22384
|
-
};
|
|
22385
|
-
var layersThickness = (layers, face) => {
|
|
22386
|
-
let sum2 = 0;
|
|
22387
|
-
for (const l of layers) if (onFace(l, face)) sum2 += l.def.thickness;
|
|
22388
|
-
return sum2;
|
|
22389
|
-
};
|
|
22390
|
-
var tornPatchAt = (layers, spalls, face, point, radius) => {
|
|
22391
|
-
for (const l of layers) {
|
|
22392
|
-
if (!onFace(l, face)) continue;
|
|
22393
|
-
if (l.mat.fracture === "tear") {
|
|
22394
|
-
let best = -1;
|
|
22395
|
-
(spalls ?? []).forEach((s, i) => {
|
|
22396
|
-
if (s[0] !== l.index || s[1] !== face) return;
|
|
22397
|
-
const dx = s[2] - point[0], dy = s[3] - point[1], dz = s[4] - point[2];
|
|
22398
|
-
const reach2 = s[5] + radius;
|
|
22399
|
-
if (dx * dx + dy * dy + dz * dz <= reach2 * reach2 && (best < 0 || s[5] > spalls[best][5])) best = i;
|
|
22400
|
-
});
|
|
22401
|
-
if (best >= 0) return { layer: l, spall: best };
|
|
22402
|
-
}
|
|
22403
|
-
if (!isSpalled(spalls, l.index, face, point)) return void 0;
|
|
22404
|
-
}
|
|
22405
|
-
return void 0;
|
|
22406
|
-
};
|
|
22407
22562
|
var REBAR_COVER = 0.03;
|
|
22408
22563
|
var COVER = REBAR_COVER;
|
|
22409
22564
|
var MAX_BARS_PER_DIRECTION = 24;
|
|
@@ -22564,12 +22719,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22564
22719
|
var steelMoment = (area3, yieldMPa, d, b, compressiveMPa, options = {}) => {
|
|
22565
22720
|
if (area3 <= 0 || d <= 0 || b <= 0) return 0;
|
|
22566
22721
|
const T2 = area3 * yieldMPa * MPA;
|
|
22567
|
-
const
|
|
22568
|
-
const x = T2 /
|
|
22722
|
+
const block2 = 0.68 * compressiveMPa * MPA * b;
|
|
22723
|
+
const x = T2 / block2;
|
|
22569
22724
|
const xl = (options.neutralAxisLimit ?? FLEXURE_DEFAULTS.neutralAxisLimit) * d;
|
|
22570
22725
|
if (x <= xl) return T2 * (d - 0.4 * x);
|
|
22571
22726
|
const top = Math.min(d / 2, (options.cover ?? FLEXURE_DEFAULTS.cover) + RATIO_BAR / 2);
|
|
22572
|
-
return
|
|
22727
|
+
return block2 * xl * (d - 0.4 * xl) + (T2 - block2 * xl) * (d - top);
|
|
22573
22728
|
};
|
|
22574
22729
|
var spanStiffness = (EI, span) => 384 * EI / (5 * span ** 3);
|
|
22575
22730
|
var elasticEnergy = (moment, span, EI, loadFactor = FLEXURE_DEFAULTS.loadFactor) => {
|
|
@@ -23517,6 +23672,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23517
23672
|
var materials_default = [
|
|
23518
23673
|
{
|
|
23519
23674
|
id: "steel",
|
|
23675
|
+
splitForm: "sheets",
|
|
23520
23676
|
density: 7850,
|
|
23521
23677
|
hpPerKg: 400,
|
|
23522
23678
|
penetration: 110,
|
|
@@ -23640,6 +23796,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23640
23796
|
},
|
|
23641
23797
|
{
|
|
23642
23798
|
id: "aluminium",
|
|
23799
|
+
splitForm: "sheets",
|
|
23643
23800
|
density: 2700,
|
|
23644
23801
|
hpPerKg: 250,
|
|
23645
23802
|
penetration: 60,
|
|
@@ -23679,6 +23836,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23679
23836
|
},
|
|
23680
23837
|
{
|
|
23681
23838
|
id: "copper",
|
|
23839
|
+
splitForm: "sheets",
|
|
23682
23840
|
density: 8960,
|
|
23683
23841
|
hpPerKg: 300,
|
|
23684
23842
|
penetration: 70,
|
|
@@ -24173,6 +24331,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24173
24331
|
},
|
|
24174
24332
|
{
|
|
24175
24333
|
id: "plastic",
|
|
24334
|
+
splitForm: "plates",
|
|
24176
24335
|
density: 1100,
|
|
24177
24336
|
hpPerKg: 60,
|
|
24178
24337
|
penetration: 8,
|
|
@@ -24207,6 +24366,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24207
24366
|
},
|
|
24208
24367
|
{
|
|
24209
24368
|
id: "rubber",
|
|
24369
|
+
splitForm: "strips",
|
|
24210
24370
|
density: 1100,
|
|
24211
24371
|
hpPerKg: 80,
|
|
24212
24372
|
penetration: 12,
|
|
@@ -24239,6 +24399,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24239
24399
|
},
|
|
24240
24400
|
{
|
|
24241
24401
|
id: "fabric",
|
|
24402
|
+
splitForm: "strips",
|
|
24242
24403
|
density: 400,
|
|
24243
24404
|
hpPerKg: 20,
|
|
24244
24405
|
penetration: 0.8,
|
|
@@ -24336,6 +24497,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24336
24497
|
},
|
|
24337
24498
|
{
|
|
24338
24499
|
id: "leather",
|
|
24500
|
+
splitForm: "strips",
|
|
24339
24501
|
density: 900,
|
|
24340
24502
|
hpPerKg: 50,
|
|
24341
24503
|
penetration: 4,
|
|
@@ -24372,6 +24534,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24372
24534
|
},
|
|
24373
24535
|
{
|
|
24374
24536
|
id: "paper",
|
|
24537
|
+
splitForm: "strips",
|
|
24375
24538
|
density: 700,
|
|
24376
24539
|
hpPerKg: 8,
|
|
24377
24540
|
penetration: 0.3,
|
|
@@ -25300,21 +25463,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25300
25463
|
const r = [x[0], y[0], z[0], x[1], y[1], z[1], x[2], y[2], z[2]];
|
|
25301
25464
|
const half = new Float64Array(n * n);
|
|
25302
25465
|
const out = new Float64Array(n * n);
|
|
25303
|
-
for (let
|
|
25466
|
+
for (let block2 = 0; block2 < n; block2 += 3) {
|
|
25304
25467
|
for (let col = 0; col < n; col++) {
|
|
25305
25468
|
for (let i = 0; i < 3; i++) {
|
|
25306
25469
|
let sum2 = 0;
|
|
25307
|
-
for (let m = 0; m < 3; m++) sum2 += r[i * 3 + m] * k[(
|
|
25308
|
-
half[(
|
|
25470
|
+
for (let m = 0; m < 3; m++) sum2 += r[i * 3 + m] * k[(block2 + m) * n + col];
|
|
25471
|
+
half[(block2 + i) * n + col] = sum2;
|
|
25309
25472
|
}
|
|
25310
25473
|
}
|
|
25311
25474
|
}
|
|
25312
25475
|
for (let row = 0; row < n; row++) {
|
|
25313
|
-
for (let
|
|
25476
|
+
for (let block2 = 0; block2 < n; block2 += 3) {
|
|
25314
25477
|
for (let i = 0; i < 3; i++) {
|
|
25315
25478
|
let sum2 = 0;
|
|
25316
|
-
for (let m = 0; m < 3; m++) sum2 += half[row * n +
|
|
25317
|
-
out[row * n +
|
|
25479
|
+
for (let m = 0; m < 3; m++) sum2 += half[row * n + block2 + m] * r[i * 3 + m];
|
|
25480
|
+
out[row * n + block2 + i] = sum2;
|
|
25318
25481
|
}
|
|
25319
25482
|
}
|
|
25320
25483
|
}
|
|
@@ -25702,7 +25865,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25702
25865
|
const delta = new Float64Array(n);
|
|
25703
25866
|
for (let i = 0; i < n; i++) delta[i] = after2.u[i] - before.u[i];
|
|
25704
25867
|
for (const beam of beams.values()) if (!after2.standing.has(beam.part.id)) for (const node of beam.nodes) for (const dof of dofsOf(node)) delta[dof] = 0;
|
|
25705
|
-
|
|
25868
|
+
const potential = (x) => {
|
|
25869
|
+
let height = 0;
|
|
25870
|
+
for (let i = 0; i < n; i++) height += after2.load[i] * x[i];
|
|
25871
|
+
return frame2.shape.halfQuadratic(after2.structure, x) - height;
|
|
25872
|
+
};
|
|
25873
|
+
const had = new Float64Array(n);
|
|
25874
|
+
for (let i = 0; i < n; i++) had[i] = after2.u[i] - delta[i];
|
|
25875
|
+
released = Math.max(0, potential(had) - potential(after2.u));
|
|
25706
25876
|
spin = spinOf({ frame: frame2, after: after2, delta, released, centre: allCentre, mass: all, floor: floor2, g });
|
|
25707
25877
|
}
|
|
25708
25878
|
return {
|
|
@@ -25925,8 +26095,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25925
26095
|
if (worst > MECHANISM) return null;
|
|
25926
26096
|
const holding = feet.filter((_, index) => holds3[index]);
|
|
25927
26097
|
if (holding.length < 3) return null;
|
|
25928
|
-
|
|
25929
|
-
return { u: u.slice(), k: k.slice(), holding, masses, standing };
|
|
26098
|
+
return { u: u.slice(), structure, load: f, holding, masses, standing };
|
|
25930
26099
|
}
|
|
25931
26100
|
return null;
|
|
25932
26101
|
}
|
|
@@ -26155,7 +26324,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26155
26324
|
var TEAR_JOULES = 150;
|
|
26156
26325
|
var STRIP_THICKNESS = 15e-4;
|
|
26157
26326
|
var UNIT_FRAGMENT_FACTOR = 4;
|
|
26158
|
-
var BREACH_GRID_CAP = 4096;
|
|
26159
26327
|
var MASONRY_CRUMBLE_SPEED = 0.6;
|
|
26160
26328
|
var MASONRY_TOPPLE = 0.4;
|
|
26161
26329
|
var MASONRY_TOPPLE_MIN_HEIGHT = 0.5;
|
|
@@ -26372,6 +26540,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26372
26540
|
objectsRevision++;
|
|
26373
26541
|
}
|
|
26374
26542
|
};
|
|
26543
|
+
const movedObjects = [];
|
|
26544
|
+
const markMoved = (o) => {
|
|
26545
|
+
if (o.rayMoved) return;
|
|
26546
|
+
o.rayMoved = true;
|
|
26547
|
+
movedObjects.push(o);
|
|
26548
|
+
};
|
|
26375
26549
|
const listeners = /* @__PURE__ */ new Map();
|
|
26376
26550
|
let cur = [];
|
|
26377
26551
|
const blasts = [];
|
|
@@ -26547,6 +26721,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26547
26721
|
unsup: [],
|
|
26548
26722
|
anyAnchor: false,
|
|
26549
26723
|
order: ++orderCounter,
|
|
26724
|
+
rayStamp: 0,
|
|
26725
|
+
raySlot: 0,
|
|
26726
|
+
rayMoved: false,
|
|
26550
26727
|
loose: carry?.loose ?? false,
|
|
26551
26728
|
cast: /* @__PURE__ */ new Map(),
|
|
26552
26729
|
base: { pos: [pos[0], pos[1], pos[2]], rot: [rot[0], rot[1], rot[2], rot[3]] }
|
|
@@ -27381,6 +27558,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27381
27558
|
applySoilPose(o);
|
|
27382
27559
|
};
|
|
27383
27560
|
const applySoilPose = (o) => {
|
|
27561
|
+
markMoved(o);
|
|
27384
27562
|
const so = o.soil;
|
|
27385
27563
|
if (!so) {
|
|
27386
27564
|
o.st.position = [o.base.pos[0], o.base.pos[1], o.base.pos[2]];
|
|
@@ -28299,11 +28477,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28299
28477
|
return grid;
|
|
28300
28478
|
};
|
|
28301
28479
|
const partsAlong = (o, lo, ld, maxDist) => {
|
|
28302
|
-
if (o.parts.length < PART_GRID_MIN_PARTS || !lo.
|
|
28303
|
-
partGridOf(o).candidates(lo, ld, maxDist, gridCandidates);
|
|
28304
|
-
|
|
28305
|
-
|
|
28306
|
-
|
|
28480
|
+
if (o.parts.length < PART_GRID_MIN_PARTS || !(Number.isFinite(lo[0]) && Number.isFinite(lo[1]) && Number.isFinite(lo[2]) && Number.isFinite(ld[0]) && Number.isFinite(ld[1]) && Number.isFinite(ld[2]))) return -1;
|
|
28481
|
+
const count = partGridOf(o).candidates(lo, ld, maxDist, gridCandidates);
|
|
28482
|
+
for (let i = 0; i < count; i++) {
|
|
28483
|
+
const p = o.parts[gridCandidates[i]];
|
|
28484
|
+
if (i < gridParts.length) gridParts[i] = p;
|
|
28485
|
+
else gridParts.push(p);
|
|
28486
|
+
}
|
|
28487
|
+
return count;
|
|
28307
28488
|
};
|
|
28308
28489
|
const splitInto = (o, cuts) => {
|
|
28309
28490
|
const carryFor = (keep2, keepOpen = () => false) => ({
|
|
@@ -28360,6 +28541,140 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28360
28541
|
return implList;
|
|
28361
28542
|
};
|
|
28362
28543
|
const NO_IMPLS = [];
|
|
28544
|
+
const RAY_CELL = 2;
|
|
28545
|
+
const RAY_GRID_BIG = 4;
|
|
28546
|
+
const RAY_GRID_HALF = 512;
|
|
28547
|
+
const RAY_GRID_MAX_CELLS = 64;
|
|
28548
|
+
const gridCells = /* @__PURE__ */ new Map();
|
|
28549
|
+
const gridCentre = [0, 0, 0];
|
|
28550
|
+
const gridSpans = /* @__PURE__ */ new WeakMap();
|
|
28551
|
+
const bigObjects = [];
|
|
28552
|
+
let gridFor = -1;
|
|
28553
|
+
let gridQuery = 0;
|
|
28554
|
+
const gridHits = [];
|
|
28555
|
+
const cellOf = (v) => Math.floor(v / RAY_CELL) | 0;
|
|
28556
|
+
const inGrid = (c) => c >= -RAY_GRID_HALF && c < RAY_GRID_HALF;
|
|
28557
|
+
const cellKey3 = (ix, iy, iz) => ix + RAY_GRID_HALF + (iy + RAY_GRID_HALF) * 1024 + (iz + RAY_GRID_HALF) * 1048576 | 0;
|
|
28558
|
+
const cellAt = (key2) => {
|
|
28559
|
+
let cell = gridCells.get(key2);
|
|
28560
|
+
if (!cell) {
|
|
28561
|
+
cell = [];
|
|
28562
|
+
gridCells.set(key2, cell);
|
|
28563
|
+
}
|
|
28564
|
+
return cell;
|
|
28565
|
+
};
|
|
28566
|
+
const dropFrom = (list2, o) => {
|
|
28567
|
+
const at4 = list2.indexOf(o);
|
|
28568
|
+
if (at4 < 0) return;
|
|
28569
|
+
list2[at4] = list2[list2.length - 1];
|
|
28570
|
+
list2.length--;
|
|
28571
|
+
};
|
|
28572
|
+
const unplace = (o, span) => {
|
|
28573
|
+
if (!span.placed) return;
|
|
28574
|
+
span.placed = false;
|
|
28575
|
+
if (span.big) {
|
|
28576
|
+
dropFrom(bigObjects, o);
|
|
28577
|
+
return;
|
|
28578
|
+
}
|
|
28579
|
+
for (let iz = span.z0; iz <= span.z1; iz++) for (let iy = span.y0; iy <= span.y1; iy++) for (let ix = span.x0; ix <= span.x1; ix++) dropFrom(cellAt(cellKey3(ix, iy, iz)), o);
|
|
28580
|
+
};
|
|
28581
|
+
const place = (o) => {
|
|
28582
|
+
o.raySlot = slots.get(o.id) ?? 0;
|
|
28583
|
+
let span = gridSpans.get(o);
|
|
28584
|
+
const c = rotateVecInto(o.st.rotation, o.bc, gridCentre);
|
|
28585
|
+
c[0] += o.st.position[0];
|
|
28586
|
+
c[1] += o.st.position[1];
|
|
28587
|
+
c[2] += o.st.position[2];
|
|
28588
|
+
const r = o.br;
|
|
28589
|
+
const x0 = cellOf(c[0] - r), y0 = cellOf(c[1] - r), z0 = cellOf(c[2] - r);
|
|
28590
|
+
const x1 = cellOf(c[0] + r), y1 = cellOf(c[1] + r), z1 = cellOf(c[2] + r);
|
|
28591
|
+
const big = !(x1 - x0 < RAY_GRID_BIG && y1 - y0 < RAY_GRID_BIG && z1 - z0 < RAY_GRID_BIG) || !(inGrid(x0) && inGrid(y0) && inGrid(z0) && inGrid(x1) && inGrid(y1) && inGrid(z1));
|
|
28592
|
+
if (span?.placed && span.big === big && (big || span.x0 === x0 && span.y0 === y0 && span.z0 === z0 && span.x1 === x1 && span.y1 === y1 && span.z1 === z1)) return;
|
|
28593
|
+
if (span) unplace(o, span);
|
|
28594
|
+
else {
|
|
28595
|
+
span = { x0, y0, z0, x1, y1, z1, big, placed: false };
|
|
28596
|
+
gridSpans.set(o, span);
|
|
28597
|
+
}
|
|
28598
|
+
span.x0 = x0;
|
|
28599
|
+
span.y0 = y0;
|
|
28600
|
+
span.z0 = z0;
|
|
28601
|
+
span.x1 = x1;
|
|
28602
|
+
span.y1 = y1;
|
|
28603
|
+
span.z1 = z1;
|
|
28604
|
+
span.big = big;
|
|
28605
|
+
span.placed = true;
|
|
28606
|
+
if (big) {
|
|
28607
|
+
bigObjects.push(o);
|
|
28608
|
+
return;
|
|
28609
|
+
}
|
|
28610
|
+
for (let iz = z0; iz <= z1; iz++) for (let iy = y0; iy <= y1; iy++) for (let ix = x0; ix <= x1; ix++) cellAt(cellKey3(ix, iy, iz)).push(o);
|
|
28611
|
+
};
|
|
28612
|
+
const refreshGrid = () => {
|
|
28613
|
+
if (gridFor !== objectsRevision) {
|
|
28614
|
+
for (const cell of gridCells.values()) cell.length = 0;
|
|
28615
|
+
bigObjects.length = 0;
|
|
28616
|
+
const all = objectsInOrder();
|
|
28617
|
+
for (let i = 0; i < all.length; i++) {
|
|
28618
|
+
const span = gridSpans.get(all[i]);
|
|
28619
|
+
if (span) span.placed = false;
|
|
28620
|
+
place(all[i]);
|
|
28621
|
+
}
|
|
28622
|
+
for (let i = 0; i < movedObjects.length; i++) movedObjects[i].rayMoved = false;
|
|
28623
|
+
movedObjects.length = 0;
|
|
28624
|
+
gridFor = objectsRevision;
|
|
28625
|
+
return;
|
|
28626
|
+
}
|
|
28627
|
+
for (let i = 0; i < movedObjects.length; i++) {
|
|
28628
|
+
const o = movedObjects[i];
|
|
28629
|
+
o.rayMoved = false;
|
|
28630
|
+
if (objects.get(o.id) === o) place(o);
|
|
28631
|
+
}
|
|
28632
|
+
movedObjects.length = 0;
|
|
28633
|
+
};
|
|
28634
|
+
const sortBySlot = (list2, count) => {
|
|
28635
|
+
for (let i = 1; i < count; i++) {
|
|
28636
|
+
const o = list2[i];
|
|
28637
|
+
let j = i - 1;
|
|
28638
|
+
while (j >= 0 && list2[j].raySlot > o.raySlot) {
|
|
28639
|
+
list2[j + 1] = list2[j];
|
|
28640
|
+
j--;
|
|
28641
|
+
}
|
|
28642
|
+
list2[j + 1] = o;
|
|
28643
|
+
}
|
|
28644
|
+
};
|
|
28645
|
+
const objectsNear = (origin, d, maxDist) => {
|
|
28646
|
+
if (!(maxDist < Infinity)) return -1;
|
|
28647
|
+
const ex = origin[0] + d[0] * maxDist, ey = origin[1] + d[1] * maxDist, ez = origin[2] + d[2] * maxDist;
|
|
28648
|
+
const x0 = cellOf(Math.min(origin[0], ex)), y0 = cellOf(Math.min(origin[1], ey)), z0 = cellOf(Math.min(origin[2], ez));
|
|
28649
|
+
const x1 = cellOf(Math.max(origin[0], ex)), y1 = cellOf(Math.max(origin[1], ey)), z1 = cellOf(Math.max(origin[2], ez));
|
|
28650
|
+
if (!(inGrid(x0) && inGrid(y0) && inGrid(z0) && inGrid(x1) && inGrid(y1) && inGrid(z1))) return -1;
|
|
28651
|
+
if ((x1 - x0 + 1) * (y1 - y0 + 1) * (z1 - z0 + 1) > RAY_GRID_MAX_CELLS) return -1;
|
|
28652
|
+
refreshGrid();
|
|
28653
|
+
const stamp = ++gridQuery;
|
|
28654
|
+
let count = 0;
|
|
28655
|
+
for (let i = 0; i < bigObjects.length; i++) {
|
|
28656
|
+
bigObjects[i].rayStamp = stamp;
|
|
28657
|
+
if (count < gridHits.length) gridHits[count] = bigObjects[i];
|
|
28658
|
+
else gridHits.push(bigObjects[i]);
|
|
28659
|
+
count++;
|
|
28660
|
+
}
|
|
28661
|
+
for (let iz = z0; iz <= z1; iz++)
|
|
28662
|
+
for (let iy = y0; iy <= y1; iy++)
|
|
28663
|
+
for (let ix = x0; ix <= x1; ix++) {
|
|
28664
|
+
const cell = gridCells.get(cellKey3(ix, iy, iz));
|
|
28665
|
+
if (!cell) continue;
|
|
28666
|
+
for (let i = 0; i < cell.length; i++) {
|
|
28667
|
+
const o = cell[i];
|
|
28668
|
+
if (o.rayStamp === stamp) continue;
|
|
28669
|
+
o.rayStamp = stamp;
|
|
28670
|
+
if (count < gridHits.length) gridHits[count] = o;
|
|
28671
|
+
else gridHits.push(o);
|
|
28672
|
+
count++;
|
|
28673
|
+
}
|
|
28674
|
+
}
|
|
28675
|
+
sortBySlot(gridHits, count);
|
|
28676
|
+
return count;
|
|
28677
|
+
};
|
|
28363
28678
|
const NO_SKIP = {};
|
|
28364
28679
|
const rayDirections = [];
|
|
28365
28680
|
let rayDepth = 0;
|
|
@@ -28416,8 +28731,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28416
28731
|
const minRadius = skip.minObjectRadius ?? 0;
|
|
28417
28732
|
let best = null;
|
|
28418
28733
|
const counts = sweepCounts;
|
|
28419
|
-
const
|
|
28420
|
-
|
|
28734
|
+
const near = scope2 || candidates ? -1 : objectsNear(origin, d, maxDist);
|
|
28735
|
+
const visited = scope2 ? scope2.objects : candidates ?? (near >= 0 ? gridHits : objectsInOrder());
|
|
28736
|
+
const visitedCount = near >= 0 ? near : visited.length;
|
|
28737
|
+
for (let oi = 0; oi < visitedCount; oi++) {
|
|
28421
28738
|
const o = visited[oi];
|
|
28422
28739
|
if (counts) counts.objectVisits++;
|
|
28423
28740
|
if (skip.skipLoose && o.loose || o.br < minRadius) continue;
|
|
@@ -28433,8 +28750,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28433
28750
|
objectOrigin[2] = origin[2] - o.st.position[2];
|
|
28434
28751
|
const lo = rotateVecInto(objectTurnBack, objectOrigin, objectOrigin);
|
|
28435
28752
|
const ld = rotateVecInto(objectTurnBack, d, objectDirection);
|
|
28436
|
-
const
|
|
28437
|
-
|
|
28753
|
+
const scoped = scope2?.parts.get(o);
|
|
28754
|
+
const gathered = scoped || counts ? -1 : partsAlong(o, lo, ld, maxDist);
|
|
28755
|
+
const along3 = scoped ?? (gathered >= 0 ? gridParts : o.parts);
|
|
28756
|
+
const alongCount = gathered >= 0 ? gathered : along3.length;
|
|
28757
|
+
for (let pi = 0; pi < alongCount; pi++) {
|
|
28438
28758
|
const p = along3[pi];
|
|
28439
28759
|
if (counts) counts.partVisits++;
|
|
28440
28760
|
if (isLost(p) || ignore?.has(`${o.id}\0${p.spec.id}`)) continue;
|
|
@@ -28444,7 +28764,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28444
28764
|
counts.shapeTested.add(o.id);
|
|
28445
28765
|
}
|
|
28446
28766
|
const r = rayPartInto(o.st.position, o.st.rotation, p.spec, p.q, origin, d, p.pos);
|
|
28447
|
-
if (r && r.t0 < 0 && r.t1 > 0 && p.st.chipped?.length && inGap(p, toLocal(p.pos, p.q, objLocal(o, origin)))) {
|
|
28767
|
+
if ((passed || skip.body) && r && r.t0 < 0 && r.t1 > 0 && p.st.chipped?.length && inGap(p, toLocal(p.pos, p.q, objLocal(o, origin)))) {
|
|
28448
28768
|
r.t0 = 0;
|
|
28449
28769
|
r.n = vec.scale(d, -1);
|
|
28450
28770
|
}
|
|
@@ -29621,7 +29941,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29621
29941
|
for (const i of out) worn[i] = -1;
|
|
29622
29942
|
return knockOutUnits(o, p, point, energy, out, src);
|
|
29623
29943
|
};
|
|
29624
|
-
const knockOutUnits = (o, p, wp, energy, out, src, d, drive = CHIP_DRIVE) => {
|
|
29944
|
+
const knockOutUnits = (o, p, wp, energy, out, src, d, drive = CHIP_DRIVE, severed) => {
|
|
29625
29945
|
var _a, _b;
|
|
29626
29946
|
const [u, v] = planeAxes(p.thin);
|
|
29627
29947
|
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
@@ -29666,7 +29986,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29666
29986
|
setStage(o, p, 1, {}, src);
|
|
29667
29987
|
const center = toWorld(c, q, [(lo[0] + hi[0]) / 2, (lo[1] + hi[1]) / 2, (lo[2] + hi[2]) / 2]);
|
|
29668
29988
|
const units = cells.map((cell) => ({ center: toWorld(c, q, cell.center), size: [cell.size[0], cell.size[1], cell.size[2]] }));
|
|
29669
|
-
emit2({ ...base2(o, src), type: "chip", part: p.spec.id, center, size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]], rotation: q, fragments, units });
|
|
29989
|
+
emit2({ ...base2(o, src), type: "chip", part: p.spec.id, center, size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]], rotation: q, fragments, units, ...severed ? { severed } : {} });
|
|
29670
29990
|
debris2(o, p, p.mat.breakDebris, center, vec.normalize(vec.sub(center, wp), [0, 1, 0]), 14, 3, src);
|
|
29671
29991
|
const cut = wornLocally(p) && cutBandsGone(o, p, cells, d ?? vec.normalize(vec.sub(partXf(o, p).c, wp), [1, 0, 0]), src);
|
|
29672
29992
|
if (p.spec.reinforcement && !cut) exposeRebar(o, p, src);
|
|
@@ -29686,12 +30006,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29686
30006
|
const grid = gridOf(p);
|
|
29687
30007
|
const gone = p.rt.chips ?? {};
|
|
29688
30008
|
const worn = (_a = p.rt).bands ?? (_a.bands = {});
|
|
30009
|
+
const [u, v] = [0, 1, 2].filter((k) => k !== along3);
|
|
30010
|
+
const standing = (band) => grid.filter((cell, i) => gone[i] !== -1 && bandOf2(cell.center[along3]) === band);
|
|
30011
|
+
const bearOn = (a, b) => Math.abs(a.center[u] - b.center[u]) < (a.size[u] + b.size[u]) / 2 - 1e-6 && Math.abs(a.center[v] - b.center[v]) < (a.size[v] + b.size[v]) / 2 - 1e-6;
|
|
29689
30012
|
for (const band of new Set(cells.map((cell) => bandOf2(cell.center[along3])))) {
|
|
29690
30013
|
if ((worn[band] ?? 0) >= 1) continue;
|
|
30014
|
+
const left = standing(band);
|
|
29691
30015
|
const center = -p.dims[along3] / 2 + (band + 0.5) * height;
|
|
29692
|
-
if (
|
|
29693
|
-
|
|
29694
|
-
|
|
30016
|
+
if (left.length === 0) {
|
|
30017
|
+
worn[band] = 1;
|
|
30018
|
+
return giveAtCut(o, p, src, { at: alongAt(along3, center), d });
|
|
30019
|
+
}
|
|
30020
|
+
for (const next of [band - 1, band + 1]) {
|
|
30021
|
+
if (next < 0 || next >= bands || (worn[next] ?? 0) >= 1) continue;
|
|
30022
|
+
const beyond = standing(next);
|
|
30023
|
+
if (beyond.length === 0 || left.some((a) => beyond.some((b) => bearOn(a, b)))) continue;
|
|
30024
|
+
worn[band] = 1;
|
|
30025
|
+
worn[next] = 1;
|
|
30026
|
+
return giveAtCut(o, p, src, { at: alongAt(along3, (center + (-p.dims[along3] / 2 + (next + 0.5) * height)) / 2), d });
|
|
30027
|
+
}
|
|
29695
30028
|
}
|
|
29696
30029
|
return false;
|
|
29697
30030
|
};
|
|
@@ -29854,7 +30187,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29854
30187
|
const at4 = vec.madd(origin, d, s * vec.length(d));
|
|
29855
30188
|
debris2(o, p, "sparks", at4, vec.scale(d, -1), 6, 3, src);
|
|
29856
30189
|
});
|
|
29857
|
-
if (severed
|
|
30190
|
+
if (severed === 0) return;
|
|
30191
|
+
reyield(o, p, barsMoment(p), src);
|
|
30192
|
+
if (barsMoment(p) <= 0) dropAboveCut(o, p, origin, src);
|
|
30193
|
+
};
|
|
30194
|
+
const dropAboveCut = (o, p, wp, src) => {
|
|
30195
|
+
const cut = p.rt.hinges?.reduce((low, h) => Math.min(low, h.point[1]), Infinity) ?? Infinity;
|
|
30196
|
+
if (!Number.isFinite(cut)) return;
|
|
30197
|
+
const gone = p.rt.chips ?? {};
|
|
30198
|
+
const grid = gridOf(p);
|
|
30199
|
+
const above2 = grid.flatMap((cell, i) => gone[i] !== -1 && vec.add(p.pos, rotateVec(p.q, cell.center))[1] > cut ? [i] : []);
|
|
30200
|
+
if (above2.length === 0) return;
|
|
30201
|
+
const ax = [rotateVec(p.q, [1, 0, 0])[1], rotateVec(p.q, [0, 1, 0])[1], rotateVec(p.q, [0, 0, 1])[1]];
|
|
30202
|
+
const floor2 = Math.min(...above2.map((i) => {
|
|
30203
|
+
const cell = grid[i];
|
|
30204
|
+
return vec.add(p.pos, rotateVec(p.q, cell.center))[1] - (Math.abs(ax[0]) * cell.size[0] + Math.abs(ax[1]) * cell.size[1] + Math.abs(ax[2]) * cell.size[2]) / 2;
|
|
30205
|
+
}));
|
|
30206
|
+
knockOutUnits(o, p, wp, 0, above2, src, [0, -1, 0], 0, { point: [p.pos[0], floor2, p.pos[2]], normal: [0, 1, 0] });
|
|
29858
30207
|
};
|
|
29859
30208
|
const giveAtCut = (o, p, src, cut) => {
|
|
29860
30209
|
if (!p.spec.reinforcement || !p.spec.units || !p.st.chipped?.length || sectionLoss(p) <= 0) return false;
|
|
@@ -29948,7 +30297,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29948
30297
|
const unitPlan = p.spec.units ? unitFragmentPlan(p, maxFragments * UNIT_FRAGMENT_FACTOR) : [];
|
|
29949
30298
|
const axis2 = style === "splinter" || style === "snap" ? severAxis(p) : -1;
|
|
29950
30299
|
const cutAt3 = axis2 < 0 ? void 0 : p.rt.cutAt ?? (origin ? hitLocal[axis2] : void 0);
|
|
29951
|
-
const
|
|
30300
|
+
const woodForm = p.mat.splitForm === "slivers" || p.mat.splitForm === "plies" || p.mat.splitForm === "granules" ? p.mat.splitForm : void 0;
|
|
30301
|
+
const planRnd = woodForm ? splitStream(o.id, p.spec.id, hitLocal) : rnd2;
|
|
29952
30302
|
const plan = unitPlan.length > 0 ? unitPlan : planFragments({
|
|
29953
30303
|
style,
|
|
29954
30304
|
dims: p.dims,
|
|
@@ -29959,7 +30309,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29959
30309
|
maxFragments,
|
|
29960
30310
|
rnd: planRnd,
|
|
29961
30311
|
sheet: p.mat.sheet,
|
|
29962
|
-
...
|
|
30312
|
+
...woodForm ? { form: woodForm } : {},
|
|
29963
30313
|
...cutAt3 !== void 0 ? { cut: { at: cutAt3, gap: SEVER_BAND } } : {},
|
|
29964
30314
|
...p.spec.solids ? { solids: p.spec.solids } : {}
|
|
29965
30315
|
});
|
|
@@ -30443,18 +30793,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30443
30793
|
const confinementOf = (conf, point, radius) => {
|
|
30444
30794
|
if (conf === null) return 1;
|
|
30445
30795
|
if (typeof conf === "number") return conf;
|
|
30446
|
-
let
|
|
30796
|
+
let hits2 = 0;
|
|
30447
30797
|
let sum2 = 0;
|
|
30448
30798
|
for (const d of raysOf(Math.max(1, Math.round(conf.rays)))) {
|
|
30449
30799
|
const h = raycastInternal(point, d, radius * conf.reach, void 0, true);
|
|
30450
30800
|
if (h) {
|
|
30451
|
-
|
|
30801
|
+
hits2++;
|
|
30452
30802
|
sum2 += h.distance;
|
|
30453
30803
|
}
|
|
30454
30804
|
}
|
|
30455
|
-
if (
|
|
30456
|
-
const closed =
|
|
30457
|
-
const ratio = clamp2(radius / Math.max(sum2 /
|
|
30805
|
+
if (hits2 === 0) return 1;
|
|
30806
|
+
const closed = hits2 / Math.max(1, Math.round(conf.rays));
|
|
30807
|
+
const ratio = clamp2(radius / Math.max(sum2 / hits2, 1e-3), 0, 2);
|
|
30458
30808
|
return Math.min(Math.max(1, conf.max), 1 + conf.gain * closed ** conf.power * ratio);
|
|
30459
30809
|
};
|
|
30460
30810
|
const FLAG_LOST = 1;
|
|
@@ -31531,6 +31881,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31531
31881
|
poseVersion++;
|
|
31532
31882
|
objectPoses.set(o, (objectPoses.get(o) ?? 0) + 1);
|
|
31533
31883
|
updateBound(o);
|
|
31884
|
+
markMoved(o);
|
|
31534
31885
|
if (o.hosted && (o.hostedHosts?.has(partId) || p.spec.hostedIn !== void 0 && p.st.exposed !== true)) dirtyHosted.add(o);
|
|
31535
31886
|
},
|
|
31536
31887
|
remove(id) {
|
|
@@ -33199,6 +33550,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33199
33550
|
else slab.y0 = round2(slab.y1 - thickness);
|
|
33200
33551
|
slab.mass = Math.max(1, Math.round((slab.aabb[2] - slab.aabb[0]) * (slab.aabb[3] - slab.aabb[1]) * (slab.y1 - slab.y0) * densityOf(slab.material)));
|
|
33201
33552
|
};
|
|
33553
|
+
function footprintWithin(leaf, footprint) {
|
|
33554
|
+
const out = [];
|
|
33555
|
+
for (const r of footprint) {
|
|
33556
|
+
const cut = [Math.max(leaf[0], r[0]), Math.max(leaf[1], r[1]), Math.min(leaf[2], r[2]), Math.min(leaf[3], r[3])];
|
|
33557
|
+
if (cut[2] - cut[0] > 1e-6 && cut[3] - cut[1] > 1e-6) out.push(cut);
|
|
33558
|
+
}
|
|
33559
|
+
return out;
|
|
33560
|
+
}
|
|
33202
33561
|
function cutSlab(context, slab, wallBoxes) {
|
|
33203
33562
|
const { options } = context;
|
|
33204
33563
|
const roof = slab.cover === true;
|
|
@@ -33227,7 +33586,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33227
33586
|
floor: slab.floor,
|
|
33228
33587
|
...slab.cover ? { cover: true } : {},
|
|
33229
33588
|
slab: slab.id,
|
|
33230
|
-
...slab.footprint ? { footprint: slab.footprint } : {}
|
|
33589
|
+
...slab.footprint ? { footprint: footprintWithin(leaf, slab.footprint) } : {}
|
|
33231
33590
|
})
|
|
33232
33591
|
);
|
|
33233
33592
|
context.parts.splice(context.parts.indexOf(slab), 1, ...panels);
|
|
@@ -33712,7 +34071,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33712
34071
|
return spec;
|
|
33713
34072
|
};
|
|
33714
34073
|
var MEMBER_CAGE = { spacing: 0.1, diameter: 0.01, unit: 0.1 };
|
|
33715
|
-
var CAGED_ROLES = /* @__PURE__ */ new Set(["beam", "column"]);
|
|
34074
|
+
var CAGED_ROLES = /* @__PURE__ */ new Set(["beam", "column", "slab"]);
|
|
33716
34075
|
var CAGE_COVER = 0.03;
|
|
33717
34076
|
var CAGE_BUCKLING_SHARE = 0.5;
|
|
33718
34077
|
var DEFAULT_RESIDUAL = 0.15;
|
|
@@ -33990,15 +34349,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33990
34349
|
const pier = (clear - win) / 2;
|
|
33991
34350
|
const at23 = (u) => along3 === 0 ? [u, 0, fixed2] : [fixed2, 0, u];
|
|
33992
34351
|
const size = (u, h) => along3 === 0 ? [u, h, c.thickness] : [c.thickness, h, u];
|
|
33993
|
-
const
|
|
34352
|
+
const put2 = (name, u, h, y, centreU, on) => {
|
|
33994
34353
|
const p = at23(centreU);
|
|
33995
34354
|
wall(`infill_${f}_${side}_${k}_${name}`, size(u, h), [p[0], y, p[2]], on);
|
|
33996
34355
|
};
|
|
33997
34356
|
const id = (name) => `infill_${f}_${side}_${k}_${name}`;
|
|
33998
|
-
|
|
33999
|
-
|
|
34000
|
-
|
|
34001
|
-
|
|
34357
|
+
put2("sill", clear, sill, yb + sill / 2, centre2, [c1, c2]);
|
|
34358
|
+
put2("pl", pier, head - sill, yb + sill + (head - sill) / 2, centre2 - clear / 2 + pier / 2, [c1, id("sill")]);
|
|
34359
|
+
put2("pr", pier, head - sill, yb + sill + (head - sill) / 2, centre2 + clear / 2 - pier / 2, [c2, id("sill")]);
|
|
34360
|
+
put2("head", clear, room - head, yb + head + (room - head) / 2, centre2, [c1, c2]);
|
|
34002
34361
|
const gp = at23(centre2);
|
|
34003
34362
|
const gid = `glass_${f}_${side}_${k}`;
|
|
34004
34363
|
parts2.push({
|
|
@@ -34088,24 +34447,24 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34088
34447
|
const floor2 = `slab_${level - 1}`;
|
|
34089
34448
|
const y = storeyBase(g, level);
|
|
34090
34449
|
const shafts = options.shafts ?? [];
|
|
34091
|
-
const
|
|
34450
|
+
const put2 = (id, material, size, at23, mass, extra = {}) => {
|
|
34092
34451
|
parts2.push({ id: id + sfx, material, shape: box2(size), position: [at23[0], y + size[1] / 2, at23[1]], mass, fill: 0.2, structure: { role: "partition" }, tags: ["mechanical"], ...extra });
|
|
34093
34452
|
rests(joints, id + sfx, floor2, "bolt");
|
|
34094
34453
|
};
|
|
34095
|
-
shafts.forEach((at23, k) =>
|
|
34454
|
+
shafts.forEach((at23, k) => put2(`machine_${k}`, "steel", [1.2, 1, 0.8], at23, c.machineMass + c.suspendedMass, { tags: ["mechanical", "elevator_machine"] }));
|
|
34096
34455
|
const liters = options.waterLiters ?? towerWater(level, options);
|
|
34097
34456
|
const depth = 2;
|
|
34098
34457
|
const side = Math.sqrt(liters / 1e3 / depth);
|
|
34099
34458
|
const [hx] = slabHalf(g);
|
|
34100
34459
|
const tankAt = options.tankAt ?? [-hx / 2, 0];
|
|
34101
34460
|
const shell = 4 * side * depth + 2 * side * side;
|
|
34102
|
-
|
|
34461
|
+
put2("water_tank", c.tankMaterial, [side, depth, side], tankAt, liters + 1100 * c.tankWall * shell, {
|
|
34103
34462
|
fill: shell * c.tankWall / (side * side * depth),
|
|
34104
34463
|
thickness: c.tankWall,
|
|
34105
34464
|
contains: { fluid: "water", liters },
|
|
34106
34465
|
tags: ["mechanical", "water_tank"]
|
|
34107
34466
|
});
|
|
34108
|
-
for (let k = 0; k < c.chillers; k++)
|
|
34467
|
+
for (let k = 0; k < c.chillers; k++) put2(`chiller_${k}`, "steel", [3, 2, 1.5], [-hx + 2 + k * 3.5, -(slabHalf(g)[1] - 2)], c.chillerMass, { tags: ["mechanical", "chiller"] });
|
|
34109
34468
|
return { ...spec, parts: parts2, joints };
|
|
34110
34469
|
}
|
|
34111
34470
|
var DAMPER_DEFAULTS = { ratio: 0.01, modalShare: 0.25, material: "steel", maxHeight: 2.5 };
|
|
@@ -46170,7 +46529,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
46170
46529
|
stack: 6,
|
|
46171
46530
|
shape: "cup",
|
|
46172
46531
|
color: 14215408,
|
|
46173
|
-
rarity: "common"
|
|
46532
|
+
rarity: "common",
|
|
46533
|
+
parts: [
|
|
46534
|
+
{
|
|
46535
|
+
id: "body",
|
|
46536
|
+
material: "glass",
|
|
46537
|
+
thickness: 3e-3
|
|
46538
|
+
}
|
|
46539
|
+
]
|
|
46174
46540
|
},
|
|
46175
46541
|
{
|
|
46176
46542
|
id: "cutlery",
|
|
@@ -52869,14 +53235,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52869
53235
|
var ITEM_CONTRACTS = createItemContracts();
|
|
52870
53236
|
var createGoodsKinds = (options = {}) => defineCategories(GOODS_KINDS, options);
|
|
52871
53237
|
var KINDS2 = createGoodsKinds();
|
|
52872
|
-
var
|
|
53238
|
+
var withKind = (item) => {
|
|
52873
53239
|
const kind = item.kind;
|
|
52874
|
-
|
|
52875
|
-
|
|
53240
|
+
if (!kind || !KINDS2.has(kind)) return item;
|
|
53241
|
+
const defaults = KINDS2.defaults(kind);
|
|
53242
|
+
const seal = defaults.seal;
|
|
53243
|
+
const parts2 = defaults.parts;
|
|
53244
|
+
const own = item.parts;
|
|
53245
|
+
return { ...item, ...seal ? { seal: { ...seal, ...item.seal } } : {}, ...!own && parts2 ? { parts: parts2 } : {} };
|
|
52876
53246
|
};
|
|
52877
53247
|
var goodsPack = {
|
|
52878
53248
|
id: "goods",
|
|
52879
|
-
items: GOODS_ITEMS.map(
|
|
53249
|
+
items: GOODS_ITEMS.map(withKind),
|
|
52880
53250
|
categories: GOODS_CATEGORIES,
|
|
52881
53251
|
places: GOODS_PLACES,
|
|
52882
53252
|
containers: GOODS_CONTAINERS,
|
|
@@ -56480,7 +56850,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56480
56850
|
worlds.set(world, info);
|
|
56481
56851
|
return world;
|
|
56482
56852
|
}
|
|
56483
|
-
function
|
|
56853
|
+
function pointOf3(world, fixtureId) {
|
|
56484
56854
|
const info = worlds.get(world);
|
|
56485
56855
|
return info ? info.points.get(fixtureId) : void 0;
|
|
56486
56856
|
}
|
|
@@ -56621,7 +56991,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56621
56991
|
if (info) for (const f of planned.fixtures) info.points.set(f.global, f.point);
|
|
56622
56992
|
return out;
|
|
56623
56993
|
}
|
|
56624
|
-
return { version: ADAPTER_VERSION, household: hh, plan, createWorld, add: add2, blockedOf, pointOf:
|
|
56994
|
+
return { version: ADAPTER_VERSION, household: hh, plan, createWorld, add: add2, blockedOf, pointOf: pointOf3, ownSpec, registries: { typeMap, contentMap, contentByGroup, chairTables, fixturesOfPoint, substitutes, preference, ownTypes } };
|
|
56625
56995
|
}
|
|
56626
56996
|
var FloorplanInteractables = { version: ADAPTER_VERSION, create: create2, TYPE_MAP, CONTENT_MAP, CONTENT_BY_GROUP, CHAIR_TABLES, PREFERENCE, mergeRegistry };
|
|
56627
56997
|
|
|
@@ -56701,21 +57071,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56701
57071
|
{ type: "buffet", category: "buffet", w: 1.6, d: 0.5, h: 0.9, opening: 0.45 },
|
|
56702
57072
|
{ type: "china_cabinet", category: "china_cabinet", w: 1.2, d: 0.45, h: 2, opening: 0.45 },
|
|
56703
57073
|
{ type: "stairs", category: "stairs", w: 1, d: 3.2, h: 2.8 },
|
|
56704
|
-
{ type: "planter_bed", category: "planter_bed", w: 3, d: 0.7, h: 0.4, color: { role: "dirt" } },
|
|
56705
|
-
{ type: "planter_bed_small", category: "planter_bed", w: 1.8, d: 0.6, h: 0.4, color: { role: "dirt" } },
|
|
57074
|
+
{ type: "planter_bed", category: "planter_bed", w: 3, d: 0.7, h: 0.4, color: { role: "dirt" }, material: "concrete" },
|
|
57075
|
+
{ type: "planter_bed_small", category: "planter_bed", w: 1.8, d: 0.6, h: 0.4, color: { role: "dirt" }, material: "concrete" },
|
|
56706
57076
|
{ type: "tree_small", category: "tree", w: 1.2, d: 1.2, h: 3, color: { role: "lawn" } },
|
|
56707
57077
|
{ type: "tree_large", category: "tree_large", w: 3, d: 3, h: 6, color: { role: "lawn" } },
|
|
56708
|
-
{ type: "shrub", category: "shrub", w: 0.8, d: 0.8, h: 0.9, color: { role: "lawn" } },
|
|
56709
|
-
{ type: "outdoor_pot", category: "outdoor_pot", w: 0.5, d: 0.5, h: 0.7 },
|
|
56710
|
-
{ type: "fountain", category: "fountain", w: 2, d: 2, h: 1.2 },
|
|
57078
|
+
{ type: "shrub", category: "shrub", w: 0.8, d: 0.8, h: 0.9, color: { role: "lawn" }, material: "foliage" },
|
|
57079
|
+
{ type: "outdoor_pot", category: "outdoor_pot", w: 0.5, d: 0.5, h: 0.7, material: "ceramic" },
|
|
57080
|
+
{ type: "fountain", category: "fountain", w: 2, d: 2, h: 1.2, material: "concrete" },
|
|
56711
57081
|
{ type: "garden_bench", category: "garden_bench", w: 1.5, d: 0.5, h: 0.5 },
|
|
56712
57082
|
{ type: "clothesline", category: "clothesline", w: 3.6, d: 0.4, h: 2 },
|
|
56713
57083
|
{ type: "bbq_grill", category: "bbq_grill", w: 1, d: 0.7, h: 1.4 },
|
|
56714
57084
|
{ type: "outbuilding", category: "outbuilding", w: 3.2, d: 3, h: 2.6 },
|
|
56715
57085
|
{ type: "doghouse", category: "doghouse", w: 0.6, d: 0.8, h: 0.7 },
|
|
56716
57086
|
{ type: "water_tank", category: "water_tank", w: 1, d: 1, h: 1.8 },
|
|
56717
|
-
{ type: "pool", category: "pool", w: 7, d: 3.5, h: 0, rim: 1.2, color: { role: "water" } },
|
|
56718
|
-
{ type: "pool_large", category: "pool", w: 9, d: 4.5, h: 0, rim: 1.2, color: { role: "water" } },
|
|
57087
|
+
{ type: "pool", category: "pool", w: 7, d: 3.5, h: 0, rim: 1.2, color: { role: "water" }, material: "concrete" },
|
|
57088
|
+
{ type: "pool_large", category: "pool", w: 9, d: 4.5, h: 0, rim: 1.2, color: { role: "water" }, material: "concrete" },
|
|
56719
57089
|
{ type: "sun_lounger", category: "sun_lounger", w: 0.7, d: 2, h: 0.4, deck: true },
|
|
56720
57090
|
{ type: "outdoor_table", category: "outdoor_table", w: 1.6, d: 1, h: 0.75, deck: true },
|
|
56721
57091
|
{ type: "gas_cylinder", category: "gas_cylinder", w: 0.35, d: 0.35, h: 0.6 },
|
|
@@ -56725,12 +57095,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56725
57095
|
{ type: "track_spot", category: "ceiling_light", w: 0.6, d: 0.1, h: 0.12, decor: true, mount: "ceiling", color: { role: "metal" } },
|
|
56726
57096
|
{ type: "chandelier", category: "ceiling_light", w: 0.7, d: 0.7, h: 0.6, decor: true, mount: "ceiling", color: { role: "metal" } },
|
|
56727
57097
|
{ type: "wall_ac", category: "air_conditioner", w: 0.9, d: 0.25, h: 0.28, decor: true, mount: "wall", color: { role: "ceiling" } },
|
|
56728
|
-
{ type: "ac_condenser", category: "ac_condenser", w: 0.8, d: 0.35, h: 0.6, decor: true, mount: "floor", color: { role: "ceiling" } },
|
|
57098
|
+
{ type: "ac_condenser", category: "ac_condenser", w: 0.8, d: 0.35, h: 0.6, decor: true, mount: "floor", color: { role: "ceiling" }, material: "steel" },
|
|
56729
57099
|
{ type: "picture_small", category: "picture", w: 0.4, d: 0.03, h: 0.5, decor: true, mount: "wall", color: { role: "picture_accent" } },
|
|
56730
57100
|
{ type: "picture_large", category: "picture", w: 0.9, d: 0.03, h: 0.6, decor: true, mount: "wall", color: { role: "picture_accent" } },
|
|
56731
|
-
{ type: "mirror", category: "picture", w: 0.6, d: 0.03, h: 0.9, decor: true, mount: "wall", color: { role: "metal" } },
|
|
56732
|
-
{ type: "floor_plant", category: "plant", w: 0.4, d: 0.4, h: 0.9, decor: true, mount: "floor", color: { role: "lawn" } },
|
|
56733
|
-
{ type: "table_plant", category: "plant", w: 0.2, d: 0.2, h: 0.3, decor: true, mount: "support", color: { role: "lawn" } },
|
|
57101
|
+
{ type: "mirror", category: "picture", w: 0.6, d: 0.03, h: 0.9, decor: true, mount: "wall", color: { role: "metal" }, material: "glass" },
|
|
57102
|
+
{ type: "floor_plant", category: "plant", w: 0.4, d: 0.4, h: 0.9, decor: true, mount: "floor", color: { role: "lawn" }, material: "ceramic" },
|
|
57103
|
+
{ type: "table_plant", category: "plant", w: 0.2, d: 0.2, h: 0.3, decor: true, mount: "support", color: { role: "lawn" }, material: "ceramic" },
|
|
56734
57104
|
{ type: "mailbox", category: "mailbox", w: 0.35, d: 0.3, h: 0.3, decor: true, mount: "wall_top", color: { role: "metal" } },
|
|
56735
57105
|
{ type: "table_lamp", category: "table_light", w: 0.36, d: 0.36, h: 0.5, decor: true, mount: "support", powered: true },
|
|
56736
57106
|
{ type: "hanging_plant", category: "plant", w: 0.3, d: 0.3, h: 0.7, decor: true, mount: "ceiling", color: { role: "lawn" } },
|
|
@@ -56745,11 +57115,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56745
57115
|
{ type: "gourmet_counter_small", category: "gourmet", w: 1.8, d: 0.65, h: 1, window: true, equip: ["bbq_grill", "kitchen_cabinet"] },
|
|
56746
57116
|
{ type: "gourmet_table", category: "gourmet", w: 2.8, d: 0.9, h: 0.78 },
|
|
56747
57117
|
{ type: "gourmet_table_small", category: "gourmet", w: 1.2, d: 0.9, h: 0.78 },
|
|
56748
|
-
{ type: "pool_small", category: "pool", w: 5, d: 2.6, h: 0, rim: 1.2, color: { role: "water" } },
|
|
56749
|
-
{ type: "pool_medium", category: "pool", w: 6, d: 3, h: 0, rim: 1.2, color: { role: "water" } },
|
|
57118
|
+
{ type: "pool_small", category: "pool", w: 5, d: 2.6, h: 0, rim: 1.2, color: { role: "water" }, material: "concrete" },
|
|
57119
|
+
{ type: "pool_medium", category: "pool", w: 6, d: 3, h: 0, rim: 1.2, color: { role: "water" }, material: "concrete" },
|
|
56750
57120
|
{ type: "deck", category: "deck", w: 3, d: 2, h: 0.15, flat: true, deck: true, color: { role: "deck_floor" } },
|
|
56751
|
-
{ type: "garden_bed", category: "garden_bed", w: 2, d: 0.8, h: 0.3, color: { role: "dirt" } },
|
|
56752
|
-
{ type: "fruit_tree", category: "tree", w: 2.2, d: 2.2, h: 3.5, color: { role: "lawn" } },
|
|
57121
|
+
{ type: "garden_bed", category: "garden_bed", w: 2, d: 0.8, h: 0.3, color: { role: "dirt" }, material: "concrete" },
|
|
57122
|
+
{ type: "fruit_tree", category: "tree", w: 2.2, d: 2.2, h: 3.5, color: { role: "lawn" }, material: "foliage" },
|
|
56753
57123
|
{ type: "palm_tree", category: "tree", w: 1.2, d: 1.2, h: 4, color: { role: "lawn" } },
|
|
56754
57124
|
{ type: "pergola", category: "pergola", w: 3.6, d: 3.2, h: 2.4, flat: true, mount: "roof", color: { role: "deck_floor" } },
|
|
56755
57125
|
{ type: "bbq_simple", category: "bbq_simple", w: 0.8, d: 0.6, h: 1.2 },
|
|
@@ -57816,7 +58186,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57816
58186
|
}
|
|
57817
58187
|
var residentialTower = residentialTowerTemplate();
|
|
57818
58188
|
|
|
57819
|
-
// ../game-floorplan-three/dist/chunk-
|
|
58189
|
+
// ../game-floorplan-three/dist/chunk-3EJGIA6V.js
|
|
57820
58190
|
var __defProp4 = Object.defineProperty;
|
|
57821
58191
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
57822
58192
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -57826,6 +58196,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57826
58196
|
"prompt.lockedDoor": "E: locked door",
|
|
57827
58197
|
"prompt.lightOn": "E: turn on the light",
|
|
57828
58198
|
"prompt.lightOff": "E: turn off the light",
|
|
58199
|
+
"prompt.sit": "E: sit",
|
|
58200
|
+
"prompt.lie": "E: lie down",
|
|
57829
58201
|
"what.door": "the door",
|
|
57830
58202
|
"what.curtain": "the curtain",
|
|
57831
58203
|
"what.mailbox": "the mailbox",
|
|
@@ -57852,6 +58224,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57852
58224
|
"prompt.lockedDoor": "E: porta trancada",
|
|
57853
58225
|
"prompt.lightOn": "E: acender a luz",
|
|
57854
58226
|
"prompt.lightOff": "E: apagar a luz",
|
|
58227
|
+
"prompt.sit": "E: sentar",
|
|
58228
|
+
"prompt.lie": "E: deitar",
|
|
57855
58229
|
"what.door": "a porta",
|
|
57856
58230
|
"what.curtain": "a cortina",
|
|
57857
58231
|
"what.mailbox": "a caixa de correio",
|
|
@@ -58103,7 +58477,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58103
58477
|
try {
|
|
58104
58478
|
for (const { b, shut } of pieces) {
|
|
58105
58479
|
shutFaces = shut;
|
|
58106
|
-
|
|
58480
|
+
put2(mat, "box", (b[0] + b[3]) / 2, (b[1] + b[4]) / 2, (b[2] + b[5]) / 2, _qi, b[3] - b[0], b[4] - b[1], b[5] - b[2], color2);
|
|
58107
58481
|
}
|
|
58108
58482
|
} finally {
|
|
58109
58483
|
shared3.ctx.keepOut = taken.length ? taken : void 0;
|
|
@@ -58112,7 +58486,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58112
58486
|
}
|
|
58113
58487
|
return true;
|
|
58114
58488
|
}
|
|
58115
|
-
function
|
|
58489
|
+
function put2(mat, geo, px, py, pz, q, sx, sy, sz, color2, uvr) {
|
|
58116
58490
|
if ((shared3.ctx.keepOut || shared3.ctx.itemBoxes) && geo === "box" && !uvr && keptOut(mat, px, py, pz, q, sx, sy, sz, color2)) return;
|
|
58117
58491
|
if (shared3.ctx.blockBoxes && geo === "box" && mat !== "emissive" && mat !== "glass" && Math.abs(q.x) + Math.abs(q.y) + Math.abs(q.z) < 1e-9) shared3.ctx.blockBoxes.push([px - sx / 2, py - sy / 2, pz - sz / 2, px + sx / 2, py + sy / 2, pz + sz / 2]);
|
|
58118
58492
|
{
|
|
@@ -58206,16 +58580,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58206
58580
|
function boxC(mat, cx, cy, cz, sx, sy, sz, color2, rx = 0, ry = 0, rz = 0, uvr) {
|
|
58207
58581
|
if (rx || ry || rz) _q.setFromEuler(_e.set(rx, ry, rz, "YXZ"));
|
|
58208
58582
|
else _q.identity();
|
|
58209
|
-
|
|
58583
|
+
put2(mat, "box", cx, cy, cz, _q, sx, sy, sz, color2, uvr);
|
|
58210
58584
|
}
|
|
58211
58585
|
function bxBase(mat, x0, y0, z0, x1, y1, z1, color2) {
|
|
58212
58586
|
if (x1 - x0 < 1e-4 || y1 - y0 < 1e-4 || z1 - z0 < 1e-4) return;
|
|
58213
58587
|
_q.identity();
|
|
58214
|
-
|
|
58588
|
+
put2(mat, "box", (x0 + x1) / 2, (y0 + y1) / 2, (z0 + z1) / 2, _q, x1 - x0, y1 - y0, z1 - z0, color2);
|
|
58215
58589
|
}
|
|
58216
58590
|
function cylBase(mat, x, y, z, r, h, color2, seg2 = "cyl") {
|
|
58217
58591
|
_q.identity();
|
|
58218
|
-
|
|
58592
|
+
put2(mat, seg2, x, y + h / 2, z, _q, r * 2, h, r * 2, color2);
|
|
58219
58593
|
}
|
|
58220
58594
|
function polyFace(mat, pts, color2, hint) {
|
|
58221
58595
|
const A = accFor(mat), n = pts.length, O = cursor.org, RY = cursor.ry;
|
|
@@ -58279,7 +58653,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58279
58653
|
const setBx = (f) => {
|
|
58280
58654
|
bxImpl = f;
|
|
58281
58655
|
};
|
|
58282
|
-
const defined = { GEO, UV_SCALE, WITH_MAP, Accumulator, cursor, PARTS, MIRRORS, part, applyPart, _Y, _qa, _qb, pieceRecord, structurePiece, accFor, _q, _e, _col, rgbOf, put, boxC, bx, getBx, setBx, cylBase, polyFace };
|
|
58656
|
+
const defined = { GEO, UV_SCALE, WITH_MAP, Accumulator, cursor, PARTS, MIRRORS, part, applyPart, _Y, _qa, _qb, pieceRecord, structurePiece, accFor, _q, _e, _col, rgbOf, put: put2, boxC, bx, getBx, setBx, cylBase, polyFace };
|
|
58283
58657
|
Object.assign(K, defined);
|
|
58284
58658
|
}
|
|
58285
58659
|
function installKernelNoise(K, _shared) {
|
|
@@ -60374,7 +60748,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60374
60748
|
Object.assign(K, defined);
|
|
60375
60749
|
}
|
|
60376
60750
|
function installRoofTiles(K, shared3) {
|
|
60377
|
-
const { UV_SCALE, _Y, _h2, _q, accFor, cursor, put, rgbOf, structurePiece } = K;
|
|
60751
|
+
const { UV_SCALE, _Y, _h2, _q, accFor, cursor, put: put2, rgbOf, structurePiece } = K;
|
|
60378
60752
|
const sh = (...a) => K.sh(...a);
|
|
60379
60753
|
const R_STYLE = () => shared3.ctx.r && shared3.ctx.r.style || "budget";
|
|
60380
60754
|
function tileRelief(mat, pts, color2, type, origin) {
|
|
@@ -60512,10 +60886,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60512
60886
|
const colonial = type !== "fiber_cement", r = colonial ? 0.085 : 0.075, c = sh(roofColor, colonial ? 0.82 : 0.9), lift = colonial ? 0.05 : 0.035;
|
|
60513
60887
|
_q.setFromUnitVectors(_Y, K._v3.set(dx / Ln, dy / Ln, dz / Ln));
|
|
60514
60888
|
const mx = (a[0] + b[0]) / 2, my = (a[1] + b[1]) / 2 + lift, mz = (a[2] + b[2]) / 2;
|
|
60515
|
-
|
|
60889
|
+
put2("plain", colonial ? "cyl" : "cyl6", mx, my, mz, _q, r * 2, Ln, r * 2, c);
|
|
60516
60890
|
if (colonial) for (let t = 0.25; t < Ln - 0.1; t += 0.42) {
|
|
60517
60891
|
const f = t / Ln;
|
|
60518
|
-
|
|
60892
|
+
put2("plain", "cyl", a[0] + dx * f, a[1] + dy * f + lift, a[2] + dz * f, _q, r * 2.25, 0.035, r * 2.25, sh(c, 0.7));
|
|
60519
60893
|
}
|
|
60520
60894
|
}
|
|
60521
60895
|
function pieceOfPane(x, z) {
|
|
@@ -61994,7 +62368,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61994
62368
|
var UNDER_SINK_VALVE_RISE = 0.1;
|
|
61995
62369
|
var pipeMass = (diameter, length2) => DENSITY.plastic * Math.PI * (diameter / 2) ** 2 * length2 * PIPE_WALL_FILL;
|
|
61996
62370
|
function installUtilitiesWater(K, shared3) {
|
|
61997
|
-
const { THREE, _Y, _q, cursor, cylBase, part, pieceRecord, put } = K;
|
|
62371
|
+
const { THREE, _Y, _q, cursor, cylBase, part, pieceRecord, put: put2 } = K;
|
|
61998
62372
|
function createWater(r, state) {
|
|
61999
62373
|
const H = r.utilities?.plumbing, cap = H ? +H.capacityL || 0 : 0, ls = { dry: [], full: [] }, points = {}, itemPoint = {};
|
|
62000
62374
|
if (H) for (const p of H.points) {
|
|
@@ -62081,7 +62455,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62081
62455
|
const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2], L = Math.hypot(dx, dy, dz);
|
|
62082
62456
|
if (L < 1e-3) return;
|
|
62083
62457
|
_q.setFromUnitVectors(_Y, _v3.set(dx / L, dy / L, dz / L));
|
|
62084
|
-
|
|
62458
|
+
put2("plain", "cyl", (a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2, _q, diameter, L, diameter, color2);
|
|
62085
62459
|
}
|
|
62086
62460
|
const _v3 = new THREE.Vector3();
|
|
62087
62461
|
function layWallRun({ id, routes, diameter, group, meta }) {
|
|
@@ -62346,7 +62720,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62346
62720
|
var END_RENDER = 0.02;
|
|
62347
62721
|
var SLIVER_CLEAR = 5e-4;
|
|
62348
62722
|
var MORTAR_LIFT = 9e-3;
|
|
62349
|
-
function layUnits(rect, coursing,
|
|
62723
|
+
function layUnits(rect, coursing, put2) {
|
|
62350
62724
|
const { courseH, unitLen, joint: joint2, courseBase } = coursing;
|
|
62351
62725
|
const first = Math.floor((rect.y0 - courseBase) / courseH + 1e-6);
|
|
62352
62726
|
for (let row = first; courseBase + row * courseH < rect.y1 - 1e-6; row++) {
|
|
@@ -62366,7 +62740,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62366
62740
|
units[units.length - 1][1] = rect.a1;
|
|
62367
62741
|
if (units.length > 1 && units[0][1] - units[0][0] < MIN_PIECE2) units.splice(0, 2, [rect.a0, units[1][1]]);
|
|
62368
62742
|
if (units.length > 1 && units[units.length - 1][1] - units[units.length - 1][0] < MIN_PIECE2) units.splice(units.length - 2, 2, [units[units.length - 2][0], rect.a1]);
|
|
62369
|
-
for (const [b0, b1] of units)
|
|
62743
|
+
for (const [b0, b1] of units) put2(b0, ya, b1, yb);
|
|
62370
62744
|
}
|
|
62371
62745
|
}
|
|
62372
62746
|
function coreWidthOf(thickness, unitId) {
|
|
@@ -62724,10 +63098,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62724
63098
|
const walled = applyPanels(slabbed, rawStructure, "panels", slabOptions && rawStructure.construction.frame.rebar ? (span) => beamDepthFor(span, slabOptions) : void 0);
|
|
62725
63099
|
return (slabOptions ? deepenBondBeams(walled, rawStructure, slabOptions) : walled).parts;
|
|
62726
63100
|
}
|
|
62727
|
-
function addFrameBox(THREE, parent, box5, mat, id,
|
|
62728
|
-
for (const b of
|
|
63101
|
+
function addFrameBox(THREE, parent, box5, mat, id, block2) {
|
|
63102
|
+
for (const b of block2.length ? outsideBoxes(box5, block2) : [box5]) addStageBox(THREE, parent, b[0], b[1], b[2], b[3], b[4], b[5], mat, id);
|
|
62729
63103
|
}
|
|
62730
|
-
function buildStructuralStageGroups(THREE, rawStructure, outbuildings, runs = [],
|
|
63104
|
+
function buildStructuralStageGroups(THREE, rawStructure, outbuildings, runs = [], block2 = []) {
|
|
62731
63105
|
const foundation = new THREE.Group();
|
|
62732
63106
|
foundation.name = "stage:1:foundation";
|
|
62733
63107
|
const frame2 = new THREE.Group();
|
|
@@ -62768,15 +63142,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62768
63142
|
seatSlabs(slabs.filter((s) => !s.id.startsWith("tank_")), [...beams, ...columns.filter((c) => !c.tank)], beams);
|
|
62769
63143
|
for (const c of columns) {
|
|
62770
63144
|
const mat = c.material === "wood_soft" || c.material === "wood_hard" ? mats.wood : c.material === "steel" ? mats.sheet : mats.concrete;
|
|
62771
|
-
addFrameBox(THREE, frame2, [c.aabb[0], c.y0, c.aabb[1], c.aabb[2], c.y1, c.aabb[3]], mat, c.id,
|
|
63145
|
+
addFrameBox(THREE, frame2, [c.aabb[0], c.y0, c.aabb[1], c.aabb[2], c.y1, c.aabb[3]], mat, c.id, block2);
|
|
62772
63146
|
if (c.tank || c.y0 > 0.1 || c.material !== "concrete") continue;
|
|
62773
63147
|
if (c.floor === 0) addRebarCage(THREE, starterBars, c.aabb, 0, 0.42, mats.rebar);
|
|
62774
63148
|
}
|
|
62775
63149
|
for (const b of beams) {
|
|
62776
63150
|
const p = beamParts.find((x) => x.id === b.id);
|
|
62777
|
-
addFrameBox(THREE, frame2, [b.aabb[0], b.y0, b.aabb[1], b.aabb[2], b.y1, b.aabb[3]], p && (p.material === "wood_soft" || p.material === "wood_hard") ? mats.wood : mats.concrete, b.id,
|
|
63151
|
+
addFrameBox(THREE, frame2, [b.aabb[0], b.y0, b.aabb[1], b.aabb[2], b.y1, b.aabb[3]], p && (p.material === "wood_soft" || p.material === "wood_hard") ? mats.wood : mats.concrete, b.id, block2);
|
|
62778
63152
|
}
|
|
62779
|
-
for (const s of slabs) addFrameBox(THREE, frame2, [s.aabb[0], s.y0, s.aabb[1], s.aabb[2], s.y1, s.aabb[3]], mats.concrete, s.id,
|
|
63153
|
+
for (const s of slabs) addFrameBox(THREE, frame2, [s.aabb[0], s.y0, s.aabb[1], s.aabb[2], s.y1, s.aabb[3]], mats.concrete, s.id, block2);
|
|
62780
63154
|
const wallCores = wallParts.filter(isMasonry).map((w) => {
|
|
62781
63155
|
const line = wallLineOf(w.aabb), width = coreWidthOf(line.thickness, unit), centre = coreLineOf(line, w, columns, width);
|
|
62782
63156
|
return { ...solidOf(w), aabb: line.alongU ? [w.aabb[0], centre - width / 2, w.aabb[2], centre + width / 2] : [centre - width / 2, w.aabb[1], centre + width / 2, w.aabb[3]] };
|
|
@@ -62943,7 +63317,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62943
63317
|
var FLOOR_SLAB_UNDERSIDE = 0.24;
|
|
62944
63318
|
var BOX_COLOR = 15381256;
|
|
62945
63319
|
function installUtilitiesElectrical(K, shared3) {
|
|
62946
|
-
const { _Y, _q, _v3, bx, cursor, cylBase, part, pieceRecord, put } = K;
|
|
63320
|
+
const { _Y, _q, _v3, bx, cursor, cylBase, part, pieceRecord, put: put2 } = K;
|
|
62947
63321
|
const sh = (...a) => K.sh(...a);
|
|
62948
63322
|
function electricalStructure() {
|
|
62949
63323
|
const R = shared3.ctx.r, E = R.utilities?.electrical;
|
|
@@ -62955,7 +63329,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62955
63329
|
const L = Math.hypot(b[0] - a[0], b[1] - a[1], b[2] - a[2]);
|
|
62956
63330
|
if (L < 1e-3) return;
|
|
62957
63331
|
_q.setFromUnitVectors(_Y, _v3.set((b[0] - a[0]) / L, (b[1] - a[1]) / L, (b[2] - a[2]) / L));
|
|
62958
|
-
|
|
63332
|
+
put2("plain", "cyl", (a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2, _q, r_ * 2, L, r_ * 2, wireRun);
|
|
62959
63333
|
};
|
|
62960
63334
|
const pole = (u, v, h) => {
|
|
62961
63335
|
const buried = postEmbedment(h), below = shared3.ctx.visorScene ? 0 : buried;
|
|
@@ -63160,7 +63534,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63160
63534
|
}
|
|
63161
63535
|
return 0;
|
|
63162
63536
|
};
|
|
63163
|
-
const
|
|
63537
|
+
const boundsOf2 = (roomId, x, z) => {
|
|
63164
63538
|
const rects = shared3.ctx.roomById[roomId ?? ""]?.parts ?? [], rect = rects.find((r) => r[0] <= x && x <= r[2] && r[1] <= z && z <= r[3]) ?? rects[0];
|
|
63165
63539
|
return rect ? [rect[0] + WALL_HALF, rect[1] + WALL_HALF, rect[2] - WALL_HALF, rect[3] - WALL_HALF] : [-Infinity, -Infinity, Infinity, Infinity];
|
|
63166
63540
|
};
|
|
@@ -63186,7 +63560,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63186
63560
|
const fittings = [
|
|
63187
63561
|
...lights.map((it) => {
|
|
63188
63562
|
const ceiling = ceilingOf(it), kind = lampOf.get(it.id) ?? DEFAULT_LAMP_TYPE, lamp = kind === "sconce" ? DEFAULT_LAMP_TYPE : kind;
|
|
63189
|
-
const layout = lamp === "tube_t8" ? tubeLayoutOf(it.x, it.z,
|
|
63563
|
+
const layout = lamp === "tube_t8" ? tubeLayoutOf(it.x, it.z, boundsOf2(it.room, it.x, it.z)) : { alongU: true, span: SOCKET_SIZE.t8.spans[0] }, params = { lamp, x: it.x, z: it.z, ...layout };
|
|
63190
63564
|
return { id: it.id, lamp: kind, rough: ceilingSocketParts({ ...params, mountY: undersideAt(it.x, it.z, ceiling) }), finished: ceilingSocketParts({ ...params, mountY: ceiling }) };
|
|
63191
63565
|
}),
|
|
63192
63566
|
...sconces.map((lampPoint) => {
|
|
@@ -63217,7 +63591,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63217
63591
|
const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2], L = Math.hypot(dx, dy, dz);
|
|
63218
63592
|
if (L < 1e-3) return;
|
|
63219
63593
|
_q.setFromUnitVectors(_Y, _v3.set(dx / L, dy / L, dz / L));
|
|
63220
|
-
|
|
63594
|
+
put2("plain", "cyl", (a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2, _q, diameter, L, diameter, color2);
|
|
63221
63595
|
}
|
|
63222
63596
|
const defined = { electricalStructure, pipe2 };
|
|
63223
63597
|
Object.assign(K, defined);
|
|
@@ -63470,7 +63844,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63470
63844
|
Object.assign(K, defined);
|
|
63471
63845
|
}
|
|
63472
63846
|
function installFurnitureApi(K, shared3) {
|
|
63473
|
-
const { _e, _h2, _q, boxC, cursor, macroGround, polyFace, put } = K;
|
|
63847
|
+
const { _e, _h2, _q, boxC, cursor, macroGround, polyFace, put: put2 } = K;
|
|
63474
63848
|
const MATERIAL_MAP2 = { plain: "plain", metal: "metal", wood: "wood", glass: "glass", fabric: "fabric", foam: "fabric", plant: "plant", water: "water", emissive: "emissive", "atlas_picture": "picture", "atlas_floor": "floor", plaster: "plain", matte: "glass", glass_light: "emissive", light: "emissive", ceramic_tile: "plain", parquet: "plain", ceramic: "plain" };
|
|
63475
63849
|
const mm = (k) => MATERIAL_MAP2[k] || "plain";
|
|
63476
63850
|
const LIGHTS = [];
|
|
@@ -63487,7 +63861,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63487
63861
|
cylinder(M, mat, x, y, z, r, h, color2, rx = 0, rz = 0, seg2) {
|
|
63488
63862
|
const [px, pz] = loc(M, x, z);
|
|
63489
63863
|
_q.setFromEuler(_e.set(rx || 0, M.ry, rz || 0, "YXZ"));
|
|
63490
|
-
|
|
63864
|
+
put2(mm(mat), seg2 || "cyl", px, M.base + y + (rx || rz ? 0 : h / 2), pz, _q, r * 2, h, r * 2, color2);
|
|
63491
63865
|
},
|
|
63492
63866
|
leaf(M, x, y, z, w, h, color2, ry = 0, rx = 0) {
|
|
63493
63867
|
const [px, pz] = loc(M, x, z), a = M.ry + (ry || 0), ca = Math.cos(a), sa = Math.sin(a), t1 = (rx || 0) * 0.8, t2 = (rx || 0) * 1.5, y0 = M.base + y;
|
|
@@ -63508,12 +63882,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63508
63882
|
if (uv && mat === "atlas_floor") {
|
|
63509
63883
|
const col = Math.floor(uv.u0 * 4 + 1e-6), lin = uv.v0 < 0.5 ? 1 : 0, cell = col + 4 * lin, h0 = _h2(Math.round(px * 8), Math.round(pz * 8)), type = cell === 5 ? "dirt" : cell === 0 || cell === 1 ? "lawn" : null;
|
|
63510
63884
|
if (type === "dirt") {
|
|
63511
|
-
|
|
63885
|
+
put2("dirt", "plane", px, M.base + y, pz, _q, w, h, 1, sh(color2, 1 / 0.965));
|
|
63512
63886
|
return;
|
|
63513
63887
|
}
|
|
63514
63888
|
if (type) uv = { u0: uv.u0, u1: uv.u1, v0: uv.v0, v1: uv.v1, rot: h0 * 4 | 0, fx: h0 > 0.5 ? 1 : 0, vc: (wx, wz) => macroGround(wx, wz, type) };
|
|
63515
63889
|
}
|
|
63516
|
-
|
|
63890
|
+
put2(mm(mat), "plane", px, M.base + y, pz, _q, w, h, 1, color2, uv);
|
|
63517
63891
|
},
|
|
63518
63892
|
light(M, x, y, z, color2, range3, type, ex) {
|
|
63519
63893
|
const [px, pz] = loc(M, x, z);
|
|
@@ -63539,7 +63913,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63539
63913
|
Object.assign(K, defined);
|
|
63540
63914
|
}
|
|
63541
63915
|
function installFurnitureBuilders(K, shared3) {
|
|
63542
|
-
const { PE, _q, kit2, kk, paletteColor, put, rngOf, sh } = K;
|
|
63916
|
+
const { PE, _q, kit2, kk, paletteColor, put: put2, rngOf, sh } = K;
|
|
63543
63917
|
const counterTap = (...a) => K.counterTap(...a);
|
|
63544
63918
|
const apart = () => !shared3.ctx.visorScene;
|
|
63545
63919
|
const FURNITURE = {
|
|
@@ -63591,7 +63965,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63591
63965
|
lc("metal", -0.08, h + 0.03, -0.05, 0.01, 0.2, 9075290);
|
|
63592
63966
|
_q.identity();
|
|
63593
63967
|
const [px, pz] = [M.x + -0.08 * Math.cos(M.ry) + -0.05 * Math.sin(M.ry), M.z - -0.08 * Math.sin(M.ry) + -0.05 * Math.cos(M.ry)];
|
|
63594
|
-
|
|
63968
|
+
put2("fabric", "cone", px, M.base + h + 0.32, pz, _q, 0.36, 0.2, 0.36, 15259824);
|
|
63595
63969
|
}
|
|
63596
63970
|
},
|
|
63597
63971
|
shelf(M, A, o = {}) {
|
|
@@ -63869,7 +64243,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63869
64243
|
lc("plain", 0, 0, 0, 0.14, 0.03, 2763306);
|
|
63870
64244
|
lc("metal", 0, 0.03, 0, 0.012, M.h - 0.35, 9075290);
|
|
63871
64245
|
_q.identity();
|
|
63872
|
-
|
|
64246
|
+
put2("fabric", "cone", M.x, M.base + (M.y || 0) + M.h - 0.2, M.z, _q, 0.4, 0.3, 0.4, 14733992);
|
|
63873
64247
|
},
|
|
63874
64248
|
microwave(M, A) {
|
|
63875
64249
|
const { b: lb } = kk(M, A);
|
|
@@ -65570,6 +65944,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65570
65944
|
const defined = { NO_COLLIDE, registerCollision, objectDistance, collideObject, collideAt, walkInSolids, kitCollides };
|
|
65571
65945
|
Object.assign(K, defined);
|
|
65572
65946
|
}
|
|
65947
|
+
var PELVIS_FROM_HEAD = 0.95;
|
|
65948
|
+
var SWING_SEAT = 0.45;
|
|
65949
|
+
var SAUNA_BENCH = 0.45;
|
|
65950
|
+
var TUB_FLOOR = 0.12;
|
|
65951
|
+
var PLAN_FURNITURE_SEATS = {
|
|
65952
|
+
sun_lounger: ({ w, d, h }) => [{ id: "lie", pose: "lie", pos: [0, h, -d / 2 + PELVIS_FROM_HEAD], ry: 0, eye: 0.2, exit: [w / 2 + 0.5, 0, 0] }],
|
|
65953
|
+
swing: ({ d }) => [{ id: "seat", pose: "sit", pos: [0, SWING_SEAT, 0], ry: 0, exit: [0, 0, d / 2 + 0.6] }],
|
|
65954
|
+
soaking_tub: ({ d }) => [{ id: "seat", pose: "sit", pos: [0, TUB_FLOOR, -d / 6], ry: 0, exit: [0, 0, d / 2 + 0.5] }],
|
|
65955
|
+
sauna: ({ d }) => [{ id: "bench", pose: "sit", pos: [0, SAUNA_BENCH, -d / 4], ry: 0, exit: [0, 0, d / 2 + 0.5] }]
|
|
65956
|
+
};
|
|
65957
|
+
var planFurnitureSeats = (type, size) => PLAN_FURNITURE_SEATS[type]?.(size) ?? [];
|
|
65573
65958
|
function installInteractionItems(K, shared3) {
|
|
65574
65959
|
const { t, LIGHTS, cursor, definePiece, localOf, registerCollision, togglePiece } = K;
|
|
65575
65960
|
const DOOR_ITEM = /^(tv_unit|tv_unit_small|tv_unit_large|sideboard|china_cabinet|filing_cabinet|pantry|laundry_cabinet|wardrobe|wardrobe_small|wardrobe_large|closet_wardrobe|kitchen_cabinet|kitchen_cabinet_large|kitchen_cabinet_small|fridge|fridge_large|display_fridge_medium|display_fridge)$/;
|
|
@@ -65589,11 +65974,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65589
65974
|
function buildItem2(m, M, ent, api, parent) {
|
|
65590
65975
|
registerCollision(m, M);
|
|
65591
65976
|
const type = m.type;
|
|
65977
|
+
seatItem(m, M);
|
|
65592
65978
|
if (LIGHT_TYPES.has(type)) return lightItem(m, M, ent, api, parent);
|
|
65593
65979
|
if (type === "curtain") return curtainItem(m, M, ent, api, parent);
|
|
65594
65980
|
if (DOOR_ITEM.test(type) || DRAWER_ITEM.test(type)) return furnitureItem(m, M, ent, api, parent, DRAWER_ITEM.test(type));
|
|
65595
65981
|
ent.f(M, api);
|
|
65596
65982
|
}
|
|
65983
|
+
function seatItem(m, M) {
|
|
65984
|
+
const seats = planFurnitureSeats(m.type, { w: M.w, d: M.d, h: M.h });
|
|
65985
|
+
const first = seats[0];
|
|
65986
|
+
if (!first) return;
|
|
65987
|
+
const base2 = M.base + (M.y || 0), [ax, az] = localOf(M, first.pos[0], first.pos[2]);
|
|
65988
|
+
I().items.push({ type: "seat", id: m.id, floor: M.floor, anchor: [ax, base2 + first.pos[1], az], range: 1.6, angle: 1.1, pieces: [], seats, mount: { x: M.x, y: base2, z: M.z, ry: M.ry }, text: () => t(first.pose === "lie" ? "prompt.lie" : "prompt.sit"), action: () => void 0 });
|
|
65989
|
+
}
|
|
65597
65990
|
function lightItem(m, M, ent, api, parent) {
|
|
65598
65991
|
M.on = M.light = M.lit = true;
|
|
65599
65992
|
const n0 = LIGHTS.length, name = shared3.quality === "game" ? "ix:light:" + m.room + "@" + parent : "ix:light:" + m.id;
|
|
@@ -66743,7 +67136,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66743
67136
|
PL.push(l);
|
|
66744
67137
|
}
|
|
66745
67138
|
const slotOf = (i) => lease ? lease.handles[i].slot : i;
|
|
66746
|
-
const
|
|
67139
|
+
const put2 = (i, v) => {
|
|
66747
67140
|
if (lease) {
|
|
66748
67141
|
lease.handles[i].update(v.color === void 0 || typeof v.color === "number" ? v : { ...v, color: new THREE.Color(v.color).getHex() });
|
|
66749
67142
|
return;
|
|
@@ -66882,13 +67275,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66882
67275
|
const b0 = LZU.uRB0.value, b1 = LZU.uRB1.value, b2 = LZU.uRB2.value, by = LZU.uRBY.value, ex = LZU.uREx.value;
|
|
66883
67276
|
A.crates[i] = g ? { k: g.k, rects: g.rects, y: g.y, exterior: !!g.exterior, exclusion: g.exclusion || null, d: g.d } : null;
|
|
66884
67277
|
if (!g) {
|
|
66885
|
-
|
|
67278
|
+
put2(i, { intensity: 0 });
|
|
66886
67279
|
for (const a of [b0, b1, b2, ex]) a.set(EMPTY, at4 * 4);
|
|
66887
67280
|
by.set([0, 0], at4 * 2);
|
|
66888
67281
|
continue;
|
|
66889
67282
|
}
|
|
66890
67283
|
const lamp = g.exterior ? { intensity: g.lumens, distance: g.dist, decay: g.decay } : { intensity: (7 + g.range * 0.8) * lim(1 + 0.4 * (Math.sqrt(g.n) - 1), 1, 2.2), distance: Math.max(3, g.dm * 1.3 + 0.5), decay: 1.6 };
|
|
66891
|
-
|
|
67284
|
+
put2(i, { position: g.pos, color: g.color, ...lamp });
|
|
66892
67285
|
const rs = g.rects;
|
|
66893
67286
|
b0.set(rs[0] || EMPTY, at4 * 4);
|
|
66894
67287
|
b1.set(rs[1] || EMPTY, at4 * 4);
|
|
@@ -67428,7 +67821,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67428
67821
|
const bars = def && def.reinforcement ? pc.role === "column" || pc.role === "beam" ? { ...def.reinforcement, diameter: Math.max(def.reinforcement.diameter, MEMBER_CAGE.diameter) } : def.reinforcement : null;
|
|
67429
67822
|
const cage = bars ? pc.role === "column" && sp.shape.kind === "box" ? { ...bars, residualCapacity: cageResidualCapacity(sp.shape.size, bars, sp.structure?.capacity) } : { ...bars } : null;
|
|
67430
67823
|
const out = cage && !sp.reinforcement ? { ...sp, reinforcement: cage } : sp;
|
|
67431
|
-
if (out.reinforcement && !out.units && pc.material === "concrete" && (pc.role
|
|
67824
|
+
if (out.reinforcement && !out.units && pc.material === "concrete" && CAGED_ROLES.has(pc.role) && sp.shape.kind === "box") {
|
|
67432
67825
|
return { ...out, units: { size: [MEMBER_CAGE.unit, MEMBER_CAGE.unit, Math.min(...sp.shape.size)], bond: "stack", mortar: "concrete" } };
|
|
67433
67826
|
}
|
|
67434
67827
|
return out;
|
|
@@ -67491,6 +67884,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67491
67884
|
if (distance4 <= -depth) return true;
|
|
67492
67885
|
return distance4 <= -depth * noise3();
|
|
67493
67886
|
}
|
|
67887
|
+
var WALL_ALONG_U = { along: 0, up: 1, across: 2 };
|
|
67888
|
+
var WALL_ALONG_V = { along: 2, up: 1, across: 0 };
|
|
67889
|
+
var LYING = { along: 0, up: 2, across: 1 };
|
|
67890
|
+
function extentOf(part, axis2) {
|
|
67891
|
+
if (axis2 === 1) return [part.y0, part.y1];
|
|
67892
|
+
return axis2 === 0 ? [part.aabb[0], part.aabb[2]] : [part.aabb[1], part.aabb[3]];
|
|
67893
|
+
}
|
|
67894
|
+
function planeAxesOf(part) {
|
|
67895
|
+
const [u0, v0, u1, v1] = part.aabb;
|
|
67896
|
+
if (thinAxisOf([u1 - u0, part.y1 - part.y0, v1 - v0]) === 1) return LYING;
|
|
67897
|
+
return u1 - u0 >= v1 - v0 ? WALL_ALONG_U : WALL_ALONG_V;
|
|
67898
|
+
}
|
|
67899
|
+
function pointOf2(axes, along22, up, across2) {
|
|
67900
|
+
const out = [0, 0, 0];
|
|
67901
|
+
out[axes.along] = along22;
|
|
67902
|
+
out[axes.up] = up;
|
|
67903
|
+
out[axes.across] = across2;
|
|
67904
|
+
return out;
|
|
67905
|
+
}
|
|
67494
67906
|
var JOINT_SHARE = 0.5;
|
|
67495
67907
|
var EPSILON22 = 1e-4;
|
|
67496
67908
|
function carve(boxes, grid) {
|
|
@@ -67600,11 +68012,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67600
68012
|
const boxes = part.gone?.length ? subtract2(mergeSpans(part.spans), part.gone) : mergeSpans(part.spans);
|
|
67601
68013
|
for (const s of line.open ? mergeSpans(carve(boxes, line.open), 0) : boxes) {
|
|
67602
68014
|
const along22 = line.start + (s.a + s.b) / 2;
|
|
67603
|
-
point.set(line.
|
|
67604
|
-
const
|
|
68015
|
+
point.set(...pointOf2(line.axes, along22, (s.y0 + s.y1) / 2, part.mid)).applyMatrix4(toMesh);
|
|
68016
|
+
const [hx, hy, hz2] = pointOf2(line.axes, (s.b - s.a) / 2, (s.y1 - s.y0) / 2, part.thick / 2);
|
|
67605
68017
|
out.push({
|
|
67606
68018
|
center: [point.x, point.y, point.z],
|
|
67607
|
-
half: [
|
|
68019
|
+
half: [hx * scale.x, hy * scale.y, hz2 * scale.z],
|
|
67608
68020
|
rotation: [turn2.x, turn2.y, turn2.z, turn2.w],
|
|
67609
68021
|
kind: "box"
|
|
67610
68022
|
});
|
|
@@ -67662,6 +68074,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67662
68074
|
var SPALL_MIN = 0.025;
|
|
67663
68075
|
var SPALL_RAGGED = 0.045;
|
|
67664
68076
|
var PLASTER_REACH = { least: SPALL_MIN, band: SPALL_RAGGED };
|
|
68077
|
+
var CAST_GAP = 2e-3;
|
|
67665
68078
|
var COVER2 = 0.015;
|
|
67666
68079
|
var LUMP_BAR_INSET = 0.035;
|
|
67667
68080
|
var LUMPS_PER_BAR = 1;
|
|
@@ -67680,6 +68093,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67680
68093
|
if (hi[0] - lo[0] <= 1e-4 || hi[1] - lo[1] <= 1e-4 || hi[2] - lo[2] <= 1e-4) return null;
|
|
67681
68094
|
return { x: (lo[0] + hi[0]) / 2, y: (lo[1] + hi[1]) / 2, z: (lo[2] + hi[2]) / 2, sx: hi[0] - lo[0], sy: hi[1] - lo[1], sz: hi[2] - lo[2], colour: unit.colour };
|
|
67682
68095
|
}
|
|
68096
|
+
var axisVector = (axis2) => [axis2 === 0 ? 1 : 0, axis2 === 1 ? 1 : 0, axis2 === 2 ? 1 : 0];
|
|
68097
|
+
function unitBoxOf(axes, centre, size, colour) {
|
|
68098
|
+
const [x, y, z] = pointOf2(axes, centre[0], centre[1], centre[2]), [sx, sy, sz] = pointOf2(axes, size[0], size[1], size[2]);
|
|
68099
|
+
return { x, y, z, sx, sy, sz, colour };
|
|
68100
|
+
}
|
|
68101
|
+
function coatedInside(bounds2, axes) {
|
|
68102
|
+
const inner = [...bounds2];
|
|
68103
|
+
inner[axes.along] = bounds2[axes.along] + COVER2;
|
|
68104
|
+
inner[axes.along + 3] = bounds2[axes.along + 3] - COVER2;
|
|
68105
|
+
inner[axes.up + 3] = bounds2[axes.up + 3] - COVER2;
|
|
68106
|
+
if (axes.up !== 1) inner[axes.up] = bounds2[axes.up] + COVER2;
|
|
68107
|
+
return inner;
|
|
68108
|
+
}
|
|
67683
68109
|
function installDestructionBreach(K, _shared) {
|
|
67684
68110
|
const { THREE, fragmentMaterial, invalidate, invalidateShadow } = K;
|
|
67685
68111
|
const paintState = { attached: false };
|
|
@@ -67848,13 +68274,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67848
68274
|
hasStrike = true;
|
|
67849
68275
|
};
|
|
67850
68276
|
function cells(part, units, mask) {
|
|
67851
|
-
const [
|
|
67852
|
-
const
|
|
67853
|
-
const
|
|
67854
|
-
const
|
|
67855
|
-
const [
|
|
67856
|
-
const rows = Math.max(1, Math.round((
|
|
67857
|
-
const rowH = (
|
|
68277
|
+
const [a0, a1] = extentOf(part, mask.axes.along), [up0, up1] = extentOf(part, mask.axes.up);
|
|
68278
|
+
const len = a1 - a0;
|
|
68279
|
+
const offset = a0 - mask.start;
|
|
68280
|
+
const merge = Math.max(1, Math.ceil(Math.sqrt(Math.max(1, Math.round((up1 - up0) / units.size[1])) * Math.max(1, Math.round(len / units.size[0])) / BREACH_GRID_CAP)));
|
|
68281
|
+
const ul = units.size[0] * merge, uh = units.size[1] * merge;
|
|
68282
|
+
const rows = Math.max(1, Math.round((up1 - up0) / uh));
|
|
68283
|
+
const rowH = (up1 - up0) / rows;
|
|
67858
68284
|
const per = Math.max(1, Math.round(len / ul));
|
|
67859
68285
|
const w = len / per;
|
|
67860
68286
|
const out = [];
|
|
@@ -67862,7 +68288,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67862
68288
|
const shift = units.bond === "running" && r & 1 ? w / 2 : 0;
|
|
67863
68289
|
for (let i = 0; i < per + (shift ? 1 : 0); i++) {
|
|
67864
68290
|
const a = Math.max(0, i * w - shift), b = Math.min(len, i * w - shift + w);
|
|
67865
|
-
if (b - a > 1e-3) out.push({ a: offset + a, b: offset + b, y0:
|
|
68291
|
+
if (b - a > 1e-3) out.push({ a: offset + a, b: offset + b, y0: up0 + r * rowH, y1: up0 + (r + 1) * rowH, r, i });
|
|
67866
68292
|
}
|
|
67867
68293
|
}
|
|
67868
68294
|
return out;
|
|
@@ -67930,8 +68356,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67930
68356
|
return [...first, ...other];
|
|
67931
68357
|
}
|
|
67932
68358
|
const pillarSpans = (view) => structure.parts.filter((q) => q.role === "column" && wallsAround(q).includes(view.host)).map((q) => {
|
|
67933
|
-
const
|
|
67934
|
-
return { a, b
|
|
68359
|
+
const [from, to] = extentOf(q, view.mask.axes.along), [y0, y1] = extentOf(q, view.mask.axes.up);
|
|
68360
|
+
return { a: from - view.mask.start, b: to - view.mask.start, y0, y1 };
|
|
67935
68361
|
});
|
|
67936
68362
|
const windowGaps = (view) => (structure.openings ?? []).filter((o) => o.kind === "window" && o.wall === view.host).map((o) => ({ a: Math.min(o.from, o.to) - view.mask.start, b: Math.max(o.from, o.to) - view.mask.start, y0: o.y0, y1: o.y1 }));
|
|
67937
68363
|
function outsideGaps(c, gaps) {
|
|
@@ -67980,9 +68406,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67980
68406
|
sh.uniforms.uToHouse = toHouse;
|
|
67981
68407
|
sh.uniforms.uMask = { value: mask.texture };
|
|
67982
68408
|
sh.uniforms.uMaskRect = { value: mask.rect };
|
|
67983
|
-
sh.uniforms.
|
|
68409
|
+
sh.uniforms.uMaskAlong = { value: axisVector(mask.axes.along) };
|
|
68410
|
+
sh.uniforms.uMaskUp = { value: axisVector(mask.axes.up) };
|
|
67984
68411
|
sh.vertexShader = sh.vertexShader.replace("void main() {", "uniform mat4 uToHouse;\nvarying vec3 vHousePos;\nvoid main() {").replace("#include <begin_vertex>", "#include <begin_vertex>\nvHousePos = (uToHouse * vec4(transformed, 1.0)).xyz;");
|
|
67985
|
-
sh.fragmentShader = sh.fragmentShader.replace("void main() {", "uniform sampler2D uMask;\nuniform vec4 uMaskRect;\nuniform
|
|
68412
|
+
sh.fragmentShader = sh.fragmentShader.replace("void main() {", "uniform sampler2D uMask;\nuniform vec4 uMaskRect;\nuniform vec3 uMaskAlong;\nuniform vec3 uMaskUp;\nvarying vec3 vHousePos;\nvoid main() {\n vec2 mUv = vec2((dot(vHousePos, uMaskAlong) - uMaskRect.x) / uMaskRect.z, (dot(vHousePos, uMaskUp) - uMaskRect.y) / uMaskRect.w);\n if (mUv.x >= 0.0 && mUv.x <= 1.0 && mUv.y >= 0.0 && mUv.y <= 1.0 && texture2D(uMask, mUv).r > 0.5) discard;");
|
|
67986
68413
|
};
|
|
67987
68414
|
material.customProgramCacheKey = () => "breachMask" + (base2.customProgramCacheKey?.() ?? "");
|
|
67988
68415
|
const mesh3 = new THREE.Mesh(g, material);
|
|
@@ -67990,7 +68417,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67990
68417
|
mesh3.userData.breachMask = mask;
|
|
67991
68418
|
mesh3.userData.cutAt = (p) => {
|
|
67992
68419
|
const v = local2([p.x, p.y, p.z]);
|
|
67993
|
-
const i = Math.floor((
|
|
68420
|
+
const i = Math.floor((v[mask.axes.along] - mask.start) / mask.len * mask.w), j = Math.floor((v[mask.axes.up] - mask.y0) / mask.height * mask.h);
|
|
67994
68421
|
return i >= 0 && i < mask.w && j >= 0 && j < mask.h && mask.data[j * mask.w + i] > 127;
|
|
67995
68422
|
};
|
|
67996
68423
|
mesh3.position.copy(it.mesh.position);
|
|
@@ -68017,9 +68444,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68017
68444
|
material.onBeforeCompile = (sh) => {
|
|
68018
68445
|
sh.uniforms.uCore = { value: core.texture };
|
|
68019
68446
|
sh.uniforms.uCoreRect = { value: core.rect };
|
|
68020
|
-
sh.uniforms.
|
|
68447
|
+
sh.uniforms.uCoreAlong = { value: axisVector(core.axes.along) };
|
|
68448
|
+
sh.uniforms.uCoreUp = { value: axisVector(core.axes.up) };
|
|
68021
68449
|
sh.vertexShader = sh.vertexShader.replace("void main() {", "varying vec3 vHousePos;\nvoid main() {").replace("#include <begin_vertex>", "#include <begin_vertex>\n#ifdef USE_INSTANCING\nvHousePos = (instanceMatrix * vec4(transformed, 1.0)).xyz;\n#else\nvHousePos = transformed;\n#endif");
|
|
68022
|
-
sh.fragmentShader = sh.fragmentShader.replace("void main() {", "uniform sampler2D uCore;\nuniform vec4 uCoreRect;\nuniform
|
|
68450
|
+
sh.fragmentShader = sh.fragmentShader.replace("void main() {", "uniform sampler2D uCore;\nuniform vec4 uCoreRect;\nuniform vec3 uCoreAlong;\nuniform vec3 uCoreUp;\nvarying vec3 vHousePos;\nvoid main() {\n vec2 cUv = vec2((dot(vHousePos, uCoreAlong) - uCoreRect.x) / uCoreRect.z, (dot(vHousePos, uCoreUp) - uCoreRect.y) / uCoreRect.w);\n if (cUv.x >= 0.0 && cUv.x <= 1.0 && cUv.y >= 0.0 && cUv.y <= 1.0 && texture2D(uCore, cUv).r > 0.5) discard;").replace("#include <color_fragment>", "#include <color_fragment>\nif (!gl_FrontFacing) diffuseColor.rgb *= 0.55;");
|
|
68023
68451
|
};
|
|
68024
68452
|
material.customProgramCacheKey = () => "breachCore";
|
|
68025
68453
|
material.userData.breachCore = core;
|
|
@@ -68038,17 +68466,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68038
68466
|
}
|
|
68039
68467
|
function maskOf(hostId, parts2) {
|
|
68040
68468
|
const host = structure.byId.get(hostId);
|
|
68041
|
-
const
|
|
68042
|
-
const
|
|
68043
|
-
const y0 = Math.min(...parts2.map((id) => structure.byId.get(id).
|
|
68044
|
-
const len =
|
|
68469
|
+
const axes = planeAxesOf(host);
|
|
68470
|
+
const [start, end3] = extentOf(host, axes.along);
|
|
68471
|
+
const y0 = Math.min(...parts2.map((id) => extentOf(structure.byId.get(id), axes.up)[0])), y1 = Math.max(...parts2.map((id) => extentOf(structure.byId.get(id), axes.up)[1]));
|
|
68472
|
+
const len = end3 - start;
|
|
68045
68473
|
const w = Math.max(2, Math.min(2048, Math.ceil(len / MASK_TEXEL))), h = Math.max(2, Math.min(1024, Math.ceil((y1 - y0) / MASK_TEXEL)));
|
|
68046
68474
|
const data = new Uint8Array(w * h);
|
|
68047
68475
|
const texture = new THREE.DataTexture(data, w, h, THREE.RedFormat);
|
|
68048
68476
|
texture.magFilter = THREE.LinearFilter;
|
|
68049
68477
|
texture.minFilter = THREE.LinearFilter;
|
|
68050
68478
|
texture.needsUpdate = true;
|
|
68051
|
-
return { data, texture, w, h,
|
|
68479
|
+
return { data, texture, w, h, axes, start, len, y0, height: y1 - y0, rect: new THREE.Vector4(start, y0, len, y1 - y0) };
|
|
68052
68480
|
}
|
|
68053
68481
|
function besidePillars(c, pillars) {
|
|
68054
68482
|
let { a, b } = c;
|
|
@@ -68077,13 +68505,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68077
68505
|
}
|
|
68078
68506
|
function splitUnits(view, id, around) {
|
|
68079
68507
|
const { mask } = view;
|
|
68080
|
-
const along22 = (p) =>
|
|
68508
|
+
const along22 = (p) => p[mask.axes.along] - mask.start;
|
|
68509
|
+
const upOf = (p) => p[mask.axes.up];
|
|
68081
68510
|
const part = structure.byId.get(id), units = specOf(id).units, chips2 = view.chips.get(id), opening = view.openings.get(id);
|
|
68082
68511
|
const own = cells(part, units, mask);
|
|
68083
68512
|
const all = (id === view.host ? own.flatMap((c) => besidePillars(c, around.pillars)) : own).flatMap((c) => outsideGaps(c, around.gaps));
|
|
68084
68513
|
const holes = [], kept = [];
|
|
68085
68514
|
if (view.fallen.has(id)) return { all, kept, holes: all, boxes: [] };
|
|
68086
|
-
const boxes = chips2.map((k) => ({ s0: along22(k.center) - k.along, s1: along22(k.center) + k.along, y0: k.center
|
|
68515
|
+
const boxes = chips2.map((k) => ({ s0: along22(k.center) - k.along, s1: along22(k.center) + k.along, y0: upOf(k.center) - k.up, y1: upOf(k.center) + k.up }));
|
|
68087
68516
|
const gone = (c) => {
|
|
68088
68517
|
const over = boxes.filter((k) => k.s1 > c.a && k.s0 < c.b && k.y1 > c.y0 && k.y0 < c.y1);
|
|
68089
68518
|
const share = covered(c, over);
|
|
@@ -68091,7 +68520,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68091
68520
|
const s = (c.a + c.b) / 2, y = (c.y0 + c.y1) / 2;
|
|
68092
68521
|
return share >= 0.5 && over.some((k) => s >= k.s0 && s <= k.s1 && y >= k.y0 && y <= k.y1);
|
|
68093
68522
|
};
|
|
68094
|
-
const open = (c) => gone(c) || opening !== void 0 && Math.hypot((c.a + c.b) / 2 - along22(opening.center), (c.y0 + c.y1) / 2 - opening.center
|
|
68523
|
+
const open = (c) => gone(c) || opening !== void 0 && Math.hypot((c.a + c.b) / 2 - along22(opening.center), (c.y0 + c.y1) / 2 - upOf(opening.center)) < opening.radius;
|
|
68095
68524
|
for (const c of all) (open(c) ? holes : kept).push(c);
|
|
68096
68525
|
return { all, kept, holes, boxes };
|
|
68097
68526
|
}
|
|
@@ -68104,20 +68533,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68104
68533
|
function publishStanding(view) {
|
|
68105
68534
|
if (!view.saved) return;
|
|
68106
68535
|
const { mask } = view;
|
|
68107
|
-
const along22 = (p) =>
|
|
68536
|
+
const along22 = (p) => p[mask.axes.along] - mask.start;
|
|
68537
|
+
const upOf = (p) => p[mask.axes.up];
|
|
68108
68538
|
const parts2 = view.parts.map((id) => {
|
|
68109
68539
|
const part = structure.byId.get(id);
|
|
68110
|
-
const
|
|
68111
|
-
const
|
|
68112
|
-
const gone = (view.chips.get(id) ?? []).map((k) => ({ a: along22(k.center) - k.along, b: along22(k.center) + k.along, y0: k.center
|
|
68540
|
+
const [across0, across1] = extentOf(part, mask.axes.across);
|
|
68541
|
+
const thick = across1 - across0, mid = (across0 + across1) / 2;
|
|
68542
|
+
const gone = (view.chips.get(id) ?? []).map((k) => ({ a: along22(k.center) - k.along, b: along22(k.center) + k.along, y0: upOf(k.center) - k.up, y1: upOf(k.center) + k.up }));
|
|
68113
68543
|
return { spans: view.kept.get(id) ?? [], gone, thick, mid };
|
|
68114
68544
|
});
|
|
68115
|
-
const line = {
|
|
68545
|
+
const line = { axes: mask.axes, start: mask.start, open: view.core };
|
|
68116
68546
|
view.items.forEach((it, k) => publishSolids(it.mesh, it.v0, it.v1, k === 0 ? standingSolids(THREE, house, it.mesh, line, parts2) : []));
|
|
68117
68547
|
}
|
|
68118
68548
|
function paint2(view) {
|
|
68119
68549
|
const { mask, core } = view;
|
|
68120
|
-
const along22 = (p) =>
|
|
68550
|
+
const along22 = (p) => p[mask.axes.along] - mask.start;
|
|
68551
|
+
const upOf = (p) => p[mask.axes.up];
|
|
68121
68552
|
const holes = [];
|
|
68122
68553
|
const pits = [];
|
|
68123
68554
|
const discs = [];
|
|
@@ -68133,10 +68564,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68133
68564
|
view.kept.set(id, []);
|
|
68134
68565
|
continue;
|
|
68135
68566
|
}
|
|
68136
|
-
const
|
|
68137
|
-
const
|
|
68138
|
-
if (opening) discs.push({ s: along22(opening.center), y: opening.center
|
|
68139
|
-
for (const k of spalls) flakes.push({ s: along22(k.center), y: k.center
|
|
68567
|
+
const [across0, across1] = extentOf(part, mask.axes.across);
|
|
68568
|
+
const thick = across1 - across0, mid = (across0 + across1) / 2;
|
|
68569
|
+
if (opening) discs.push({ s: along22(opening.center), y: upOf(opening.center), r: opening.radius });
|
|
68570
|
+
for (const k of spalls) flakes.push({ s: along22(k.center), y: upOf(k.center), r: k.radius });
|
|
68140
68571
|
holes.push(...lost);
|
|
68141
68572
|
view.kept.set(id, kept);
|
|
68142
68573
|
if (units2.mortar === part.material) {
|
|
@@ -68192,18 +68623,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68192
68623
|
const list2 = [];
|
|
68193
68624
|
const tone = (hex2, k) => tmp.c.setHex(hex2).multiplyScalar(k).getHex();
|
|
68194
68625
|
const b = view.bounds;
|
|
68195
|
-
const inner =
|
|
68626
|
+
const inner = coatedInside(b, mask.axes);
|
|
68196
68627
|
for (const { c, part, units: units2, thick, mid } of shown2) {
|
|
68197
68628
|
if (!near(c)) continue;
|
|
68198
68629
|
const centre = mask.start + (c.a + c.b) / 2, y = (c.y0 + c.y1) / 2, len = c.b - c.a, h = c.y1 - c.y0;
|
|
68199
68630
|
const at4 = (s, dy, d, colour) => {
|
|
68200
|
-
const unit = clipToBox(
|
|
68201
|
-
if (unit && !discs.some((k) =>
|
|
68631
|
+
const unit = clipToBox(unitBoxOf(mask.axes, [centre, y, mid], [s, dy, d], colour), inner);
|
|
68632
|
+
if (unit && !discs.some((k) => {
|
|
68633
|
+
const p = [unit.x, unit.y, unit.z];
|
|
68634
|
+
return Math.hypot(p[mask.axes.along] - mask.start - k.s, p[mask.axes.up] - k.y) < k.r;
|
|
68635
|
+
})) list2.push(unit);
|
|
68202
68636
|
};
|
|
68203
68637
|
const base2 = fragmentMaterial(part.material).color.getHex();
|
|
68204
68638
|
const n = noise2(centre * 3.1, y * 2.7, 0.07);
|
|
68205
68639
|
if (units2.mortar === "concrete") {
|
|
68206
|
-
at4(len, h, thick - 2 * COVER2, tone(base2, 0.9 + 0.04 * n));
|
|
68640
|
+
at4(len - CAST_GAP, h - CAST_GAP, thick - 2 * COVER2, tone(base2, 0.9 + 0.04 * n));
|
|
68207
68641
|
} else {
|
|
68208
68642
|
at4(len, h, thick - 2 * COVER2 - 0.012, 10327948);
|
|
68209
68643
|
at4(len - 0.012, h - 0.012, thick - 2 * COVER2, tone(base2, 0.8 + 0.35 * n));
|
|
@@ -68232,14 +68666,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68232
68666
|
view.flakes = flakes.length;
|
|
68233
68667
|
publishStanding(view);
|
|
68234
68668
|
}
|
|
68235
|
-
function chipBox(chip,
|
|
68669
|
+
function chipBox(chip, axes) {
|
|
68236
68670
|
house.updateWorldMatrix(true, false);
|
|
68237
68671
|
const q = tmp.q.set(chip.rotation[0], chip.rotation[1], chip.rotation[2], chip.rotation[3]).premultiply(house.getWorldQuaternion(new THREE.Quaternion()).invert());
|
|
68238
68672
|
let a = 0, u = 0;
|
|
68239
68673
|
for (let k = 0; k < 3; k++) {
|
|
68240
68674
|
const axis2 = tmp.p.set(k === 0 ? 1 : 0, k === 1 ? 1 : 0, k === 2 ? 1 : 0).applyQuaternion(q);
|
|
68241
|
-
a += Math.abs(
|
|
68242
|
-
u += Math.abs(axis2.
|
|
68675
|
+
a += Math.abs(axis2.getComponent(axes.along)) * chip.size[k] / 2;
|
|
68676
|
+
u += Math.abs(axis2.getComponent(axes.up)) * chip.size[k] / 2;
|
|
68243
68677
|
}
|
|
68244
68678
|
return { center: local2(chip.center), along: a, up: u };
|
|
68245
68679
|
}
|
|
@@ -68275,12 +68709,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68275
68709
|
const grey = fragmentMaterial("concrete").color.getHex();
|
|
68276
68710
|
const stone = (s, y, d, size, r) => {
|
|
68277
68711
|
const centre = mask.start + s;
|
|
68278
|
-
const unit = clipToBox(
|
|
68712
|
+
const unit = clipToBox(unitBoxOf(mask.axes, [centre, y, d], size, tmp.c.setHex(grey).multiplyScalar(0.85 + 0.2 * r(7)).getHex()), bounds2);
|
|
68279
68713
|
if (unit) out.push(unit);
|
|
68280
68714
|
};
|
|
68281
68715
|
for (const { c, part, thick, mid } of gone) {
|
|
68282
|
-
const
|
|
68283
|
-
const
|
|
68716
|
+
const [from, to] = extentOf(part, mask.axes.along), [up0, up1] = extentOf(part, mask.axes.up);
|
|
68717
|
+
const p0 = from - mask.start, p1 = to - mask.start;
|
|
68718
|
+
const lying = p1 - p0 > up1 - up0;
|
|
68284
68719
|
const random = (seed) => (n) => {
|
|
68285
68720
|
const x = Math.sin(seed + n * 3.3) * 43758.5453;
|
|
68286
68721
|
return x - Math.floor(x);
|
|
@@ -68298,7 +68733,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68298
68733
|
stone(s, y, d, [size, size * (0.6 + 0.5 * r(4)), size], r);
|
|
68299
68734
|
}
|
|
68300
68735
|
}
|
|
68301
|
-
const bars = lying ? [
|
|
68736
|
+
const bars = lying ? [up0 + LUMP_BAR_INSET, up1 - LUMP_BAR_INSET].filter((y) => y >= c.y0 - 1e-6 && y <= c.y1 + 1e-6) : [p0 + LUMP_BAR_INSET, p1 - LUMP_BAR_INSET].filter((s) => s >= c.a - 1e-6 && s <= c.b + 1e-6);
|
|
68302
68737
|
for (const bar2 of bars) {
|
|
68303
68738
|
for (const side of [-1, 1]) {
|
|
68304
68739
|
const d = mid + side * (thick / 2 - LUMP_BAR_INSET);
|
|
@@ -68358,8 +68793,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68358
68793
|
if (view.openings.has(partId)) return false;
|
|
68359
68794
|
view.openings.set(partId, { center: local2(change.opening.center), radius: change.opening.radius });
|
|
68360
68795
|
}
|
|
68361
|
-
if (change.chip) view.chips.get(partId).push(chipBox(change.chip, view.mask.
|
|
68362
|
-
for (const chip of change.chips ?? []) view.chips.get(partId).push(chipBox(chip, view.mask.
|
|
68796
|
+
if (change.chip) view.chips.get(partId).push(chipBox(change.chip, view.mask.axes));
|
|
68797
|
+
for (const chip of change.chips ?? []) view.chips.get(partId).push(chipBox(chip, view.mask.axes));
|
|
68363
68798
|
if (change.spall) {
|
|
68364
68799
|
const list2 = view.spalls.get(partId);
|
|
68365
68800
|
list2.push({ center: local2(change.spall.center), radius: change.spall.radius });
|
|
@@ -68460,13 +68895,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68460
68895
|
},
|
|
68461
68896
|
/**
|
|
68462
68897
|
* What still stands of the units of `partId` once its wall is cut, as drawn: spans along the wall from `start` (in the house's space, along u when
|
|
68463
|
-
* `
|
|
68898
|
+
* `axes.along`) and up `axes.up`. Null while the wall is whole (all of the part stands).
|
|
68464
68899
|
*/
|
|
68465
68900
|
standing(partId) {
|
|
68466
68901
|
const hostId = hostOf(partId), view = hostId ? views.get(hostId) : void 0;
|
|
68467
68902
|
if (view?.keptStale) refreshKept(view);
|
|
68468
68903
|
const spans = view?.saved ? view.kept.get(partId) : void 0;
|
|
68469
|
-
return view && spans ? { spans,
|
|
68904
|
+
return view && spans ? { spans, axes: view.mask.axes, start: view.mask.start } : null;
|
|
68470
68905
|
},
|
|
68471
68906
|
/** Handles a `stage` event of the house's object. Returns true when the wall was cut. */
|
|
68472
68907
|
stage(event) {
|
|
@@ -68921,8 +69356,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68921
69356
|
if (du * du + dv * dv >= radius * radius) continue;
|
|
68922
69357
|
const left = breach.standing(part.id);
|
|
68923
69358
|
if (!left) return true;
|
|
68924
|
-
const s0 = (left.
|
|
68925
|
-
const
|
|
69359
|
+
const s0 = (left.axes.along === 0 ? lx : lz) - left.start;
|
|
69360
|
+
const flat2 = left.axes.up !== 1, t0 = left.axes.up === 0 ? lx : lz;
|
|
69361
|
+
const low1 = flat2 ? t0 - radius : Math.min(ly0, ly1), high1 = flat2 ? t0 + radius : Math.max(ly0, ly1);
|
|
68926
69362
|
for (const c of left.spans) if (c.b > s0 - radius && c.a < s0 + radius && c.y1 > low1 && c.y0 < high1) return true;
|
|
68927
69363
|
}
|
|
68928
69364
|
return false;
|
|
@@ -70758,13 +71194,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
70758
71194
|
function seatStructure(L, c, seats, options) {
|
|
70759
71195
|
return [...base(L, c, seats, options.plinth), ...back(L, c), ...arms(L, c, options.boardBack)];
|
|
70760
71196
|
}
|
|
70761
|
-
function cushion(
|
|
70762
|
-
return { ...
|
|
71197
|
+
function cushion(block2, id) {
|
|
71198
|
+
return { ...block2, id, material: "foam", layers: CLOTH_COVER };
|
|
70763
71199
|
}
|
|
70764
71200
|
var SOFAS = /^sofa_/;
|
|
70765
71201
|
var ARMCHAIRS = /^armchair/;
|
|
70766
71202
|
var BEDS = /^(double_bed|queen_bed|king_bed|single_bed|mattress)$/;
|
|
70767
|
-
var seatsOf = (cushions) => cushions.map((
|
|
71203
|
+
var seatsOf = (cushions) => cushions.map((block2, k) => ({ x: block2.position[0], ...cushions[k + 1] ? { seam: (block2.position[0] + cushions[k + 1].position[0]) / 2 } : {} }));
|
|
70768
71204
|
function sofaParts(drawn) {
|
|
70769
71205
|
const woods = drawn.filter((p) => p.key === "wood");
|
|
70770
71206
|
const cloth2 = drawn.filter((p) => p.key === "fabric");
|
|
@@ -70806,7 +71242,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
70806
71242
|
};
|
|
70807
71243
|
const colours = { wood: feet[0].color, skirt: skirt.color, back: back2.color, arm: armLeft.color };
|
|
70808
71244
|
const structure = seatStructure(layout, colours, seatsOf(seatCushions), { plinth: false, boardBack: layout.backFrame });
|
|
70809
|
-
const cushions = [...seatCushions.map((
|
|
71245
|
+
const cushions = [...seatCushions.map((block2, k) => cushion(block2, `seat_cushion_${k}`)), ...backCushions.map((block2, k) => cushion(block2, `back_cushion_${k}`)), cushion(pillow, "accent_pillow")];
|
|
70810
71246
|
return [...structure, ...cushions];
|
|
70811
71247
|
}
|
|
70812
71248
|
var ARMCHAIR_SUPPORT = 0.28;
|
|
@@ -71179,18 +71615,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
71179
71615
|
};
|
|
71180
71616
|
return { spec, build, top, fixed: fixed2 };
|
|
71181
71617
|
}
|
|
71618
|
+
var furnitureCatalogEntry = (type, catalog) => (catalog ?? residentialItems).find((i) => i.type === type);
|
|
71182
71619
|
function furnitureSpec(THREE, type, opts = {}) {
|
|
71183
71620
|
const renderer = rendererOf(THREE, opts.document);
|
|
71184
71621
|
const ent = renderer.types[type];
|
|
71185
71622
|
if (!ent) throw new Error(`game-floorplan-three: no builder for the furniture type "${type}"`);
|
|
71186
|
-
const entry2 = (opts.catalog
|
|
71623
|
+
const entry2 = furnitureCatalogEntry(type, opts.catalog);
|
|
71187
71624
|
const w = opts.w ?? entry2?.w;
|
|
71188
71625
|
const d = opts.d ?? entry2?.d;
|
|
71189
71626
|
const h = opts.h ?? entry2?.h;
|
|
71190
71627
|
if (w === void 0 || d === void 0 || h === void 0) throw new Error(`game-floorplan-three: furniture type "${type}" is not in the catalogue, so give w, d and h`);
|
|
71191
71628
|
const o = opts.options ?? {};
|
|
71192
71629
|
const seed = Math.round(opts.seed ?? 1);
|
|
71193
|
-
const plain2 = SHELVING.test(type) ? "paper" : "plastic";
|
|
71630
|
+
const plain2 = entry2?.material ?? (SHELVING.test(type) ? "paper" : "plastic");
|
|
71194
71631
|
const root = { x: seed, z: 0, ry: 0, w, d, h, y: 0, base: 0, palette: o.palette, seed: `furniture_${type}_${seed}` };
|
|
71195
71632
|
const { K, shared: shared3 } = renderer.internals;
|
|
71196
71633
|
const before = K.PARTS.length;
|
|
@@ -73226,7 +73663,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
73226
73663
|
hgFrac: 0.9,
|
|
73227
73664
|
rail: 1,
|
|
73228
73665
|
scope: 1,
|
|
73229
|
-
rpm: 1100
|
|
73666
|
+
rpm: 1100,
|
|
73667
|
+
eject: "down"
|
|
73230
73668
|
}
|
|
73231
73669
|
},
|
|
73232
73670
|
thompson_m1a1: {
|
|
@@ -73377,7 +73815,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
73377
73815
|
length: 660,
|
|
73378
73816
|
barrel: 470,
|
|
73379
73817
|
options: {
|
|
73380
|
-
shot: 1
|
|
73818
|
+
shot: 1,
|
|
73819
|
+
eject: "down"
|
|
73381
73820
|
}
|
|
73382
73821
|
},
|
|
73383
73822
|
saiga_12: {
|
|
@@ -74567,7 +75006,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
74567
75006
|
fore: 0.55,
|
|
74568
75007
|
gas: 1,
|
|
74569
75008
|
charge: 1,
|
|
74570
|
-
bayo: 1
|
|
75009
|
+
bayo: 1,
|
|
75010
|
+
eject: "up"
|
|
74571
75011
|
},
|
|
74572
75012
|
variantOf: "sks"
|
|
74573
75013
|
},
|
|
@@ -74755,7 +75195,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
74755
75195
|
fore: 0,
|
|
74756
75196
|
bands: 1,
|
|
74757
75197
|
br: 0.012,
|
|
74758
|
-
m1887: 1
|
|
75198
|
+
m1887: 1,
|
|
75199
|
+
eject: "up"
|
|
74759
75200
|
},
|
|
74760
75201
|
variantOf: "winchester_1894"
|
|
74761
75202
|
},
|
|
@@ -75676,6 +76117,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
75676
76117
|
kit.torus(lever, ring3, M.metal, 0, 0, 0);
|
|
75677
76118
|
parts2.muzzle = kit.mark(group, length2 + 0.01, 0, 0);
|
|
75678
76119
|
parts2.eject = kit.mark(group, middle + 0.02, 0.012, 0.01);
|
|
76120
|
+
if (options.eject) parts2.ejectSide = options.eject;
|
|
75679
76121
|
parts2.loadPort = kit.mark(group, middle + 0.03, -0.035, 0.02);
|
|
75680
76122
|
parts2.topLoad = parts2.eject;
|
|
75681
76123
|
parts2.frames = {
|
|
@@ -75924,7 +76366,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
75924
76366
|
const ejectX = receiverEnd - (options.ejectBack || 0.07);
|
|
75925
76367
|
const ejectY = options.ar ? receiverHeight * 0.2 : by;
|
|
75926
76368
|
parts2.muzzle = kit.mark(group, length2 + 0.01, by, 0);
|
|
75927
|
-
|
|
76369
|
+
const ejectsDown = options.eject === "down";
|
|
76370
|
+
if (ejectsDown) kit.box(group, 0.05, 2e-3, wR * 0.5, M.hole, ejectX, -receiverHeight / 2 - 1e-3, 0);
|
|
76371
|
+
parts2.eject = ejectsDown ? kit.mark(group, ejectX, -receiverHeight / 2 - 4e-3, 0) : kit.mark(group, ejectX, ejectY, wR / 2 + 6e-3);
|
|
76372
|
+
if (options.eject) parts2.ejectSide = options.eject;
|
|
75928
76373
|
parts2.loadPort = kit.mark(group, receiverEnd - 0.05, -receiverHeight / 2 - 4e-3, 0);
|
|
75929
76374
|
parts2.topLoad = kit.mark(group, ejectX, receiverHeight / 2 + 4e-3, 0);
|
|
75930
76375
|
parts2.family = familyOf(options);
|
|
@@ -76195,7 +76640,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76195
76640
|
box5(group, 0.026, 0.075, 0.026, body, bodyLength + 0.05, -0.05, 0, 0.1);
|
|
76196
76641
|
}
|
|
76197
76642
|
parts2.muzzle = kit.mark(group, L + 0.01, 0.012, 0);
|
|
76198
|
-
|
|
76643
|
+
if (options.eject === "down") {
|
|
76644
|
+
box5(group, 0.05, 2e-3, 0.024, M.hole, bodyLength * 0.25, -0.0385, 0);
|
|
76645
|
+
parts2.eject = kit.mark(group, bodyLength * 0.25, -0.042, 0);
|
|
76646
|
+
parts2.ejectSide = "down";
|
|
76647
|
+
} else parts2.eject = kit.mark(group, bodyLength * 0.25, 5e-3, 0.03);
|
|
76199
76648
|
return { group, parts: parts2 };
|
|
76200
76649
|
}
|
|
76201
76650
|
|
|
@@ -76206,14 +76655,30 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76206
76655
|
const tube2 = new THREE.Mesh(new THREE.TubeGeometry(curve, 40, radius, 8, false), material);
|
|
76207
76656
|
tube2.castShadow = tube2.receiveShadow = true;
|
|
76208
76657
|
group.add(tube2);
|
|
76658
|
+
return tube2;
|
|
76659
|
+
};
|
|
76660
|
+
var fuelPack = (kit, target) => {
|
|
76661
|
+
const { M, box: box5, cylinderY, sphere: sphere2 } = kit;
|
|
76662
|
+
for (const z of [-0.1, 0.1]) {
|
|
76663
|
+
cylinderY(target, 0.085, 0.5, M.olive, -0.3, -0.05, z, 20);
|
|
76664
|
+
sphere2(target, 0.085, M.olive, -0.3, 0.2, z, 2).scale.y = 0.45;
|
|
76665
|
+
sphere2(target, 0.085, M.olive, -0.3, -0.3, z, 2).scale.y = 0.45;
|
|
76666
|
+
cylinderY(target, 0.03, 0.03, M.metal, -0.3, 0.24, z, 12);
|
|
76667
|
+
}
|
|
76668
|
+
sphere2(target, 0.075, M.olive, -0.3, 0.1, 0, 2).position.x = -0.39;
|
|
76669
|
+
box5(target, 0.03, 0.6, 0.24, M.dark, -0.4, -0.05, 0);
|
|
76670
|
+
cylinderY(target, 0.03, 0.012, M.metal, -0.39, 0.18, 0, 14);
|
|
76671
|
+
const gauge = kit.pivot(target, -0.39, 0.18, 3e-3);
|
|
76672
|
+
box5(gauge, 2e-3, 0.022, 2e-3, M.red, 0, 8e-3, 0.012);
|
|
76673
|
+
return gauge;
|
|
76209
76674
|
};
|
|
76210
76675
|
var pilot = (kit, group, x, y) => {
|
|
76211
76676
|
const { M, cylinderX } = kit;
|
|
76212
76677
|
cylinderX(group, 6e-3, 0.03, M.fire2, x + 0.015, y, 0, 6, 0).userData.flame = 1;
|
|
76213
76678
|
cylinderX(group, 4e-3, 0.022, M.fire, x + 0.012, y, 0, 6, 0).userData.flame = 1;
|
|
76214
76679
|
};
|
|
76215
|
-
function buildFlamethrower(kit, group, parts2) {
|
|
76216
|
-
const { M, box: box5, cylinderX
|
|
76680
|
+
function buildFlamethrower(kit, group, parts2, separate = false) {
|
|
76681
|
+
const { M, box: box5, cylinderX } = kit;
|
|
76217
76682
|
parts2.kick = 0.15;
|
|
76218
76683
|
heatify(parts2.glow, cylinderX(group, 0.016, 0.62, M.steel, 0.42, 0, 0, 14));
|
|
76219
76684
|
cylinderX(group, 0.022, 0.1, M.dark, 0.78, 0, 0, 14);
|
|
@@ -76231,19 +76696,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76231
76696
|
box5(rearGrip, 0.03, 0.1, 0.03, M.wood, 0, -0.05, 0);
|
|
76232
76697
|
box5(group, 0.05, 4e-3, 0.012, M.metal, 0.2, -0.035, 0);
|
|
76233
76698
|
cylinderX(group, 0.02, 0.04, M.metal, 0.1, 0, 0, 12);
|
|
76234
|
-
|
|
76235
|
-
|
|
76236
|
-
|
|
76237
|
-
|
|
76238
|
-
|
|
76239
|
-
|
|
76240
|
-
|
|
76241
|
-
|
|
76242
|
-
|
|
76243
|
-
cylinderY(group, 0.03, 0.012, M.metal, -0.39, 0.18, 0, 14);
|
|
76244
|
-
const gauge = kit.pivot(group, -0.39, 0.18, 3e-3);
|
|
76245
|
-
parts2.gauge = gauge;
|
|
76246
|
-
box5(gauge, 2e-3, 0.022, 2e-3, M.red, 0, 8e-3, 0.012);
|
|
76699
|
+
if (separate) {
|
|
76700
|
+
const pack2 = kit.group();
|
|
76701
|
+
parts2.gauge = fuelPack(kit, pack2);
|
|
76702
|
+
hose(kit, group, [[0.08, 0, 0], [0, -0.04, 0], [-0.08, -0.2, 0.05]], 0.011, M.rubber);
|
|
76703
|
+
parts2.worn = { root: pack2, mount: kit.pivot(pack2, -0.415, -0.05, 0), port: kit.pivot(pack2, -0.25, -0.33, 0.08), wandEnd: kit.pivot(group, -0.08, -0.2, 0.05), hoseMaterial: M.rubber };
|
|
76704
|
+
} else {
|
|
76705
|
+
hose(kit, group, [[0.08, 0, 0], [0, -0.04, 0], [-0.08, -0.2, 0.05], [-0.18, -0.32, 0.08], [-0.25, -0.33, 0.08]], 0.011, M.rubber);
|
|
76706
|
+
parts2.gauge = fuelPack(kit, group);
|
|
76707
|
+
}
|
|
76247
76708
|
parts2.muzzle = kit.pivot(group, 0.94, 0, 0);
|
|
76248
76709
|
parts2.rear = kit.pivot(group, 0.1, 0, 0);
|
|
76249
76710
|
}
|
|
@@ -76434,7 +76895,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76434
76895
|
const type = options.lt ?? "";
|
|
76435
76896
|
const isFlame = type === "flame" || type === "flameDIY";
|
|
76436
76897
|
const parts2 = { family: isFlame ? "flame" : "rocket", launcherType: type, glow: [] };
|
|
76437
|
-
if (type === "flame") buildFlamethrower(kit, group, parts2);
|
|
76898
|
+
if (type === "flame") buildFlamethrower(kit, group, parts2, options.separateWorn === true);
|
|
76438
76899
|
else if (type === "flameDIY") buildImprovisedFlamethrower(kit, group, parts2);
|
|
76439
76900
|
else ROCKET_BUILDERS[type]?.(kit, group, parts2);
|
|
76440
76901
|
parts2.eject = parts2.muzzle;
|
|
@@ -76637,6 +77098,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76637
77098
|
};
|
|
76638
77099
|
parts2.muzzle = kit.mark(group, BARREL_END + 0.01, 0, 0);
|
|
76639
77100
|
parts2.eject = kit.mark(group, 0.3, -0.07, 0.08);
|
|
77101
|
+
parts2.ejectSide = "down";
|
|
76640
77102
|
return { group, parts: parts2 };
|
|
76641
77103
|
}
|
|
76642
77104
|
|
|
@@ -76674,6 +77136,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76674
77136
|
box5(tripod, 0.012, 0.62, 0.012, M.metal, 0.22, -0.25, -0.16, -0.75, 0, -0.3);
|
|
76675
77137
|
parts2.muzzle = kit.mark(group, 1.72, 0.01, 0);
|
|
76676
77138
|
parts2.eject = kit.mark(group, 0.3, -0.07, 0);
|
|
77139
|
+
parts2.ejectSide = "down";
|
|
76677
77140
|
return { group, parts: parts2 };
|
|
76678
77141
|
}
|
|
76679
77142
|
|
|
@@ -76798,6 +77261,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76798
77261
|
parts2.trigger = box5(group, 4e-3, 0.016, 4e-3, M.dark, 0.24, -0.045, 0);
|
|
76799
77262
|
parts2.muzzle = kit.mark(group, 0.48, 0, 0);
|
|
76800
77263
|
parts2.eject = kit.mark(group, 0.2, -0.07, 0);
|
|
77264
|
+
parts2.ejectSide = "down";
|
|
76801
77265
|
return { group, parts: parts2 };
|
|
76802
77266
|
}
|
|
76803
77267
|
|
|
@@ -76908,6 +77372,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76908
77372
|
};
|
|
76909
77373
|
parts2.muzzle = kit.mark(group, length2, 0, 0);
|
|
76910
77374
|
parts2.eject = kit.mark(group, 0.12, -0.092, 0);
|
|
77375
|
+
parts2.ejectSide = "down";
|
|
76911
77376
|
return { group, parts: parts2 };
|
|
76912
77377
|
}
|
|
76913
77378
|
|
|
@@ -77033,6 +77498,87 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77033
77498
|
return (y) => frontTopX + (frontTopY - y) * Math.tan(angle);
|
|
77034
77499
|
}
|
|
77035
77500
|
|
|
77501
|
+
// src/models/sight.ts
|
|
77502
|
+
var SIGHT_SINK = 5e-4;
|
|
77503
|
+
var FOOTPRINT_INSET = 0.15;
|
|
77504
|
+
var RAY_CLEARANCE = 0.05;
|
|
77505
|
+
var measured = /* @__PURE__ */ new WeakMap();
|
|
77506
|
+
var boundsOf = (THREE, geometry) => {
|
|
77507
|
+
const known = measured.get(geometry);
|
|
77508
|
+
if (known) return known;
|
|
77509
|
+
const position = geometry.getAttribute("position");
|
|
77510
|
+
const box5 = new THREE.Box3().setFromBufferAttribute(position);
|
|
77511
|
+
const bounds = { box: box5, sphere: box5.getBoundingSphere(new THREE.Sphere()) };
|
|
77512
|
+
measured.set(geometry, bounds);
|
|
77513
|
+
return bounds;
|
|
77514
|
+
};
|
|
77515
|
+
var hits = /* @__PURE__ */ new WeakMap();
|
|
77516
|
+
var KEY_DIGITS = 6;
|
|
77517
|
+
function hitOn(THREE, mesh3, origin) {
|
|
77518
|
+
const geometry = mesh3.geometry;
|
|
77519
|
+
const ray = new THREE.Ray(origin.clone(), new THREE.Vector3(0, -1, 0)).applyMatrix4(new THREE.Matrix4().copy(mesh3.matrixWorld).invert());
|
|
77520
|
+
const from = ray.origin;
|
|
77521
|
+
const along3 = ray.direction;
|
|
77522
|
+
const key2 = [...from.toArray(), ...along3.toArray()].map((value) => value.toFixed(KEY_DIGITS)).join(",");
|
|
77523
|
+
const known = hits.get(geometry) ?? /* @__PURE__ */ new Map();
|
|
77524
|
+
hits.set(geometry, known);
|
|
77525
|
+
if (!known.has(key2)) {
|
|
77526
|
+
const before = { box: geometry.boundingBox, sphere: geometry.boundingSphere };
|
|
77527
|
+
const bounds = boundsOf(THREE, geometry);
|
|
77528
|
+
geometry.boundingBox = bounds.box;
|
|
77529
|
+
geometry.boundingSphere = bounds.sphere;
|
|
77530
|
+
const probe2 = new THREE.Mesh(geometry, mesh3.material);
|
|
77531
|
+
const found = new THREE.Raycaster(from, along3).intersectObject(probe2, false)[0];
|
|
77532
|
+
geometry.boundingBox = before.box;
|
|
77533
|
+
geometry.boundingSphere = before.sphere;
|
|
77534
|
+
known.set(key2, found ? found.point.clone() : null);
|
|
77535
|
+
}
|
|
77536
|
+
const local2 = known.get(key2);
|
|
77537
|
+
return local2 ? local2.clone().applyMatrix4(mesh3.matrixWorld) : null;
|
|
77538
|
+
}
|
|
77539
|
+
function surfaceUnder(kit, support, parent, spec) {
|
|
77540
|
+
const { THREE } = kit;
|
|
77541
|
+
let root = support;
|
|
77542
|
+
while (root.parent) root = root.parent;
|
|
77543
|
+
root.updateMatrixWorld(true);
|
|
77544
|
+
const reachX = spec.length / 2 * (1 - 2 * FOOTPRINT_INSET);
|
|
77545
|
+
const reachZ = spec.width / 2 * (1 - 2 * FOOTPRINT_INSET);
|
|
77546
|
+
const corners = [[0, 0], [-reachX, -reachZ], [-reachX, reachZ], [reachX, -reachZ], [reachX, reachZ]].map(([dx, dz]) => parent.localToWorld(new THREE.Vector3(spec.x + dx, 0, dz)));
|
|
77547
|
+
const footprint = new THREE.Box3().setFromPoints(corners);
|
|
77548
|
+
const under = [];
|
|
77549
|
+
const world = new THREE.Box3();
|
|
77550
|
+
const whole = new THREE.Box3();
|
|
77551
|
+
support.traverse((child) => {
|
|
77552
|
+
const mesh3 = child;
|
|
77553
|
+
if (!mesh3.isMesh) return;
|
|
77554
|
+
world.copy(boundsOf(THREE, mesh3.geometry).box).applyMatrix4(mesh3.matrixWorld);
|
|
77555
|
+
whole.union(world);
|
|
77556
|
+
if (mesh3.userData["sight"] === true) return;
|
|
77557
|
+
if (world.max.x < footprint.min.x || world.min.x > footprint.max.x || world.max.z < footprint.min.z || world.min.z > footprint.max.z) return;
|
|
77558
|
+
under.push(mesh3);
|
|
77559
|
+
});
|
|
77560
|
+
const top = whole.max.y;
|
|
77561
|
+
if (under.length === 0) throw new Error("a sight with nothing under it");
|
|
77562
|
+
let highest = -Infinity;
|
|
77563
|
+
for (const origin of corners) {
|
|
77564
|
+
origin.y = top + RAY_CLEARANCE;
|
|
77565
|
+
for (const mesh3 of under) {
|
|
77566
|
+
const hit = hitOn(THREE, mesh3, origin);
|
|
77567
|
+
if (hit) highest = Math.max(highest, parent.worldToLocal(hit).y);
|
|
77568
|
+
}
|
|
77569
|
+
}
|
|
77570
|
+
if (highest === -Infinity) throw new Error("a sight with nothing under it");
|
|
77571
|
+
return highest;
|
|
77572
|
+
}
|
|
77573
|
+
function placeSight(kit, parent, support, spec) {
|
|
77574
|
+
const tilt = spec.tilt ?? 0;
|
|
77575
|
+
const halfHeight = spec.height / 2 * Math.cos(tilt) + spec.length / 2 * Math.abs(Math.sin(tilt));
|
|
77576
|
+
const bottom = surfaceUnder(kit, support, parent, spec) - SIGHT_SINK;
|
|
77577
|
+
const mesh3 = kit.box(parent, spec.length, spec.height, spec.width, spec.material, spec.x, bottom + halfHeight, 0, tilt);
|
|
77578
|
+
mesh3.userData["sight"] = true;
|
|
77579
|
+
return { mesh: mesh3, bottom };
|
|
77580
|
+
}
|
|
77581
|
+
|
|
77036
77582
|
// src/models/pistol-design-slide.ts
|
|
77037
77583
|
function buildDesignSlide(kit, slide2, parts2, name, design, length2) {
|
|
77038
77584
|
const { M, box: box5, cylinderX } = kit;
|
|
@@ -77059,14 +77605,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77059
77605
|
}
|
|
77060
77606
|
heatify(parts2.glow, cylinderX(slide2, 62e-4, 4e-3, M.dark, length2 + 15e-4, 2e-3, 0, 18));
|
|
77061
77607
|
cylinderX(slide2, 34e-4, 5e-3, M.hole, length2 + 25e-4, 2e-3, 0, 12);
|
|
77062
|
-
const
|
|
77063
|
-
|
|
77064
|
-
|
|
77065
|
-
box5(slide2,
|
|
77066
|
-
box5(slide2, 22e-4, 22e-4, 0.0166, M.white, 9e-3,
|
|
77608
|
+
const front = placeSight(kit, slide2, slide2, { length: 4e-3, height: 7e-3, width: 4e-3, material: M.dark, x: length2 - 8e-3 });
|
|
77609
|
+
const rear = placeSight(kit, slide2, slide2, { length: 8e-3, height: 7e-3, width: 0.016, material: M.dark, x: 9e-3 });
|
|
77610
|
+
parts2.sights = [front.mesh, rear.mesh];
|
|
77611
|
+
box5(slide2, 22e-4, 22e-4, 46e-4, M.white, length2 - 8e-3, front.bottom + 58e-4, 0);
|
|
77612
|
+
box5(slide2, 22e-4, 22e-4, 0.0166, M.white, 9e-3, rear.bottom + 58e-4, 0);
|
|
77067
77613
|
}
|
|
77068
77614
|
|
|
77069
77615
|
// src/models/pistol-design.ts
|
|
77616
|
+
var PORT_RISE = 5e-3;
|
|
77070
77617
|
function buildDesignedPistol(kit, options, name) {
|
|
77071
77618
|
const { M, box: box5 } = kit;
|
|
77072
77619
|
const design = PISTOL_DESIGNS[name];
|
|
@@ -77115,7 +77662,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77115
77662
|
box5(hammer2, 0.01, 6e-3, 0.012, M.dark, -0.011, 8e-3, 0, 0.5);
|
|
77116
77663
|
}
|
|
77117
77664
|
parts2.muzzle = kit.mark(group, length2 + 6e-3, 2e-3, 0);
|
|
77118
|
-
parts2.eject = kit.mark(group, length2 * 0.6, sh / 2, sw * 0.25);
|
|
77665
|
+
parts2.eject = kit.mark(group, length2 * 0.6, sh / 2 + PORT_RISE, sw * 0.25);
|
|
77119
77666
|
return { group, parts: parts2 };
|
|
77120
77667
|
}
|
|
77121
77668
|
|
|
@@ -77154,11 +77701,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77154
77701
|
box5(group, 24e-4, SLIDE_HEIGHT * 0.9, WIDTH2 + 4e-4, M.dark, slideLength, 0, 0);
|
|
77155
77702
|
for (let i = 0; i < 9; i++) box5(slide2, 22e-4, SLIDE_HEIGHT * 0.66, WIDTH2 + 12e-4, M.dark, 8e-3 + i * 48e-4, -3e-3, 0);
|
|
77156
77703
|
box5(slide2, length2 * 0.08, 3e-3, WIDTH2 * 0.5, M.hole, length2 * 0.42, SLIDE_HEIGHT / 2, WIDTH2 * 0.12);
|
|
77157
|
-
|
|
77158
|
-
box5(slide2, 3e-3, 2e-3, 4e-3, M.hole, 8e-3,
|
|
77704
|
+
const rearSight = placeSight(kit, slide2, slide2, { length: 7e-3, height: 6e-3, width: 0.014, material: M.dark, x: 8e-3 });
|
|
77705
|
+
box5(slide2, 3e-3, 2e-3, 4e-3, M.hole, 8e-3, rearSight.bottom + 5e-3, 0);
|
|
77159
77706
|
box5(group, barrelLength * 0.9, 4e-3, WIDTH2 * 0.42, metal2, slideLength + barrelLength * 0.5, SLIDE_HEIGHT / 2 + 2e-3, 0);
|
|
77160
77707
|
for (let i = 0; i < 7; i++) box5(group, 4e-3, 15e-4, WIDTH2 * 0.43, M.hole, slideLength + 0.01 + i * 0.013, SLIDE_HEIGHT / 2 + 4e-3, 0);
|
|
77161
|
-
|
|
77708
|
+
parts2.sights = [rearSight.mesh, placeSight(kit, group, group, { length: 4e-3, height: 6e-3, width: 4e-3, material: M.dark, x: length2 - 6e-3 }).mesh];
|
|
77162
77709
|
const nose = plate(kit, group, [[-WIDTH2 / 2, -SLIDE_HEIGHT / 2 + 2e-3], [WIDTH2 / 2, -SLIDE_HEIGHT / 2 + 2e-3], [WIDTH2 * 0.16, SLIDE_HEIGHT / 2 - 2e-3], [-WIDTH2 * 0.16, SLIDE_HEIGHT / 2 - 2e-3]], null, 3e-3, metal2);
|
|
77163
77710
|
nose.rotation.y = Math.PI / 2;
|
|
77164
77711
|
nose.position.set(length2 + 15e-4, 0, 0);
|
|
@@ -77292,16 +77839,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77292
77839
|
const muzzleY = style.tri ? slideHeight * 0.08 : 2e-3;
|
|
77293
77840
|
heatify(parts2.glow, cylinderX(slide2, style.tri ? 72e-4 : 62e-4, 4e-3, M.dark, L + 15e-4, muzzleY, 0, 18));
|
|
77294
77841
|
cylinderX(slide2, 34e-4, 5e-3, M.hole, L + 25e-4, muzzleY, 0, 12);
|
|
77295
|
-
const
|
|
77842
|
+
const seat2 = (spec) => placeSight(kit, slide2, slide2, spec);
|
|
77296
77843
|
if (style.sight === "u" || style.sight === "3dot") {
|
|
77297
|
-
|
|
77298
|
-
|
|
77299
|
-
|
|
77300
|
-
|
|
77301
|
-
|
|
77844
|
+
const front = seat2({ length: 4e-3, height: 7e-3, width: 4e-3, material: M.dark, x: L - 8e-3 });
|
|
77845
|
+
const rear = seat2({ length: 8e-3, height: 7e-3, width: 0.016, material: M.dark, x: 9e-3 });
|
|
77846
|
+
parts2.sights = [front.mesh, rear.mesh];
|
|
77847
|
+
box5(slide2, 22e-4, 22e-4, 46e-4, M.white, L - 8e-3, front.bottom + 58e-4, 0);
|
|
77848
|
+
if (style.sight === "u") box5(slide2, 4e-3, 2e-3, 0.0122, M.white, 9e-3, rear.bottom + 6e-3, 0);
|
|
77849
|
+
else box5(slide2, 22e-4, 22e-4, 0.0166, M.white, 9e-3, rear.bottom + 58e-4, 0);
|
|
77302
77850
|
} else {
|
|
77303
|
-
|
|
77304
|
-
box5(slide2, 6e-3, 4e-3, 0.012, M.dark, 8e-3, top + 2e-3, 0);
|
|
77851
|
+
parts2.sights = [seat2({ length: 6e-3, height: 4e-3, width: 3e-3, material: M.dark, x: L - 6e-3 }).mesh, seat2({ length: 6e-3, height: 4e-3, width: 0.012, material: M.dark, x: 8e-3 }).mesh];
|
|
77305
77852
|
}
|
|
77306
77853
|
if (style.decock === "slide") {
|
|
77307
77854
|
box5(slide2, 0.012, 8e-3, 4e-3, M.dark, 0.02, slideHeight * 0.15, slideWidth / 2 + 2e-3, 0.3);
|
|
@@ -77459,8 +78006,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77459
78006
|
box5(group, barrel * 0.96, 58e-4, 88e-4, M.metal, start + barrel * 0.48, 0.0218, 0);
|
|
77460
78007
|
for (let i = 0; i < 2; i++) box5(group, barrel * 0.2, 62e-4, 92e-4, M.hole, start + barrel * (0.26 + i * 0.36), 0.0218, 0);
|
|
77461
78008
|
box5(group, 0.012, 36e-4, 4e-3, M.dark, start + barrel * 0.4, -4e-3, 94e-4);
|
|
77462
|
-
|
|
77463
|
-
|
|
78009
|
+
const front = placeSight(kit, group, group, { length: 9e-3, height: 0.01, width: 34e-4, material: M.metal, x: start + barrel - 7e-3, tilt: -0.35 });
|
|
78010
|
+
parts2.sights = [...parts2.sights ?? [], front.mesh];
|
|
78011
|
+
box5(group, 35e-4, 5e-3, 36e-4, M.red, start + barrel - 45e-4, front.mesh.position.y + 3e-4, 0, -0.35);
|
|
77464
78012
|
cylinderX(group, 42e-4, 5e-3, M.hole, start + barrel + 15e-4, 9e-3, 0, 12);
|
|
77465
78013
|
}
|
|
77466
78014
|
function buildPythonGrip(kit, parts2, group) {
|
|
@@ -77490,8 +78038,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77490
78038
|
box5(group, 0.085, 0.056, 0.026, M.metal, 0.07, -4e-3, 0);
|
|
77491
78039
|
kit.roundness = null;
|
|
77492
78040
|
box5(group, 0.056, 8e-3, 0.02, M.metal, 0.075, 0.025, 0);
|
|
77493
|
-
|
|
77494
|
-
|
|
78041
|
+
const rear = placeSight(kit, group, group, { length: 0.016, height: 0.01, width: 0.016, material: M.metal, x: 0.044 });
|
|
78042
|
+
parts2.sights = [rear.mesh];
|
|
78043
|
+
box5(group, 4e-3, 8e-3, 0.012, M.dark, 0.044, rear.bottom + 0.011, 0);
|
|
77495
78044
|
box5(group, 0.024, 0.012, 4e-3, M.dark, 0.055, 4e-3, -0.013);
|
|
77496
78045
|
box5(group, 0.016, 0.018, 0.0255, M.metal, 0.099, -0.014, 0);
|
|
77497
78046
|
const crane = kit.pivot(group, 0.077, -0.026, 0);
|
|
@@ -77555,8 +78104,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77555
78104
|
heatify(parts2.glow, cylinderX(group, 88e-4, barrel, metal2, 0.112 + barrel / 2, 9e-3, 0, 18));
|
|
77556
78105
|
box5(group, barrel * 0.92, 0.015, 0.013, metal2, 0.112 + barrel * 0.46, -5e-3, 0);
|
|
77557
78106
|
cylinderX(group, 4e-3, 5e-3, M.hole, 0.112 + barrel + 15e-4, 9e-3, 0, 12);
|
|
77558
|
-
|
|
77559
|
-
|
|
78107
|
+
parts2.sights = [
|
|
78108
|
+
placeSight(kit, group, group, { length: 0.012, height: 9e-3, width: 4e-3, material: M.dark, x: 0.112 + barrel - 8e-3, tilt: -0.3 }).mesh,
|
|
78109
|
+
placeSight(kit, group, group, { length: 0.012, height: 6e-3, width: 0.012, material: M.dark, x: 0.105 }).mesh
|
|
78110
|
+
];
|
|
77560
78111
|
const hammer2 = kit.pivot(group, 0.036, 0.018, 0);
|
|
77561
78112
|
box5(hammer2, 0.01, 0.02, 8e-3, M.dark, -4e-3, 8e-3, 0, 0.45);
|
|
77562
78113
|
parts2.hammer = hammer2;
|
|
@@ -78061,13 +78612,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
78061
78612
|
return root;
|
|
78062
78613
|
};
|
|
78063
78614
|
var hasWeaponModel = (id) => id in MODEL_ENTRIES || id in ARCHETYPE_MODELS;
|
|
78064
|
-
function buildWeaponModelById(THREE, id) {
|
|
78615
|
+
function buildWeaponModelById(THREE, id, options = {}) {
|
|
78065
78616
|
const entry2 = MODEL_ENTRIES[ARCHETYPE_MODELS[id] ?? id];
|
|
78066
78617
|
if (!entry2) return void 0;
|
|
78067
78618
|
const kit = modelKit(THREE);
|
|
78068
|
-
const
|
|
78069
|
-
if (id in ARCHETYPE_MODELS) delete
|
|
78070
|
-
|
|
78619
|
+
const modelOptions = { L: entry2.length, B: entry2.barrel, cal: entry2.caliber, ...entry2.options };
|
|
78620
|
+
if (id in ARCHETYPE_MODELS) delete modelOptions.chambers;
|
|
78621
|
+
if (options.worn === "separate") modelOptions.separateWorn = true;
|
|
78622
|
+
const built2 = BUILDERS[entry2.builder](kit, modelOptions);
|
|
78071
78623
|
nameParts(built2.parts);
|
|
78072
78624
|
let root;
|
|
78073
78625
|
if (entry2.builder === "launcher") {
|
|
@@ -79062,9 +79614,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
79062
79614
|
if (hit.thickness <= 0) return 0;
|
|
79063
79615
|
return Math.max(0, entry2.lossDb + MASS_LAW_DB_PER_DOUBLING * Math.log2(hit.thickness / entry2.thickness));
|
|
79064
79616
|
}
|
|
79065
|
-
function totalLossDb(
|
|
79617
|
+
function totalLossDb(hits2, setup = {}) {
|
|
79066
79618
|
let total = 0;
|
|
79067
|
-
for (const hit of
|
|
79619
|
+
for (const hit of hits2) total += hitLossDb(hit, setup);
|
|
79068
79620
|
return Math.min(total, setup.maxLossDb ?? OCCLUSION_DEFAULTS.maxLossDb);
|
|
79069
79621
|
}
|
|
79070
79622
|
function occlusionState(lossDb, setup = {}) {
|
|
@@ -84621,6 +85173,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
84621
85173
|
// src/fx/layers.ts
|
|
84622
85174
|
var createLayers = () => ({ casings: true, magazines: true, muzzleFlash: true, attachments: true, beams: true });
|
|
84623
85175
|
|
|
85176
|
+
// src/models/eject-port.ts
|
|
85177
|
+
var EJECT_SIDES = {
|
|
85178
|
+
right: [-0.25, 0.55, 0.8],
|
|
85179
|
+
up: [-0.1, 0.97, 0.2],
|
|
85180
|
+
down: [0, -1, 0.05],
|
|
85181
|
+
back: [-1, -0.1, 0],
|
|
85182
|
+
backUp: [-1, 0.9, 0]
|
|
85183
|
+
};
|
|
85184
|
+
var EJECT_SCATTER = 0.12;
|
|
85185
|
+
var ejectDirection = (THREE, side) => new THREE.Vector3(...EJECT_SIDES[side]).normalize();
|
|
85186
|
+
|
|
84624
85187
|
// src/laser-raycast.ts
|
|
84625
85188
|
var VIEWMODEL_NODE_NAME = "weapon-viewmodel";
|
|
84626
85189
|
var IN_HAND_NODE_NAME = "weapon-in-hand";
|
|
@@ -84687,7 +85250,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
84687
85250
|
/** A shouldered gun's bore runs this far above the shoulder pocket (the cheek on the comb). */
|
|
84688
85251
|
boreAbove: 0.05,
|
|
84689
85252
|
/** A handgun's (or a short two-hand gun's) grip: toward the middle of the chest, a little low, at the reach of bent arms. */
|
|
84690
|
-
handgunGrip: [-0.
|
|
85253
|
+
handgunGrip: [-0.13, -0.05, -0.4],
|
|
84691
85254
|
/** A one-hand tool's grip: low in front of the body, the elbow bent. */
|
|
84692
85255
|
toolGrip: [0.02, -0.34, -0.3],
|
|
84693
85256
|
/** A gun in each hand: each grip ahead of its own shoulder, a little in and low, the arms out at the aim (the left one is the mirror, in the left shoulder's frame). */
|
|
@@ -84703,7 +85266,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
84703
85266
|
/** The farthest apart two hands hold a long gun (a support hand past it slides back along the gun, toward the grip). */
|
|
84704
85267
|
supportSpan: 0.5,
|
|
84705
85268
|
/** A gun carried at the hip (`carry: 'hip'`): its rear grip low at the right hip, a little ahead of it. */
|
|
84706
|
-
hipGrip: [0.
|
|
85269
|
+
hipGrip: [0.2, -0.4, -0.24],
|
|
84707
85270
|
/**
|
|
84708
85271
|
* A tool put away against the body to free its hand (a magazine changed with a tool in each hand): tucked in the front of the belt on its own side, muzzle down and grip forward, its
|
|
84709
85272
|
* grip here in the frame of the shoulder pocket (the left one mirrored).
|
|
@@ -84815,6 +85378,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
84815
85378
|
// the lens of the long guns and the tools: a gun beside a blade in the other hand is drawn through the same one
|
|
84816
85379
|
dual: { grip: [0.19, -0.2, -0.4], fov: 84, sights: { distance: 0.42, fromRear: 0.02 } }
|
|
84817
85380
|
};
|
|
85381
|
+
var viewKindOf = (parts2, oneHand) => oneHand ? "dual" : parts2.carry === "hip" ? "hip" : parts2.family === "pistol" || parts2.family === "revolver" ? "handgun" : parts2.family === "rocket" ? "launcher" : "long";
|
|
84818
85382
|
var NO_GRIP_REAR = [0.2, -0.24, -0.12];
|
|
84819
85383
|
var SIGHT_UNDER_EYE = 0.02;
|
|
84820
85384
|
var scratch2 = { grip: null, hip: null, aimed: null, tilt: null };
|
|
@@ -85063,8 +85627,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85063
85627
|
var SHOVEL_SWING = {
|
|
85064
85628
|
keys: [
|
|
85065
85629
|
{ at: 0, ...HOLD },
|
|
85066
|
-
{ at: 0.3, offset: [0.
|
|
85067
|
-
{ at: 0.47, offset: [-0.025, 0, -0.
|
|
85630
|
+
{ at: 0.3, offset: [0.17, 0.04, 0.06], turn: [0.05, 0.2, 0.1] },
|
|
85631
|
+
{ at: 0.47, offset: [-0.025, 0, -0.08], turn: [0, -0.15, 0] },
|
|
85068
85632
|
{ at: 0.67, offset: [-0.16, -0.03, -0.1], turn: [0, -0.5, -0.075] },
|
|
85069
85633
|
{ at: 1, ...HOLD }
|
|
85070
85634
|
]
|
|
@@ -85093,7 +85657,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85093
85657
|
pivot: "grip",
|
|
85094
85658
|
keys: [
|
|
85095
85659
|
{ at: 0, ...HOLD },
|
|
85096
|
-
{ at: 0.
|
|
85660
|
+
{ at: 0.14, offset: [0.14, 0.03, 0.05], turn: [0.7, -0.9, 0] },
|
|
85661
|
+
{ at: 0.29, offset: [0.24, 0.04, 0.1], turn: [1.9, -0.6, 0] },
|
|
85097
85662
|
{ at: 0.43, offset: [-0.1, 0.04, -0.07], turn: [-0.3, 1.2, 0] },
|
|
85098
85663
|
{ at: 0.64, offset: [-0.28, 0.1, 0], turn: [2, 1, 0] },
|
|
85099
85664
|
{ at: 0.8, offset: [-0.2, 0.06, 0.02], turn: [1.8, 0.8, 0] },
|
|
@@ -85204,7 +85769,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85204
85769
|
return group;
|
|
85205
85770
|
}
|
|
85206
85771
|
|
|
85207
|
-
// ../game-items-three/dist/chunk-
|
|
85772
|
+
// ../game-items-three/dist/chunk-DBIE2ZMX.js
|
|
85208
85773
|
var destruction_default = {
|
|
85209
85774
|
families: {
|
|
85210
85775
|
drink_can: {
|
|
@@ -85601,6 +86166,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85601
86166
|
return;
|
|
85602
86167
|
}
|
|
85603
86168
|
const rule = modelId !== void 0 ? itemDestruction(modelId) : shapeId !== void 0 ? shapeDestruction(shapeId) : void 0;
|
|
86169
|
+
const body = options.parts?.length === 1 ? options.parts[0] : void 0;
|
|
85604
86170
|
if (rule?.tessellate) tessellateShapes(root, rule.tessellate, three);
|
|
85605
86171
|
const solid2 = [];
|
|
85606
86172
|
root.traverse((object2) => {
|
|
@@ -85614,6 +86180,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85614
86180
|
mesh3.userData.destructionSkin = true;
|
|
85615
86181
|
return;
|
|
85616
86182
|
}
|
|
86183
|
+
if (body) {
|
|
86184
|
+
mesh3.userData.destructionMaterial = body.material;
|
|
86185
|
+
if (body.thickness !== void 0) mesh3.userData.destructionThickness = body.thickness;
|
|
86186
|
+
}
|
|
85617
86187
|
if (rule?.hollow) mesh3.userData.hollow = true;
|
|
85618
86188
|
if (powder) mesh3.userData.destructionPowder = { color: powder.color };
|
|
85619
86189
|
solid2.push(mesh3);
|
|
@@ -85647,6 +86217,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85647
86217
|
return object2;
|
|
85648
86218
|
};
|
|
85649
86219
|
return {
|
|
86220
|
+
carryHandle: (part) => {
|
|
86221
|
+
part.userData[CARRY_HANDLE_TAG] = true;
|
|
86222
|
+
return part;
|
|
86223
|
+
},
|
|
85650
86224
|
T: T2,
|
|
85651
86225
|
materials,
|
|
85652
86226
|
M,
|
|
@@ -89073,7 +89647,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
89073
89647
|
mesh3(bx(14, 5.5, 3), metal2(7304056), [23, 0, -6])
|
|
89074
89648
|
);
|
|
89075
89649
|
};
|
|
89076
|
-
var bucket = ({ mesh: mesh3, bx, cyl, G, plastic, metal: metal2 }) => {
|
|
89650
|
+
var bucket = ({ mesh: mesh3, bx, cyl, G, plastic, metal: metal2, carryHandle }) => {
|
|
89077
89651
|
const body = plastic(2908062);
|
|
89078
89652
|
const wire = metal2(9080209);
|
|
89079
89653
|
return G(
|
|
@@ -89082,7 +89656,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
89082
89656
|
mesh3(cyl(11.8, 11.8, 1, 16), plastic(2313602), [0, -13, 0]),
|
|
89083
89657
|
mesh3(bx(0.6, 3.7, 0.6), wire, [13, 11.35, 0]),
|
|
89084
89658
|
mesh3(bx(0.6, 3.7, 0.6), wire, [-13, 11.35, 0]),
|
|
89085
|
-
mesh3(bx(27.2, 0.5, 1.1), wire, [0, 13.25, 0])
|
|
89659
|
+
carryHandle(mesh3(bx(27.2, 0.5, 1.1), wire, [0, 13.25, 0]))
|
|
89086
89660
|
);
|
|
89087
89661
|
};
|
|
89088
89662
|
var binoculars = ({ mesh: mesh3, bx, cyl, G, M, plastic, metal: metal2 }) => {
|
|
@@ -91707,7 +92281,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
91707
92281
|
const materials = kit.materials.slice(first);
|
|
91708
92282
|
if (options.wear) setWear(materials, options.wear);
|
|
91709
92283
|
root.userData.wear = options.wear ?? 0;
|
|
91710
|
-
if (options.destructible) tagForDestruction(root, { ...kind === "model" && item.model !== void 0 ? { modelId: item.model } : {}, ...shape === void 0 ? {} : { shapeId: shape }, ...item.weight === void 0 ? {} : { weight: item.weight }, size: item.size, ...item.powder ? { powder: item.powder } : {}, three: T2 });
|
|
92284
|
+
if (options.destructible) tagForDestruction(root, { ...kind === "model" && item.model !== void 0 ? { modelId: item.model } : {}, ...shape === void 0 ? {} : { shapeId: shape }, ...item.weight === void 0 ? {} : { weight: item.weight }, size: item.size, ...item.powder ? { powder: item.powder } : {}, ...item.parts ? { parts: item.parts } : {}, three: T2 });
|
|
91711
92285
|
markKitOrigin(root, { owner: "game-items-three", kind: "item", id: item.id, ...kind === "shape" ? { standIn: true } : {} });
|
|
91712
92286
|
return { root, kind, ...shape ? { shape } : {}, size: item.size, materials };
|
|
91713
92287
|
}
|
|
@@ -91923,7 +92497,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
91923
92497
|
["nail_bat", { grips: { handle: -0.3, support: -0.41 } }],
|
|
91924
92498
|
["iron_pipe", { grips: { handle: -0.29, support: -0.41 } }],
|
|
91925
92499
|
["crowbar", { grips: { handle: -0.3, support: -0.42 } }],
|
|
91926
|
-
["sledgehammer", { grips: { handle: -0.22, support: -0.42 } }]
|
|
92500
|
+
["sledgehammer", { grips: { handle: -0.22, support: -0.42 } }],
|
|
92501
|
+
// an axe and a pickaxe are swung with both hands as the shovel is (the `two_hand_swing` family): the right at the end of the haft, the left up it toward the head
|
|
92502
|
+
["axe", { grips: { handle: -0.44, support: -0.2 } }],
|
|
92503
|
+
["pickaxe", { grips: { handle: -0.44, support: -0.2 } }],
|
|
92504
|
+
// a spear is thrust with both hands on the shaft, a forearm apart
|
|
92505
|
+
["improvised_spear", { grips: { handle: -0.35, support: -0.12 } }]
|
|
91927
92506
|
];
|
|
91928
92507
|
var hasThrowableModel = (def) => def.action?.kind === "throwable" && def.action.explosive !== void 0 && hasExplosiveModel(def.action.explosive);
|
|
91929
92508
|
var buildThrowableModel = (THREE, def) => def.action?.kind === "throwable" && def.action.explosive !== void 0 ? buildExplosiveModel(THREE, def.action.explosive) : void 0;
|
|
@@ -91955,6 +92534,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
91955
92534
|
|
|
91956
92535
|
// src/box-fx.ts
|
|
91957
92536
|
var TOOL_REACH = 0.47;
|
|
92537
|
+
var RIGID_IN_HAND = /* @__PURE__ */ new Set(["melee", "tool"]);
|
|
92538
|
+
var SEAT_STILL = { distance: 1e-4, angle: 1e-4 };
|
|
91958
92539
|
var EJECTS_ON_SHOT = /* @__PURE__ */ new Set(["pistol", "smg", "carbine", "rifle", "sniper", "shotgun"]);
|
|
91959
92540
|
var SPOUTS = /* @__PURE__ */ new Set(["firearm", "flame", "heat", "extinguisher"]);
|
|
91960
92541
|
var DROPS_MAGAZINE = /* @__PURE__ */ new Set(["pistol", "smg", "carbine", "rifle", "sniper"]);
|
|
@@ -91980,7 +92561,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
91980
92561
|
let inHand = null;
|
|
91981
92562
|
let def = null;
|
|
91982
92563
|
let hold = null;
|
|
91983
|
-
let
|
|
92564
|
+
let kick2 = 0;
|
|
91984
92565
|
let motion = null;
|
|
91985
92566
|
const applyMotion = (frame2) => {
|
|
91986
92567
|
if (!motion) return;
|
|
@@ -92021,6 +92602,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92021
92602
|
const q = new THREE.Quaternion();
|
|
92022
92603
|
const bodyFrame = new THREE.Quaternion();
|
|
92023
92604
|
const q2 = new THREE.Quaternion();
|
|
92605
|
+
const seatTurn = new THREE.Quaternion();
|
|
92606
|
+
const seatAsked = new THREE.Quaternion();
|
|
92024
92607
|
const pointForward = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI / 2);
|
|
92025
92608
|
const frontOf = new THREE.Vector3();
|
|
92026
92609
|
const restBox2 = new THREE.Box3();
|
|
@@ -92086,15 +92669,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92086
92669
|
scene.add(mesh3);
|
|
92087
92670
|
bodies.push({ mesh: mesh3, velocity: velocity2, spin: new THREE.Vector3(random() * 20 - 10, random() * 30 - 15, random() * 20 - 10), radius, age: 0, resting: false, bounces: 0, kind });
|
|
92088
92671
|
};
|
|
92089
|
-
const ejectCasing = (caliberMm, isShell
|
|
92672
|
+
const ejectCasing = (caliberMm, isShell) => {
|
|
92673
|
+
if (!model) return;
|
|
92090
92674
|
const radius = isShell ? 0.0105 : Math.max(3e-3, caliberMm / 1e3 * 0.6);
|
|
92091
92675
|
const length2 = isShell ? 0.068 : Math.min(0.07, Math.max(0.015, caliberMm / 1e3 * 2.6));
|
|
92092
92676
|
const mesh3 = new THREE.Mesh(new THREE.CylinderGeometry(radius, radius, length2, 8), isShell ? shell : brass);
|
|
92093
92677
|
mesh3.name = "casing";
|
|
92094
|
-
|
|
92095
|
-
const
|
|
92096
|
-
|
|
92097
|
-
const
|
|
92678
|
+
hand.updateMatrixWorld(true);
|
|
92679
|
+
const from = model.localToWorld(new THREE.Vector3(frontOf.x - lengthMetres * 0.4, frontOf.y + 0.02, 0.015));
|
|
92680
|
+
if (inLens) toWorldLens(camera2, from, camera2.fov ?? 72, VIEW_HOLD.tool.fov);
|
|
92681
|
+
const scatter2 = new THREE.Vector3(random() - 0.5, random() - 0.5, random() - 0.5).multiplyScalar(2 * EJECT_SCATTER);
|
|
92682
|
+
const velocity2 = ejectDirection(THREE, "right").add(scatter2).normalize().multiplyScalar(1.5 + random() * 0.6).applyQuaternion(model.getWorldQuaternion(q2));
|
|
92098
92683
|
throwBody("casing", mesh3, from, velocity2, radius);
|
|
92099
92684
|
};
|
|
92100
92685
|
const dropMagazine = (category) => {
|
|
@@ -92116,20 +92701,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92116
92701
|
bodies.splice(bodies.indexOf(body), 1);
|
|
92117
92702
|
}
|
|
92118
92703
|
const onShot = (weapon2) => {
|
|
92119
|
-
|
|
92704
|
+
kick2 = 1;
|
|
92120
92705
|
const caliber = weapon2.action.kind === "firearm" ? arsenal.calibers.get(weapon2.action.caliber) : void 0;
|
|
92121
92706
|
const energy = caliber ? muzzleEnergy(caliber) * (caliber.pellets ?? 1) : FALLBACK_ENERGY;
|
|
92122
92707
|
audio?.shot(energy, weapon2.category, { ...caliber ? { caliber } : {}, distance: options.soundDistance?.() ?? 0, space: options.soundSpace?.() ?? "outdoor" });
|
|
92123
92708
|
if (CYCLES.has(weapon2.id)) audio?.cycle();
|
|
92124
|
-
if (EJECTS_ON_SHOT.has(weapon2.category) && weapon2.id !== "shotgun_double_12") ejectCasing(caliberOf2(weapon2), weapon2.category === "shotgun"
|
|
92709
|
+
if (EJECTS_ON_SHOT.has(weapon2.category) && weapon2.id !== "shotgun_double_12") ejectCasing(caliberOf2(weapon2), weapon2.category === "shotgun");
|
|
92125
92710
|
};
|
|
92126
|
-
const onReloadStart = (weapon2
|
|
92711
|
+
const onReloadStart = (weapon2) => {
|
|
92127
92712
|
if (DROPS_MAGAZINE.has(weapon2.category)) dropMagazine(weapon2.category);
|
|
92128
92713
|
else audio?.reloadStart(weapon2.category);
|
|
92129
|
-
if (weapon2.category === "revolver" || weapon2.id === "shotgun_double_12") {
|
|
92130
|
-
const spent = Math.max(1, tool2.capacity - tool2.ammo);
|
|
92131
|
-
for (let i = 0; i < spent; i++) ejectCasing(caliberOf2(weapon2), weapon2.category === "shotgun", true);
|
|
92132
|
-
}
|
|
92133
92714
|
};
|
|
92134
92715
|
const stepBody = (body, dt) => {
|
|
92135
92716
|
body.age += dt;
|
|
@@ -92182,6 +92763,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92182
92763
|
hand.updateMatrixWorld(true);
|
|
92183
92764
|
return targetsOf(THREE, held, model.getWorldQuaternion(q2), 0);
|
|
92184
92765
|
},
|
|
92766
|
+
seat(reached) {
|
|
92767
|
+
const held = heldHold();
|
|
92768
|
+
const got = reached[side];
|
|
92769
|
+
if (!model || !def || !held || !got || !RIGID_IN_HAND.has(def.action.kind)) return false;
|
|
92770
|
+
hand.updateMatrixWorld(true);
|
|
92771
|
+
const asked = targetsOf(THREE, held, model.getWorldQuaternion(q2), 0)[side];
|
|
92772
|
+
if (!asked) return false;
|
|
92773
|
+
seatTurn.set(...got.quaternion).multiply(seatAsked.set(...asked.quaternion).invert());
|
|
92774
|
+
const off = Math.hypot(got.position[0] - asked.position[0], got.position[1] - asked.position[1], got.position[2] - asked.position[2]);
|
|
92775
|
+
if (off < SEAT_STILL.distance && 2 * Math.acos(Math.min(1, Math.abs(seatTurn.w))) < SEAT_STILL.angle) return false;
|
|
92776
|
+
hand.position.sub(v.set(...asked.position)).applyQuaternion(seatTurn).add(v.set(...got.position));
|
|
92777
|
+
hand.quaternion.premultiply(seatTurn);
|
|
92778
|
+
hand.updateMatrixWorld(true);
|
|
92779
|
+
return true;
|
|
92780
|
+
},
|
|
92185
92781
|
handle(event, tool2) {
|
|
92186
92782
|
if (event.type === "explosion" || event.type === "player" || event.type === "footfall") return;
|
|
92187
92783
|
const weapon2 = arsenal.weapons.get(event.weapon);
|
|
@@ -92196,12 +92792,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92196
92792
|
}
|
|
92197
92793
|
if (event.type === "shot") onShot(weapon2);
|
|
92198
92794
|
else if (event.type === "empty") audio?.click();
|
|
92199
|
-
else if (event.type === "reload" && event.phase === "start") onReloadStart(weapon2
|
|
92795
|
+
else if (event.type === "reload" && event.phase === "start") onReloadStart(weapon2);
|
|
92200
92796
|
else if (event.type === "reload" && event.phase === "end") audio?.reloadEnd(weapon2.category);
|
|
92201
92797
|
reloading = tool2.reloading;
|
|
92202
92798
|
},
|
|
92203
92799
|
update(dt) {
|
|
92204
|
-
|
|
92800
|
+
kick2 *= Math.exp(-dt * 14);
|
|
92205
92801
|
if (motion) {
|
|
92206
92802
|
motion.elapsed += dt;
|
|
92207
92803
|
if (motion.elapsed >= motion.duration) motion = null;
|
|
@@ -92212,7 +92808,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92212
92808
|
const held = heldHold();
|
|
92213
92809
|
const kind = isOneHand() && def?.action.kind === "firearm" ? "dual" : "tool";
|
|
92214
92810
|
placeInView({ THREE, hand, holder: model, camera: camera2, right: heldAnchor(held), box: restBox2, kind, aim: 0, offset: noMotion, ...side === "L" ? { mirror: true } : {} });
|
|
92215
|
-
hand.position.add(v.set(0, -0.12 * dip, 0.05 *
|
|
92811
|
+
hand.position.add(v.set(0, -0.12 * dip, 0.05 * kick2).applyQuaternion(camera2.quaternion));
|
|
92216
92812
|
applyMotion(camera2.quaternion);
|
|
92217
92813
|
hand.updateMatrixWorld(true);
|
|
92218
92814
|
} else if (inHand && model) {
|
|
@@ -92223,8 +92819,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92223
92819
|
const grip = def?.action.kind === "firearm" ? BODY_HOLD.dualGrip : BODY_HOLD.toolGrip;
|
|
92224
92820
|
placeOnBody({ THREE, hand, holder: model, frame: options.bodyHold?.() ?? eyeFrame(), rear, lengthMetres, handgun: true, right: heldAnchor(held), left: null, grip, ...side === "L" ? { mirror: true } : {} });
|
|
92225
92821
|
} else placeOnBody({ THREE, hand, holder: model, frame: options.bodyHold?.() ?? eyeFrame(), rear, lengthMetres, handgun, right: hold?.right ?? null, left: hold?.left ?? null });
|
|
92226
|
-
hand.position.add(v.set(0, -0.12 * dip, 0.05 *
|
|
92227
|
-
q.setFromEuler(new THREE.Euler(0.14 *
|
|
92822
|
+
hand.position.add(v.set(0, -0.12 * dip, 0.05 * kick2).applyQuaternion(camera2.quaternion));
|
|
92823
|
+
q.setFromEuler(new THREE.Euler(0.14 * kick2 - 0.25 * dip, 0, 0.6 * dip));
|
|
92228
92824
|
hand.quaternion.multiply(q);
|
|
92229
92825
|
const body = options.bodyHold?.() ?? eyeFrame();
|
|
92230
92826
|
applyMotion(bodyFrame.set(body.quaternion[0], body.quaternion[1], body.quaternion[2], body.quaternion[3]));
|
|
@@ -92398,9 +92994,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92398
92994
|
}
|
|
92399
92995
|
function cycleClip(context) {
|
|
92400
92996
|
const { parts: parts2, family } = context;
|
|
92401
|
-
if (family === "pump" && parts2.pump) return composeClip("cycle", [move("pump", "x", 0.22, 0.11, 0, PUMP_TRAVEL), move("pump", "x", 0.36, 0.11, PUMP_TRAVEL, 0)], [cue(0.3, "eject_casing"
|
|
92402
|
-
if ((family === "bolt" || family === "boltmag") && parts2.bolt && parts2.boltHandle) return composeClip("cycle", boltStroke(0.3), [cue(0.5, "eject_casing"
|
|
92403
|
-
if (family === "lever" && parts2.lever) return composeClip("cycle", [turn("lever", "z", 0.22, 0.13, 0, LEVER_TURN), turn("lever", "z", 0.38, 0.13, LEVER_TURN, 0)], [cue(0.3, "eject_casing"
|
|
92997
|
+
if (family === "pump" && parts2.pump) return composeClip("cycle", [move("pump", "x", 0.22, 0.11, 0, PUMP_TRAVEL), move("pump", "x", 0.36, 0.11, PUMP_TRAVEL, 0)], [cue(0.3, "eject_casing")], 0.5);
|
|
92998
|
+
if ((family === "bolt" || family === "boltmag") && parts2.bolt && parts2.boltHandle) return composeClip("cycle", boltStroke(0.3), [cue(0.5, "eject_casing")], 0.82);
|
|
92999
|
+
if (family === "lever" && parts2.lever) return composeClip("cycle", [turn("lever", "z", 0.22, 0.13, 0, LEVER_TURN), turn("lever", "z", 0.38, 0.13, LEVER_TURN, 0)], [cue(0.3, "eject_casing")], 0.55);
|
|
92404
93000
|
return void 0;
|
|
92405
93001
|
}
|
|
92406
93002
|
var STUCK_AT = { stovepipe: 0.35, double_feed: 0.6, misfire: 0, failure_to_extract: 0 };
|
|
@@ -92475,7 +93071,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92475
93071
|
return draft;
|
|
92476
93072
|
}
|
|
92477
93073
|
function revolverReload(kind) {
|
|
92478
|
-
const events = [sound2(0, "cylinder_open"), cue(0.32, "eject_casing", { from: "chambers"
|
|
93074
|
+
const events = [sound2(0, "cylinder_open"), cue(0.32, "eject_casing", { from: "chambers" }), sound2(0.32, "cylinder_eject"), sound2(1.2, "cylinder_close")];
|
|
92479
93075
|
if (kind !== "one_by_one") events.push(cue(0.7, "move_in", { from: "chambers" }), sound2(0.7, "speedloader"));
|
|
92480
93076
|
return { tweens: [turn("crane", "x", 0, 0.22, 0, -1.25), turn("crane", "x", 1.05, 0.2, -1.25, 0)], events, end: 1.3 };
|
|
92481
93077
|
}
|
|
@@ -92483,7 +93079,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92483
93079
|
tweens: [turn("barrels", "z", 0, 0.2, 0, -0.5), turn("barrels", "z", 1, 0.15, -0.5, 0)],
|
|
92484
93080
|
events: [
|
|
92485
93081
|
sound2(0, "barrels_open"),
|
|
92486
|
-
cue(0.25, "eject_casing", { from: "breech"
|
|
93082
|
+
cue(0.25, "eject_casing", { from: "breech" }),
|
|
92487
93083
|
sound2(0.25, "casings_eject"),
|
|
92488
93084
|
cue(0.65, "move_in", { from: "breech" }),
|
|
92489
93085
|
sound2(0.65, "shell_insert"),
|
|
@@ -92596,12 +93192,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92596
93192
|
var FAULT_SLIDE_BACK = { stovepipe: 0.35, double_feed: 0.6 };
|
|
92597
93193
|
var pullTrigger = (context) => context.parts.trigger ? [turn("trigger", "z", 0, 0.04, 0, 0.35), turn("trigger", "z", 0.06, 0.08, 0.35, 0)] : [];
|
|
92598
93194
|
var recoil = (context) => {
|
|
92599
|
-
const
|
|
93195
|
+
const kick2 = kickOf(context);
|
|
92600
93196
|
return [
|
|
92601
|
-
move(ROOT2, "x", 0, 0.03, 0, -0.014 *
|
|
92602
|
-
turn(ROOT2, "z", 0, 0.03, 0, 0.045 *
|
|
92603
|
-
move(ROOT2, "x", 0.03, 0.18, -0.014 *
|
|
92604
|
-
turn(ROOT2, "z", 0.03, 0.18, 0.045 *
|
|
93197
|
+
move(ROOT2, "x", 0, 0.03, 0, -0.014 * kick2),
|
|
93198
|
+
turn(ROOT2, "z", 0, 0.03, 0, 0.045 * kick2),
|
|
93199
|
+
move(ROOT2, "x", 0.03, 0.18, -0.014 * kick2, 0),
|
|
93200
|
+
turn(ROOT2, "z", 0.03, 0.18, 0.045 * kick2, 0)
|
|
92605
93201
|
];
|
|
92606
93202
|
};
|
|
92607
93203
|
var spinBarrels = (context) => context.parts.barrels && context.family === "belt" ? [turn("barrels", "x", 0, 0.03, 0, Math.PI / 3)] : [];
|
|
@@ -92617,7 +93213,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92617
93213
|
tweens.push(move(part, "x", 0, 0.025, 0, travel));
|
|
92618
93214
|
if (!locked) tweens.push(move(part, "x", 0.025, 0.045, travel, 0));
|
|
92619
93215
|
}
|
|
92620
|
-
events.push(cue(0.012, "eject_casing"
|
|
93216
|
+
events.push(cue(0.012, "eject_casing"));
|
|
92621
93217
|
} else if (REVOLVING.has(family) && parts2.cylinder && parts2.hammer) {
|
|
92622
93218
|
tweens.push(turn("cylinder", "x", 0, 0.05, 0, Math.PI / 3), turn("hammer", "z", 0, 0.05, 0, 0.5), turn("hammer", "z", 0.05, 0.03, 0.5, -0.5), turn("hammer", "z", 0.12, 0.08, -0.5, 0));
|
|
92623
93219
|
}
|
|
@@ -97507,8 +98103,36 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97507
98103
|
loop: 2,
|
|
97508
98104
|
timeline: [call2("bodywork_impact", [0, 0, 0], NORMAL, [variable("dx"), variable("dy"), variable("dz")], variable("bore"), variable("paint"), variable("metal"))]
|
|
97509
98105
|
};
|
|
98106
|
+
var GLASS_PIECE = 11061464;
|
|
98107
|
+
var GLASS_DUST = 12572386;
|
|
98108
|
+
var HIT = [0, 0, 0];
|
|
98109
|
+
var VEHICLE_GLASS_CHIP = {
|
|
98110
|
+
id: "vehicle_glass_chip",
|
|
98111
|
+
pageId: "vehicle:vehicle_glass_chip",
|
|
98112
|
+
team: "vehicles",
|
|
98113
|
+
budget: { particles: 16, debris: 6 },
|
|
98114
|
+
loop: 2,
|
|
98115
|
+
timeline: [
|
|
98116
|
+
burst("add", 6, { p: HIT, box: [0.04, 0.04, 0.04], size: [8e-3, 0.02], life: [0.12, 0.3], c0: 16777215, a: 0.9, fi: 0.3 }),
|
|
98117
|
+
burst("normal", 6, { p: HIT, dir: NORMAL, sp: [0.3, 0.9], drag: 3, life: [0.4, 0.8], size: [0.04, 0.08], grow: 2, c0: GLASS_DUST, a: 0.18 }),
|
|
98118
|
+
repeat(6, debris({ p: HIT, box: [0.03, 0.03, 0.03], dir: NORMAL, cone: 0.6, sp: [0.4, 1.4], size: [rnd(2e-3, 4e-3), 2e-3, rnd(2e-3, 4e-3)], c: GLASS_PIECE, spin: 20, life: 6, bounce: 0.2 }))
|
|
98119
|
+
]
|
|
98120
|
+
};
|
|
98121
|
+
var VEHICLE_GLASS_SHATTER = {
|
|
98122
|
+
id: "vehicle_glass_shatter",
|
|
98123
|
+
pageId: "vehicle:vehicle_glass_shatter",
|
|
98124
|
+
team: "vehicles",
|
|
98125
|
+
budget: { particles: 40, debris: 0 },
|
|
98126
|
+
loop: 2,
|
|
98127
|
+
timeline: [
|
|
98128
|
+
burst("add", 24, { p: HIT, box: [0.5, 0.3, 0.5], size: [0.01, 0.03], life: [0.15, 0.5], c0: 16777215, a: 0.9, fi: 0.3 }),
|
|
98129
|
+
burst("normal", 10, { p: [0, -0.15, 0], box: [0.5, 0.2, 0.5], sp: [0.1, 0.4], drag: 2, life: [0.6, 1.1], size: [0.08, 0.14], grow: 2.5, c0: GLASS_DUST, a: 0.14 })
|
|
98130
|
+
]
|
|
98131
|
+
};
|
|
97510
98132
|
var VEHICLE_EFFECTS = [
|
|
97511
98133
|
BODYWORK_IMPACT,
|
|
98134
|
+
VEHICLE_GLASS_CHIP,
|
|
98135
|
+
VEHICLE_GLASS_SHATTER,
|
|
97512
98136
|
/** The engine on fire: `engine_smoke` at its worst condition (black smoke, flames in the hood, a light). */
|
|
97513
98137
|
aliasOf(ENGINE_SMOKE, "vehicle_fire", { params: { id: "condition", options: ["100", "60", "30", "10"], default: 3 }, loop: 12 }),
|
|
97514
98138
|
/** The exhaust of a car under way: `engine_smoke` in the best condition, for half a second so a moving car asks again. */
|
|
@@ -97630,11 +98254,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97630
98254
|
const { x, y, scale } = args;
|
|
97631
98255
|
let best;
|
|
97632
98256
|
let bestDistance = 9;
|
|
97633
|
-
for (const
|
|
97634
|
-
const distance4 = Math.hypot(
|
|
98257
|
+
for (const block2 of blocks) {
|
|
98258
|
+
const distance4 = Math.hypot(block2.x - x, block2.y - y);
|
|
97635
98259
|
if (distance4 < bestDistance) {
|
|
97636
98260
|
bestDistance = distance4;
|
|
97637
|
-
best =
|
|
98261
|
+
best = block2;
|
|
97638
98262
|
}
|
|
97639
98263
|
}
|
|
97640
98264
|
if (!best) return;
|
|
@@ -97648,10 +98272,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97648
98272
|
impact2(host.engine, "concrete", [ORIGIN4[0] + x, y, ORIGIN4[2] + 0.13], [0, 0, 1], 0.8);
|
|
97649
98273
|
} else if (action === "collapse") {
|
|
97650
98274
|
const { x, y } = args;
|
|
97651
|
-
for (const
|
|
97652
|
-
const dx =
|
|
97653
|
-
const dy =
|
|
97654
|
-
|
|
98275
|
+
for (const block2 of blocks) {
|
|
98276
|
+
const dx = block2.x - x;
|
|
98277
|
+
const dy = block2.y - y;
|
|
98278
|
+
block2.motion = {
|
|
97655
98279
|
vx: dx * random.between(0.8, 2),
|
|
97656
98280
|
vy: random.between(0.5, 2.5) + dy * 0.5,
|
|
97657
98281
|
vz: random.between(-2.2, -0.4),
|
|
@@ -97668,17 +98292,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97668
98292
|
throw new Error(`blocks: unknown query ${name}`);
|
|
97669
98293
|
},
|
|
97670
98294
|
update(_host, dt) {
|
|
97671
|
-
for (const
|
|
97672
|
-
const motion =
|
|
98295
|
+
for (const block2 of blocks) {
|
|
98296
|
+
const motion = block2.motion;
|
|
97673
98297
|
if (!motion || motion.rest) continue;
|
|
97674
98298
|
motion.vy -= 9.8 * dt;
|
|
97675
|
-
|
|
97676
|
-
|
|
97677
|
-
|
|
97678
|
-
|
|
97679
|
-
|
|
97680
|
-
if (
|
|
97681
|
-
|
|
98299
|
+
block2.x += motion.vx * dt;
|
|
98300
|
+
block2.y += motion.vy * dt;
|
|
98301
|
+
block2.rotation[0] += motion.wx * dt;
|
|
98302
|
+
block2.rotation[1] += motion.wy * dt;
|
|
98303
|
+
block2.rotation[2] += motion.wz * dt;
|
|
98304
|
+
if (block2.y < FLOOR2) {
|
|
98305
|
+
block2.y = FLOOR2;
|
|
97682
98306
|
motion.vy *= -0.25;
|
|
97683
98307
|
motion.vx *= 0.5;
|
|
97684
98308
|
motion.vz *= 0.5;
|
|
@@ -97687,8 +98311,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97687
98311
|
motion.wz *= 0.5;
|
|
97688
98312
|
if (Math.abs(motion.vy) < 0.4 && Math.hypot(motion.vx, motion.vz) < 0.3) {
|
|
97689
98313
|
motion.rest = true;
|
|
97690
|
-
|
|
97691
|
-
|
|
98314
|
+
block2.rotation[0] = Math.round(block2.rotation[0] / QUARTER_TURN) * QUARTER_TURN;
|
|
98315
|
+
block2.rotation[2] = Math.round(block2.rotation[2] / QUARTER_TURN) * QUARTER_TURN;
|
|
97692
98316
|
}
|
|
97693
98317
|
}
|
|
97694
98318
|
}
|
|
@@ -98966,6 +99590,110 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
98966
99590
|
function addScrape(store, spec) {
|
|
98967
99591
|
store.add({ kind: "scrape", ...spec, y: spec.y + 2e-3 + nextLift(store) * 2e-4 });
|
|
98968
99592
|
}
|
|
99593
|
+
var RESTITUTION = -0.32;
|
|
99594
|
+
var GROUND_FRICTION = 0.5;
|
|
99595
|
+
var REST_SPEED = 0.6;
|
|
99596
|
+
var REST_SLIDE = 0.5;
|
|
99597
|
+
var TRAIL_SECONDS = 1.8;
|
|
99598
|
+
var TRAIL_STEP = 0.025;
|
|
99599
|
+
var QUARTER_TURN3 = Math.PI / 2;
|
|
99600
|
+
var TOP_FACING = 0.7;
|
|
99601
|
+
var MOVE2 = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5 };
|
|
99602
|
+
function bounce2(core, chunk, floor2) {
|
|
99603
|
+
chunk.y = floor2;
|
|
99604
|
+
if (chunk.blood && !chunk.splat && core.layers.mark) {
|
|
99605
|
+
chunk.splat = true;
|
|
99606
|
+
addBloodSplat(core.marks, core.ground, chunk.rng, { x: chunk.x, z: chunk.z, radius: chunk.rng.between(0.06, 0.13) });
|
|
99607
|
+
}
|
|
99608
|
+
chunk.vy *= RESTITUTION;
|
|
99609
|
+
chunk.vx *= GROUND_FRICTION;
|
|
99610
|
+
chunk.vz *= GROUND_FRICTION;
|
|
99611
|
+
chunk.ax *= GROUND_FRICTION;
|
|
99612
|
+
chunk.ay *= GROUND_FRICTION;
|
|
99613
|
+
chunk.az *= GROUND_FRICTION;
|
|
99614
|
+
if (Math.abs(chunk.vy) < REST_SPEED && Math.hypot(chunk.vx, chunk.vz) < REST_SLIDE) {
|
|
99615
|
+
chunk.rest = true;
|
|
99616
|
+
chunk.rx = Math.round(chunk.rx / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99617
|
+
chunk.rz = Math.round(chunk.rz / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99618
|
+
}
|
|
99619
|
+
}
|
|
99620
|
+
var chunkPad = (chunk) => Math.max(chunk.sx, chunk.sy, chunk.sz) * 0.45;
|
|
99621
|
+
function hitFace(chunk, out) {
|
|
99622
|
+
chunk.x = out.x;
|
|
99623
|
+
chunk.y = out.y;
|
|
99624
|
+
chunk.z = out.z;
|
|
99625
|
+
const into = chunk.vx * out.nx + chunk.vy * out.ny + chunk.vz * out.nz;
|
|
99626
|
+
if (into >= 0) return;
|
|
99627
|
+
const tx = chunk.vx - into * out.nx;
|
|
99628
|
+
const ty = chunk.vy - into * out.ny;
|
|
99629
|
+
const tz = chunk.vz - into * out.nz;
|
|
99630
|
+
const back2 = into * RESTITUTION;
|
|
99631
|
+
chunk.vx = tx * GROUND_FRICTION + back2 * out.nx;
|
|
99632
|
+
chunk.vy = ty * GROUND_FRICTION + back2 * out.ny;
|
|
99633
|
+
chunk.vz = tz * GROUND_FRICTION + back2 * out.nz;
|
|
99634
|
+
chunk.ax *= GROUND_FRICTION;
|
|
99635
|
+
chunk.ay *= GROUND_FRICTION;
|
|
99636
|
+
chunk.az *= GROUND_FRICTION;
|
|
99637
|
+
if (out.ny > TOP_FACING && Math.abs(back2) < REST_SPEED && Math.sqrt(tx * tx + tz * tz) * GROUND_FRICTION < REST_SLIDE) {
|
|
99638
|
+
chunk.rest = true;
|
|
99639
|
+
chunk.rx = Math.round(chunk.rx / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99640
|
+
chunk.rz = Math.round(chunk.rz / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99641
|
+
}
|
|
99642
|
+
}
|
|
99643
|
+
function leaveTrail(core, chunk, dt) {
|
|
99644
|
+
chunk.trail -= dt;
|
|
99645
|
+
if (chunk.trail > 0) return;
|
|
99646
|
+
chunk.trail = TRAIL_STEP;
|
|
99647
|
+
const random = chunk.rng;
|
|
99648
|
+
addSpark(core, {
|
|
99649
|
+
x: chunk.x,
|
|
99650
|
+
y: chunk.y,
|
|
99651
|
+
z: chunk.z,
|
|
99652
|
+
vx: chunk.vx * 0.15,
|
|
99653
|
+
vy: chunk.vy * 0.15,
|
|
99654
|
+
vz: chunk.vz * 0.15,
|
|
99655
|
+
life: random.between(0.25, 0.45),
|
|
99656
|
+
w: 0.05 + chunk.sx * 0.2,
|
|
99657
|
+
st: 0.05,
|
|
99658
|
+
kind: 0,
|
|
99659
|
+
g: 0,
|
|
99660
|
+
drag: 1,
|
|
99661
|
+
source: chunk.source
|
|
99662
|
+
});
|
|
99663
|
+
if (random.next() < 0.25) {
|
|
99664
|
+
addPuff(core, random, { x: chunk.x, y: chunk.y, z: chunk.z, s0: 0.04, s1: 0.14 + chunk.sx * 0.3, sg: 0.15, life: random.between(1, 1.6), drag: 2, buoy: 0.6, color: SMOKE_COLORS.grey, kind: 0, source: chunk.source });
|
|
99665
|
+
}
|
|
99666
|
+
}
|
|
99667
|
+
function updateChunks(core, dt) {
|
|
99668
|
+
const confiner = core.confiner;
|
|
99669
|
+
const confining = !confiner.empty;
|
|
99670
|
+
const chunks = core.chunks.items;
|
|
99671
|
+
for (let index = 0; index < chunks.length; index++) {
|
|
99672
|
+
const chunk = chunks[index];
|
|
99673
|
+
chunk.t += dt;
|
|
99674
|
+
if (chunk.rest) continue;
|
|
99675
|
+
MOVE2.x0 = chunk.x;
|
|
99676
|
+
MOVE2.y0 = chunk.y;
|
|
99677
|
+
MOVE2.z0 = chunk.z;
|
|
99678
|
+
chunk.vy -= core.gravity * dt;
|
|
99679
|
+
chunk.x += chunk.vx * dt;
|
|
99680
|
+
chunk.y += chunk.vy * dt;
|
|
99681
|
+
chunk.z += chunk.vz * dt;
|
|
99682
|
+
chunk.rx += chunk.ax * dt;
|
|
99683
|
+
chunk.ry += chunk.ay * dt;
|
|
99684
|
+
chunk.rz += chunk.az * dt;
|
|
99685
|
+
if (confining) {
|
|
99686
|
+
MOVE2.x1 = chunk.x;
|
|
99687
|
+
MOVE2.y1 = chunk.y;
|
|
99688
|
+
MOVE2.z1 = chunk.z;
|
|
99689
|
+
MOVE2.pad = chunkPad(chunk);
|
|
99690
|
+
if (confiner.confineMove(MOVE2, dt)) hitFace(chunk, confiner.out);
|
|
99691
|
+
}
|
|
99692
|
+
const floor2 = chunk.sy * 0.45 + core.groundAt(chunk.x, chunk.z);
|
|
99693
|
+
if (chunk.y < floor2) bounce2(core, chunk, floor2);
|
|
99694
|
+
if (chunk.hot && chunk.t < TRAIL_SECONDS && core.layers.smoke) leaveTrail(core, chunk, dt);
|
|
99695
|
+
}
|
|
99696
|
+
}
|
|
98969
99697
|
function createRingPool(capacity) {
|
|
98970
99698
|
return new OrderedPool(capacity, () => ({ x: 0, z: 0, y0: 0, rise: 0, rk: 0, R0: 0, R1: 0, r: 0, roll: 0, t: 0, life: 0 }));
|
|
98971
99699
|
}
|
|
@@ -99095,6 +99823,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99095
99823
|
puff3.z = out.z;
|
|
99096
99824
|
slideInto(out, puff3);
|
|
99097
99825
|
}
|
|
99826
|
+
function chunkBornFrom(core, chunk, ox, oy, oz) {
|
|
99827
|
+
const confiner = core.confiner;
|
|
99828
|
+
if (confiner.empty) return;
|
|
99829
|
+
BIRTH.x0 = ox;
|
|
99830
|
+
BIRTH.y0 = oy;
|
|
99831
|
+
BIRTH.z0 = oz;
|
|
99832
|
+
BIRTH.x1 = chunk.x;
|
|
99833
|
+
BIRTH.y1 = chunk.y;
|
|
99834
|
+
BIRTH.z1 = chunk.z;
|
|
99835
|
+
BIRTH.pad = chunkPad(chunk);
|
|
99836
|
+
if (confiner.confineMove(BIRTH, 0)) hitFace(chunk, confiner.out);
|
|
99837
|
+
}
|
|
99098
99838
|
function composeFireballs(context) {
|
|
99099
99839
|
const { core, def, random, x, y, z, size, scale, direction } = context;
|
|
99100
99840
|
if (!core.layers.fire || !def.fireballs) return;
|
|
@@ -99279,7 +100019,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99279
100019
|
const sy = plate2 ? s * 0.3 : s * random.between(0.6, 1);
|
|
99280
100020
|
const color2 = hexToRgb2(chunks.colors.length > 0 ? pick22(random, chunks.colors) : DEFAULT_CHUNK_COLOR);
|
|
99281
100021
|
const hot = random.next() < chunks.hot;
|
|
99282
|
-
addChunk(core, random, {
|
|
100022
|
+
const chunk = addChunk(core, random, {
|
|
99283
100023
|
x: x + d.x * 0.2,
|
|
99284
100024
|
y: y + 0.2,
|
|
99285
100025
|
z: z + d.z * 0.2,
|
|
@@ -99293,10 +100033,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99293
100033
|
plate: plate2,
|
|
99294
100034
|
hot
|
|
99295
100035
|
});
|
|
100036
|
+
chunkBornFrom(core, chunk, x, y, z);
|
|
99296
100037
|
}
|
|
99297
100038
|
}
|
|
99298
100039
|
function composeRimDebris(context) {
|
|
99299
|
-
const { core, random, x, z } = context;
|
|
100040
|
+
const { core, random, x, y, z } = context;
|
|
99300
100041
|
const radius = context.def.mark.crater ?? 0;
|
|
99301
100042
|
if (!core.layers.shrapnel) return;
|
|
99302
100043
|
const speedScale = context.def.chunks.speed ?? 1;
|
|
@@ -99307,7 +100048,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99307
100048
|
const s = random.between(0.12, 0.28);
|
|
99308
100049
|
const vy2 = random.between(4, 10);
|
|
99309
100050
|
const color2 = hexToRgb2(random.next() < 0.6 ? ROCK_COLORS[0] : ROCK_COLORS[1]);
|
|
99310
|
-
addChunk(core, random, {
|
|
100051
|
+
const chunk = addChunk(core, random, {
|
|
99311
100052
|
x: x + Math.cos(angle) * 0.3,
|
|
99312
100053
|
y: 0.1,
|
|
99313
100054
|
z: z + Math.sin(angle) * 0.3,
|
|
@@ -99320,6 +100061,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99320
100061
|
color: color2,
|
|
99321
100062
|
plate: true
|
|
99322
100063
|
});
|
|
100064
|
+
chunkBornFrom(core, chunk, x, y, z);
|
|
99323
100065
|
}
|
|
99324
100066
|
}
|
|
99325
100067
|
function composeMushroom(context, spec) {
|
|
@@ -99450,71 +100192,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99450
100192
|
emitRequests(context);
|
|
99451
100193
|
return scale;
|
|
99452
100194
|
}
|
|
99453
|
-
var RESTITUTION = -0.32;
|
|
99454
|
-
var GROUND_FRICTION = 0.5;
|
|
99455
|
-
var REST_SPEED = 0.6;
|
|
99456
|
-
var REST_SLIDE = 0.5;
|
|
99457
|
-
var TRAIL_SECONDS = 1.8;
|
|
99458
|
-
var TRAIL_STEP = 0.025;
|
|
99459
|
-
var QUARTER_TURN3 = Math.PI / 2;
|
|
99460
|
-
function bounce2(core, chunk, floor2) {
|
|
99461
|
-
chunk.y = floor2;
|
|
99462
|
-
if (chunk.blood && !chunk.splat && core.layers.mark) {
|
|
99463
|
-
chunk.splat = true;
|
|
99464
|
-
addBloodSplat(core.marks, core.ground, chunk.rng, { x: chunk.x, z: chunk.z, radius: chunk.rng.between(0.06, 0.13) });
|
|
99465
|
-
}
|
|
99466
|
-
chunk.vy *= RESTITUTION;
|
|
99467
|
-
chunk.vx *= GROUND_FRICTION;
|
|
99468
|
-
chunk.vz *= GROUND_FRICTION;
|
|
99469
|
-
chunk.ax *= GROUND_FRICTION;
|
|
99470
|
-
chunk.ay *= GROUND_FRICTION;
|
|
99471
|
-
chunk.az *= GROUND_FRICTION;
|
|
99472
|
-
if (Math.abs(chunk.vy) < REST_SPEED && Math.hypot(chunk.vx, chunk.vz) < REST_SLIDE) {
|
|
99473
|
-
chunk.rest = true;
|
|
99474
|
-
chunk.rx = Math.round(chunk.rx / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99475
|
-
chunk.rz = Math.round(chunk.rz / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99476
|
-
}
|
|
99477
|
-
}
|
|
99478
|
-
function leaveTrail(core, chunk, dt) {
|
|
99479
|
-
chunk.trail -= dt;
|
|
99480
|
-
if (chunk.trail > 0) return;
|
|
99481
|
-
chunk.trail = TRAIL_STEP;
|
|
99482
|
-
const random = chunk.rng;
|
|
99483
|
-
addSpark(core, {
|
|
99484
|
-
x: chunk.x,
|
|
99485
|
-
y: chunk.y,
|
|
99486
|
-
z: chunk.z,
|
|
99487
|
-
vx: chunk.vx * 0.15,
|
|
99488
|
-
vy: chunk.vy * 0.15,
|
|
99489
|
-
vz: chunk.vz * 0.15,
|
|
99490
|
-
life: random.between(0.25, 0.45),
|
|
99491
|
-
w: 0.05 + chunk.sx * 0.2,
|
|
99492
|
-
st: 0.05,
|
|
99493
|
-
kind: 0,
|
|
99494
|
-
g: 0,
|
|
99495
|
-
drag: 1,
|
|
99496
|
-
source: chunk.source
|
|
99497
|
-
});
|
|
99498
|
-
if (random.next() < 0.25) {
|
|
99499
|
-
addPuff(core, random, { x: chunk.x, y: chunk.y, z: chunk.z, s0: 0.04, s1: 0.14 + chunk.sx * 0.3, sg: 0.15, life: random.between(1, 1.6), drag: 2, buoy: 0.6, color: SMOKE_COLORS.grey, kind: 0, source: chunk.source });
|
|
99500
|
-
}
|
|
99501
|
-
}
|
|
99502
|
-
function updateChunks(core, dt) {
|
|
99503
|
-
for (const chunk of core.chunks.items) {
|
|
99504
|
-
chunk.t += dt;
|
|
99505
|
-
if (chunk.rest) continue;
|
|
99506
|
-
chunk.vy -= core.gravity * dt;
|
|
99507
|
-
chunk.x += chunk.vx * dt;
|
|
99508
|
-
chunk.y += chunk.vy * dt;
|
|
99509
|
-
chunk.z += chunk.vz * dt;
|
|
99510
|
-
chunk.rx += chunk.ax * dt;
|
|
99511
|
-
chunk.ry += chunk.ay * dt;
|
|
99512
|
-
chunk.rz += chunk.az * dt;
|
|
99513
|
-
const floor2 = chunk.sy * 0.45 + core.groundAt(chunk.x, chunk.z);
|
|
99514
|
-
if (chunk.y < floor2) bounce2(core, chunk, floor2);
|
|
99515
|
-
if (chunk.hot && chunk.t < TRAIL_SECONDS && core.layers.smoke) leaveTrail(core, chunk, dt);
|
|
99516
|
-
}
|
|
99517
|
-
}
|
|
99518
100195
|
var DECAY = { shake: 5, white: 7, red: 2.2, side: 3, chroma: 3, desat: 0.7, gasSeconds: 5, beat: 6 };
|
|
99519
100196
|
var INITIAL_FLASH_DECAY = 6;
|
|
99520
100197
|
function createScreenState() {
|
|
@@ -103297,6 +103974,45 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103297
103974
|
};
|
|
103298
103975
|
}
|
|
103299
103976
|
|
|
103977
|
+
// src/fx/worn-pack-rig.ts
|
|
103978
|
+
var MOUNT_TURN = Math.PI / 2;
|
|
103979
|
+
var HOSE_SAG = 0.18;
|
|
103980
|
+
var HOSE_RADIUS = 0.011;
|
|
103981
|
+
var HOSE_SEGMENTS = 28;
|
|
103982
|
+
var createWornPackRig = (THREE, scene, pack2) => {
|
|
103983
|
+
const turn2 = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), MOUNT_TURN);
|
|
103984
|
+
const cord = createHangingCord(THREE, { segments: HOSE_SEGMENTS, radius: HOSE_RADIUS, material: pack2.hoseMaterial });
|
|
103985
|
+
const hose2 = cord.mesh;
|
|
103986
|
+
const from = new THREE.Vector3();
|
|
103987
|
+
const to = new THREE.Vector3();
|
|
103988
|
+
const rotation2 = new THREE.Quaternion();
|
|
103989
|
+
const offset = new THREE.Vector3();
|
|
103990
|
+
pack2.root.visible = false;
|
|
103991
|
+
hose2.visible = false;
|
|
103992
|
+
scene.add(pack2.root, hose2);
|
|
103993
|
+
return {
|
|
103994
|
+
update(slot) {
|
|
103995
|
+
const shown = slot !== null;
|
|
103996
|
+
pack2.root.visible = shown;
|
|
103997
|
+
hose2.visible = shown;
|
|
103998
|
+
if (!slot) return;
|
|
103999
|
+
rotation2.set(...slot.quaternion).multiply(turn2);
|
|
104000
|
+
pack2.root.quaternion.copy(rotation2);
|
|
104001
|
+
pack2.root.position.set(...slot.position).sub(offset.copy(pack2.mount.position).applyQuaternion(rotation2));
|
|
104002
|
+
pack2.root.updateMatrixWorld(true);
|
|
104003
|
+
pack2.wandEnd.getWorldPosition(from);
|
|
104004
|
+
pack2.port.getWorldPosition(to);
|
|
104005
|
+
cord.hang(from, to, HOSE_SAG);
|
|
104006
|
+
},
|
|
104007
|
+
dispose() {
|
|
104008
|
+
hose2.removeFromParent();
|
|
104009
|
+
hose2.geometry.dispose();
|
|
104010
|
+
pack2.root.removeFromParent();
|
|
104011
|
+
discardObject3D(pack2.root);
|
|
104012
|
+
}
|
|
104013
|
+
};
|
|
104014
|
+
};
|
|
104015
|
+
|
|
103300
104016
|
// src/fx/heavy.ts
|
|
103301
104017
|
var PI17 = Math.PI;
|
|
103302
104018
|
var ROCKET_LIGHT_NAME = "rocket-light";
|
|
@@ -103708,6 +104424,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103708
104424
|
|
|
103709
104425
|
// src/fx/viewmodel-events.ts
|
|
103710
104426
|
var PI18 = Math.PI;
|
|
104427
|
+
var DROP_SPEED = 0.4;
|
|
103711
104428
|
var UGL_FLASH = 1.6;
|
|
103712
104429
|
var restFlat = (object2) => {
|
|
103713
104430
|
object2.rotation.x = 0;
|
|
@@ -103728,10 +104445,16 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103728
104445
|
if (session.cartridge.caseType) casing2.group.userData["caseType"] = session.cartridge.caseType;
|
|
103729
104446
|
particles.spawn(casing2.group, velocity2, { kind: "casing", life: 25, radius: casing2.radius, bounce: 0.35, spin, onRest: restFlat, ownsGeometry: true, collider: casingCollider(casing2.radius, casing2.length) });
|
|
103730
104447
|
};
|
|
103731
|
-
const
|
|
104448
|
+
const scattered = (side, speed) => {
|
|
104449
|
+
const direction = ejectDirection(THREE, side);
|
|
104450
|
+
const jitter = vector2(random() - 0.5, random() - 0.5, random() - 0.5).multiplyScalar(2 * EJECT_SCATTER);
|
|
104451
|
+
return direction.add(jitter).normalize().multiplyScalar(speed);
|
|
104452
|
+
};
|
|
104453
|
+
const ejectFromPort = () => {
|
|
103732
104454
|
if (!parts2.eject) return;
|
|
103733
|
-
const
|
|
103734
|
-
|
|
104455
|
+
const side = parts2.ejectSide ?? "right";
|
|
104456
|
+
const speed = side === "down" ? DROP_SPEED : (1.5 + random() * 0.6) * reach2;
|
|
104457
|
+
throwCase(parts2.eject, toWorld3(session, scattered(side, speed)), vector2(random() * 30, random() * 30, random() * 30));
|
|
103735
104458
|
};
|
|
103736
104459
|
const ejectAll = (marks, spent) => {
|
|
103737
104460
|
marks?.forEach((mark, index) => {
|
|
@@ -103805,7 +104528,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103805
104528
|
const round5 = buildRound(kit, session.cartridge.dims, session.cartridge.shape);
|
|
103806
104529
|
round5.group.position.copy(positionOf3(parts2.eject));
|
|
103807
104530
|
particles.spawn(round5.group, toWorld3(session, vector2(-0.2, 1.1, 1.2)), { kind: "round", life: 25, radius: round5.radius, bounce: 0.3, spin: vector2(8, 12, 6), onRest: restFlat, ownsGeometry: true });
|
|
103808
|
-
} else ejectFromPort(
|
|
104531
|
+
} else ejectFromPort();
|
|
103809
104532
|
};
|
|
103810
104533
|
const trackOf = (mark) => () => root.parent ? { position: positionOf3(mark), orientation: root.getWorldQuaternion(new THREE.Quaternion()) } : null;
|
|
103811
104534
|
return (event) => {
|
|
@@ -103823,9 +104546,9 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103823
104546
|
}
|
|
103824
104547
|
break;
|
|
103825
104548
|
case "eject_casing":
|
|
103826
|
-
if (data.from === "chambers") ejectAll(parts2.chambers, () => ({ velocity:
|
|
103827
|
-
else if (data.from === "breech") ejectAll(parts2.breech, () => ({ velocity:
|
|
103828
|
-
else ejectFromPort(
|
|
104549
|
+
if (data.from === "chambers") ejectAll(parts2.chambers, () => ({ velocity: scattered("back", 0.5 + random() * 0.3), spin: vector2(10, 20, 5), tilt: 0 }));
|
|
104550
|
+
else if (data.from === "breech") ejectAll(parts2.breech, () => ({ velocity: scattered("backUp", 1.3), spin: vector2(3, 8, 12), tilt: -0.5 }));
|
|
104551
|
+
else ejectFromPort();
|
|
103829
104552
|
break;
|
|
103830
104553
|
case "drop_magazine":
|
|
103831
104554
|
dropMagazine(data.up === true);
|
|
@@ -104429,6 +105152,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104429
105152
|
hand.add(holder);
|
|
104430
105153
|
let tasks = [];
|
|
104431
105154
|
let stockRig = null;
|
|
105155
|
+
let wornRig = null;
|
|
104432
105156
|
let stockFolded = false;
|
|
104433
105157
|
let session = null;
|
|
104434
105158
|
let player = null;
|
|
@@ -104472,6 +105196,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104472
105196
|
lens2 = null;
|
|
104473
105197
|
lensLayer = -1;
|
|
104474
105198
|
session.attachments?.dispose();
|
|
105199
|
+
wornRig?.dispose();
|
|
105200
|
+
wornRig = null;
|
|
104475
105201
|
discardObject3D(session.model.root);
|
|
104476
105202
|
player = null;
|
|
104477
105203
|
session = null;
|
|
@@ -104497,7 +105223,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104497
105223
|
});
|
|
104498
105224
|
const equip = (weapon2) => {
|
|
104499
105225
|
const def = arsenal.weapons.get(weapon2);
|
|
104500
|
-
const model = def ? buildWeaponModelById(THREE, weapon2) : void 0;
|
|
105226
|
+
const model = def ? buildWeaponModelById(THREE, weapon2, { worn: "separate" }) : void 0;
|
|
104501
105227
|
if (!def || !model) return false;
|
|
104502
105228
|
release();
|
|
104503
105229
|
hold = null;
|
|
@@ -104508,6 +105234,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104508
105234
|
lift = 0;
|
|
104509
105235
|
rigStock(THREE, model, def);
|
|
104510
105236
|
rigUnderbarrel(THREE, model, def);
|
|
105237
|
+
wornRig = model.parts.worn ? createWornPackRig(THREE, scene, model.parts.worn) : null;
|
|
104511
105238
|
const modelBox = new THREE.Box3().setFromObject(model.root);
|
|
104512
105239
|
const length2 = modelBox.getSize(new THREE.Vector3()).x;
|
|
104513
105240
|
modelRear = modelBox.min.x;
|
|
@@ -104678,7 +105405,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104678
105405
|
const oneHand = isOneHand();
|
|
104679
105406
|
const held = heldHold();
|
|
104680
105407
|
if (options.firstPerson?.()) {
|
|
104681
|
-
const kind =
|
|
105408
|
+
const kind = viewKindOf(session.model.parts, oneHand);
|
|
104682
105409
|
const aim = oneHand || kind === "hip" ? 0 : options.aim?.() ?? 0;
|
|
104683
105410
|
placeInView({ THREE, hand, holder, camera: camera2, right: heldAnchor(held), box: restBox2, kind, aim, offset: viewMotion(dt, aim), ...side === "L" ? { mirror: true } : {} });
|
|
104684
105411
|
setLens(kind);
|
|
@@ -104691,7 +105418,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104691
105418
|
if (oneHand) placeOnBody({ THREE, hand, holder, frame: options.bodyHold?.() ?? eyeFrame(), rear: modelRear, lengthMetres: session.lengthMetres, handgun: true, right: heldAnchor(held), left: null, grip: BODY_HOLD.dualGrip, ...side === "L" ? { mirror: true } : {} });
|
|
104692
105419
|
else placeOnBody({ THREE, hand, holder, frame: options.bodyHold?.() ?? eyeFrame(), rear: modelRear, lengthMetres: session.lengthMetres, handgun: family === "pistol" || family === "revolver", hip: session.model.parts.carry === "hip", right: hold?.right ?? null, left: hold?.left ?? null });
|
|
104693
105420
|
hand.updateMatrixWorld(true);
|
|
104694
|
-
lift += (liftToKeepInView() - lift) * Math.min(1, dt * HAND_IN_VIEW.rate);
|
|
105421
|
+
lift += ((options.bodyHold?.() ? 0 : liftToKeepInView()) - lift) * Math.min(1, dt * HAND_IN_VIEW.rate);
|
|
104695
105422
|
if (lift > 1e-4) hand.position.addScaledVector(up.set(0, 1, 0).applyQuaternion(camera2.quaternion), lift);
|
|
104696
105423
|
hand.updateMatrixWorld(true);
|
|
104697
105424
|
pullFromWall(dt);
|
|
@@ -104773,6 +105500,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104773
105500
|
clock += dt;
|
|
104774
105501
|
if (session) {
|
|
104775
105502
|
place(dt);
|
|
105503
|
+
wornRig?.update(options.firstPerson?.() ? null : options.bodySlot?.("back") ?? null);
|
|
104776
105504
|
player?.update(dt);
|
|
104777
105505
|
if (posed.length) {
|
|
104778
105506
|
hand.updateMatrixWorld(true);
|
|
@@ -104902,6 +105630,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104902
105630
|
...options.physics ? { physics: options.physics } : {},
|
|
104903
105631
|
...options.contact ? { contact: options.contact } : {},
|
|
104904
105632
|
...options.bodyHold ? { bodyHold: options.bodyHold } : {},
|
|
105633
|
+
...options.bodySlot ? { bodySlot: options.bodySlot } : {},
|
|
104905
105634
|
...options.firstPerson ? { firstPerson: options.firstPerson } : {},
|
|
104906
105635
|
...options.viewmodelFov ? { viewmodelFov: options.viewmodelFov } : {},
|
|
104907
105636
|
...options.aim ? { aim: options.aim } : {},
|
|
@@ -104989,6 +105718,11 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104989
105718
|
if (supportR > 0.5) delete merged2.fingers;
|
|
104990
105719
|
return merged2;
|
|
104991
105720
|
},
|
|
105721
|
+
seat: (reached) => {
|
|
105722
|
+
const moved = model.inHand === null && box5.seat(reached);
|
|
105723
|
+
const movedLeft = left !== null && leftHeld() && left.model.inHand === null && left.box.seat(reached);
|
|
105724
|
+
return moved || movedLeft;
|
|
105725
|
+
},
|
|
104992
105726
|
muzzle: (hand) => {
|
|
104993
105727
|
const pair = hand === "L" ? left : right;
|
|
104994
105728
|
if (!pair) return null;
|
|
@@ -105525,6 +106259,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
105525
106259
|
source: "generated",
|
|
105526
106260
|
file: "generated/famas.svg"
|
|
105527
106261
|
},
|
|
106262
|
+
fists: {
|
|
106263
|
+
source: "generated",
|
|
106264
|
+
file: "generated/fists.svg"
|
|
106265
|
+
},
|
|
105528
106266
|
flamethrower: {
|
|
105529
106267
|
source: "generated",
|
|
105530
106268
|
file: "generated/flamethrower.svg"
|
|
@@ -105621,6 +106359,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
105621
106359
|
source: "generated",
|
|
105622
106360
|
file: "generated/hammer.svg"
|
|
105623
106361
|
},
|
|
106362
|
+
hand: {
|
|
106363
|
+
source: "generated",
|
|
106364
|
+
file: "generated/hand.svg"
|
|
106365
|
+
},
|
|
105624
106366
|
hatchet: {
|
|
105625
106367
|
source: "generated",
|
|
105626
106368
|
file: "generated/hatchet.svg"
|
|
@@ -105721,6 +106463,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
105721
106463
|
source: "generated",
|
|
105722
106464
|
file: "generated/kel_tec_ksg.svg"
|
|
105723
106465
|
},
|
|
106466
|
+
kick: {
|
|
106467
|
+
source: "generated",
|
|
106468
|
+
file: "generated/kick.svg"
|
|
106469
|
+
},
|
|
105724
106470
|
knife: {
|
|
105725
106471
|
source: "generated",
|
|
105726
106472
|
file: "generated/knife.svg"
|
|
@@ -105973,6 +106719,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
105973
106719
|
source: "generated",
|
|
105974
106720
|
file: "generated/shotgun_semi_12.svg"
|
|
105975
106721
|
},
|
|
106722
|
+
shove: {
|
|
106723
|
+
source: "generated",
|
|
106724
|
+
file: "generated/shove.svg"
|
|
106725
|
+
},
|
|
105976
106726
|
shovel: {
|
|
105977
106727
|
source: "generated",
|
|
105978
106728
|
file: "generated/shovel.svg"
|
|
@@ -106633,6 +107383,16 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
106633
107383
|
get fx() {
|
|
106634
107384
|
return fx;
|
|
106635
107385
|
},
|
|
107386
|
+
// every tool of the arsenal has its picture: the hotbar shows it for the ones no item stands for too (the generic guns, the hand and the fists)
|
|
107387
|
+
toolThumbnails: () => {
|
|
107388
|
+
const urls = {};
|
|
107389
|
+
if (thumbnailBase === false) return urls;
|
|
107390
|
+
for (const id of arsenal.weapons.keys()) {
|
|
107391
|
+
const url2 = weaponThumbnailUrl(id, thumbnailBase);
|
|
107392
|
+
if (url2) urls[id] = url2;
|
|
107393
|
+
}
|
|
107394
|
+
return urls;
|
|
107395
|
+
},
|
|
106636
107396
|
items: () => [
|
|
106637
107397
|
...weaponDefs.map((def) => withThumbnail(weaponItem(def, arsenal.name(def.id), options.items, options.props), def.id)),
|
|
106638
107398
|
counterItem(text.counter),
|
|
@@ -106720,6 +107480,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
106720
107480
|
// the weapon against a wall asks as often as the laser, on the clock of the simulation (so a fast-forwarded room measures as often per frame)
|
|
106721
107481
|
contact: createLaserRaycast(lent.THREE, lent.scene, lent.camera, { now: () => simulatedMs }),
|
|
106722
107482
|
...lent.holdFrame ? { bodyHold: () => lent.holdFrame?.() ?? null, leftBodyHold: () => lent.holdFrame?.("L") ?? null } : {},
|
|
107483
|
+
...lent.bodySlot ? { bodySlot: (slot) => lent.bodySlot?.(slot) ?? null } : {},
|
|
106723
107484
|
firstPerson: () => lent.player().cameraMode === "first",
|
|
106724
107485
|
// the lens of the gun in first person, how far it is brought to the eye (the right button) and how the body moves (the bob and the sway follow it)
|
|
106725
107486
|
...lent.setViewmodelFov ? { viewmodelFov: (degrees) => lent.setViewmodelFov?.(degrees) } : {},
|
|
@@ -106787,7 +107548,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
106787
107548
|
created.update(dt);
|
|
106788
107549
|
holstered?.update(dt);
|
|
106789
107550
|
});
|
|
106790
|
-
const offHands = lent.setHandTargets?.(
|
|
107551
|
+
const offHands = lent.setHandTargets?.(
|
|
107552
|
+
() => holstered?.handTargets() ?? created.handTargets(),
|
|
107553
|
+
(reached) => !holstered?.handTargets() && created.seat(reached)
|
|
107554
|
+
);
|
|
106791
107555
|
const offMuzzle = lent.setMuzzleSource?.((hand) => created.muzzle(hand));
|
|
106792
107556
|
const offClear = lent.onClear?.(() => created.clearLoose());
|
|
106793
107557
|
created.handle({ type: "tool", weapon: lent.tool().weapon }, lent.tool());
|
|
@@ -107109,7 +107873,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
107109
107873
|
if (by === "shot") say(fillText2(log.jet_lit, { seconds: num2(now() - (vessel.leakAt ?? now()), 1), rest: num2(rest2, 1) }), { phase: "torch", objectId: vessel.objectId, seconds: now() - (vessel.leakAt ?? now()), rest: rest2 });
|
|
107110
107874
|
else say(fillText2(log.lighter_lit, {}), { phase: "torch", objectId: vessel.objectId, by });
|
|
107111
107875
|
};
|
|
107112
|
-
const
|
|
107876
|
+
const shove2 = (vessel) => {
|
|
107113
107877
|
const leak = vessel.leaks[vessel.leaks.length - 1];
|
|
107114
107878
|
if (!room || !leak) return;
|
|
107115
107879
|
const [dx, dy, dz] = leak.direction;
|
|
@@ -107285,7 +108049,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
107285
108049
|
continue;
|
|
107286
108050
|
}
|
|
107287
108051
|
if (vessel.leakAt !== void 0) {
|
|
107288
|
-
if (t - vessel.leakAt <= hissSeconds && leaking(vessel))
|
|
108052
|
+
if (t - vessel.leakAt <= hissSeconds && leaking(vessel)) shove2(vessel);
|
|
107289
108053
|
if (vessel.cause === "shot" && !vessel.lit && t - vessel.leakAt >= igniteDelay && leaking(vessel)) ignite(vessel, "shot");
|
|
107290
108054
|
}
|
|
107291
108055
|
if (vessel.lit) {
|
|
@@ -107881,6 +108645,51 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
107881
108645
|
return { model: holder, axis: [0, 1, 0], ...body ? { body } : {} };
|
|
107882
108646
|
}
|
|
107883
108647
|
|
|
108648
|
+
// src/body-action-models.ts
|
|
108649
|
+
var SKIN3 = 14263420;
|
|
108650
|
+
var CLOTH = 3099514;
|
|
108651
|
+
var SOLE = 8947848;
|
|
108652
|
+
var block = (THREE, group, [width, height, depth, x, y, z = 0, turn2 = 0], color2, metalness = 0) => {
|
|
108653
|
+
const mesh3 = new THREE.Mesh(new THREE.BoxGeometry(width, height, depth), new THREE.MeshStandardMaterial({ color: color2, metalness }));
|
|
108654
|
+
mesh3.position.set(x, y, z);
|
|
108655
|
+
mesh3.rotation.z = turn2;
|
|
108656
|
+
group.add(mesh3);
|
|
108657
|
+
};
|
|
108658
|
+
var forearm = (THREE, group, y) => block(THREE, group, [0.34, 0.075, 0.07, -0.17, y], CLOTH);
|
|
108659
|
+
var openHand = (THREE, group) => {
|
|
108660
|
+
forearm(THREE, group, 0);
|
|
108661
|
+
block(THREE, group, [0.1, 0.09, 0.03, 0.05, 0], SKIN3);
|
|
108662
|
+
for (const [index, y] of [-0.033, -0.011, 0.011, 0.033].entries()) block(THREE, group, [0.085 - (index === 0 || index === 3 ? 0.012 : 0), 0.019, 0.025, 0.145, y + (index - 1.5) * 4e-3, 0, (index - 1.5) * 0.09], SKIN3);
|
|
108663
|
+
block(THREE, group, [0.06, 0.022, 0.025, 0.07, 0.07, 0, 0.7], SKIN3);
|
|
108664
|
+
};
|
|
108665
|
+
var fists = (THREE, group) => {
|
|
108666
|
+
for (const y of [-0.075, 0.075]) {
|
|
108667
|
+
forearm(THREE, group, y);
|
|
108668
|
+
block(THREE, group, [0.095, 0.085, 0.08, 0.05, y], SKIN3);
|
|
108669
|
+
for (const step of [-1.5, -0.5, 0.5, 1.5]) block(THREE, group, [0.025, 0.018, 0.02, 0.105, y + step * 0.02], SKIN3);
|
|
108670
|
+
}
|
|
108671
|
+
};
|
|
108672
|
+
var shove = (THREE, group) => {
|
|
108673
|
+
forearm(THREE, group, 0);
|
|
108674
|
+
block(THREE, group, [0.035, 0.16, 0.11, 0.05, 0.04], SKIN3);
|
|
108675
|
+
block(THREE, group, [0.05, 0.03, 0.03, 0.02, -0.06, 0, 0.5], SKIN3);
|
|
108676
|
+
};
|
|
108677
|
+
var kick = (THREE, group) => {
|
|
108678
|
+
block(THREE, group, [0.5, 0.11, 0.11, -0.25, 0], CLOTH);
|
|
108679
|
+
block(THREE, group, [0.07, 0.3, 0.12, 0.035, 0.04], CLOTH);
|
|
108680
|
+
block(THREE, group, [0.03, 0.3, 0.125, 0.085, 0.04], SOLE, 0.8);
|
|
108681
|
+
block(THREE, group, [0.07, 0.07, 0.12, 0.05, 0.2, 0, 0.3], CLOTH);
|
|
108682
|
+
};
|
|
108683
|
+
var BUILDERS5 = { hand: openHand, fists, shove, kick };
|
|
108684
|
+
function buildBodyActionModel(THREE, id) {
|
|
108685
|
+
const draw2 = BUILDERS5[id];
|
|
108686
|
+
if (!draw2) return void 0;
|
|
108687
|
+
const group = new THREE.Group();
|
|
108688
|
+
group.name = id;
|
|
108689
|
+
draw2(THREE, group);
|
|
108690
|
+
return group;
|
|
108691
|
+
}
|
|
108692
|
+
|
|
107884
108693
|
// src/weapon-props.ts
|
|
107885
108694
|
function createWeaponProps(options = {}) {
|
|
107886
108695
|
const entryOf = ([id, model]) => ({ id, model: model ?? { item: "" } });
|