ShitboxInfinity/tools/build_all_levels.sh
m3ultra e9717326f4 Smashable street furniture; fix levels losing every texture on rebuild
Street lamps, bollards and bins are no longer baked scenery. The builder emits
SL_/BO_/WB_ markers off the OSM nodes and game.gd spawns them as RigidBodies
with a low centre of mass, so clipping a lamp at 100 topples it instead of
driving through a painted pole. ~206 physics bodies per level (58 parked cars,
60 lamps, 88 bollards/bins), all asleep until hit. Verified by ramming one:
23.6 deg tilt, launched at 18 m/s.

Fixes a self-inflicted trap from the last commit: level_*.jpg are Godot's
extraction of the GLB's embedded textures, NOT Blender output. build_all
cleared them to avoid orphans but left level.glb.import, so Godot's cache
decided nothing had changed and never re-extracted -- queen_st_mall shipped
with 0 of its 31 textures, loading fine but rendering untextured. The .import
now goes with them.

Also confirmed the Wheel of Brisbane pivot really does turn (0.086 rad over
120 frames, 0.000 m centre drift) -- it was previously untested.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 18:53:05 +10:00

28 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# Rebuild every OSM level. Area JSONs are cached in $OSM_CACHE; refetch via the
# README curl + osm_xml_to_json.py if absent.
set -e
cd "$(dirname "$0")/.."
B=/Applications/Blender.app/Contents/MacOS/Blender
C="${OSM_CACHE:-$HOME/.cache/burnout_osm}"
[ -d "$C" ] || { echo "no OSM cache at $C -- set OSM_CACHE or refetch (see README)"; exit 1; }
while IFS='|' read -r id json lat lon sway loop bridge canopy; do
ARGS=$(python3 tools/osm_level_args.py "$C/$json" "$sway" "$loop") || { echo "ARGS FAILED $id"; continue; }
SPAWN=$(echo "$ARGS" | head -1)
RP=$(echo "$ARGS" | tail -1)
# level_*.jpg are Godot's extraction of the GLB's embedded textures, not
# Blender's output. Clear them so renamed/dropped materials don't leave
# orphans -- but the .glb.import MUST go too, or Godot's cache decides
# nothing changed and never re-extracts, leaving a level with no textures
# at all (loads, renders untextured, spams "Resource file not found").
rm -f "levels/$id"/level_*.jpg "levels/$id"/level_*.jpg.import "levels/$id"/level.glb.import
"$B" -b -P tools/build_level_osm.py -- "$C/$json" "$id" "$lat" "$lon" "$SPAWN" "$RP" "$bridge" "$canopy" 2>&1 \
| grep -E '^(level built|bridge truss|canopies built)'
done <<'EOF'
queen_st_mall|brisbane_cbd.json|-27.4699|153.0251|Queen Street Mall|Adelaide Street,Edward Street,Elizabeth Street,George Street|-|Queen Street
southbank|southbank.json|-27.4775|153.0215|Little Stanley Street|trace:Grey Street|-|-
albert_parklands|albert_parklands.json|-27.4740|153.0280|Albert Street|Alice Street,George Street,Margaret Street,Edward Street|-|-
story_bridge|story_bridge.json|-27.4635|153.0355|Bradfield Highway|trace:Bradfield Highway|Bradfield Highway|-
kangaroo_point|kangaroo_point.json|-27.4780|153.0345|River Terrace|trace:River Terrace|-|-
EOF