pub struct LayeredEntity {Show 15 fields
pub density_layer: Option<DensityEntity>,
pub metaball_opacity: f32,
pub metaball_emission: f32,
pub curve_layer: Option<CurveEntity>,
pub glyph_layer: Vec<Glyph3DInstance>,
pub position: Vec3,
pub hp: f32,
pub max_hp: f32,
pub layer_visibility: LayerVisibility,
pub dissolution: DissolutionState,
pub alive: bool,
pub name: String,
pub id: u32,
pub time: f32,
pub base_color: Vec4,
}Expand description
A multi-layered entity with four visual systems that peel away as HP drops.
Fields§
§density_layer: Option<DensityEntity>Layer 4 (outermost): particle density aura.
metaball_opacity: f32Layer 3: metaball/isosurface primary form. (Stored as opacity + emission parameters; actual metaball rendering would use the metaball module when the GPU pipeline supports it.)
metaball_emission: f32§curve_layer: Option<CurveEntity>Layer 2: mathematical curve skeleton.
glyph_layer: Vec<Glyph3DInstance>Layer 1 (innermost): identity glyph markers.
position: Vec3World position.
hp: f32Current HP.
max_hp: f32Maximum HP.
layer_visibility: LayerVisibilityComputed layer visibility.
dissolution: DissolutionStateDeath dissolution state.
alive: boolWhether the entity is alive.
name: StringEntity name.
id: u32Unique ID.
time: f32Accumulated time.
base_color: Vec4Base color (propagated to all layers).
Implementations§
Source§impl LayeredEntity
impl LayeredEntity
pub fn new(name: &str, position: Vec3, max_hp: f32) -> Self
Sourcepub fn with_density(self, density: DensityEntity) -> Self
pub fn with_density(self, density: DensityEntity) -> Self
Set the density (particle cloud) layer.
Sourcepub fn with_curves(self, curves: CurveEntity) -> Self
pub fn with_curves(self, curves: CurveEntity) -> Self
Set the curve (mathematical skeleton) layer.
Sourcepub fn with_glyph(self, glyph: Glyph3DInstance) -> Self
pub fn with_glyph(self, glyph: Glyph3DInstance) -> Self
Add a glyph identity marker.
Sourcepub fn with_glyphs(self, glyphs: Vec<Glyph3DInstance>) -> Self
pub fn with_glyphs(self, glyphs: Vec<Glyph3DInstance>) -> Self
Add multiple glyph markers at once.
pub fn with_color(self, color: Vec4) -> Self
Sourcepub fn update(&mut self, dt: f32)
pub fn update(&mut self, dt: f32)
Main update: advance all layers, compute visibility, handle dissolution.
Sourcepub fn take_damage(
&mut self,
amount: f32,
impact_point: Vec2,
impact_direction: Vec2,
)
pub fn take_damage( &mut self, amount: f32, impact_point: Vec2, impact_direction: Vec2, )
Take damage at an impact point.
Sourcepub fn take_crit(
&mut self,
amount: f32,
impact_point: Vec2,
impact_direction: Vec2,
)
pub fn take_crit( &mut self, amount: f32, impact_point: Vec2, impact_direction: Vec2, )
Apply a critical hit: permanent particle loss + curve break.
Sourcepub fn apply_force(&mut self, force: Vec2)
pub fn apply_force(&mut self, force: Vec2)
Apply an external force to all layers.
Sourcepub fn render(
&self,
spawn_fn: &mut dyn FnMut(Glyph) -> GlyphId,
dt: f32,
) -> usize
pub fn render( &self, spawn_fn: &mut dyn FnMut(Glyph) -> GlyphId, dt: f32, ) -> usize
Render all visible layers by spawning glyphs. Returns glyph count.
pub fn hp_ratio(&self) -> f32
pub fn is_dissolved(&self) -> bool
Sourcepub fn get_bounds(&self) -> (Vec2, Vec2)
pub fn get_bounds(&self) -> (Vec2, Vec2)
Combined bounding box from all layers.
Sourcepub fn total_particle_count(&self) -> u32
pub fn total_particle_count(&self) -> u32
Total alive particle count across all layers.
Auto Trait Implementations§
impl Freeze for LayeredEntity
impl RefUnwindSafe for LayeredEntity
impl Send for LayeredEntity
impl Sync for LayeredEntity
impl Unpin for LayeredEntity
impl UnsafeUnpin for LayeredEntity
impl UnwindSafe for LayeredEntity
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> 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.