@adatechnology/game-items-three 0.10.0 → 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.
@@ -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;
@@ -5198,7 +5260,7 @@ var GameItemsThree = (() => {
5198
5260
  teamId: "pregos",
5199
5261
  teamBox: [
5200
5262
  1.3,
5201
- 0.6,
5263
+ 0.335,
5202
5264
  0.5
5203
5265
  ],
5204
5266
  scale: 0.1
@@ -8279,7 +8341,9 @@ var GameItemsThree = (() => {
8279
8341
  mesh2(cyl(0.035, 0.035, 1.1, 6), steel, [direction * 0.06, y, z], [0, 0, R]),
8280
8342
  mesh2(new T2.ConeGeometry(0.035, 0.16, 6), steel, [-direction * 0.57, y, z], [0, 0, direction * R])
8281
8343
  ];
8282
- return G(...nail(-0.2, -0.15, 1), ...nail(-0.2, 0.15, -1), ...nail(0.2, -0.15, -1), ...nail(0.2, 0.15, 1));
8344
+ const LOW = -0.0675;
8345
+ const HIGH = LOW + 0.135;
8346
+ return G(...nail(LOW, -0.15, 1), ...nail(LOW, 0.15, -1), ...nail(HIGH, -0.15, -1), ...nail(HIGH, 0.15, 1));
8283
8347
  };
8284
8348
 
8285
8349
  // src/models/raffia-sack.ts
@@ -19674,6 +19738,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
19674
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);
19675
19739
  if (brittle && mat.fracture === "shatter") addCrack(o, p, entry2, n, crackLen, src);
19676
19740
  if (p.spec.contains && (p.st.liters ?? 0) > 1e-4) {
19741
+ o.active = true;
19677
19742
  emit({
19678
19743
  ...base(o, src),
19679
19744
  type: "leak",
@@ -30592,7 +30657,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30592
30657
  kind: "material",
30593
30658
  size: [
30594
30659
  0.13,
30595
- 0.06,
30660
+ 0.0335,
30596
30661
  0.05
30597
30662
  ],
30598
30663
  weight: 0.5,
@@ -46584,7 +46649,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
46584
46649
  }
46585
46650
  var residentialTower = residentialTowerTemplate();
46586
46651
 
46587
- // ../game-floorplan-three/dist/chunk-6GFCK5NZ.js
46652
+ // ../game-floorplan-three/dist/chunk-ZVCG4IGR.js
46588
46653
  var __defProp3 = Object.defineProperty;
46589
46654
  var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp3(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
46590
46655
  var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
@@ -55319,11 +55384,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55319
55384
  }
55320
55385
  return seats;
55321
55386
  }
55387
+ var MAX_INTERIOR = 32;
55388
+ var INTERIOR_INSET = 0.01;
55322
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 });
55323
55390
  function installLightsRoomLight(K, shared2) {
55324
55391
  const { THREE, rectsOf: rectsOf2, cfg } = K;
55325
55392
  const MAX_LIGHTS = 12, EMPTY = [1e9, 1e9, -1e9, -1e9];
55326
- 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 } };
55327
55394
  for (let i = 0; i < MAX_LIGHTS; i++) for (const k of ["uRB0", "uRB1", "uRB2", "uREx"]) LZU[k].value.set(EMPTY, i * 4);
55328
55395
  function roomLightMask(material) {
55329
55396
  const m = material;
@@ -55336,23 +55403,31 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55336
55403
  if (!sh || !sh.fragmentShader) return;
55337
55404
  if (sh.uniforms) Object.assign(sh.uniforms, LZU);
55338
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);
55339
55408
  sh.fragmentShader = sh.fragmentShader.replace("void main() {", `varying vec3 vRoomW;
55340
55409
  #if NUM_POINT_LIGHTS > 0
55341
- 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 ];
55342
55411
  #endif
55412
+ uniform vec4 uRIn[ ${MAX_INTERIOR} ]; uniform vec2 uRInY[ ${MAX_INTERIOR} ]; uniform int uRInN;
55343
55413
  uniform float uIndK;
55344
55414
  bool inRoomR( vec4 r, vec3 p ) { return p.x >= r.x && p.x <= r.z && p.z >= r.y && p.z <= r.w; }
55345
- float roomMask( vec4 a, vec4 b, vec4 c, vec2 yy, vec4 ex ) {
55346
- vec3 p = vRoomW; float k = ( inRoomR( a, p ) || inRoomR( b, p ) || inRoomR( c, p ) ) ? 1.0 : 0.0;
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;
55347
55421
  k *= ( p.y >= yy.x && p.y <= yy.y ) ? 1.0 : 0.0; if ( inRoomR( ex, p ) ) k = 0.0; return k;
55348
55422
  }
55349
- void main() {`).replace("getPointLightInfo( pointLight, geometryPosition, directLight );", `getPointLightInfo( pointLight, geometryPosition, directLight );
55350
- float rmk = roomMask( uRB0[ i ], uRB1[ i ], uRB2[ i ], uRBY[ i ], uREx[ i ] );
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 );
55351
55426
  directLight.color *= rmk;
55352
- 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 ) ) ) );`);
55353
55428
  };
55354
55429
  m.customProgramCacheKey = function() {
55355
- return (pk ? pk.call(this) : "") + "|rm1";
55430
+ return (pk ? pk.call(this) : "") + "|rm3";
55356
55431
  };
55357
55432
  m.needsUpdate = true;
55358
55433
  return material;
@@ -55364,7 +55439,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55364
55439
  for (const k of Object.keys(mats)) roomLightMask(mats[k]);
55365
55440
  const budget = o.budget, lease = budget ? budget.lease({ owner: "floorplan.rooms", point: N, shadows: NS }) : null;
55366
55441
  if (budget && !lease) throw new Error("lighting: the LightBudget has no " + N + " free point slots (" + NS + " with shadow) for the rooms");
55367
- 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]]) {
55368
55443
  const next = new Float32Array(budget.sizes.point * width);
55369
55444
  if (width === 4) for (let i = 0; i < budget.sizes.point; i++) next.set(EMPTY, i * 4);
55370
55445
  LZU[key2].value = next;
@@ -55521,7 +55596,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55521
55596
  A.stats.external = Ne;
55522
55597
  let shadows = 0;
55523
55598
  for (let i = 0; i < N; i++) {
55524
- const g = asg[i], at2 = slotOf(i), b0 = LZU.uRB0.value, b1 = LZU.uRB1.value, b2 = LZU.uRB2.value, by = LZU.uRBY.value, ex = LZU.uREx.value;
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;
55525
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;
55526
55603
  if (!g) {
55527
55604
  put(i, { intensity: 0 });
@@ -55550,7 +55627,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55550
55627
  if (!lease) PL[i].shadow.camera.far = Math.max(4, lamp.distance);
55551
55628
  }
55552
55629
  }
55553
- if (effects) effects.update(houses);
55630
+ if (effects) effects.update(houses, _f);
55554
55631
  A.stats.shadows = shadows;
55555
55632
  return A.stats;
55556
55633
  };
@@ -55567,7 +55644,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55567
55644
  return A;
55568
55645
  }
55569
55646
  const effectsByBudget = /* @__PURE__ */ new WeakMap();
55570
- 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
+ };
55571
55654
  function effectLights(options) {
55572
55655
  const o = options || {};
55573
55656
  const budget = o.budget;
@@ -55575,7 +55658,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55575
55658
  const known = effectsByBudget.get(budget);
55576
55659
  if (known && !o.ours) return known;
55577
55660
  const ours = new Set(o.ours || []), size = budget.sizes.point, _p = new THREE.Vector3(), P0 = new THREE.Vector3();
55578
- 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]]) {
55579
55662
  const had = LZU[key2].value;
55580
55663
  if (had.length >= size * width) continue;
55581
55664
  const next = new Float32Array(size * width);
@@ -55583,11 +55666,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55583
55666
  next.set(had);
55584
55667
  LZU[key2].value = next;
55585
55668
  }
55669
+ const maskHouseMaterials = () => {
55670
+ const mats = shared2.mats;
55671
+ for (const k in mats) roomLightMask(mats[k]);
55672
+ };
55673
+ maskHouseMaterials();
55586
55674
  const roomBoxes = (house, M) => {
55587
55675
  const list2 = [];
55588
55676
  for (const c of house.r.rooms) {
55589
55677
  if (c.type === "void") continue;
55590
- const rs = [];
55678
+ const rs = [], inner = [];
55591
55679
  for (const [a, b, c2, d] of rectsOf2(c)) {
55592
55680
  let x0 = 1e9, z0 = 1e9, x1 = -1e9, z1 = -1e9;
55593
55681
  for (const [u, v] of [[a, b], [c2, b], [a, d], [c2, d]]) {
@@ -55598,9 +55686,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55598
55686
  z1 = Math.max(z1, _p.z);
55599
55687
  }
55600
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]);
55601
55690
  }
55602
55691
  _p.set(0, house.y0(c.floor), 0).applyMatrix4(M);
55603
- list2.push({ c, rs, y: [_p.y - 0.06, _p.y + (c.ceiling || 2.8) + 0.3] });
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] });
55604
55694
  }
55605
55695
  return list2;
55606
55696
  };
@@ -55622,9 +55712,28 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55622
55712
  reach2(house.r.doors, true);
55623
55713
  reach2(house.r.windows, false);
55624
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
+ };
55625
55733
  const clear = (at2) => {
55626
55734
  for (const key2 of ["uRB0", "uRB1", "uRB2", "uREx"]) LZU[key2].value.set(EMPTY, at2 * 4);
55627
55735
  LZU.uRBY.value.set([0, 0], at2 * 2);
55736
+ LZU.uROut.value[at2] = 0;
55628
55737
  };
55629
55738
  const write = (at2, into) => {
55630
55739
  const rs = [];
@@ -55641,13 +55750,55 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55641
55750
  LZU.uRB0.value.set(rs[0] || EMPTY, at2 * 4);
55642
55751
  LZU.uRB1.value.set(rs[1] || EMPTY, at2 * 4);
55643
55752
  LZU.uRB2.value.set(rs[2] || EMPTY, at2 * 4);
55644
- LZU.uRBY.value.set([lo, hi], at2 * 2);
55753
+ LZU.uRBY.value.set(rs.length ? [lo, hi] : [0, 0], at2 * 2);
55645
55754
  LZU.uREx.value.set(EMPTY, at2 * 4);
55646
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
+ };
55647
55773
  const A = {
55648
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. */
55649
- update(houses) {
55650
- const indoors = cfg.effectLightsIndoors !== false, list2 = (Array.isArray(houses) ? houses : [houses]).filter((h) => !!h), cache2 = /* @__PURE__ */ new Map();
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;
55651
55802
  for (let at2 = 0; at2 < size; at2++) {
55652
55803
  if (ours.has(at2)) continue;
55653
55804
  const light = budget.group.children[at2];
@@ -55655,21 +55806,36 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55655
55806
  clear(at2);
55656
55807
  continue;
55657
55808
  }
55658
- const into = /* @__PURE__ */ new Map();
55659
55809
  P0.set(light.position.x, light.position.y, light.position.z);
55660
- for (const house of list2) {
55661
- if (house.group && !house.group.visible) continue;
55662
- house.house.updateMatrixWorld(true);
55663
- const M = house.house.matrixWorld;
55664
- let boxes = cache2.get(house);
55665
- if (!boxes) cache2.set(house, boxes = roomBoxes(house, M));
55666
- const here = boxAt(boxes, P0.x, P0.y, P0.z);
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);
55667
55831
  if (here) into.set(here.c, here);
55668
- openingSides(house, M, boxes, into);
55832
+ openingSides(house, house.house.matrixWorld, entry2.boxes, into);
55669
55833
  }
55670
- if (into.size) write(at2, into);
55834
+ if (into && into.size) write(at2, into);
55671
55835
  else clear(at2);
55836
+ LZU.uROut.value[at2] = isIndoor ? EFFECT_INDOORS : EFFECT_OUTDOORS;
55672
55837
  }
55838
+ writeInteriors(focus);
55673
55839
  }
55674
55840
  };
55675
55841
  if (!o.ours) effectsByBudget.set(budget, A);