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,
impl<'a, R> Instance<'a, R>where
R: Renderable,
Sourcepub fn new(instantiable: &'a Instantiable<R>, num_bone_matrices: usize) -> Self
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