pub struct AcousticsConfig {
pub rays: u32,
pub jitter_radius: f64,
pub absorption_per_voxel: f64,
pub open_cutoff_hz: f32,
pub occluded_cutoff_hz: f32,
pub max_occlusion_db: f32,
pub send_occlusion_frac: f32,
pub max_distance: f64,
pub material_map: Vec<(Rgb, u8)>,
pub absorption: Vec<(u8, f32)>,
}Expand description
Tuning knobs for source_acoustics. The defaults are the cave-demo
tuning; every field is plain data so hosts can persist or lerp them.
Fields§
§rays: u32Jittered rays per source→listener query, including the direct
ray. 1 = direct only; the default 9 (direct + an 8-point ring)
matches the Sound Physics budget and gives soft doorway
transitions. Clamped to at least 1.
jitter_radius: f64Radius (world/voxel units) of the jitter ring around the source, perpendicular to the source→listener axis. Roughly “how big is the emitter”: bigger radii leak more around thin edges.
absorption_per_voxel: f64Per-voxel absorption: a ray crossing t voxels of solid keeps
exp(-absorption · t) of its energy. 0.25 ⇒ ~78% through a
1-voxel wall, ~29% through 5.
open_cutoff_hz: f32Lowpass cutoff at full transmission (unoccluded), Hz.
occluded_cutoff_hz: f32Lowpass cutoff at zero transmission (fully buried), Hz.
max_occlusion_db: f32Gain applied at zero transmission, decibels (negative). Scales
linearly with 1 - transmission; distance attenuation is NOT
included (that is the spatial backend’s job).
send_occlusion_frac: f32Fraction of the occlusion gain also applied to the reverb send —
a buried source still excites the room, just less. 0.5 halves
the dB loss on the send relative to the dry path.
max_distance: f64Hard cap on the marched source→listener distance (world units);
beyond it no rays are cast and the source reports
SourceAcoustics::clear — distance attenuation is the spatial
backend’s job, and a far-away source in open air must NOT come
back muffled. Bounds the DDA cost.
material_map: Vec<(Rgb, u8)>AU2.0 — the host’s colour→material terrain map (the SAME map the
renderer’s set_terrain_materials and the debris system’s
fracture tables take), classifying the voxels a thickness ray
crosses. Only consulted when absorption is
non-empty.
absorption: Vec<(u8, f32)>AU2.0 — material id → effective-thickness multiplier: a ray
crossing one voxel of a 0.35 material accumulates 0.35 voxels
of muffling (glass/crystal), a 1.0 material the full voxel
(stone — also the default for unmapped materials). Empty
(the default) keeps the exact legacy arithmetic — bit-identical
to pre-AU2 output. Interior cells carry no colour in the .vxl
format; a ray reuses the last surface colour it crossed (1.0
until the first) — in practice deep interiors are rock, so the
default reads correctly.
Note the engine-wide convention: colours absent from
material_map classify as material 0,
so an entry for id 0 here re-weights every unmapped
voxel — a deliberate global-default knob, not an accident.
Trait Implementations§
Source§impl Clone for AcousticsConfig
impl Clone for AcousticsConfig
Source§impl Debug for AcousticsConfig
impl Debug for AcousticsConfig
Source§impl Default for AcousticsConfig
impl Default for AcousticsConfig
Source§impl PartialEq for AcousticsConfig
impl PartialEq for AcousticsConfig
impl StructuralPartialEq for AcousticsConfig
Auto Trait Implementations§
impl Freeze for AcousticsConfig
impl RefUnwindSafe for AcousticsConfig
impl Send for AcousticsConfig
impl Sync for AcousticsConfig
impl Unpin for AcousticsConfig
impl UnsafeUnpin for AcousticsConfig
impl UnwindSafe for AcousticsConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more