Skip to main content

RtInstance

Struct RtInstance 

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

Instanced reference to a shared Blas3D with affine transform, cached inverse, normal matrix, and material binding.

Implementations§

Source§

impl RtInstance

Transform precomputation and update helpers for RtInstance.

Source

pub fn new( blas_id: u32, transform: Mat4, material_id: u32, local_bounds: AxisAlignedBox3D, ) -> Self

Creates an instanced BLAS reference with precomputed inverse matrix, normal matrix, and world bounding box.

§Arguments
  • u32 - Index of the referenced Blas3D.
  • Mat4 - Local-to-world affine transform matrix.
  • u32 - Bound material index.
  • AxisAlignedBox3D - Local-space bounding box of the referenced Blas3D.
§Returns
  • Self - Ready-to-trace scene instance.
Source

pub fn update_transform( &mut self, transform: Mat4, local_bounds: AxisAlignedBox3D, )

Recomputes the inverse transform, normal matrix, and world bounding box for a moved or scaled instance.

§Arguments
  • &Self - Mutable instance reference.
  • Mat4 - Updated local-to-world affine transform matrix.
  • AxisAlignedBox3D - Local-space bounding box of the referenced Blas3D.
Source§

impl RtInstance

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_blas_id(&self) -> u32

Source

pub fn get_mut_blas_id(&mut self) -> &mut u32

Source

pub fn set_blas_id(&mut self, val: u32) -> &mut Self

Source

pub fn get_transform(&self) -> Mat4

Source

pub fn get_mut_transform(&mut self) -> &mut Mat4

Source

pub fn set_transform(&mut self, val: Mat4) -> &mut Self

Source

pub fn get_inv_transform(&self) -> Mat4

Source

pub fn get_mut_inv_transform(&mut self) -> &mut Mat4

Source

pub fn set_inv_transform(&mut self, val: Mat4) -> &mut Self

Source

pub fn get_normal_matrix(&self) -> [Vec3; 3]

Source

pub fn get_mut_normal_matrix(&mut self) -> &mut [Vec3; 3]

Source

pub fn set_normal_matrix(&mut self, val: [Vec3; 3]) -> &mut Self

Source

pub fn get_material_id(&self) -> u32

Source

pub fn get_mut_material_id(&mut self) -> &mut u32

Source

pub fn set_material_id(&mut self, val: u32) -> &mut Self

Source

pub fn get_world_bounds(&self) -> AxisAlignedBox3D

Source

pub fn get_mut_world_bounds(&mut self) -> &mut AxisAlignedBox3D

Source

pub fn set_world_bounds(&mut self, val: AxisAlignedBox3D) -> &mut Self

Source

pub fn get_visible(&self) -> bool

Source

pub fn get_mut_visible(&mut self) -> &mut bool

Source

pub fn set_visible(&mut self, val: bool) -> &mut Self

Source

pub fn get_determinant_sign(&self) -> f32

Source

pub fn get_mut_determinant_sign(&mut self) -> &mut f32

Source

pub fn set_determinant_sign(&mut self, val: f32) -> &mut Self

Trait Implementations§

Source§

impl Clone for RtInstance

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RtInstance

Source§

impl Debug for RtInstance

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RtInstance

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RtInstance

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.