Struct Scene

Source
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§

Source§

impl<'a> Scene<'a>

Source

pub fn new(device: &'a Device) -> Scene<'_>

Source

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.

Source

pub fn deattach_geometry(&mut self, id: u32) -> Option<Geometry<'a>>

Detach the geometry from the scene

Source

pub fn get_geometry(&self, id: u32) -> Option<&Geometry<'a>>

Look up a geometry in the scene by the ID returned from attach_geometry

Source

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

Source

pub fn iter(&self) -> Iter<'_, u32, Geometry<'a>>

Get an iterator over the geometry map

Source

pub fn iter_mut(&mut self) -> IterMut<'_, u32, Geometry<'a>>

Get an iterator over the geometry map

Source

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.

Source

pub unsafe fn handle(&self) -> RTCScene

Get the underlying handle to the scene, e.g. for passing it to native code or ISPC kernels.

Trait Implementations§

Source§

impl<'a> Drop for Scene<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a> Sync for Scene<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Scene<'a>

§

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§

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.