diff --git a/tools/maps/sion/cga_builder.py b/tools/maps/sion/cga_builder.py index a346b1e..6ee3fb2 100644 --- a/tools/maps/sion/cga_builder.py +++ b/tools/maps/sion/cga_builder.py @@ -1101,8 +1101,10 @@ def build_cga_building( return Polygon(ext, holes) # 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 + 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_parts = extrude_2d_poly_prism( 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_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_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( np.array([0.0, plinth_bot_y, 0.0]), u_xz, v_xz, n_up, lod2_uv, 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 @@ -1242,7 +1244,7 @@ def build_cga_building( 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: 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_uv = fp_to_uv(slab_fp) slab_thick = 0.28 @@ -1267,10 +1269,10 @@ 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)) + (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 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) + 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.8 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,