mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
handle zero distance from listener to source
This commit is contained in:
parent
87b85d6951
commit
e0cb8db914
1 changed files with 7 additions and 2 deletions
|
@ -169,8 +169,13 @@ float AudioMixer::azimuthForSource(const PositionalAudioStream& streamToAdd, con
|
|||
// project the rotated source position vector onto the XZ plane
|
||||
rotatedSourcePosition.y = 0.0f;
|
||||
|
||||
// produce an oriented angle about the y-axis
|
||||
return glm::orientedAngle(glm::vec3(0.0f, 0.0f, -1.0f), glm::normalize(rotatedSourcePosition), glm::vec3(0.0f, -1.0f, 0.0f));
|
||||
if (rotatedSourcePosition != glm::vec3()) {
|
||||
// produce an oriented angle about the y-axis
|
||||
return glm::orientedAngle(glm::vec3(0.0f, 0.0f, -1.0f), glm::normalize(rotatedSourcePosition), glm::vec3(0.0f, -1.0f, 0.0f));
|
||||
} else {
|
||||
// there is no distance between listener and source - return no azimuth
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void AudioMixer::addStreamToMixForListeningNodeWithStream(AudioMixerClientData& listenerNodeData,
|
||||
|
|
Loading…
Reference in a new issue