Struct Instance

Source
pub struct Instance<'a, R>
where R: Renderable,
{ pub instantiable: &'a Instantiable<R>, pub transformation: Transformation, pub trans_mat: Mat4, pub bone_poses: Vec<SkeletonPose<'a>>, pub bone_matrices: Vec<Mat4>, }
Expand description

A drawable::Instance contains the instance data for an instance of a drawable::Instantiable

It requires a base transformation, an array of BonePose (which matches the Instantiable’s BoneSet array), and an array of Mat4 for each bone in the BonePose array.

Fields§

§instantiable: &'a Instantiable<R>

Reference to the Instantiable this is based on

This is provided as the instance depends on the Instantiable although it does not use the data here

The [Skeleton] of the Instantiable is borrowed by the SkeletonPose

§transformation: Transformation

The transformation to apply to this model instance

§trans_mat: Mat4

Matrix for the transformation (must be updated after updating Transformation),

§bone_poses: Vec<SkeletonPose<'a>>

The sets of BonePose corresponding to the BoneSet array in the Instantiable

§bone_matrices: Vec<Mat4>

Transformation matrices for the bones

Implementations§

Source§

impl<'a, R> Instance<'a, R>
where R: Renderable,

Source

pub fn new(instantiable: &'a Instantiable<R>, num_bone_matrices: usize) -> Self

Create a new Instance from an Instantiable

This contains an array of SkeletonPoses to allow elements of the Instantiable to be posed, and respective matrices for drawing the meshes within the Instantiable

It should contain appropriate Materials too

Auto Trait Implementations§

§

impl<'a, R> Freeze for Instance<'a, R>

§

impl<'a, R> RefUnwindSafe for Instance<'a, R>

§

impl<'a, R> Send for Instance<'a, R>
where <R as Renderable>::Vertices: Sync, <R as Renderable>::Texture: Sync, <R as Renderable>::Material: Sync,

§

impl<'a, R> Sync for Instance<'a, R>
where <R as Renderable>::Vertices: Sync, <R as Renderable>::Texture: Sync, <R as Renderable>::Material: Sync,

§

impl<'a, R> Unpin for Instance<'a, R>

§

impl<'a, R> UnwindSafe for Instance<'a, R>

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.