diff options
author | Chris Robinson <[email protected]> | 2022-03-10 22:37:02 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-03-10 22:37:02 -0800 |
commit | e28937d1f6704bcdc3f0a194744905906b106cdd (patch) | |
tree | aef91265df648b63e69ea1a12b4a2db00ea668e2 /alc/alu.cpp | |
parent | a2d34e4c2a37931fda58d0a632140da3e2edd5b0 (diff) |
Add options to reverse local X and Y coordinates
To go along with reverse-z on the other axii. This is only for games that have
position/orientation errors causing top-bottom (or left-right) inversion.
Diffstat (limited to 'alc/alu.cpp')
-rw-r--r-- | alc/alu.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index 203fd9b6..557b072d 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -128,9 +128,11 @@ float InitConeScale() /* Cone scalar */ const float ConeScale{InitConeScale()}; -/* Localized Z scalar for mono sources (initialized in aluInit, after +/* Localized scalars for mono sources (initialized in aluInit, after * configuration is loaded). */ +float XScale{1.0f}; +float YScale{1.0f}; float ZScale{1.0f}; } // namespace @@ -245,6 +247,8 @@ inline ResamplerFunc SelectResampler(Resampler resampler, uint increment) void aluInit(CompatFlagBitset flags) { MixDirectHrtf = SelectHrtfMixer(); + XScale = flags.test(CompatFlags::ReverseX) ? -1.0f : 1.0f; + YScale = flags.test(CompatFlags::ReverseY) ? -1.0f : 1.0f; ZScale = flags.test(CompatFlags::ReverseZ) ? -1.0f : 1.0f; } @@ -1516,7 +1520,7 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ContextBa else if(Distance > 0.0f) spread = std::asin(props->Radius/Distance) * 2.0f; - CalcPanningAndFilters(voice, ToSource[0], ToSource[1], ToSource[2]*ZScale, + CalcPanningAndFilters(voice, ToSource[0]*XScale, ToSource[1]*YScale, ToSource[2]*ZScale, Distance*context->mParams.MetersPerUnit, spread, DryGain, WetGain, SendSlots, props, context->mParams, Device); } |