pub struct EntityCurve {Show 13 fields
pub curve_type: CurveType,
pub control_points: Vec<Vec2>,
pub base_points: Vec<Vec2>,
pub color: Vec4,
pub emission: f32,
pub thickness: f32,
pub stiffness: f32,
pub segment_count: u32,
pub alive: bool,
pub point_velocities: Vec<Vec2>,
pub closed: bool,
pub dash_pattern: Option<(f32, f32)>,
pub layer: u32,
}Expand description
A single mathematical curve within an entity.
Fields§
§curve_type: CurveTypeThe mathematical definition.
control_points: Vec<Vec2>Control points (interpretation depends on curve_type). For Bezier: these ARE the control points. For others: these define offset/scale/anchor positions.
base_points: Vec<Vec2>Base (unmodified) control points for restoring after deformation.
color: Vec4RGBA color of this curve.
emission: f32Emission intensity (for glow/bloom).
thickness: f32Line thickness in world units.
stiffness: f32Stiffness: how much this curve resists external forces (higher = more rigid).
segment_count: u32Number of line segments to tessellate into.
alive: boolWhether this curve is still intact (false = broken by crit/death).
point_velocities: Vec<Vec2>Per-point velocity (for physics response and dissolution).
closed: boolClosed curve (connect last point back to first).
dash_pattern: Option<(f32, f32)>Dash pattern: None = solid, Some(on, off) = dashed.
layer: u32Layer priority for rendering order.
Implementations§
Source§impl EntityCurve
impl EntityCurve
Sourcepub fn new(curve_type: CurveType, control_points: Vec<Vec2>) -> Self
pub fn new(curve_type: CurveType, control_points: Vec<Vec2>) -> Self
Create a new curve with the given type and initial control points.
pub fn with_color(self, color: Vec4) -> Self
pub fn with_emission(self, e: f32) -> Self
pub fn with_thickness(self, t: f32) -> Self
pub fn with_stiffness(self, s: f32) -> Self
pub fn with_segments(self, n: u32) -> Self
pub fn with_closed(self, c: bool) -> Self
pub fn with_dash(self, on: f32, off: f32) -> Self
pub fn with_layer(self, l: u32) -> Self
Sourcepub fn apply_force(&mut self, force: Vec2)
pub fn apply_force(&mut self, force: Vec2)
Apply an external force impulse to all control points. Points with lower stiffness move more.
Sourcepub fn apply_hit_recoil(&mut self, direction: Vec2, magnitude: f32)
pub fn apply_hit_recoil(&mut self, direction: Vec2, magnitude: f32)
Apply a directional impulse from a hit (recoil). Points closer to the impact side are affected more.
Sourcepub fn step_physics(&mut self, dt: f32, damping: f32)
pub fn step_physics(&mut self, dt: f32, damping: f32)
Step physics: apply velocity, spring-back toward base positions, damping.
Sourcepub fn break_curve(&mut self)
pub fn break_curve(&mut self)
Break this curve (from crit hit or death).
Sourcepub fn kinetic_energy(&self) -> f32
pub fn kinetic_energy(&self) -> f32
Total energy (kinetic) in this curve’s control points.
Trait Implementations§
Source§impl Clone for EntityCurve
impl Clone for EntityCurve
Auto Trait Implementations§
impl Freeze for EntityCurve
impl RefUnwindSafe for EntityCurve
impl Send for EntityCurve
impl Sync for EntityCurve
impl Unpin for EntityCurve
impl UnsafeUnpin for EntityCurve
impl UnwindSafe for EntityCurve
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.