![]() |
VR-Forces Developer's Guide
|
DtProceduralSoundBehavior that adapts audio to the current visibility distance.
Creates one audio layer per tier. Each layer is managed by an internal slot behavior that applies a crossfade envelope based on normalised fog intensity. Fog intensity is computed as max(0, 1 - visibilityMeters / clearVisibilityMeters), so dense fog (low metres) maps to high intensity and clear sky maps to 0. The outer behavior returns isActive()=false when visibility is at or above clearVisibilityMeters.

Public Member Functions | |
| DtVisibilitySoundBehavior (const DtVisibilitySoundConfig &config) | |
| void | setupSound (DtProceduralSound &sound, DtDe &de) override |
| void | update (DtDe &de) override |
| bool | isActive (const DtProceduralSoundBehaviorContext &ctx) const override |
| float | currentVolumeDb (const DtProceduralSoundBehaviorContext &ctx, float channelBaseVolumeDb) const override |
| void | setLocalVisibilityOverride (bool hazy, float visibilityMeters) override |
| void | setProximityDistance (double distanceMeters) override |
| bool | isInRange () const override |
| bool | usingLocalOverride () const override |
| void | appendImGuiDebugInfo () const override |
Public Member Functions inherited from makVrv::DtProceduralSoundBehavior | |
| virtual | ~DtProceduralSoundBehavior ()=default |
| virtual void | setLocalPrecipitationOverride (bool raining, float normalizedIntensity) |
| virtual void | setLocalWindSpeedOverride (bool audible, float speedMs) |
| virtual float | proximityDistMeters () const |
| virtual float | nextIntervalSeconds (const DtProceduralSoundBehaviorContext &ctx, float builtInInterval) const |
| virtual int | selectClip (const DtProceduralSoundBehaviorContext &ctx, const std::vector< float > &weights) const |
| virtual float | selectGain (const DtProceduralSoundBehaviorContext &ctx, float minGain, float maxGain) const |
| virtual float | selectPitch (const DtProceduralSoundBehaviorContext &ctx, float minPitch, float maxPitch) const |
| virtual bool | wantRestart () const |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| virtual | ~DtVirtualBaseClass () |
Private Attributes | |
| DtVisibilitySoundConfig | myConfig |
| std::atomic< float > | myFogIntensity |
| std::atomic< bool > | myIsHazy |
| std::atomic< bool > | myHasLocalVisOverride |
| std::atomic< bool > | myLocalHazy |
| std::atomic< float > | myLocalVisMeters |
| std::atomic< bool > | myIsInRange |
| std::atomic< bool > | myUsingLocalOverride |
| std::vector< std::unique_ptr < DtTierSlotBehavior > > | mySlots |
Additional Inherited Members | |
Protected Attributes inherited from makVrv::DtProceduralSoundBehavior | |
| std::atomic< float > | myProximityDistMeters {0.0f} |
|
explicit |
Constructor.
| config | Full tier configuration (paths and crossfade parameters). |
|
overridevirtual |
Configure the visibility sound with one layer per tier.
| sound | The procedural sound to configure. |
| de | Display engine context; used by the clip loader for path token resolution. |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Read the current visibility distance from DtEnvironment and update atomics.
| de | Display engine context. |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Returns false when visibility is at or above clearVisibilityMeters.
| ctx | Current channel context (unused). |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Returns channelBaseVolumeDb unchanged; each slot handles its own gain curve.
| ctx | Current channel context (unused). |
| channelBaseVolumeDb | Channel base volume in dB. |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
rief Store a local weather area visibility override for the next update().
| hazy | True when inside a visibility local weather area. |
| visibilityMeters | Raw visibility distance in metres from the local area. |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Cache the listener-to-entity distance and update the proximity gate.
| distanceMeters | Euclidean distance in metres from the listener to the entity. |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Returns true if the entity is within maxRangeMeters of the listener.
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Returns true when a local weather area provided the visibility value this frame.
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Emit ImGui text showing current fog intensity and hazy/override flags.
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
private |
Full tier configuration.
|
private |
Normalised fog intensity [0,1]; updated by update().
|
private |
True when visibility is below clearVisibilityMeters.
True when a local weather area override is pending via setLocalVisibilityOverride().
|
private |
|
private |
Local weather area hazy gate, written by setLocalVisibilityOverride().
|
private |
Local weather area raw visibility in metres, written by setLocalVisibilityOverride().
|
private |
True when the entity is within maxRangeMeters of the listener (or when maxRangeMeters == 0).
|
private |
True when the local weather area path was taken in the last update().
|
private |
Per-tier slot behaviors.