cvc/lod + cvcGL: cvc-lod-bake tool, bake_mesh_asset, SceneGraph::selectLOD - #491
Merged
Merged
Conversation
…ene renderer The scene-graph seam for LOD: a prop-less GraphicsNode that owns a mesh LOD ladder (one GeometryNode child per rung, rung 0 = finest) plus the pyramid's monotone world_error_m ladder, and draws exactly one rung. select(view) runs the pure math in <cvc/lod/select.h>: the bound-nearest distance to the node's world bounding sphere (derived from rung 0's extent), then the hysteretic select_rung over the ladder, then sets exactly the chosen rung's child visible. Nothing here draws, so the per-frame selection is exercisable with a null renderer / no GL context; a SceneGraph-level pass or the caller invokes it each frame. LOD stays a render proxy: a rung is never read by a nav/material/RF path. setPyramid(mesh_pyramid) installs the rungs from a built pyramid (cvc::lod), so the whole chain now composes: build_mesh_pyramid -> [scene.cvch5 cache] -> setPyramid -> select per frame. Gate cvcgl_lod_node (headless, plain main/assert like the other cvcGL node tests): a 3-rung node with a 0/1/4 m error ladder picks the finest rung up close, the coarsest very far away, and coarsens monotonically as the camera retreats.
…ctLOD
The drive + bake side that makes the pyramid pipeline usable end to end.
* cvc::lod::bake_mesh_asset(ctx, h5file, name, geometry, params, force, pool)
-- build a mesh's pyramid and cache it in a scene.cvch5, SKIPPING the work
when a current pyramid (matching mesh_content_hash) is already present unless
force. The reusable core of the bake tool; a demo bundle bake calls it on each
glTF mesh it has loaded.
* cvc-lod-bake CLI (src/cvc/tools) -- bake INPUT.{off,raw} -> OUTPUT.cvch5
[--name --rungs --ratio --force]. Hermetic (cvc::geometry read; model formats
are baked from code via bake_mesh_asset). HDF5-gated.
* cvc::gl::SceneGraph::selectLOD(view) -- one per-frame pass that runs every
LodGraphicsNode's select() (via the existing getAllGraphicsOfType walk). The
caller calls it once per frame; returns the LOD-node count.
The whole chain is now callable: build_mesh_pyramid -> bake_mesh_asset /
scene.cvch5 (file or blob) -> LodGraphicsNode::setPyramid -> SceneGraph::selectLOD
per frame.
Tests: lod_store_test gains BakeMeshAssetSkipsWhenCurrent (first bake writes;
same mesh skips; --force rebakes; a changed mesh rebakes on the new hash) and
cvcgl_lod_node gains a SceneGraph::selectLOD scenario (far view -> coarsest, near
-> finest, exactly the one LOD node visited). cvc-lod-bake verified end-to-end on
a generated OFF grid (bakes a valid HDF5, re-run reports "up to date, skipped").
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #490 (base
feat/lod-scene-node). The bake + drive side that makes the pyramid pipeline usable end to end.What
cvc::lod::bake_mesh_asset(ctx, h5file, name, geometry, params, force, pool)— build a mesh's pyramid and cache it in ascene.cvch5, skipping the work when a current pyramid (matchingmesh_content_hash) is already present unlessforce. The reusable core of the tool; a demo bundle bake calls it per glTF mesh it has loaded.cvc-lod-bakeCLI (src/cvc/tools) —cvc-lod-bake INPUT.{off,raw} OUTPUT.cvch5 [--name --rungs --ratio --force]. Hermetic (cvc::geometryread; model formats bake from code viabake_mesh_asset). HDF5-gated.cvc::gl::SceneGraph::selectLOD(view)— one per-frame pass that runs everyLodGraphicsNode::select()via the existinggetAllGraphicsOfTypewalk; returns the LOD-node count.The whole chain is now callable:
build_mesh_pyramid→bake_mesh_asset/scene.cvch5(file or blob) →LodGraphicsNode::setPyramid→SceneGraph::selectLODper frame.Tests
lod_store_test+BakeMeshAssetSkipsWhenCurrent: first bake writes; same mesh skips;--forcerebakes; a changed mesh rebakes on the new hash.cvcgl_lod_node+ aSceneGraph::selectLODscenario: far view → coarsest, near → finest, exactly the one LOD node visited.cvc-lod-bakeverified end-to-end on a generated OFF grid: bakes a valid HDF5 (\x89HDF), re-run reportsup to date, skipped.This completes the libcvc LOD pipeline. The remaining application step is wiring it into demo3's Austin bundle (CVC-DBG/cvcdbg — cross-repo, wasm demo build): bake
buildings.glbinto the bundle'sscene.cvch5(or fetch it as a blob), attach aLodGraphicsNode, and callselectLODeach frame.