Keep Cut 13b CGA+LOD2+legacy footprint under 85 MiB while preserving watertightness
This commit is contained in:
parent
b950cebd59
commit
352ac9ed38
1 changed files with 9 additions and 7 deletions
|
|
@ -1101,8 +1101,10 @@ def build_cga_building(
|
||||||
return Polygon(ext, holes)
|
return Polygon(ext, holes)
|
||||||
|
|
||||||
# 1. Zone 0: Plinth / Foundation (IsGroundAnchored = true)
|
# 1. Zone 0: Plinth / Foundation (IsGroundAnchored = true)
|
||||||
plinth_fp = primary_fp.simplify(1.05, preserve_topology=True)
|
plinth_fp = primary_fp.simplify(1.35, preserve_topology=True)
|
||||||
plinth_fp = _clean_polygon_2d(plinth_fp if isinstance(plinth_fp, Polygon) else primary_fp, min_area=0.8) or primary_fp
|
plinth_fp = _clean_polygon_2d(plinth_fp if isinstance(plinth_fp, Polygon) else primary_fp, min_area=0.8) or primary_fp
|
||||||
|
if len(plinth_fp.exterior.coords) > 7 and not plinth_fp.interiors:
|
||||||
|
plinth_fp = plinth_fp.minimum_rotated_rectangle
|
||||||
plinth_uv = fp_to_uv(plinth_fp)
|
plinth_uv = fp_to_uv(plinth_fp)
|
||||||
plinth_parts = extrude_2d_poly_prism(
|
plinth_parts = extrude_2d_poly_prism(
|
||||||
np.array([0.0, plinth_bot_y, 0.0]), u_xz, v_xz, n_up, plinth_uv,
|
np.array([0.0, plinth_bot_y, 0.0]), u_xz, v_xz, n_up, plinth_uv,
|
||||||
|
|
@ -1121,14 +1123,14 @@ def build_cga_building(
|
||||||
is_canopy_only = (len(w_rtd) == 0 and wall_h > 1.2) or objektart in ("Flugdach",)
|
is_canopy_only = (len(w_rtd) == 0 and wall_h > 1.2) or objektart in ("Flugdach",)
|
||||||
is_mauer = (objektart == "Mauer gross")
|
is_mauer = (objektart == "Mauer gross")
|
||||||
|
|
||||||
# Build lean watertight LOD2 silhouette (single OBB/simplified prism) for 620..2200m GLB
|
# Build lean watertight LOD2 silhouette (single OBB prism, uniform wall material to minimize draw calls & JSON overhead)
|
||||||
lod2_fp = primary_fp.minimum_rotated_rectangle
|
lod2_fp = primary_fp.minimum_rotated_rectangle
|
||||||
lod2_uv = Polygon([(x, -z) for x, z in lod2_fp.exterior.coords])
|
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_h = max(1.2, max(eave_y, raw_max_y) - plinth_bot_y)
|
||||||
lod2_t, lod2_m, _, _ = extrude_2d_poly_prism(
|
lod2_t, lod2_m, _, _ = extrude_2d_poly_prism(
|
||||||
np.array([0.0, plinth_bot_y, 0.0]), u_xz, v_xz, n_up, lod2_uv,
|
np.array([0.0, plinth_bot_y, 0.0]), u_xz, v_xz, n_up, lod2_uv,
|
||||||
0.0, lod2_h,
|
0.0, lod2_h,
|
||||||
mat_top=pal["roof"], mat_bot=pal["plinth"], mat_side=pal["wall"],
|
mat_top=pal["wall"], mat_bot=pal["wall"], mat_side=pal["wall"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Early exit for low/underground single-zone structures
|
# Early exit for low/underground single-zone structures
|
||||||
|
|
@ -1242,7 +1244,7 @@ def build_cga_building(
|
||||||
slab_fp_s = slab_fp.simplify(1.15, preserve_topology=True)
|
slab_fp_s = slab_fp.simplify(1.15, preserve_topology=True)
|
||||||
if isinstance(slab_fp_s, Polygon) and not slab_fp_s.is_empty and slab_fp_s.area >= 0.8:
|
if isinstance(slab_fp_s, Polygon) and not slab_fp_s.is_empty and slab_fp_s.area >= 0.8:
|
||||||
slab_fp = slab_fp_s
|
slab_fp = slab_fp_s
|
||||||
if len(slab_fp.exterior.coords) > 7 and not slab_fp.interiors:
|
if len(slab_fp.exterior.coords) > 5 and not slab_fp.interiors:
|
||||||
slab_fp = slab_fp.minimum_rotated_rectangle
|
slab_fp = slab_fp.minimum_rotated_rectangle
|
||||||
slab_uv = fp_to_uv(slab_fp)
|
slab_uv = fp_to_uv(slab_fp)
|
||||||
slab_thick = 0.28
|
slab_thick = 0.28
|
||||||
|
|
@ -1267,10 +1269,10 @@ def build_cga_building(
|
||||||
if len(zones) >= MAX_ZONES_PER_BUILDING - n_roofs - 1:
|
if len(zones) >= MAX_ZONES_PER_BUILDING - n_roofs - 1:
|
||||||
break
|
break
|
||||||
want_win = (not is_mauer) and (
|
want_win = (not is_mauer) and (
|
||||||
(hero_zone and blen >= 3.2 and (b_i % 2 == 0))
|
(hero_zone and blen >= 3.2 and (b_i % 2 == 0) and t_idx < 2)
|
||||||
or (micro_zone == MICRO_VISSIGEN and blen >= 4.5 and (b_i % 2 == 0) and t_idx == 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 in (MICRO_CLAVAU, MICRO_SUBURBAN) and blen >= 4.8 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)
|
or (micro_zone == MICRO_RONQUOZ and blen >= 6.8 and b_i == 0 and t_idx == 0)
|
||||||
)
|
)
|
||||||
r_parts, c_parts, has_win = _build_wall_bay_geometry(
|
r_parts, c_parts, has_win = _build_wall_bay_geometry(
|
||||||
sa, sb, blen, y0, bay_y_top, wall_thick, pal, micro_zone,
|
sa, sb, blen, y0, bay_y_top, wall_thick, pal, micro_zone,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue