diff options
author | Chris Robinson <[email protected]> | 2012-10-09 06:19:36 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-10-09 06:19:36 -0700 |
commit | 39bc2ba65c5b52b46bd8dd1587837882d98c5120 (patch) | |
tree | 36da448b685a228a76e7221d47d3ada0175d7feb /OpenAL32 | |
parent | d598f82722d6784fada1c8b2a522463d5bf31c42 (diff) |
Build the listener matrix separately
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alListener.h | 5 | ||||
-rw-r--r-- | OpenAL32/alListener.c | 31 |
2 files changed, 5 insertions, 31 deletions
diff --git a/OpenAL32/Include/alListener.h b/OpenAL32/Include/alListener.h index 8c5fe734..830b70da 100644 --- a/OpenAL32/Include/alListener.h +++ b/OpenAL32/Include/alListener.h @@ -12,9 +12,12 @@ typedef struct ALlistener { volatile ALfloat Velocity[3]; volatile ALfloat Forward[3]; volatile ALfloat Up[3]; - volatile ALfloat Matrix[4][4]; volatile ALfloat Gain; volatile ALfloat MetersPerUnit; + + struct { + ALfloat Matrix[4][4]; + } Params; } ALlistener; #ifdef __cplusplus diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c index f026c8b2..682acbb5 100644 --- a/OpenAL32/alListener.c +++ b/OpenAL32/alListener.c @@ -129,7 +129,6 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) al_try { - ALfloat U[3], V[3], N[3]; CHECK_VALUE(Context, values); switch(param) { @@ -138,42 +137,14 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) isfinite(values[2]) && isfinite(values[3]) && isfinite(values[4]) && isfinite(values[5])); - /* AT then UP */ - N[0] = values[0]; - N[1] = values[1]; - N[2] = values[2]; - aluNormalize(N); - V[0] = values[3]; - V[1] = values[4]; - V[2] = values[5]; - aluNormalize(V); - /* Build and normalize right-vector */ - aluCrossproduct(N, V, U); - aluNormalize(U); - LockContext(Context); + /* AT then UP */ Context->Listener->Forward[0] = values[0]; Context->Listener->Forward[1] = values[1]; Context->Listener->Forward[2] = values[2]; Context->Listener->Up[0] = values[3]; Context->Listener->Up[1] = values[4]; Context->Listener->Up[2] = values[5]; - Context->Listener->Matrix[0][0] = U[0]; - Context->Listener->Matrix[0][1] = V[0]; - Context->Listener->Matrix[0][2] = -N[0]; - Context->Listener->Matrix[0][3] = 0.0f; - Context->Listener->Matrix[1][0] = U[1]; - Context->Listener->Matrix[1][1] = V[1]; - Context->Listener->Matrix[1][2] = -N[1]; - Context->Listener->Matrix[1][3] = 0.0f; - Context->Listener->Matrix[2][0] = U[2]; - Context->Listener->Matrix[2][1] = V[2]; - Context->Listener->Matrix[2][2] = -N[2]; - Context->Listener->Matrix[2][3] = 0.0f; - Context->Listener->Matrix[3][0] = 0.0f; - Context->Listener->Matrix[3][1] = 0.0f; - Context->Listener->Matrix[3][2] = 0.0f; - Context->Listener->Matrix[3][3] = 1.0f; Context->UpdateSources = AL_TRUE; UnlockContext(Context); break; |