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.