[Openal-devel] AL_EXT_source_distance_model revisit
Chris Robinson
chris.kcat at gmail.com
Tue Oct 20 10:39:59 PDT 2009
On Monday 19 October 2009 3:20:30 pm you wrote:
> You never know how a developer will decide to use a published API :-)
> So while 'normally' you probably wouldn't use these 2 mechanisms
> together, almost certainly someone will, so it's important to document
> the expected behavior.
Right. And in that case, alDistanceModel will reset every source's distance
model, whether one was explicitly set on it or not. It needs to reset the
model for generated sources to maintain backwards compatibility, and I don't
personally see a reason to special-case sources that had a distance model
explicitly set.
Though if people recommends otherwise, I won't complain too much. It's just an
extra flag per source that's set in alSourcei[v] with AL_DISTANCE_MODEL, and
checked in alDistanceModel.
Or perhaps another option I just thought of.. have an alEnable/alDisable
context state for per-source distance models. When disabled (default) the
context's model is used, otherwise the source's model is. Then alDistanceModel
has no explicit effect on source state, but the enable says which should be
used. Eg:
alSourcei(sID, AL_DISTANCE_MODEL, AL_LINEAR_DISTANCE_CLAMPED);
alDistanceModel(AL_NONE);
... AL_NONE is used for all sources ...
alEnable(AL_SOURCE_DISTANCE_MODEL);
... now linear distance clamped is used for sID, inverse distance clamped for
other sources ...
alDisable(AL_SOURCE_DISTANCE_MODEL);
... now AL_NONE is used for all sources ...
alGetSourceiv(sID, AL_DISTANCE_MODEL, &val);
... gives val == AL_LINEAR_DISTANCE_CLAMPED ...
More information about the Openal-devel
mailing list