@adatechnology/game-items-three 0.10.1 → 0.10.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 +193 -29
- package/dist/index.global.js.map +1 -1
- package/package.json +12 -12
package/dist/index.global.js
CHANGED
|
@@ -3037,6 +3037,28 @@ var GameItemsThree = (() => {
|
|
|
3037
3037
|
"corrosive"
|
|
3038
3038
|
]
|
|
3039
3039
|
},
|
|
3040
|
+
{
|
|
3041
|
+
id: "sewage",
|
|
3042
|
+
color: 5921582,
|
|
3043
|
+
opacity: 0.92,
|
|
3044
|
+
stainColor: 3093273,
|
|
3045
|
+
viscosity: 4,
|
|
3046
|
+
density: 1010,
|
|
3047
|
+
dryTime: 1800,
|
|
3048
|
+
gloss: 0.8,
|
|
3049
|
+
leavesMark: true,
|
|
3050
|
+
drink: {
|
|
3051
|
+
thirst: 0,
|
|
3052
|
+
effects: [
|
|
3053
|
+
"disgust",
|
|
3054
|
+
"poison"
|
|
3055
|
+
]
|
|
3056
|
+
},
|
|
3057
|
+
tags: [
|
|
3058
|
+
"organic",
|
|
3059
|
+
"waste"
|
|
3060
|
+
]
|
|
3061
|
+
},
|
|
3040
3062
|
{
|
|
3041
3063
|
id: "honey",
|
|
3042
3064
|
color: 14193162,
|
|
@@ -3068,6 +3090,46 @@ var GameItemsThree = (() => {
|
|
|
3068
3090
|
tags: [
|
|
3069
3091
|
"dirty"
|
|
3070
3092
|
]
|
|
3093
|
+
},
|
|
3094
|
+
{
|
|
3095
|
+
id: "coolant",
|
|
3096
|
+
color: 3455050,
|
|
3097
|
+
opacity: 0.7,
|
|
3098
|
+
stainColor: 2783796,
|
|
3099
|
+
viscosity: 4,
|
|
3100
|
+
density: 1070,
|
|
3101
|
+
dryTime: 1200,
|
|
3102
|
+
gloss: 0.85,
|
|
3103
|
+
leavesMark: true,
|
|
3104
|
+
drink: {
|
|
3105
|
+
thirst: 0,
|
|
3106
|
+
effects: [
|
|
3107
|
+
"poison"
|
|
3108
|
+
]
|
|
3109
|
+
},
|
|
3110
|
+
tags: [
|
|
3111
|
+
"coolant"
|
|
3112
|
+
]
|
|
3113
|
+
},
|
|
3114
|
+
{
|
|
3115
|
+
id: "brake_fluid",
|
|
3116
|
+
color: 13145646,
|
|
3117
|
+
opacity: 0.8,
|
|
3118
|
+
stainColor: 9069600,
|
|
3119
|
+
viscosity: 8,
|
|
3120
|
+
density: 1050,
|
|
3121
|
+
dryTime: 3600,
|
|
3122
|
+
gloss: 0.9,
|
|
3123
|
+
leavesMark: true,
|
|
3124
|
+
drink: {
|
|
3125
|
+
thirst: 0,
|
|
3126
|
+
effects: [
|
|
3127
|
+
"poison"
|
|
3128
|
+
]
|
|
3129
|
+
},
|
|
3130
|
+
tags: [
|
|
3131
|
+
"brake_fluid"
|
|
3132
|
+
]
|
|
3071
3133
|
}
|
|
3072
3134
|
];
|
|
3073
3135
|
var LIQUIDS = liquids_default;
|
|
@@ -19676,6 +19738,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19676
19738
|
if (mat.ductility >= 0.5 && p.thickness <= THIN_SHEET_DISHING) addDent(o, p, entry2, n, Math.max(caliber * 3 / 1e3, 0.012), clamp2(E * 2e-5, 1e-3, 0.03), src);
|
|
19677
19739
|
if (brittle && mat.fracture === "shatter") addCrack(o, p, entry2, n, crackLen, src);
|
|
19678
19740
|
if (p.spec.contains && (p.st.liters ?? 0) > 1e-4) {
|
|
19741
|
+
o.active = true;
|
|
19679
19742
|
emit({
|
|
19680
19743
|
...base(o, src),
|
|
19681
19744
|
type: "leak",
|
|
@@ -46586,7 +46649,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
46586
46649
|
}
|
|
46587
46650
|
var residentialTower = residentialTowerTemplate();
|
|
46588
46651
|
|
|
46589
|
-
// ../game-floorplan-three/dist/chunk-
|
|
46652
|
+
// ../game-floorplan-three/dist/chunk-ZVCG4IGR.js
|
|
46590
46653
|
var __defProp3 = Object.defineProperty;
|
|
46591
46654
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp3(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
46592
46655
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -55321,11 +55384,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55321
55384
|
}
|
|
55322
55385
|
return seats;
|
|
55323
55386
|
}
|
|
55387
|
+
var MAX_INTERIOR = 32;
|
|
55388
|
+
var INTERIOR_INSET = 0.01;
|
|
55324
55389
|
var newGroup = (k, house, exterior) => ({ k, house, ls: [], exterior, pos: [0, 0, 0], color: 0, n: 0, range: 0, rects: [], y: [0, 0], exclusion: null, lumens: 0, dist: 0, decay: 0, floor: 0, roomId: null, dm: 0, d: 0 });
|
|
55325
55390
|
function installLightsRoomLight(K, shared2) {
|
|
55326
55391
|
const { THREE, rectsOf: rectsOf2, cfg } = K;
|
|
55327
55392
|
const MAX_LIGHTS = 12, EMPTY = [1e9, 1e9, -1e9, -1e9];
|
|
55328
|
-
const LZU = { uRB0: { value: new Float32Array(MAX_LIGHTS * 4) }, uRB1: { value: new Float32Array(MAX_LIGHTS * 4) }, uRB2: { value: new Float32Array(MAX_LIGHTS * 4) }, uRBY: { value: new Float32Array(MAX_LIGHTS * 2) }, uREx: { value: new Float32Array(MAX_LIGHTS * 4) }, uIndK: { value: 0.06 } };
|
|
55393
|
+
const LZU = { uRB0: { value: new Float32Array(MAX_LIGHTS * 4) }, uRB1: { value: new Float32Array(MAX_LIGHTS * 4) }, uRB2: { value: new Float32Array(MAX_LIGHTS * 4) }, uRBY: { value: new Float32Array(MAX_LIGHTS * 2) }, uREx: { value: new Float32Array(MAX_LIGHTS * 4) }, uROut: { value: new Float32Array(MAX_LIGHTS) }, uRIn: { value: new Float32Array(MAX_INTERIOR * 4) }, uRInY: { value: new Float32Array(MAX_INTERIOR * 2) }, uRInN: { value: 0 }, uIndK: { value: 0.06 } };
|
|
55329
55394
|
for (let i = 0; i < MAX_LIGHTS; i++) for (const k of ["uRB0", "uRB1", "uRB2", "uREx"]) LZU[k].value.set(EMPTY, i * 4);
|
|
55330
55395
|
function roomLightMask(material) {
|
|
55331
55396
|
const m = material;
|
|
@@ -55338,23 +55403,31 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55338
55403
|
if (!sh || !sh.fragmentShader) return;
|
|
55339
55404
|
if (sh.uniforms) Object.assign(sh.uniforms, LZU);
|
|
55340
55405
|
if (sh.vertexShader) sh.vertexShader = sh.vertexShader.replace("void main() {", "varying vec3 vRoomW;\nvoid main() {").replace("#include <begin_vertex>", "#include <begin_vertex>\n vRoomW = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;");
|
|
55406
|
+
const lightsBegin = THREE.ShaderChunk?.lights_fragment_begin;
|
|
55407
|
+
if (lightsBegin) sh.fragmentShader = sh.fragmentShader.replace("#include <lights_fragment_begin>", lightsBegin);
|
|
55341
55408
|
sh.fragmentShader = sh.fragmentShader.replace("void main() {", `varying vec3 vRoomW;
|
|
55342
55409
|
#if NUM_POINT_LIGHTS > 0
|
|
55343
|
-
uniform vec4 uRB0[ NUM_POINT_LIGHTS ]; uniform vec4 uRB1[ NUM_POINT_LIGHTS ]; uniform vec4 uRB2[ NUM_POINT_LIGHTS ]; uniform vec2 uRBY[ NUM_POINT_LIGHTS ]; uniform vec4 uREx[ NUM_POINT_LIGHTS ];
|
|
55410
|
+
uniform vec4 uRB0[ NUM_POINT_LIGHTS ]; uniform vec4 uRB1[ NUM_POINT_LIGHTS ]; uniform vec4 uRB2[ NUM_POINT_LIGHTS ]; uniform vec2 uRBY[ NUM_POINT_LIGHTS ]; uniform vec4 uREx[ NUM_POINT_LIGHTS ]; uniform float uROut[ NUM_POINT_LIGHTS ];
|
|
55344
55411
|
#endif
|
|
55412
|
+
uniform vec4 uRIn[ ${MAX_INTERIOR} ]; uniform vec2 uRInY[ ${MAX_INTERIOR} ]; uniform int uRInN;
|
|
55345
55413
|
uniform float uIndK;
|
|
55346
55414
|
bool inRoomR( vec4 r, vec3 p ) { return p.x >= r.x && p.x <= r.z && p.z >= r.y && p.z <= r.w; }
|
|
55347
|
-
|
|
55348
|
-
|
|
55415
|
+
bool roomInside( vec3 p ) {
|
|
55416
|
+
for ( int j = 0; j < ${MAX_INTERIOR}; j ++ ) { if ( j >= uRInN ) break; if ( inRoomR( uRIn[ j ], p ) && p.y >= uRInY[ j ].x && p.y <= uRInY[ j ].y ) return true; }
|
|
55417
|
+
return false;
|
|
55418
|
+
}
|
|
55419
|
+
float roomMask( vec4 a, vec4 b, vec4 c, vec2 yy, vec4 ex, float outdoor, bool inside ) {
|
|
55420
|
+
vec3 p = vRoomW; if ( outdoor > 0.5 && outdoor < 1.5 && !inside ) return 1.0; float k = ( inRoomR( a, p ) || inRoomR( b, p ) || inRoomR( c, p ) ) ? 1.0 : 0.0;
|
|
55349
55421
|
k *= ( p.y >= yy.x && p.y <= yy.y ) ? 1.0 : 0.0; if ( inRoomR( ex, p ) ) k = 0.0; return k;
|
|
55350
55422
|
}
|
|
55351
|
-
void main() {
|
|
55352
|
-
|
|
55423
|
+
void main() {
|
|
55424
|
+
bool rInside = roomInside( vRoomW ); float rmk = 1.0;`).replace("getPointLightInfo( pointLight, geometryPosition, directLight );", `getPointLightInfo( pointLight, geometryPosition, directLight );
|
|
55425
|
+
rmk = roomMask( uRB0[ i ], uRB1[ i ], uRB2[ i ], uRBY[ i ], uREx[ i ], uROut[ i ], rInside );
|
|
55353
55426
|
directLight.color *= rmk;
|
|
55354
|
-
reflectedLight.indirectDiffuse += BRDF_Lambert( material.diffuseColor ) * pointLight.color * ( rmk * uIndK * ( 1.0 - smoothstep( 0.0, max( pointLight.distance, 0.1 ), length( pointLight.position - geometryPosition ) ) ) );`);
|
|
55427
|
+
reflectedLight.indirectDiffuse += BRDF_Lambert( material.diffuseColor ) * pointLight.color * ( rmk * step( uROut[ i ], 0.5 ) * uIndK * ( 1.0 - smoothstep( 0.0, max( pointLight.distance, 0.1 ), length( pointLight.position - geometryPosition ) ) ) );`);
|
|
55355
55428
|
};
|
|
55356
55429
|
m.customProgramCacheKey = function() {
|
|
55357
|
-
return (pk ? pk.call(this) : "") + "|
|
|
55430
|
+
return (pk ? pk.call(this) : "") + "|rm3";
|
|
55358
55431
|
};
|
|
55359
55432
|
m.needsUpdate = true;
|
|
55360
55433
|
return material;
|
|
@@ -55366,7 +55439,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55366
55439
|
for (const k of Object.keys(mats)) roomLightMask(mats[k]);
|
|
55367
55440
|
const budget = o.budget, lease = budget ? budget.lease({ owner: "floorplan.rooms", point: N, shadows: NS }) : null;
|
|
55368
55441
|
if (budget && !lease) throw new Error("lighting: the LightBudget has no " + N + " free point slots (" + NS + " with shadow) for the rooms");
|
|
55369
|
-
if (budget) for (const [key2, width] of [["uRB0", 4], ["uRB1", 4], ["uRB2", 4], ["uRBY", 2], ["uREx", 4]]) {
|
|
55442
|
+
if (budget) for (const [key2, width] of [["uRB0", 4], ["uRB1", 4], ["uRB2", 4], ["uRBY", 2], ["uREx", 4], ["uROut", 1]]) {
|
|
55370
55443
|
const next = new Float32Array(budget.sizes.point * width);
|
|
55371
55444
|
if (width === 4) for (let i = 0; i < budget.sizes.point; i++) next.set(EMPTY, i * 4);
|
|
55372
55445
|
LZU[key2].value = next;
|
|
@@ -55523,7 +55596,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55523
55596
|
A.stats.external = Ne;
|
|
55524
55597
|
let shadows = 0;
|
|
55525
55598
|
for (let i = 0; i < N; i++) {
|
|
55526
|
-
const g = asg[i], at2 = slotOf(i)
|
|
55599
|
+
const g = asg[i], at2 = slotOf(i);
|
|
55600
|
+
LZU.uROut.value[at2] = 0;
|
|
55601
|
+
const b0 = LZU.uRB0.value, b1 = LZU.uRB1.value, b2 = LZU.uRB2.value, by = LZU.uRBY.value, ex = LZU.uREx.value;
|
|
55527
55602
|
A.crates[i] = g ? { k: g.k, rects: g.rects, y: g.y, exterior: !!g.exterior, exclusion: g.exclusion || null, d: g.d } : null;
|
|
55528
55603
|
if (!g) {
|
|
55529
55604
|
put(i, { intensity: 0 });
|
|
@@ -55552,7 +55627,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55552
55627
|
if (!lease) PL[i].shadow.camera.far = Math.max(4, lamp.distance);
|
|
55553
55628
|
}
|
|
55554
55629
|
}
|
|
55555
|
-
if (effects) effects.update(houses);
|
|
55630
|
+
if (effects) effects.update(houses, _f);
|
|
55556
55631
|
A.stats.shadows = shadows;
|
|
55557
55632
|
return A.stats;
|
|
55558
55633
|
};
|
|
@@ -55569,7 +55644,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55569
55644
|
return A;
|
|
55570
55645
|
}
|
|
55571
55646
|
const effectsByBudget = /* @__PURE__ */ new WeakMap();
|
|
55572
|
-
const OPENING_REACH = 2.5, OPENING_SIDE = 0.6;
|
|
55647
|
+
const OPENING_REACH = 2.5, OPENING_SIDE = 0.6, OUTDOOR_REACH = 30;
|
|
55648
|
+
const EFFECT_OUTDOORS = 1, EFFECT_INDOORS = 2;
|
|
55649
|
+
const boxesByHouse = /* @__PURE__ */ new WeakMap();
|
|
55650
|
+
const sameBoxMatrix = (a, b) => {
|
|
55651
|
+
for (let i = 0; i < 16; i++) if (a[i] !== b[i]) return false;
|
|
55652
|
+
return true;
|
|
55653
|
+
};
|
|
55573
55654
|
function effectLights(options) {
|
|
55574
55655
|
const o = options || {};
|
|
55575
55656
|
const budget = o.budget;
|
|
@@ -55577,7 +55658,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55577
55658
|
const known = effectsByBudget.get(budget);
|
|
55578
55659
|
if (known && !o.ours) return known;
|
|
55579
55660
|
const ours = new Set(o.ours || []), size = budget.sizes.point, _p = new THREE.Vector3(), P0 = new THREE.Vector3();
|
|
55580
|
-
for (const [key2, width] of [["uRB0", 4], ["uRB1", 4], ["uRB2", 4], ["uRBY", 2], ["uREx", 4]]) {
|
|
55661
|
+
for (const [key2, width] of [["uRB0", 4], ["uRB1", 4], ["uRB2", 4], ["uRBY", 2], ["uREx", 4], ["uROut", 1]]) {
|
|
55581
55662
|
const had = LZU[key2].value;
|
|
55582
55663
|
if (had.length >= size * width) continue;
|
|
55583
55664
|
const next = new Float32Array(size * width);
|
|
@@ -55585,11 +55666,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55585
55666
|
next.set(had);
|
|
55586
55667
|
LZU[key2].value = next;
|
|
55587
55668
|
}
|
|
55669
|
+
const maskHouseMaterials = () => {
|
|
55670
|
+
const mats = shared2.mats;
|
|
55671
|
+
for (const k in mats) roomLightMask(mats[k]);
|
|
55672
|
+
};
|
|
55673
|
+
maskHouseMaterials();
|
|
55588
55674
|
const roomBoxes = (house, M) => {
|
|
55589
55675
|
const list2 = [];
|
|
55590
55676
|
for (const c of house.r.rooms) {
|
|
55591
55677
|
if (c.type === "void") continue;
|
|
55592
|
-
const rs = [];
|
|
55678
|
+
const rs = [], inner = [];
|
|
55593
55679
|
for (const [a, b, c2, d] of rectsOf2(c)) {
|
|
55594
55680
|
let x0 = 1e9, z0 = 1e9, x1 = -1e9, z1 = -1e9;
|
|
55595
55681
|
for (const [u, v] of [[a, b], [c2, b], [a, d], [c2, d]]) {
|
|
@@ -55600,9 +55686,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55600
55686
|
z1 = Math.max(z1, _p.z);
|
|
55601
55687
|
}
|
|
55602
55688
|
rs.push([x0 - 0.08, z0 - 0.08, x1 + 0.08, z1 + 0.08]);
|
|
55689
|
+
inner.push([x0 + INTERIOR_INSET, z0 + INTERIOR_INSET, x1 - INTERIOR_INSET, z1 - INTERIOR_INSET]);
|
|
55603
55690
|
}
|
|
55604
55691
|
_p.set(0, house.y0(c.floor), 0).applyMatrix4(M);
|
|
55605
|
-
|
|
55692
|
+
const ceiling = c.ceiling || 2.8;
|
|
55693
|
+
list2.push({ c, rs, y: [_p.y - 0.06, _p.y + ceiling + 0.3], inner, innerY: [_p.y - 0.06, _p.y + ceiling + 0.05] });
|
|
55606
55694
|
}
|
|
55607
55695
|
return list2;
|
|
55608
55696
|
};
|
|
@@ -55624,9 +55712,28 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55624
55712
|
reach2(house.r.doors, true);
|
|
55625
55713
|
reach2(house.r.windows, false);
|
|
55626
55714
|
};
|
|
55715
|
+
const openingsFacing = (house, M, boxes, into, reach2) => {
|
|
55716
|
+
const open = house.internal && house.internal.doorState || /* @__PURE__ */ new Map();
|
|
55717
|
+
const through = (list2, isDoor) => {
|
|
55718
|
+
for (const p of list2 || []) {
|
|
55719
|
+
if (isDoor && !(open.has(p.id) ? open.get(p.id) : !!p.open)) continue;
|
|
55720
|
+
const alongU = p.axis === "u", y = house.y0(p.floor) + (isDoor ? 1 : ((p.y0 != null ? p.y0 : 0.9) + (p.y1 != null ? p.y1 : 2)) / 2);
|
|
55721
|
+
const at2 = (side) => _p.set(alongU ? p.at : p.pos + side, y, alongU ? p.pos + side : p.at).applyMatrix4(M).clone();
|
|
55722
|
+
const centre = at2(0);
|
|
55723
|
+
if (centre.distanceTo(P0) > reach2) continue;
|
|
55724
|
+
const low = at2(-OPENING_SIDE), high = at2(OPENING_SIDE), lowRoom = boxAt(boxes, low.x, low.y, low.z), highRoom = boxAt(boxes, high.x, high.y, high.z);
|
|
55725
|
+
if (!lowRoom === !highRoom) continue;
|
|
55726
|
+
const room = lowRoom || highRoom, outside = lowRoom ? high : low;
|
|
55727
|
+
if ((P0.x - centre.x) * (outside.x - centre.x) + (P0.z - centre.z) * (outside.z - centre.z) > 0) into.set(room.c, room);
|
|
55728
|
+
}
|
|
55729
|
+
};
|
|
55730
|
+
through(house.r.doors, true);
|
|
55731
|
+
through(house.r.windows, false);
|
|
55732
|
+
};
|
|
55627
55733
|
const clear = (at2) => {
|
|
55628
55734
|
for (const key2 of ["uRB0", "uRB1", "uRB2", "uREx"]) LZU[key2].value.set(EMPTY, at2 * 4);
|
|
55629
55735
|
LZU.uRBY.value.set([0, 0], at2 * 2);
|
|
55736
|
+
LZU.uROut.value[at2] = 0;
|
|
55630
55737
|
};
|
|
55631
55738
|
const write = (at2, into) => {
|
|
55632
55739
|
const rs = [];
|
|
@@ -55643,13 +55750,55 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55643
55750
|
LZU.uRB0.value.set(rs[0] || EMPTY, at2 * 4);
|
|
55644
55751
|
LZU.uRB1.value.set(rs[1] || EMPTY, at2 * 4);
|
|
55645
55752
|
LZU.uRB2.value.set(rs[2] || EMPTY, at2 * 4);
|
|
55646
|
-
LZU.uRBY.value.set([lo, hi], at2 * 2);
|
|
55753
|
+
LZU.uRBY.value.set(rs.length ? [lo, hi] : [0, 0], at2 * 2);
|
|
55647
55754
|
LZU.uREx.value.set(EMPTY, at2 * 4);
|
|
55648
55755
|
};
|
|
55756
|
+
const nearHouses = [];
|
|
55757
|
+
const writeInteriors = (focus) => {
|
|
55758
|
+
if (focus) for (const h of nearHouses) {
|
|
55759
|
+
const b = h.entry.bounds;
|
|
55760
|
+
h.d = Math.hypot(Math.max(b[0] - focus.x, 0, focus.x - b[2]), Math.max(b[1] - focus.z, 0, focus.z - b[3]));
|
|
55761
|
+
}
|
|
55762
|
+
if (focus) nearHouses.sort((a, b) => a.d - b.d);
|
|
55763
|
+
const rects = LZU.uRIn.value, ys = LZU.uRInY.value;
|
|
55764
|
+
let n = 0;
|
|
55765
|
+
for (const { entry: entry2 } of nearHouses) for (const q of entry2.boxes) for (const r of q.inner) {
|
|
55766
|
+
if (n >= MAX_INTERIOR) break;
|
|
55767
|
+
rects.set(r, n * 4);
|
|
55768
|
+
ys.set(q.innerY, n * 2);
|
|
55769
|
+
n++;
|
|
55770
|
+
}
|
|
55771
|
+
LZU.uRInN.value = n;
|
|
55772
|
+
};
|
|
55649
55773
|
const A = {
|
|
55650
55774
|
/** Once per frame, after the budget's `present`: points the mask of every lit slot that is not the house's at the rooms its light reaches. */
|
|
55651
|
-
update(houses) {
|
|
55652
|
-
|
|
55775
|
+
update(houses, focus) {
|
|
55776
|
+
maskHouseMaterials();
|
|
55777
|
+
const indoors = cfg.effectLightsIndoors !== false, list2 = (Array.isArray(houses) ? houses : [houses]).filter((h) => !!h);
|
|
55778
|
+
const entries = list2.map((house) => {
|
|
55779
|
+
if (house.group && !house.group.visible) return void 0;
|
|
55780
|
+
let entry2 = boxesByHouse.get(house);
|
|
55781
|
+
if (!entry2 || !sameBoxMatrix(entry2.matrix, house.house.matrixWorld.elements)) {
|
|
55782
|
+
house.house.updateMatrixWorld(true);
|
|
55783
|
+
const M = house.house.matrixWorld, boxes = roomBoxes(house, M);
|
|
55784
|
+
let x0 = 1e9, z0 = 1e9, x1 = -1e9, z1 = -1e9, y0 = 1e9, y1 = -1e9;
|
|
55785
|
+
for (const q of boxes) {
|
|
55786
|
+
for (const r of q.rs) {
|
|
55787
|
+
x0 = Math.min(x0, r[0]);
|
|
55788
|
+
z0 = Math.min(z0, r[1]);
|
|
55789
|
+
x1 = Math.max(x1, r[2]);
|
|
55790
|
+
z1 = Math.max(z1, r[3]);
|
|
55791
|
+
}
|
|
55792
|
+
y0 = Math.min(y0, q.y[0]);
|
|
55793
|
+
y1 = Math.max(y1, q.y[1]);
|
|
55794
|
+
}
|
|
55795
|
+
entry2 = { matrix: Float64Array.from(M.elements), boxes, bounds: [x0, z0, x1, z1, y0, y1] };
|
|
55796
|
+
boxesByHouse.set(house, entry2);
|
|
55797
|
+
}
|
|
55798
|
+
return entry2;
|
|
55799
|
+
});
|
|
55800
|
+
const reach2 = OPENING_REACH + OPENING_SIDE;
|
|
55801
|
+
nearHouses.length = 0;
|
|
55653
55802
|
for (let at2 = 0; at2 < size; at2++) {
|
|
55654
55803
|
if (ours.has(at2)) continue;
|
|
55655
55804
|
const light = budget.group.children[at2];
|
|
@@ -55657,21 +55806,36 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
55657
55806
|
clear(at2);
|
|
55658
55807
|
continue;
|
|
55659
55808
|
}
|
|
55660
|
-
const into = /* @__PURE__ */ new Map();
|
|
55661
55809
|
P0.set(light.position.x, light.position.y, light.position.z);
|
|
55662
|
-
|
|
55663
|
-
|
|
55664
|
-
|
|
55665
|
-
|
|
55666
|
-
|
|
55667
|
-
|
|
55668
|
-
|
|
55810
|
+
let into, isIndoor = false;
|
|
55811
|
+
for (let i = 0; i < list2.length; i++) {
|
|
55812
|
+
const entry2 = entries[i];
|
|
55813
|
+
if (entry2 && boxAt(entry2.boxes, P0.x, P0.y, P0.z)) {
|
|
55814
|
+
isIndoor = true;
|
|
55815
|
+
break;
|
|
55816
|
+
}
|
|
55817
|
+
}
|
|
55818
|
+
const lightReach = isIndoor ? reach2 : light.distance > 0 ? Math.min(light.distance, OUTDOOR_REACH) : OUTDOOR_REACH;
|
|
55819
|
+
for (let i = 0; i < list2.length; i++) {
|
|
55820
|
+
const entry2 = entries[i], house = list2[i];
|
|
55821
|
+
if (!entry2) continue;
|
|
55822
|
+
const b = entry2.bounds;
|
|
55823
|
+
if (P0.x < b[0] - lightReach || P0.x > b[2] + lightReach || P0.z < b[1] - lightReach || P0.z > b[3] + lightReach || P0.y < b[4] - lightReach || P0.y > b[5] + lightReach) continue;
|
|
55824
|
+
into = into || /* @__PURE__ */ new Map();
|
|
55825
|
+
if (!isIndoor) {
|
|
55826
|
+
if (!nearHouses.some((h) => h.entry === entry2)) nearHouses.push({ entry: entry2, d: 0 });
|
|
55827
|
+
openingsFacing(house, house.house.matrixWorld, entry2.boxes, into, lightReach);
|
|
55828
|
+
continue;
|
|
55829
|
+
}
|
|
55830
|
+
const here = boxAt(entry2.boxes, P0.x, P0.y, P0.z);
|
|
55669
55831
|
if (here) into.set(here.c, here);
|
|
55670
|
-
openingSides(house,
|
|
55832
|
+
openingSides(house, house.house.matrixWorld, entry2.boxes, into);
|
|
55671
55833
|
}
|
|
55672
|
-
if (into.size) write(at2, into);
|
|
55834
|
+
if (into && into.size) write(at2, into);
|
|
55673
55835
|
else clear(at2);
|
|
55836
|
+
LZU.uROut.value[at2] = isIndoor ? EFFECT_INDOORS : EFFECT_OUTDOORS;
|
|
55674
55837
|
}
|
|
55838
|
+
writeInteriors(focus);
|
|
55675
55839
|
}
|
|
55676
55840
|
};
|
|
55677
55841
|
if (!o.ours) effectsByBudget.set(budget, A);
|