Skip to content

World GB3 part 1: everything the renderer draws is in the bundle - #1496

Merged
transfix merged 1 commit into
masterfrom
feat/gb3-one-renderer
Nov 23, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/gb3-one-renderer

Conversation

@transfix

Copy link
Copy Markdown
Owner

GB3 part 1 of ARIADNE_WORLDS section 18.8 ("one renderer"): everything cvcGL's world renderer draws is now in the world's bundle, and world_from_bundle makes the drawn world from any bundle. Part 2 (next PR) has cvcGL draw a world dataset, a city's included, through this.

What changes

  • The bundle holds what the renderer draws (generated_world_bundle):

    • props_r1.glb and props_r2.glb, the props' coarser rungs (render only);
    • props.json, the props' render cells: the cell size and, per cell, its bounds and its run of triangles (lines, for the needles) in each prop mesh. A cell's points are the ones its faces use, which a glb read back keeps together;
    • streets.json, the street network the roads were extruded from (nodes; segments with width, class, arterial) and the city's counts (buildings, archetypes, districts, road length);
    • ground.png, the painted ground in the material colours at 2048 a side, north at the top. Callers that already painted it pass it in (world_ground); otherwise it is painted for the bundle.
  • world_from_bundle(app, bundle, reader) gives a generated_world and its ground from a loaded bundle of any version:

    • the terrain and every mesh by name (any other mesh item draws with the buildings, its placement applied);
    • the cells, the streets and the counts;
    • the params: the generator's for a generated world, else a world over the terrain's extent, with walls where the bundle has edge_walls;
    • rebuilt from the stored terrain, not stored: the bodies of water and the shore grid, the ground under the water's columns, and the terrain's render LOD chunks and their water;
    • the ground: ground.png, else a version 1 city's satellite.png.

    Written again with its ground, a generated world's bundle gives the same bytes and hash.

  • terrain_water_bodies(terrain, level): the builder's water step, factored out. It now takes rows and columns separately, so a city's terrain that is not square works; for a square terrain the result is unchanged.

  • cvc::encode_png (new image_encode.h): PNG bytes in memory through stb, the same pixels always giving the same bytes.

  • city_bundle_dir_reader(dir): the directory reader load_city_bundle already used, now public.

  • generated_world::surfaces: geometry()'s surface table when there is no model (a world read from a bundle).

  • cvcGL's world job now paints, then writes the bundle, so the bundle's ground is the texture just painted (in the material colours at 2048, the default) instead of a second painting. The first world does the same.

The headless data-generate and the drawn node both write the same ground, so the drawn world's dataset hash still equals the headless one (cvcgl_ariadne_physics).

Tests

world_bundle_v2_test, 3 new tests (9 in all):

  • AGeneratedWorldReadsBackAsTheWorldItDraws: a world with water, read back. It has the same params, terrain and cell surfaces; the same faces in all seven meshes; the same cells (runs, bounds, and each cell's mesh); the same streets and counts; the same terrain chunks (rungs, errors, water rungs); and the same wet cells. Its ground is the material painting texel for texel. Written again, every file has the same bytes and the bundle the same hash.
  • AVersionOneCityIsAWorldToDraw: a version 1 city with a non-square, off-centre terrain and a satellite image becomes a world to draw: terrain chunks, no water, and the satellite image as its ground, south row first.
  • ABadRendererFileSaysWhy: a cell run outside its mesh, a cell of the wrong width, a segment naming a missing node, and a bad ground.png each fail with a message naming the problem.

AGeneratedWorldIsTheSameWorldReadBack passes the new files through when it rewrites the geometry.

Locally (MSVC Release, full build): 2,123 matching world, ariadne, data, nav, bundle and cvcGL ariadne tests pass, cvcgl_ariadne_physics among them. The four reformatted files had whitespace-only changes after that run.

Not in this PR

  • Part 2: cvcGL drawing a world dataset (a data node's city, a saved world) with the generated-world renderer, and the data node's simpler world draw going.
  • A world read from a bundle has no raster, so the renderer's other colour modes (risk, occupancy, height) can't be repainted for it; it draws its stored ground.

@transfix
transfix merged commit 4b10281 into master Nov 23, 2026
31 checks passed
@transfix
transfix deleted the feat/gb3-one-renderer branch November 23, 2026 19:53
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