mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-17 10:10:23 +00:00
Remove hard maximum distance in the OpenAL driver
Hard sound source culling is now handled by the SoundManager.
This commit is contained in:
parent
6f2e311c58
commit
9cfa2eeab8
@ -1109,13 +1109,8 @@ void OpenAL_Output::initCommon3D(ALuint source, const osg::Vec3f &pos, ALfloat m
|
|||||||
alSource3f(source, AL_VELOCITY, 0.0f, 0.0f, 0.0f);
|
alSource3f(source, AL_VELOCITY, 0.0f, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenAL_Output::updateCommon(ALuint source, const osg::Vec3f& pos, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool useenv, bool is3d)
|
void OpenAL_Output::updateCommon(ALuint source, const osg::Vec3f& pos, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool useenv)
|
||||||
{
|
{
|
||||||
if(is3d)
|
|
||||||
{
|
|
||||||
if((pos - mListenerPos).length2() > maxdist*maxdist)
|
|
||||||
gain = 0.0f;
|
|
||||||
}
|
|
||||||
if(useenv && mListenerEnv == Env_Underwater && !mWaterFilter)
|
if(useenv && mListenerEnv == Env_Underwater && !mWaterFilter)
|
||||||
{
|
{
|
||||||
gain *= 0.9f;
|
gain *= 0.9f;
|
||||||
@ -1243,7 +1238,7 @@ void OpenAL_Output::updateSound(Sound *sound)
|
|||||||
ALuint source = GET_PTRID(sound->mHandle);
|
ALuint source = GET_PTRID(sound->mHandle);
|
||||||
|
|
||||||
updateCommon(source, sound->getPosition(), sound->getMaxDistance(), sound->getRealVolume(),
|
updateCommon(source, sound->getPosition(), sound->getMaxDistance(), sound->getRealVolume(),
|
||||||
sound->getPitch(), sound->getUseEnv(), sound->getIs3D());
|
sound->getPitch(), sound->getUseEnv());
|
||||||
getALError();
|
getALError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1369,7 +1364,7 @@ void OpenAL_Output::updateStream(Stream *sound)
|
|||||||
ALuint source = stream->mSource;
|
ALuint source = stream->mSource;
|
||||||
|
|
||||||
updateCommon(source, sound->getPosition(), sound->getMaxDistance(), sound->getRealVolume(),
|
updateCommon(source, sound->getPosition(), sound->getMaxDistance(), sound->getRealVolume(),
|
||||||
sound->getPitch(), sound->getUseEnv(), sound->getIs3D());
|
sound->getPitch(), sound->getUseEnv());
|
||||||
getALError();
|
getALError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace MWSound
|
|||||||
void initCommon2D(ALuint source, const osg::Vec3f &pos, ALfloat gain, ALfloat pitch, bool loop, bool useenv);
|
void initCommon2D(ALuint source, const osg::Vec3f &pos, ALfloat gain, ALfloat pitch, bool loop, bool useenv);
|
||||||
void initCommon3D(ALuint source, const osg::Vec3f &pos, ALfloat mindist, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool loop, bool useenv);
|
void initCommon3D(ALuint source, const osg::Vec3f &pos, ALfloat mindist, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool loop, bool useenv);
|
||||||
|
|
||||||
void updateCommon(ALuint source, const osg::Vec3f &pos, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool useenv, bool is3d);
|
void updateCommon(ALuint source, const osg::Vec3f &pos, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool useenv);
|
||||||
|
|
||||||
OpenAL_Output& operator=(const OpenAL_Output &rhs);
|
OpenAL_Output& operator=(const OpenAL_Output &rhs);
|
||||||
OpenAL_Output(const OpenAL_Output &rhs);
|
OpenAL_Output(const OpenAL_Output &rhs);
|
||||||
|
Loading…
Reference in New Issue
Block a user