pub struct Scene3d { /* private fields */ }Expand description
Ready 3D visual state rendered with one camera and depth attachment.
Implementations§
Source§impl Scene3d
impl Scene3d
Sourcepub fn new(background: Color) -> Result<Self, Scene3dError>
pub fn new(background: Color) -> Result<Self, Scene3dError>
Creates an empty scene with a normalized opaque clear color.
Sourcepub fn with_budget(
background: Color,
budget: Scene3dBudget,
) -> Result<Self, Scene3dError>
pub fn with_budget( background: Color, budget: Scene3dBudget, ) -> Result<Self, Scene3dError>
Creates a lazily allocated scene with explicit live-resource limits.
Sourcepub fn try_push(
&mut self,
mesh: &RetainedMesh3d,
transform: Transform3d,
style: MeshStyle3d,
) -> Result<Object3dId, Scene3dError>
pub fn try_push( &mut self, mesh: &RetainedMesh3d, transform: Transform3d, style: MeshStyle3d, ) -> Result<Object3dId, Scene3dError>
Adds a retained object and returns a stable handle for later updates.
Sourcepub const fn background(&self) -> Color
pub const fn background(&self) -> Color
Returns the normalized finite opaque target clear color.
Sourcepub fn instances(&self) -> &[Mesh3dInstance]
pub fn instances(&self) -> &[Mesh3dInstance]
Returns objects in host insertion order; depth determines visibility.
Sourcepub fn object_count(&self) -> usize
pub fn object_count(&self) -> usize
Returns the number of independently transformed objects.
Sourcepub const fn budget(&self) -> Scene3dBudget
pub const fn budget(&self) -> Scene3dBudget
Returns the configured simultaneous-live and retained-capacity limits.
Sourcepub fn statistics(&self) -> Scene3dStatistics
pub fn statistics(&self) -> Scene3dStatistics
Returns deduplicated allocation accounting without allocating scratch.
Sourcepub fn instance(
&self,
object_id: Object3dId,
) -> Result<&Mesh3dInstance, Scene3dError>
pub fn instance( &self, object_id: Object3dId, ) -> Result<&Mesh3dInstance, Scene3dError>
Resolves a live scene-provenance-checked handle in constant time.
Sourcepub fn remove(
&mut self,
object_id: Object3dId,
) -> Result<Mesh3dInstance, Scene3dError>
pub fn remove( &mut self, object_id: Object3dId, ) -> Result<Mesh3dInstance, Scene3dError>
Removes an object, preserving survivor IDs and insertion order.
Removal shifts dense storage in O(N); transform/style/visibility lookups remain O(1). Lookup slots are reused with never-repeated numeric IDs. The returned instance owns its retired mesh reference. Dropping it releases that reference, not necessarily in-flight driver memory.
Sourcepub fn set_mesh(
&mut self,
object_id: Object3dId,
mesh: &RetainedMesh3d,
) -> Result<Scene3dMeshUpdateReport, Scene3dError>
pub fn set_mesh( &mut self, object_id: Object3dId, mesh: &RetainedMesh3d, ) -> Result<Scene3dMeshUpdateReport, Scene3dError>
Rebinds only this object to an immutable mesh after complete validation.
Shared users of the old mesh are unchanged. Transform, style, visibility and ID survive. The accepted resource limits apply to final scene state; replacement overlap is at most old plus incoming mesh and is reported. Synchronous errors preserve all live visual state. In-flight submissions retain their old GPU references; no immediate driver retirement is promised.
Sourcepub fn visible_object_count(&self) -> usize
pub fn visible_object_count(&self) -> usize
Returns objects currently participating in rendering.
Sourcepub fn set_transform(
&mut self,
object_id: Object3dId,
transform: Transform3d,
) -> Result<(), Scene3dError>
pub fn set_transform( &mut self, object_id: Object3dId, transform: Transform3d, ) -> Result<(), Scene3dError>
Replaces one object’s model transform without touching retained topology.
Sourcepub fn set_style(
&mut self,
object_id: Object3dId,
style: MeshStyle3d,
) -> Result<(), Scene3dError>
pub fn set_style( &mut self, object_id: Object3dId, style: MeshStyle3d, ) -> Result<(), Scene3dError>
Replaces one object’s complete extensible visual material bundle.
Sourcepub fn set_visible(
&mut self,
object_id: Object3dId,
visible: bool,
) -> Result<(), Scene3dError>
pub fn set_visible( &mut self, object_id: Object3dId, visible: bool, ) -> Result<(), Scene3dError>
Shows or hides one object without releasing retained topology.
Sourcepub fn set_wireframe(
&mut self,
object_id: Object3dId,
wireframe: Option<WireframeStyle3d>,
) -> Result<(), Scene3dError>
pub fn set_wireframe( &mut self, object_id: Object3dId, wireframe: Option<WireframeStyle3d>, ) -> Result<(), Scene3dError>
Enables or disables explicit visible/hidden edges for one object.