22 float downLimit,
float upLimit,
float lateralLimit,
float bellyDepthKm,
float roofHeightKm,
26 float gain = 0.f, pan = 0.f;
28 float referenceDistanceKm,
bool downwardExhaust)
30 if (level <= 0.f)
return;
33 const auto relative = cameraFromVehicle - position;
35 if (spatial.gain <= 0.f)
return;
36 float directivity = 1.f;
38 if (downwardExhaust && distance > .000001f)
43 const float facing = std::clamp(
RiseMath::Vec3Dot(&relative, &exhaust) / distance, -1.f, 1.f);
46 directivity += .6f * std::min(facing, 0.f);
48 const float audible = level * spatial.gain * directivity;
50 pan += audible * spatial.pan;
56 addSource(
Level(output.y, downLimit), {0.f, -bellyDepthKm, 0.f}, .100f,
true);
57 addSource(.25f *
Level(-output.y, upLimit), {0.f, roofHeightKm, 0.f}, .005f,
false);
58 addSource(.25f *
Level(std::fabs(output.x), lateralLimit), {}, .005f,
false);
60 addSource(.25f *
Level(std::fabs(output.z), .002f), {}, .005f,
false);
61 return {std::min(gain, 1.f), gain > 0.f ? pan / gain : 0.f};