Skip to main content

Module visibility

Module visibility 

Source
Expand description

Per-entity + group visibility for a solid’s faces / edges / vertices.

The whole-solid + whole-scene toggles already live on SolidDisplay::visible / RenderScene::set_visible. THIS module adds the finer grain the Scene tree needs: an INDIVIDUAL face, edge or vertex can be hidden, and a WHOLE GROUP (all faces / all edges / all vertices of a solid) toggled — with a tristate (GroupState) group readout for the UI checkbox.

§Where the state lives

Each SolidDisplay carries an EntityVisibility — a set of HIDDEN indices per kind (default-visible: an empty set = everything shown). The key is the entity’s INDEX in the solid’s faces / edges / vertices list, the exact index the render pass and the Scene tree already enumerate by (so a hidden face maps straight onto a mesh triangle-range skip — see crate::render). Reused solids keep their sets across history reruns (the pipeline clones the SolidDisplay); a freshly re-tessellated solid resets to all-visible, mirroring how the per-solid visible flag behaves.

§How faces actually hide (the render mechanism)

A solid’s mesh emits each face’s triangles as one contiguous run (the kernel groups by face_ids), and the renderer already keeps a per-face first_index/index_count range. The face pass, instead of one whole-mesh draw, walks the faces and coalesces CONTIGUOUS VISIBLE ranges into draw calls, breaking (flushing) the run at every hidden face — so a hidden face’s triangles are simply never submitted. Edges/vertices skip their line segments / point sprites the same way. No mesh is rebuilt; visibility is purely a draw-time mask, so toggling is free of any re-tessellation.

Structs§

EntityVisibility
The hidden-entity sets of ONE solid (empty = all visible). Indices are into the owning SolidDisplay’s faces / edges / vertices.

Enums§

EntityKind
Which sub-entity list of a solid a visibility toggle addresses.
GroupState
A group checkbox’s tristate: every entity of the kind shown, none shown, or a mix. An empty group reads All — nothing to hide.