pub struct Scene<'a> { /* private fields */ }
Expand description
A scene containing various geometry for rendering. Geometry
can be added and removed by attaching and detaching it, after
which the scene BVH can be built via commit
which will
return a CommittedScene
which can be used for ray queries.
Implementations
sourceimpl<'a> Scene<'a>
impl<'a> Scene<'a>
pub fn new(device: &'a Device) -> Scene<'_>
sourcepub fn attach_geometry(&mut self, mesh: Geometry<'a>) -> u32
pub fn attach_geometry(&mut self, mesh: Geometry<'a>) -> u32
Attach a new geometry to the scene. Returns the scene local ID which can than be used to find the hit geometry from the ray ID member. A geometry can only be attached to one Scene at a time, per the Embree documentation. The geometry can be detached from the scene to move it to another one.
sourcepub fn deattach_geometry(&mut self, id: u32) -> Option<Geometry<'a>>
pub fn deattach_geometry(&mut self, id: u32) -> Option<Geometry<'a>>
Detach the geometry from the scene
sourcepub fn get_geometry(&self, id: u32) -> Option<&Geometry<'a>>
pub fn get_geometry(&self, id: u32) -> Option<&Geometry<'a>>
Look up a geometry in the scene by the ID returned from attach_geometry
sourcepub fn get_geometry_mut(&mut self, id: u32) -> Option<&mut Geometry<'a>>
pub fn get_geometry_mut(&mut self, id: u32) -> Option<&mut Geometry<'a>>
Look up a geometry in the scene by the ID returned from attach_geometry
sourcepub fn iter_mut(&mut self) -> IterMut<'_, u32, Geometry<'a>>
pub fn iter_mut(&mut self) -> IterMut<'_, u32, Geometry<'a>>
Get an iterator over the geometry map
sourcepub fn commit(&'a self) -> CommittedScene<'a>
pub fn commit(&'a self) -> CommittedScene<'a>
Commit the scene to build the BVH on top of the geometry to allow
for ray tracing the scene. The returned CommittedScene
can be
used for intersection and occlusion tests. The Scene
can’t
be modified while the CommittedScene
is active.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Scene<'a>
impl<'a> !Send for Scene<'a>
impl<'a> Unpin for Scene<'a>
impl<'a> UnwindSafe for Scene<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more