Use OBB LOD2 silhouettes, micro-zone roof budgets, and level-9 zlib for <16 MiB
This commit is contained in:
parent
6294af87ca
commit
b950cebd59
1 changed files with 18 additions and 14 deletions
|
|
@ -764,17 +764,17 @@ def _build_wall_bay_geometry(
|
|||
return col_parts, col_parts, False
|
||||
|
||||
# Compute window openings within [0..bay_len] x [0..h]
|
||||
# Keep 1 window on normal bays (2 on wide >=8.5m facades) to hold <= 16 MiB RCGA city budget
|
||||
# Keep 1 crisp window on normal bays (2 on wide >=10m hero facades) to hold <= 16 MiB RCGA city budget
|
||||
if micro_zone == MICRO_FORTRESS:
|
||||
n_win = 1 if bay_len < 8.5 else 2
|
||||
n_win = 1 if bay_len < 10.0 else 2
|
||||
win_w = min(0.75, (bay_len - 1.0) / n_win * 0.36)
|
||||
win_h = min(1.75, h * 0.56)
|
||||
elif micro_zone == MICRO_RONQUOZ:
|
||||
n_win = 1 if bay_len < 10.5 else 2
|
||||
win_w = min(2.40, (bay_len - 1.2) / n_win * 0.55)
|
||||
n_win = 1
|
||||
win_w = min(2.40, (bay_len - 1.2) * 0.50)
|
||||
win_h = min(1.25, h * 0.40)
|
||||
else:
|
||||
n_win = 1 if bay_len < 8.5 else 2
|
||||
n_win = 1 if (bay_len < 10.0 or micro_zone not in (MICRO_OLD_TOWN, MICRO_FORTRESS)) else 2
|
||||
win_w = min(1.25, (bay_len - 0.9) / n_win * 0.42)
|
||||
win_h = min(1.42, h * 0.52)
|
||||
|
||||
|
|
@ -1121,11 +1121,8 @@ def build_cga_building(
|
|||
is_canopy_only = (len(w_rtd) == 0 and wall_h > 1.2) or objektart in ("Flugdach",)
|
||||
is_mauer = (objektart == "Mauer gross")
|
||||
|
||||
# Build lean watertight LOD2 silhouette (single simplified prism) for 620..2200m GLB
|
||||
lod2_fp = primary_fp.simplify(1.25, preserve_topology=True)
|
||||
lod2_fp = _clean_polygon_2d(lod2_fp if isinstance(lod2_fp, Polygon) else primary_fp, min_area=0.5) or primary_fp
|
||||
if len(lod2_fp.exterior.coords) > 6:
|
||||
lod2_fp = lod2_fp.minimum_rotated_rectangle
|
||||
# Build lean watertight LOD2 silhouette (single OBB/simplified prism) for 620..2200m GLB
|
||||
lod2_fp = primary_fp.minimum_rotated_rectangle
|
||||
lod2_uv = Polygon([(x, -z) for x, z in lod2_fp.exterior.coords])
|
||||
lod2_h = max(1.2, max(eave_y, raw_max_y) - plinth_bot_y)
|
||||
lod2_t, lod2_m, _, _ = extrude_2d_poly_prism(
|
||||
|
|
@ -1147,7 +1144,14 @@ def build_cga_building(
|
|||
)
|
||||
|
||||
# 2. Precompute Roof Zones so we know exact zone budget
|
||||
max_roofs = 0 if is_mauer else 4
|
||||
if is_mauer:
|
||||
max_roofs = 0
|
||||
elif micro_zone in (MICRO_FORTRESS, MICRO_OLD_TOWN, MICRO_CIVIC):
|
||||
max_roofs = 4
|
||||
elif micro_zone in (MICRO_CLAVAU, MICRO_SUBURBAN):
|
||||
max_roofs = 2
|
||||
else:
|
||||
max_roofs = 1
|
||||
roof_items = _build_roof_zones(
|
||||
r_rtd, footprints, eave_y, bldg_center_xz, pal, max_roofs, micro_zone, objektart
|
||||
)
|
||||
|
|
@ -1263,8 +1267,8 @@ 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 >= 3.2 and (b_i % 2 == 0 or t_idx == 0))
|
||||
or (micro_zone == MICRO_VISSIGEN and blen >= 4.2 and (b_i % 2 == 0))
|
||||
(hero_zone and blen >= 3.2 and (b_i % 2 == 0))
|
||||
or (micro_zone == MICRO_VISSIGEN and blen >= 4.5 and (b_i % 2 == 0) and t_idx == 0)
|
||||
or (micro_zone in (MICRO_CLAVAU, MICRO_SUBURBAN) and blen >= 4.5 and b_i == 0 and t_idx == 0)
|
||||
or (micro_zone == MICRO_RONQUOZ and blen >= 6.5 and b_i == 0 and t_idx == 0)
|
||||
)
|
||||
|
|
@ -1634,7 +1638,7 @@ def export_rcga_tile(tx: int, tz: int, buildings: list[CgaBuildingResult], out_p
|
|||
total_c_tris += ci_cnt // 3
|
||||
|
||||
payload = bytes(bldg_hdrs) + bytes(zone_hdrs) + bytes(geo_blob)
|
||||
comp = zlib.compress(payload, level=6)
|
||||
comp = zlib.compress(payload, level=9)
|
||||
outer_hdr = struct.pack("<4sIiiII", b"RCGA", 1, tx, tz, len(buildings), len(payload))
|
||||
out_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
out_path.write_bytes(outer_hdr + comp)
|
||||
|
|
|
|||
Loading…
Reference in a new issue