Cut 13b: trim tier threshold, window threshold, and LOD2 non-hero tolerance under 85 MiB

This commit is contained in:
Meta Vens 2026-12-06 03:09:51 +01:00
commit 670067322b

View file

@ -1224,8 +1224,10 @@ def build_cga_building(
# Build real-footprint + pitched-roof watertight LOD2 solids
lod2_solids: list[tuple[np.ndarray, int]] = []
lod2_body_h = max(1.0, eave_y - plinth_bot_y - 0.02)
for pfp in plinth_fps:
l2_fp = pfp.simplify(2.6, preserve_topology=True)
l2_simp = 2.2 if micro_zone in (MICRO_FORTRESS, MICRO_CIVIC, MICRO_OLD_TOWN) else 3.2
l2_wings = plinth_fps if micro_zone in (MICRO_FORTRESS, MICRO_CIVIC) else plinth_fps[:1]
for pfp in l2_wings:
l2_fp = pfp.simplify(l2_simp, preserve_topology=True)
l2_fp = _clean_polygon_2d(l2_fp if isinstance(l2_fp, Polygon) else pfp, min_area=1.0) or pfp
l2_t, _, _, _ = extrude_2d_poly_prism(
np.array([0.0, plinth_bot_y, 0.0]), u_xz, v_xz, n_up, fp_to_uv(l2_fp),
@ -1299,7 +1301,7 @@ def build_cga_building(
# Cap structural tiers cleanly so total city RCGA + LOD2 fits well <= 16 MiB (and total sion <= 85 MiB)
avail_for_stories = MAX_ZONES_PER_BUILDING - (2 + n_roofs)
max_tiers = 4 if wall_h >= 22.0 else (3 if (hero_zone and wall_h >= 12.0) else (2 if ((hero_zone and wall_h >= 6.0) or wall_h >= 7.5) else 1))
max_tiers = 4 if wall_h >= 22.0 else (3 if (hero_zone and wall_h >= 12.5) else (2 if ((hero_zone and wall_h >= 6.8) or wall_h >= 8.2) else 1))
n_tiers = min(n_stories, max_tiers, max(1, avail_for_stories // max(4, min(raw_bays_len + 1, 5))))
n_tiers = max(1, n_tiers)
@ -1386,9 +1388,9 @@ def build_cga_building(
if len(zones) >= MAX_ZONES_PER_BUILDING - n_roofs - 1:
break
want_win = (not is_mauer) and (
(hero_zone and blen >= 4.0 and t_idx == 0 and (b_i == 0 or (micro_zone in (MICRO_FORTRESS, MICRO_CIVIC) and b_i == 2 and blen >= 5.5)))
or (micro_zone in (MICRO_VISSIGEN, MICRO_CLAVAU, MICRO_SUBURBAN) and blen >= 6.0 and b_i == 0 and t_idx == 0)
or (micro_zone == MICRO_RONQUOZ and blen >= 8.5 and b_i == 0 and t_idx == 0)
(hero_zone and blen >= 4.5 and t_idx == 0 and (b_i == 0 or (micro_zone in (MICRO_FORTRESS, MICRO_CIVIC) and b_i == 2 and blen >= 6.0)))
or (micro_zone in (MICRO_VISSIGEN, MICRO_CLAVAU, MICRO_SUBURBAN) and blen >= 7.2 and b_i == 0 and t_idx == 0)
or (micro_zone == MICRO_RONQUOZ and blen >= 9.5 and b_i == 0 and t_idx == 0)
)
r_parts, c_parts, has_win = _build_wall_bay_geometry(
sa, sb, blen, y0, bay_y_top, wall_thick, pal, micro_zone,