pub struct MorphTarget {
pub base_positions: Vec<Vec3>,
pub target_positions: Vec<Vec3>,
pub base_normals: Vec<Vec3>,
pub target_normals: Vec<Vec3>,
pub blend: f32,
pub speed: f32,
pub ping_pong: bool,
/* private fields */
}Expand description
Blend between two sets of vertex positions.
Fields§
§base_positions: Vec<Vec3>Base (rest) positions.
target_positions: Vec<Vec3>Target positions to morph toward.
base_normals: Vec<Vec3>Base normals.
target_normals: Vec<Vec3>Target normals.
blend: f32Current blend factor (0 = base, 1 = target).
speed: f32Animation speed (blend units per second).
ping_pong: boolWhether to ping-pong between states.
Implementations§
Source§impl MorphTarget
impl MorphTarget
Sourcepub fn new(base_positions: Vec<Vec3>, target_positions: Vec<Vec3>) -> Self
pub fn new(base_positions: Vec<Vec3>, target_positions: Vec<Vec3>) -> Self
Create a morph target from base and target position arrays.
Sourcepub fn with_normals(
self,
base_normals: Vec<Vec3>,
target_normals: Vec<Vec3>,
) -> Self
pub fn with_normals( self, base_normals: Vec<Vec3>, target_normals: Vec<Vec3>, ) -> Self
Create with normals.
Sourcepub fn with_speed(self, speed: f32) -> Self
pub fn with_speed(self, speed: f32) -> Self
Set the blend speed.
Sourcepub fn with_ping_pong(self, ping_pong: bool) -> Self
pub fn with_ping_pong(self, ping_pong: bool) -> Self
Enable ping-pong animation.
Sourcepub fn compute_positions(&self) -> Vec<Vec3>
pub fn compute_positions(&self) -> Vec<Vec3>
Compute the current blended positions.
Sourcepub fn compute_normals(&self) -> Vec<Vec3>
pub fn compute_normals(&self) -> Vec<Vec3>
Compute the current blended normals.
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
Get the vertex count.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if the morph is complete (blend at 0 or 1).
Auto Trait Implementations§
impl Freeze for MorphTarget
impl RefUnwindSafe for MorphTarget
impl Send for MorphTarget
impl Sync for MorphTarget
impl Unpin for MorphTarget
impl UnsafeUnpin for MorphTarget
impl UnwindSafe for MorphTarget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.