Skip to content

Scene: one proxy an object - #146

Merged
yujiaxu-ops merged 5 commits into
mainfrom
scene-proxy-table
Nov 16, 2026
Merged

yujiaxu-ops merged 5 commits into
mainfrom
scene-proxy-table

Conversation

@yujiaxu-ops

@yujiaxu-ops yujiaxu-ops commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Scene step B, second part: one proxy an object. No picture changes; two faults that lived between the maps are fixed.

What

Where what an object draws landed was spread over fourteen maps keyed by the object: nine the build filled (Retained: its object-table entry, card, dynamic triangles, instance, whether its moves are the instance's, rigid model, pose group, whether its mesh is its own, emitter mesh, instanced copies), four the edits kept beside them for what they placed (EditState: its record, its value as picks test it, an instanced range, the mesh it draws) and one for procedural objects (LoadedScene::proc_of).

  • One table, scene::Retained::proxies: Proxy { object, card, draw }, Draw = Fixed | Dynamic | Instance | Procedural | Rigid | Instanced. The build fills it; commit and the geometry edit read and keep it.
  • A record's value has one home: instances[record], or procs[record - the first procedural record], for what an edit places as for the build's (hidden fillers at the records between). edit.added, edit.placed, edit.instanced, edit.mesh_of, proc_of, Picked, unpick are gone; pick and node_tris walk the two stores only.
  • A record's slot is inst_base + it, for every record: the two sites that said it another way for procedural objects say that (Top::proc_base is gone).
  • "An edit placed it" is its record being the room's (EditState::in_room), not a second set of maps. A mesh a body drives moves as an instance because its proxy says so, whoever placed it (placed_movable is gone).
  • Lights, media and particles keep their tables' own indices: a table a kind.

Two faults, each shown by a test first

  • An instanced object the build flattened (a glass or emitting material, a mirrored copy) was in none of the maps: removing it in place did nothing and it stayed in the picture (9.7 of 255 from a build's without it). It has a proxy now (Draw::Fixed), and an object with a proxy and no record an edit can clear is rebuilt out.
  • An instanced object an edit added had an object entry of its own beside its copies', so its node's power or customData wrote over copy 0's own. It has an entry a copy only, as the build's.

Smaller behaviour changes

  • A mesh whose geometry became empty gives up its mesh at once (it did at its next placement or removal).
  • Procedural geometry an edit placed, under a node that moves, moves with it (it was left where it was). Read, not tested.
  • Objects edits placed are picked in record order with the build's instances (they came after them): only an exact tie in distance could tell.

Checks

  • live::inplace_tests: the two new tests (failing before the fixes), the moves, edits and resize tests; live::instanced_tests (picks, a driven mesh added in place, moved instances) with the mover flag asserted. 165 unit tests, 239 render tests.
  • render-identity against main, native: 239 outputs, 219 byte-identical, 20 within their spread, 0 changed.
  • The voxel level (bench-destruction, sustained), main / this: debris route frame interval p50 21.12 / 21.39 ms against 21.17 / 20.65, edit 0.66 against 0.65 / 0.67; batch route 23.42 / 23.87 against 23.06 / 22.46, edit 0.86 / 0.83 against 0.76 / 0.69; no fallback, 10467 objects at the end on both.
  • wasm32: the library and renderer/web build.

Not in this PR

  • The build's and the edits' placements are still two mechanisms in what they can do: what the build flattened or placed as a model's instance is rebuilt to change; what an edit placed does not move unless a body drives it. Six in_room tests say so. One mechanism is step E.
  • instances and procs are two stores indexed by record; one array of records would be the plain form.
  • Seen once on each build and not met again in 104 direct runs: geometry-grow-live left no output under render-identity (main in the whole suite, this branch alone). Its message was not caught.

🤖 Generated with Claude Code


Note

Medium Risk
Large refactor of live scene commit, GPU placement, and picking paths; fixes are covered by inplace/render identity tests but regressions could surface in edge-case edits or instancing.

Overview
Replaces fourteen per-object maps (build Retained tables plus live EditState placement/pick side maps and proc_of) with a single scene::Retained::proxies table: each object gets a Proxy { object, card, draw } and geometry is classified via Draw (Fixed, Dynamic, Instance, Procedural, Rigid, Instanced).

Live commit and geometry edits now route through proxies: record values live only in instances[record] or procs[record - proc_first], TLAS slots use inst_base + record everywhere (Top::proc_base removed), and edit-placed objects are identified with EditState::in_room instead of separate placed / added / mesh_of / Picked maps. Picking and node_tris read those stores only; removal/hiding uses undraw on the proxy’s draw kind.

Behaviour fixes called out in tests: build-flattened instanced objects get a proxy so in-place remove actually clears them; edit-added instanced meshes no longer steal copy 0’s object-table row. moving_instances tracks proxy-driven instance motion for kernel motion vectors.

Reviewed by Cursor Bugbot for commit a302aaa. Bugbot is set up for automated code reviews on this repo. Configure here.

yujiaxu-ops and others added 5 commits November 17, 2026 00:10
Where what an object draws landed was spread over nine maps keyed by the object (its object-table entry, its card's
material, its dynamic triangles, its instance, whether its moves are the instance's, its rigid model, its pose
group, whether its mesh is its own, its emitter mesh, its instanced copies). They are one table, `Retained::proxies`:
`Proxy { object, card, draw }`, `Draw` = Fixed | Dynamic | Instance | Rigid | Instanced. The commit and the
geometry edit read it. No behaviour change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The edits kept four maps of their own by object (the record they placed it at, its instance or procedural object
as picks test it, an instanced object's range, the mesh it draws), and the build's procedural objects a fifth.
An object's proxy holds its record; `instances[record]` and `procs[record - the first procedural record]` hold its
value, for what an edit places as for the build's (hidden fillers at the records between). "An edit placed it" is
its record being the room's. A mesh a body drives moves as an instance because its proxy says so, whoever placed
it (`placed_movable` is gone). An instanced place names its mesh.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…rd's slot by one rule

Two faults that went with the maps, each shown by a test first. An instanced object the build flattened was in
none of them: removing it in place did nothing, and it stayed in the picture. It has a proxy (Draw::Fixed), and an
object with a proxy and no record an edit can clear is rebuilt out. An instanced object an edit added had an
object entry of its own beside its copies', so its node's power or customData wrote over copy 0's: it has an
entry a copy only, as the build's.

A record's slot is `inst_base` + it for every record: the two sites that said it another way for procedural
objects say that, and `Top::proc_base` is gone.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…here proxies change

From a re-read. An instance's pose group was a field every instance had beside its mesh's kind (a pose with a
mesh of its own could be written): it is a kind, `MeshKind::Pose`. `Retained::instance` for `placed`. Whether
anything moves as an instance was asked of every proxy each frame where two maps' emptiness answered before: it
is kept in the loaded scene, set at the load and by a geometry edit (the only places proxies change), and the
driven-mesh test holds it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@yujiaxu-ops
yujiaxu-ops merged commit e7d3cff into main Nov 16, 2026
9 checks passed
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