Skip to main content

Scene3d

Struct Scene3d 

Source
pub struct Scene3d { /* private fields */ }
Expand description

Ready 3D visual state rendered with one camera and depth attachment.

Implementations§

Source§

impl Scene3d

Source

pub fn new(background: Color) -> Result<Self, Scene3dError>

Creates an empty scene with a normalized opaque clear color.

Source

pub fn with_budget( background: Color, budget: Scene3dBudget, ) -> Result<Self, Scene3dError>

Creates a lazily allocated scene with explicit live-resource limits.

Source

pub fn with_alpha_background(background: Color) -> Result<Self, Scene3dError>

Creates an empty scene with a normalized straight-linear RGBA clear color. Offscreen clear RGB is premultiplied; transparent black preserves alpha for later target composition. This explicit API accepts alpha below one.

Source

pub fn with_alpha_background_and_budget( background: Color, budget: Scene3dBudget, ) -> Result<Self, Scene3dError>

Creates an alpha-capable offscreen scene with explicit resource limits.

Source

pub fn set_lighting(&mut self, lighting: Lighting3d)

Replaces validated ambient and directional scene illumination.

Source

pub const fn lighting(&self) -> Lighting3d

Returns scene illumination; surfaces remain Unlit unless explicitly opted in.

Source

pub fn set_fog(&mut self, fog: Option<Fog3d>)

Replaces or disables camera-forward distance fog without changing topology.

Source

pub const fn fog(&self) -> Option<Fog3d>

Returns optional scene fog; only explicitly participating surfaces use it.

Source

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.

Source

pub const fn background(&self) -> Color

Returns the normalized straight-linear RGBA target clear color.

Source

pub fn set_background(&mut self, background: Color) -> Result<(), Scene3dError>

Changes only the normalized straight-linear RGBA clear color, accepting alpha in 0..=1 even on a scene created with the opaque constructor. This explicit mutation performs no allocation, geometry update or upload; IDs, resources, capacities, materials and the environment are untouched. Non-finite or out-of-range channels return InvalidBackground without changing the previous color. Rendering premultiplies clear RGB exactly as it does for with_alpha_background.

Source

pub fn instances(&self) -> &[Mesh3dInstance]

Returns objects in host insertion order; depth determines visibility.

Source

pub fn object_count(&self) -> usize

Returns the number of independently transformed objects.

Source

pub const fn budget(&self) -> Scene3dBudget

Returns the configured simultaneous-live and retained-capacity limits.

Source

pub fn statistics(&self) -> Scene3dStatistics

Returns deduplicated allocation accounting in constant time without allocating scratch.

Source

pub fn instance( &self, object_id: Object3dId, ) -> Result<&Mesh3dInstance, Scene3dError>

Resolves a live scene-provenance-checked handle in constant time.

Source

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.

Source

pub fn set_texture_material( &mut self, object_id: Object3dId, material: Option<&TextureMaterial3d>, ) -> Result<Scene3dMeshUpdateReport, Scene3dError>

Attaches/replaces (Some) or removes (None) only this object’s texture material, sharing all existing topology and attribute buffers. There are no geometry/texture uploads, GPU allocations or GPU copies. Existing mesh aliases and other objects retain their materials; IDs, transform, style, visibility and reserved mesh capacity are unchanged.

Rebinding validates object provenance, texture device ownership, UVs and final scene resource/storage limits before publication. Fallible scene bookkeeping reservation may be needed. The returned report uses the same unique old-plus-incoming overlap accounting as set_mesh; it does not impose a new peak limit or promise immediate in-flight GPU retirement. Detaching retains UVs for later rebinding and does not create geometry.

Source

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.

Source

pub fn visible_object_count(&self) -> usize

Returns the number of objects currently participating in rendering in constant time.

Source

pub fn set_transform( &mut self, object_id: Object3dId, transform: Transform3d, ) -> Result<(), Scene3dError>

Replaces one object’s model transform without touching retained topology.

Source

pub fn set_style( &mut self, object_id: Object3dId, style: MeshStyle3d, ) -> Result<(), Scene3dError>

Replaces one object’s complete extensible visual material bundle.

Source

pub fn set_visible( &mut self, object_id: Object3dId, visible: bool, ) -> Result<(), Scene3dError>

Shows or hides one object without releasing retained topology.

Source

pub fn set_wireframe( &mut self, object_id: Object3dId, wireframe: Option<WireframeStyle3d>, ) -> Result<(), Scene3dError>

Enables or disables explicit visible/hidden edges for one object.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,