diff options
author | Chris Robinson <[email protected]> | 2009-11-27 20:05:21 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-11-27 20:05:21 -0800 |
commit | 98ce1d14c12bf164206b1f0d3ab4dca6d627c8be (patch) | |
tree | 062296b8c92b0c5e43217b0d2ce8e902bc39e594 /OpenAL32/alState.c | |
parent | 69f9ab88b9b9ad1b14bd1a143af230eab2a15b61 (diff) |
Update AL_EXTX_source_distance_model to require explicit enabling
The in-progress spec has been updated to reflect this
Diffstat (limited to 'OpenAL32/alState.c')
-rw-r--r-- | OpenAL32/alState.c | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 1516bb31..9b17045e 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -44,34 +44,66 @@ static const ALchar alErrOutOfMemory[] = "Out of Memory"; ALAPI ALvoid ALAPIENTRY alEnable(ALenum capability) { ALCcontext *Context; + ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; switch(capability) { + case AL_SOURCE_DISTANCE_MODEL: + Context->SourceDistanceModel = AL_TRUE; + updateSources = AL_TRUE; + break; + default: alSetError(AL_INVALID_ENUM); break; } + if(updateSources) + { + ALsource *source = Context->Source; + while(source) + { + source->NeedsUpdate = AL_TRUE; + source = source->next; + } + } + ProcessContext(Context); } ALAPI ALvoid ALAPIENTRY alDisable(ALenum capability) { ALCcontext *Context; + ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; switch(capability) { + case AL_SOURCE_DISTANCE_MODEL: + Context->SourceDistanceModel = AL_FALSE; + updateSources = AL_TRUE; + break; + default: alSetError(AL_INVALID_ENUM); break; } + if(updateSources) + { + ALsource *source = Context->Source; + while(source) + { + source->NeedsUpdate = AL_TRUE; + source = source->next; + } + } + ProcessContext(Context); } @@ -85,6 +117,10 @@ ALAPI ALboolean ALAPIENTRY alIsEnabled(ALenum capability) switch(capability) { + case AL_SOURCE_DISTANCE_MODEL: + value = Context->SourceDistanceModel; + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -588,7 +624,7 @@ ALAPI ALvoid ALAPIENTRY alSpeedOfSound(ALfloat flSpeedOfSound) ALAPI ALvoid ALAPIENTRY alDistanceModel(ALenum value) { ALCcontext *Context; - ALsource *Source; + ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; @@ -603,11 +639,7 @@ ALAPI ALvoid ALAPIENTRY alDistanceModel(ALenum value) case AL_EXPONENT_DISTANCE: case AL_EXPONENT_DISTANCE_CLAMPED: Context->DistanceModel = value; - for(Source = Context->Source;Source != NULL;Source = Source->next) - { - Source->DistanceModel = value; - Source->NeedsUpdate = AL_TRUE; - } + updateSources = !Context->SourceDistanceModel; break; default: @@ -615,5 +647,15 @@ ALAPI ALvoid ALAPIENTRY alDistanceModel(ALenum value) break; } + if(updateSources) + { + ALsource *source = Context->Source; + while(source) + { + source->NeedsUpdate = AL_TRUE; + source = source->next; + } + } + ProcessContext(Context); } |