pub struct FieldManager {
pub blend_mode: FieldBlend,
pub global_scale: f32,
/* private fields */
}Expand description
Manages all active force fields in a scene.
Fields§
§blend_mode: FieldBlend§global_scale: f32Global force multiplier applied to all fields.
Implementations§
Source§impl FieldManager
impl FieldManager
pub fn new() -> Self
Sourcepub fn add(&mut self, field: ForceField) -> FieldId
pub fn add(&mut self, field: ForceField) -> FieldId
Add a permanent force field. Returns its ID.
Sourcepub fn add_timed(&mut self, field: ForceField, ttl: f32) -> FieldId
pub fn add_timed(&mut self, field: ForceField, ttl: f32) -> FieldId
Add a field with a time-to-live in seconds. Returns its ID.
Sourcepub fn add_faded(
&mut self,
field: ForceField,
ttl: f32,
fade_in: f32,
fade_out: f32,
) -> FieldId
pub fn add_faded( &mut self, field: ForceField, ttl: f32, fade_in: f32, fade_out: f32, ) -> FieldId
Add a field with a TTL and optional fade in/out durations.
Sourcepub fn add_tagged(
&mut self,
field: ForceField,
ttl: Option<f32>,
tags: Vec<String>,
) -> FieldId
pub fn add_tagged( &mut self, field: ForceField, ttl: Option<f32>, tags: Vec<String>, ) -> FieldId
Add a tagged field.
Sourcepub fn remove_tagged(&mut self, tag: &str)
pub fn remove_tagged(&mut self, tag: &str)
Remove all fields with a specific tag.
Sourcepub fn get(&self, id: FieldId) -> Option<&ManagedField>
pub fn get(&self, id: FieldId) -> Option<&ManagedField>
Get a reference to a field by ID.
Sourcepub fn get_mut(&mut self, id: FieldId) -> Option<&mut ManagedField>
pub fn get_mut(&mut self, id: FieldId) -> Option<&mut ManagedField>
Get a mutable reference to a field by ID.
Sourcepub fn sample(&self, pos: Vec3, mass: f32, charge: f32, t: f32) -> FieldSample
pub fn sample(&self, pos: Vec3, mass: f32, charge: f32, t: f32) -> FieldSample
Sample all field effects at a world position.
Sourcepub fn sample_tagged(
&self,
pos: Vec3,
tag: &str,
mass: f32,
charge: f32,
t: f32,
) -> FieldSample
pub fn sample_tagged( &self, pos: Vec3, tag: &str, mass: f32, charge: f32, t: f32, ) -> FieldSample
Sample only fields with a specific tag.
Sourcepub fn force_at(&self, pos: Vec3, mass: f32, charge: f32, t: f32) -> Vec3
pub fn force_at(&self, pos: Vec3, mass: f32, charge: f32, t: f32) -> Vec3
Returns the pure force vector at a position (no temperature/entropy).
Sourcepub fn fields_near(&self, pos: Vec3, radius: f32) -> Vec<FieldId>
pub fn fields_near(&self, pos: Vec3, radius: f32) -> Vec<FieldId>
Returns all field IDs whose bounding region overlaps pos within radius.
Sourcepub fn iter(&self) -> impl Iterator<Item = &ManagedField>
pub fn iter(&self) -> impl Iterator<Item = &ManagedField>
Iterator over all active managed fields.
Sourcepub fn interference_at(&self, pos: Vec3, t: f32) -> f32
pub fn interference_at(&self, pos: Vec3, t: f32) -> f32
Compute field interference pattern at pos — how fields amplify/cancel each other. Returns a scalar in [-1, 1] representing constructive (+) or destructive (-) interference.
Sourcepub fn resonance_at(&self, pos: Vec3, t: f32) -> f32
pub fn resonance_at(&self, pos: Vec3, t: f32) -> f32
Resonance score at pos — how much fields oscillate in phase. Uses the variance of field force magnitudes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FieldManager
impl RefUnwindSafe for FieldManager
impl Send for FieldManager
impl Sync for FieldManager
impl Unpin for FieldManager
impl UnsafeUnpin for FieldManager
impl UnwindSafe for FieldManager
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
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.