pub enum Motion {
None,
Waves {
amp: f32,
speed: f32,
},
Sway {
amp: f32,
speed: f32,
},
Bob {
amp: f32,
speed: f32,
},
}Expand description
Loopable wind/water oscillation attached to a node or tile.
Variants§
None
Static (the default — serialized maps stay compatible).
Waves
Water surface: vertical ripple travelling across XZ.
Sway
Foliage: horizontal sway, zero at the base, strongest at the top.
Bob
Floating object: whole mesh bobs up and down.
Implementations§
Source§impl Motion
impl Motion
Sourcepub fn is_none(&self) -> bool
pub fn is_none(&self) -> bool
True when nothing moves (used to skip serialization and per-vertex work).
pub fn label(&self) -> &'static str
pub fn amp(&self) -> f32
pub fn speed(&self) -> f32
Sourcepub fn offset(
&self,
p: Vec3,
y_floor: f32,
y_ceil: f32,
phase: f32,
t: f32,
) -> Vec3
pub fn offset( &self, p: Vec3, y_floor: f32, y_ceil: f32, phase: f32, t: f32, ) -> Vec3
World-space displacement of point p at time t. y_floor/y_ceil
bound the object so Motion::Sway can taper with height; phase
decorrelates neighbours (see cell_phase, node_phase).
Sourcepub fn offset_loop(
&self,
p: Vec3,
y_floor: f32,
y_ceil: f32,
phase: f32,
t: f32,
) -> Vec3
pub fn offset_loop( &self, p: Vec3, y_floor: f32, y_ceil: f32, phase: f32, t: f32, ) -> Vec3
Displacement for sprite-sequence baking: identical shape to
Motion::offset, but every time term repeats exactly when t
advances by std::f32::consts::TAU. Baking N frames at
t = TAU·k/N therefore yields a seamless loop.
Trait Implementations§
impl Copy for Motion
Source§impl<'de> Deserialize<'de> for Motion
impl<'de> Deserialize<'de> for Motion
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Motion
Auto Trait Implementations§
impl Freeze for Motion
impl RefUnwindSafe for Motion
impl Send for Motion
impl Sync for Motion
impl Unpin for Motion
impl UnsafeUnpin for Motion
impl UnwindSafe for Motion
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