Skip to content

world: one world_geometry for render, physics and nav; the city bundle loader (G3a) - #656

Merged
transfix merged 1 commit into
masterfrom
feat/world-geometry
Oct 17, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/world-geometry

Conversation

@transfix

Copy link
Copy Markdown
Owner

Why

G3 of one world representation (docs/roadmap/WORLD-GEOMETRY-ROADMAP.md): the world as data that the renderer, the physics layer and the navigator all read, and a loader that builds it from a city bundle once, correctly. The city demos switch over in the next PR (G3b).

Change

  • The surface table (world::surface_registry): every class gains mu, restitution and rolling_resistance, from the usual vehicle-dynamics tables (asphalt 0.9 / 0.010, sand 0.45 / 0.2, snow 0.25 / 0.05, ...).
    • They are added to to_json.
    • They are kept out of ontology_hash, which covers the fields nav's rasters depend on.
  • world::world_geometry: the surface table plus named items.
    • Each item is a shared cvc::geometry (a height_field or a mesh), with a default surface, a placement and roles (render, collide, navigate).
    • add validates every surface id; terrain(), find(), bounds() and surfaces_used().
  • world::load_city_bundle(dir, options): one terrain.json parser, replacing the four hand-written ones over time.
    • It reads the grid north first, as measured on the Austin bundle, flips it once into row 0 = min y, and offers the other order as an option.
    • buildings.glb becomes one mesh with face materials (building_surface). It is z up, as the bundles are; a y-up option converts standard glTF. The buildings are not lifted.
    • A missing glb leaves a terrain-only world and says why.
    • Land cover: cvc::world never links cvc::nav (L-system roadmap §14.4, checked at configure time, so a world bundle stays a file format). The loader therefore takes a land_cover provider of per-sample surfaces and reduces it to cells (majority of the four corners, the SW corner's on a tie). Without one, every cell is terrain_surface. The nav-side provider over segment_scene_material comes with G4.
  • physics::add_world_geometry(world, g) (cvc/physics/world_geometry.h):
    • One static body per collide item: terrain for a height field, a mesh at its placement.
    • One world material per surface used, carrying the table's mu, restitution and C_rr, and reused by name, so a second world adds no duplicates.
    • nav_material stays -1 until G4, rather than add a physics→nav edge before P4's plant seam.
  • gl::add_world_geometry(sg, g) (cvcGL):
    • One GeometryNode per render item, sharing the item's arrays.
    • Each vertex is coloured by the mean albedo of its faces' surfaces, unless the geometry has colours of its own.
    • A mesh's placement becomes the node's pose.
  • Docs: PHYSICS_API.md and the roadmap, split G3 into G3a / G3b and recorded what G3a found.

Verified (Windows, MSVC Release)

  • world_geometry_test 8/8, with a synthetic bundle written by the test (a north-first terrain.json and a hand-built buildings.glb):
    • The terrain matches the generating function at every sample. A south-first bundle loaded as south first gives the same terrain, and loaded wrongly it does not.
    • Buildings carry their surface on every face, and their bases sit on the terrain.
    • Land cover reduces to cells.
    • Missing and bad files are handled.
    • The physics gate: at every terrain sample, the render mesh's vertex equals height() exactly, and Jolt's raycast agrees within 6 mm. A roof raycast hits the buildings body with the building_concrete material and its mu. Materials are reused.
  • CityBundle.RealBundleBuildingsSitOnTheTerrain with CVC_CITY_BUNDLE pointing at austin_south (skipped in CI): 5636 buildings, base minus terrain RMS 0.465 m, within the ≤ 0.5 m gate.
  • cvcgl_world_geometry_nodes (headless): one node per render item, the node's points buffer is the item's (no copy), colours from the cell surfaces, placement as pose.
  • Regression: ctest -R '^(World|CityBundle|PhysicsWorldGeometry|Geometry|HeightField|Physics|Nav|Model|Lod|Tiles|Pyramid|Assimp|Building|Road|cvcgl_(physics_scene_binding|world_geometry_nodes|pose_matrix|pose_echo|state_publisher))': 642/642 pass.

…e loader (G3a)

world::surface_registry's classes gain contact physics (mu, restitution,
rolling resistance), so the renderer, physics and nav read one table.

world::world_geometry holds the surface table and named items, each a
shared cvc::geometry (a height_field or a mesh) with a default surface,
a placement and roles (render, collide, navigate). Consumers share the
objects, never copy them.

world::load_city_bundle reads a cvc-scenes bundle into it: one
terrain.json parser, north first as measured (5636 Austin buildings sit
on the terrain at RMS 0.465 m that way, 14.3 m the other), flipped once
into row 0 = min y; buildings.glb as one mesh with face materials, z up
and not lifted. cvc::world never links cvc::nav, so land cover plugs in
through a land_cover provider of per-sample surfaces (G4 supplies one).

physics::add_world_geometry makes the static bodies and one material
per surface used (reused by name); gl::add_world_geometry makes one
node per render item sharing the item's arrays, coloured by surface
albedo, posed by placement.
@transfix
transfix merged commit 9f49931 into master Oct 17, 2026
15 checks passed
@transfix
transfix deleted the feat/world-geometry branch October 17, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant