@adatechnology/game-weapons-three 0.21.1 → 0.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.global.js +129 -23
- package/dist/index.global.js.map +1 -1
- package/package.json +4 -4
package/dist/index.global.js
CHANGED
|
@@ -15024,7 +15024,7 @@ var GameWeaponsThree = (() => {
|
|
|
15024
15024
|
heat: DEFAULT_HEAT,
|
|
15025
15025
|
noiseBurst: { step: 0.05, window: 3, cap: 0.5 },
|
|
15026
15026
|
// jogo.js (Jogo) explosionsUpdate 68300-68312: vy -= 9,8·dt; chão vy·-0,35 e vx,vz·0,6; parede v·-0,4
|
|
15027
|
-
explosives: { gravity: 9.8, groundRestitution: 0.35, groundFriction: 0.6, wallRestitution: 0.4, placeFuseFrom: 10, tripwire: { length: 10, angleDeg: 0, height: 0.15 } },
|
|
15027
|
+
explosives: { gravity: 9.8, groundRestitution: 0.35, groundFriction: 0.6, wallRestitution: 0.4, placeFuseFrom: 10, tripwire: { length: 10, angleDeg: 0, height: 0.15 }, unarmedImpact: "detonate", restSpeed: 0.5, selfDestructSeconds: 20 },
|
|
15028
15028
|
// Arsenal §11: montar e desmontar exige chave de fenda ou bancada; 2/15/30 s e a troca do lança-granadas (0,8 s) são padrões aprovados pelo dono (2026-10-24)
|
|
15029
15029
|
attachments: { fitSeconds: { field: 2, tool: 15, bench: 30 }, switchSeconds: 0.8, speedOfSound: 343 },
|
|
15030
15030
|
// Arsenal §08: tempo de mira = 0,15 s + 0,05 s por kg. O quadril do Arsenal é ×6 (o ZombiAdA liga isso por configuração); o SDK é neutro (1)
|
|
@@ -15073,6 +15073,8 @@ var GameWeaponsThree = (() => {
|
|
|
15073
15073
|
var distance = (a, b) => length(subtract(a, b));
|
|
15074
15074
|
var negate = (v) => [0 - v[0], 0 - v[1], 0 - v[2]];
|
|
15075
15075
|
var EPS = 1e-9;
|
|
15076
|
+
var STILL_STEPS = 2;
|
|
15077
|
+
var STILL_SHARE = 0.05;
|
|
15076
15078
|
var bounce = (velocity, normal, ground, rules) => {
|
|
15077
15079
|
const along = dot(velocity, normal);
|
|
15078
15080
|
if (along >= 0) return velocity;
|
|
@@ -15100,6 +15102,8 @@ var GameWeaponsThree = (() => {
|
|
|
15100
15102
|
__publicField(this, "isArmed");
|
|
15101
15103
|
__publicField(this, "isDone", false);
|
|
15102
15104
|
__publicField(this, "isDud", false);
|
|
15105
|
+
__publicField(this, "isLaunched");
|
|
15106
|
+
__publicField(this, "stillSteps", 0);
|
|
15103
15107
|
this.explosive = init.explosive;
|
|
15104
15108
|
this.position = [init.origin[0], init.origin[1], init.origin[2]];
|
|
15105
15109
|
this.velocity = init.velocity ? [init.velocity[0], init.velocity[1], init.velocity[2]] : [0, 0, 0];
|
|
@@ -15109,6 +15113,7 @@ var GameWeaponsThree = (() => {
|
|
|
15109
15113
|
this.isArmed = this.armDistance <= 0;
|
|
15110
15114
|
this.fuseLeft = this.triggers.has("timer") ? init.fuse : void 0;
|
|
15111
15115
|
this.rules = init.rules;
|
|
15116
|
+
this.isLaunched = this.triggers.has("impact") && this.moves();
|
|
15112
15117
|
}
|
|
15113
15118
|
get age() {
|
|
15114
15119
|
return this.clock;
|
|
@@ -15138,6 +15143,10 @@ var GameWeaponsThree = (() => {
|
|
|
15138
15143
|
const slice = this.fuseLeft === void 0 ? seconds : Math.min(seconds, this.fuseLeft);
|
|
15139
15144
|
this.fly(slice, probe, events);
|
|
15140
15145
|
if (this.isDone) return events;
|
|
15146
|
+
if (this.isLaunched && this.isSpent()) {
|
|
15147
|
+
events.push(this.detonate(this.clock >= this.rules.selfDestructSeconds ? "timer" : "impact"));
|
|
15148
|
+
return events;
|
|
15149
|
+
}
|
|
15141
15150
|
if (this.fuseLeft !== void 0) {
|
|
15142
15151
|
this.fuseLeft -= slice;
|
|
15143
15152
|
if (this.fuseLeft <= EPS) events.push(this.detonate("timer"));
|
|
@@ -15153,11 +15162,17 @@ var GameWeaponsThree = (() => {
|
|
|
15153
15162
|
moves() {
|
|
15154
15163
|
return length(this.velocity) > EPS;
|
|
15155
15164
|
}
|
|
15165
|
+
/** A launched round that came to rest (stopped, or still for `STILL_STEPS` steps) or flew past its self-destruct time. */
|
|
15166
|
+
isSpent() {
|
|
15167
|
+
if (this.clock >= this.rules.selfDestructSeconds) return true;
|
|
15168
|
+
return !this.moves() || this.stillSteps >= STILL_STEPS;
|
|
15169
|
+
}
|
|
15156
15170
|
fly(seconds, probe, events) {
|
|
15157
15171
|
if (seconds <= 0 || !this.moves()) {
|
|
15158
15172
|
this.clock += Math.max(0, seconds);
|
|
15159
15173
|
return;
|
|
15160
15174
|
}
|
|
15175
|
+
const start = this.position;
|
|
15161
15176
|
this.velocity = [this.velocity[0], this.velocity[1] - this.rules.gravity * seconds, this.velocity[2]];
|
|
15162
15177
|
const next = [this.position[0] + this.velocity[0] * seconds, this.position[1] + this.velocity[1] * seconds, this.position[2] + this.velocity[2] * seconds];
|
|
15163
15178
|
const hit = probe?.(this.position, next) ?? null;
|
|
@@ -15166,11 +15181,12 @@ var GameWeaponsThree = (() => {
|
|
|
15166
15181
|
const planned = distance(this.position, next);
|
|
15167
15182
|
this.flown += moved;
|
|
15168
15183
|
this.position = [target[0], target[1], target[2]];
|
|
15169
|
-
const
|
|
15184
|
+
const hitAt2 = this.clock + (hit && planned > EPS ? seconds * Math.min(1, moved / planned) : seconds);
|
|
15170
15185
|
this.clock += seconds;
|
|
15171
15186
|
if (length(this.velocity) > EPS) this.facing = normalize(this.velocity);
|
|
15187
|
+
this.stillSteps = distance(start, this.position) < this.rules.restSpeed * STILL_SHARE * seconds ? this.stillSteps + 1 : 0;
|
|
15172
15188
|
this.checkArmed(events);
|
|
15173
|
-
if (hit) this.onImpact(hit,
|
|
15189
|
+
if (hit) this.onImpact(hit, hitAt2, events);
|
|
15174
15190
|
}
|
|
15175
15191
|
checkArmed(events) {
|
|
15176
15192
|
if (this.isArmed || this.flown < this.armDistance) return;
|
|
@@ -15180,7 +15196,7 @@ var GameWeaponsThree = (() => {
|
|
|
15180
15196
|
onImpact(hit, at4, events) {
|
|
15181
15197
|
events.push({ type: "impact", at: at4, point: hit.point, armed: this.isArmed });
|
|
15182
15198
|
if (this.triggers.has("impact")) {
|
|
15183
|
-
if (this.isArmed) events.push(this.detonate("impact", at4));
|
|
15199
|
+
if (this.isArmed || this.rules.unarmedImpact !== "dud") events.push(this.detonate("impact", at4));
|
|
15184
15200
|
else {
|
|
15185
15201
|
this.isDone = true;
|
|
15186
15202
|
this.isDud = true;
|
|
@@ -24904,6 +24920,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24904
24920
|
var BREACH_GRID_CAP = 4096;
|
|
24905
24921
|
var MASONRY_CRUMBLE_SPEED = 0.6;
|
|
24906
24922
|
var TILE_CLUMPS = 160;
|
|
24923
|
+
var TILE_THICKNESS = 0.018;
|
|
24907
24924
|
var PANEL_EDGE_PILLAR = 2;
|
|
24908
24925
|
var PANEL_EDGE_BASE = 4;
|
|
24909
24926
|
var PANEL_EDGE_BEAM = 3;
|
|
@@ -26016,10 +26033,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26016
26033
|
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
26017
26034
|
const cells = grid.filter((cell, i) => worn[i] !== -1 && !(op && p.st.opening && Math.hypot(cell.center[u] - op[u], cell.center[v] - op[v]) <= p.st.opening.radius));
|
|
26018
26035
|
const { c } = partXf(o, p);
|
|
26019
|
-
const
|
|
26020
|
-
|
|
26021
|
-
|
|
26022
|
-
] : [];
|
|
26036
|
+
const tiles = isTiledCover(p);
|
|
26037
|
+
const pieces = cellFragments(o, p, clumpUnits(cells, p.thin, unitSpan(p), tiles ? TILE_CLUMPS : unitClumps), vec.add(c, [0, 1, 0]), null, MASONRY_CRUMBLE_SPEED, p.st.mass, "m_", true);
|
|
26038
|
+
const fragments = cells.length === 0 ? [] : tiles ? pieces.map((f) => ({ ...f, shape: "shard", size: f.size.map((x, k) => k === p.thin ? Math.min(x, TILE_THICKNESS) : x) })) : [...pieces, ...plasterFlakes(o, p, cells, vec.add(c, [0, 1, 0]), MASONRY_CRUMBLE_SPEED, "mp_")];
|
|
26023
26039
|
p.st.status = "broken";
|
|
26024
26040
|
p.st.hp = 0;
|
|
26025
26041
|
p.st.mass = 0;
|
|
@@ -27509,6 +27525,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27509
27525
|
return;
|
|
27510
27526
|
}
|
|
27511
27527
|
if (!force && giveAtCut(o, p, src)) return;
|
|
27528
|
+
if (!force && isTiledCover(p)) {
|
|
27529
|
+
crumbleMasonry(o, p, src);
|
|
27530
|
+
return;
|
|
27531
|
+
}
|
|
27512
27532
|
const ex = p.spec.explodes;
|
|
27513
27533
|
const style = force ?? (p.snap ? "snap" : p.mat.fracture === "none" ? "snap" : p.mat.fracture);
|
|
27514
27534
|
const { c, q } = partXf(o, p);
|
|
@@ -29530,6 +29550,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29530
29550
|
return loads;
|
|
29531
29551
|
}
|
|
29532
29552
|
var isBearing = (part) => part.role === "column" || part.role === "wall";
|
|
29553
|
+
function isRoofFrame2(part) {
|
|
29554
|
+
return part.role === "roof" || part.id.startsWith("rafter");
|
|
29555
|
+
}
|
|
29533
29556
|
function sizeCapacities(parts, supports, options) {
|
|
29534
29557
|
const loads = loadsAtRest(parts, supports);
|
|
29535
29558
|
const worst = /* @__PURE__ */ new Map();
|
|
@@ -29543,7 +29566,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29543
29566
|
for (const part of parts) {
|
|
29544
29567
|
const load = loads.get(part.id);
|
|
29545
29568
|
if (load === void 0 || part.role === "none") continue;
|
|
29546
|
-
const
|
|
29569
|
+
const afterLoss = (worst.get(part.id) ?? 1) / options.redundancy;
|
|
29570
|
+
const factor = isBearing(part) ? Math.max(1 / options.safety, afterLoss) : isRoofFrame2(part) ? Math.max(1 / options.safetyOthers, afterLoss) : 1 / options.safetyOthers;
|
|
29547
29571
|
capacities.set(part.id, Math.max(1, load * factor));
|
|
29548
29572
|
}
|
|
29549
29573
|
return capacities;
|
|
@@ -32253,7 +32277,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32253
32277
|
}
|
|
32254
32278
|
var residentialTower = residentialTowerTemplate();
|
|
32255
32279
|
|
|
32256
|
-
// ../game-floorplan-three/dist/chunk-
|
|
32280
|
+
// ../game-floorplan-three/dist/chunk-J3D4FCFR.js
|
|
32257
32281
|
var __defProp4 = Object.defineProperty;
|
|
32258
32282
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
32259
32283
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -33324,7 +33348,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33324
33348
|
}
|
|
33325
33349
|
const wref = R.walls.find((w) => w.floor === f && w.axis === j.axis && Math.abs((alongU ? w.v0 : w.u0) - L) < EPS6), th = wref ? wref.thickness || 0.15 : 0.15, t = 0.05, tt = th + 0.02;
|
|
33326
33350
|
const bar2 = (u0, y_0, u1, y_1, mat, color2, tw = tt) => alongU ? bx(mat, u0, y0 + y_0, L - tw / 2, u1, y0 + y_1, L + tw / 2, color2) : bx(mat, L - tw / 2, y0 + y_0, u0, L + tw / 2, y0 + y_1, u1, color2);
|
|
33327
|
-
|
|
33351
|
+
const frame2 = pieceRecord("window_frame:" + j.id, "aluminium", null, { floor: f });
|
|
33352
|
+
cursor.pc = frame2;
|
|
33328
33353
|
bar2(a, ya, a + t, yb, "metal", fr);
|
|
33329
33354
|
bar2(b - t, ya, b, yb, "metal", fr);
|
|
33330
33355
|
bar2(a, ya, b, ya + t, "metal", fr);
|
|
@@ -33337,6 +33362,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33337
33362
|
const am = (sd) => roomAt(f, alongU ? j.at : L + sd * 0.4, alongU ? L + sd * 0.4 : j.at);
|
|
33338
33363
|
const outside = !am(1) ? 1 : !am(-1) ? -1 : 0;
|
|
33339
33364
|
if (outside) {
|
|
33365
|
+
cursor.pc = frame2;
|
|
33340
33366
|
const off = outside * (th / 2 + 0.03);
|
|
33341
33367
|
if (alongU) bx("plaster", a - 0.05, y0 + ya - 0.04, L + (outside > 0 ? th / 2 : -th / 2 - 0.08), b + 0.05, y0 + ya, L + (outside > 0 ? th / 2 + 0.08 : -th / 2), pe_);
|
|
33342
33368
|
else bx("plaster", L + (outside > 0 ? th / 2 : -th / 2 - 0.08), y0 + ya - 0.04, a - 0.05, L + (outside > 0 ? th / 2 + 0.08 : -th / 2), y0 + ya, b + 0.05, pe_);
|
|
@@ -33352,6 +33378,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33352
33378
|
else bx("metal", L + go - 0.012, y0 + y, a, L + go + 0.012, y0 + y + 0.025, b, g);
|
|
33353
33379
|
}
|
|
33354
33380
|
}
|
|
33381
|
+
cursor.pc = null;
|
|
33355
33382
|
}
|
|
33356
33383
|
if (j.boards && !boardItems.has(j.id) && !cut) {
|
|
33357
33384
|
const inside2 = -(outside || -1), off = inside2 * (th / 2 + 0.04), n = Math.max(3, Math.round((yb - ya) / 0.16));
|
|
@@ -34284,7 +34311,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34284
34311
|
const { UV_SCALE, _Y, _h2, _q, accFor, cursor, put, rgbOf, structurePiece } = K;
|
|
34285
34312
|
const sh = (...a) => K.sh(...a);
|
|
34286
34313
|
const R_STYLE = () => shared3.ctx.r && shared3.ctx.r.style || "budget";
|
|
34287
|
-
function tileRelief(mat, pts, color2, type) {
|
|
34314
|
+
function tileRelief(mat, pts, color2, type, origin) {
|
|
34288
34315
|
const n = pts.length;
|
|
34289
34316
|
if (n < 3) return;
|
|
34290
34317
|
const [a, b, c] = pts;
|
|
@@ -34318,7 +34345,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34318
34345
|
ex /= el;
|
|
34319
34346
|
ey /= el;
|
|
34320
34347
|
ez /= el;
|
|
34321
|
-
const o = pts[0], S = [], T2 = [];
|
|
34348
|
+
const o = origin ?? pts[0], S = [], T2 = [];
|
|
34322
34349
|
for (const p of pts) {
|
|
34323
34350
|
const rx = p[0] - o[0], ry = p[1] - o[1], rz = p[2] - o[2];
|
|
34324
34351
|
S.push(rx * ex + ry * ey + rz * ez);
|
|
@@ -34383,6 +34410,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34383
34410
|
AC.nv += m * 2;
|
|
34384
34411
|
}
|
|
34385
34412
|
function ridge(a, b, type, roofColor) {
|
|
34413
|
+
const cuts = K.cfg.destruction ? baysAlong(a, b) : [];
|
|
34414
|
+
if (cuts.length) {
|
|
34415
|
+
let from = a;
|
|
34416
|
+
for (const f of [...cuts, 1]) {
|
|
34417
|
+
const to = [a[0] + (b[0] - a[0]) * f, a[1] + (b[1] - a[1]) * f, a[2] + (b[2] - a[2]) * f];
|
|
34418
|
+
ridgeCap(from, to, type, roofColor);
|
|
34419
|
+
from = to;
|
|
34420
|
+
}
|
|
34421
|
+
return;
|
|
34422
|
+
}
|
|
34423
|
+
ridgeCap(a, b, type, roofColor);
|
|
34424
|
+
}
|
|
34425
|
+
function ridgeCap(a, b, type, roofColor) {
|
|
34386
34426
|
cursor.pc = pieceOfPane((a[0] + b[0]) / 2, (a[2] + b[2]) / 2);
|
|
34387
34427
|
const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2], Ln = Math.hypot(dx, dy, dz);
|
|
34388
34428
|
if (Ln < 0.05) return;
|
|
@@ -34409,7 +34449,81 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34409
34449
|
}
|
|
34410
34450
|
return m ? structurePiece(m.id) : null;
|
|
34411
34451
|
}
|
|
34412
|
-
|
|
34452
|
+
function paneTiles(mat, pts, color2, type) {
|
|
34453
|
+
const panes = panesUnder(pts), whole = centroidPiece(pts);
|
|
34454
|
+
if (panes.length < 2 || !whole || !K.cfg.destruction) {
|
|
34455
|
+
cursor.pc = whole;
|
|
34456
|
+
tileRelief(mat, pts, color2, type);
|
|
34457
|
+
return;
|
|
34458
|
+
}
|
|
34459
|
+
for (const r of panes) {
|
|
34460
|
+
const part = clipToRect(pts, r);
|
|
34461
|
+
if (part.length < 3 || planArea(part) < 1e-4) continue;
|
|
34462
|
+
cursor.pc = centroidPiece(part);
|
|
34463
|
+
tileRelief(mat, part, color2, type, pts[0]);
|
|
34464
|
+
}
|
|
34465
|
+
}
|
|
34466
|
+
function centroidPiece(pts) {
|
|
34467
|
+
let cx = 0, cz = 0;
|
|
34468
|
+
for (const p of pts) {
|
|
34469
|
+
cx += p[0];
|
|
34470
|
+
cz += p[2];
|
|
34471
|
+
}
|
|
34472
|
+
return pieceOfPane(cx / pts.length, cz / pts.length);
|
|
34473
|
+
}
|
|
34474
|
+
function panesUnder(pts) {
|
|
34475
|
+
if (shared3.ctx.noPiece || !shared3.ctx.panes.length) return [];
|
|
34476
|
+
let x0 = Infinity, z0 = Infinity, x1 = -Infinity, z1 = -Infinity;
|
|
34477
|
+
for (const p of pts) {
|
|
34478
|
+
x0 = Math.min(x0, p[0]);
|
|
34479
|
+
x1 = Math.max(x1, p[0]);
|
|
34480
|
+
z0 = Math.min(z0, p[2]);
|
|
34481
|
+
z1 = Math.max(z1, p[2]);
|
|
34482
|
+
}
|
|
34483
|
+
const boxes = shared3.ctx.panes.map((a) => a.aabb).filter((b) => !!b && b[0] < x1 - 1e-4 && b[2] > x0 + 1e-4 && b[1] < z1 - 1e-4 && b[3] > z0 + 1e-4);
|
|
34484
|
+
if (boxes.length < 2) return boxes;
|
|
34485
|
+
const lo = [Math.min(...boxes.map((b) => b[0])), Math.min(...boxes.map((b) => b[1]))], hi = [Math.max(...boxes.map((b) => b[2])), Math.max(...boxes.map((b) => b[3]))];
|
|
34486
|
+
return boxes.map((b) => [b[0] <= lo[0] + 1e-6 ? -Infinity : b[0], b[1] <= lo[1] + 1e-6 ? -Infinity : b[1], b[2] >= hi[0] - 1e-6 ? Infinity : b[2], b[3] >= hi[1] - 1e-6 ? Infinity : b[3]]);
|
|
34487
|
+
}
|
|
34488
|
+
function baysAlong(a, b) {
|
|
34489
|
+
const rects = panesUnder([a, b, [b[0] + 1e-3, b[1], b[2] + 1e-3], [a[0] - 1e-3, a[1], a[2] - 1e-3]]);
|
|
34490
|
+
const alongX = Math.abs(b[0] - a[0]) >= Math.abs(b[2] - a[2]), i = alongX ? 0 : 2, k = alongX ? 0 : 1, span = b[i] - a[i];
|
|
34491
|
+
if (Math.abs(span) < 1e-6) return [];
|
|
34492
|
+
const cuts = /* @__PURE__ */ new Set();
|
|
34493
|
+
for (const r of rects) for (const v of [r[k], r[k + 2]]) {
|
|
34494
|
+
const f = (v - a[i]) / span;
|
|
34495
|
+
if (Number.isFinite(f) && f > 0.01 && f < 0.99) cuts.add(+f.toFixed(4));
|
|
34496
|
+
}
|
|
34497
|
+
return [...cuts].sort((p, q) => p - q);
|
|
34498
|
+
}
|
|
34499
|
+
function clipToRect(pts, r) {
|
|
34500
|
+
let poly = pts.map((p) => [p[0], p[1], p[2]]);
|
|
34501
|
+
const edges = [[0, r[0], 1], [0, r[2], -1], [2, r[1], 1], [2, r[3], -1]];
|
|
34502
|
+
for (const [axis2, at4, sign2] of edges) {
|
|
34503
|
+
if (!Number.isFinite(at4)) continue;
|
|
34504
|
+
const out = [];
|
|
34505
|
+
for (let i = 0; i < poly.length; i++) {
|
|
34506
|
+
const p = poly[i], q = poly[(i + 1) % poly.length], dp = (p[axis2] - at4) * sign2, dq = (q[axis2] - at4) * sign2;
|
|
34507
|
+
if (dp >= 0) out.push(p);
|
|
34508
|
+
if (dp >= 0 !== dq >= 0) {
|
|
34509
|
+
const t = dp / (dp - dq);
|
|
34510
|
+
out.push([p[0] + (q[0] - p[0]) * t, p[1] + (q[1] - p[1]) * t, p[2] + (q[2] - p[2]) * t]);
|
|
34511
|
+
}
|
|
34512
|
+
}
|
|
34513
|
+
poly = out;
|
|
34514
|
+
if (poly.length < 3) return [];
|
|
34515
|
+
}
|
|
34516
|
+
return poly;
|
|
34517
|
+
}
|
|
34518
|
+
function planArea(pts) {
|
|
34519
|
+
let a = 0;
|
|
34520
|
+
for (let i = 0; i < pts.length; i++) {
|
|
34521
|
+
const p = pts[i], q = pts[(i + 1) % pts.length];
|
|
34522
|
+
a += p[0] * q[2] - q[0] * p[2];
|
|
34523
|
+
}
|
|
34524
|
+
return Math.abs(a) / 2;
|
|
34525
|
+
}
|
|
34526
|
+
const defined = { R_STYLE, tileRelief, paneTiles, ridge, pieceOfPane };
|
|
34413
34527
|
Object.assign(K, defined);
|
|
34414
34528
|
}
|
|
34415
34529
|
function installRoofRect(K, shared3) {
|
|
@@ -34418,15 +34532,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34418
34532
|
function roofRect(type, X0, Z0, X1, Z1, yb, roofColor, gable, F, touchesU = [0, 0, 0, 0]) {
|
|
34419
34533
|
const C = shared3.ctx.colors, o = type === "fiber_cement" ? 0.3 : 0.45, x0 = X0 - (touchesU[0] ? 0 : o), x1 = X1 + (touchesU[2] ? 0 : o), z0 = Z0 - (touchesU[1] ? 0 : o), z1 = Z1 + (touchesU[3] ? 0 : o), dx = x1 - x0, dz = z1 - z0, xm = (x0 + x1) / 2, zm = (z0 + z1) / 2;
|
|
34420
34534
|
const mat = type === "fiber_cement" ? "fiber_cement" : "tile", tp = type === "fiber_cement" ? 0.2 : 0.5, alongX = dx >= dz, up = [0, 1, 0];
|
|
34421
|
-
const Q = (pts) =>
|
|
34422
|
-
let cx = 0, cz = 0;
|
|
34423
|
-
for (const p of pts) {
|
|
34424
|
-
cx += p[0];
|
|
34425
|
-
cz += p[2];
|
|
34426
|
-
}
|
|
34427
|
-
cursor.pc = pieceOfPane(cx / pts.length, cz / pts.length);
|
|
34428
|
-
return tileRelief(mat, pts, roofColor, type);
|
|
34429
|
-
};
|
|
34535
|
+
const Q = (pts) => K.paneTiles(mat, pts, roofColor, type);
|
|
34430
34536
|
cursor.pc = pieceOfPane(xm, zm);
|
|
34431
34537
|
{
|
|
34432
34538
|
const wt = 0.075, yc = yb - 0.2, cf = C.facade != null ? C.facade : 14209216, fas = R_STYLE() === "budget" ? 7228980 : sh(roofColor, 0.55), sof = 15131352, tz = 0.035;
|