diff options
author | Chris Robinson <[email protected]> | 2014-12-15 11:06:44 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-12-15 11:06:44 -0800 |
commit | 4b77f4ef07302acbe4a36d21450510c63bb72a47 (patch) | |
tree | a7fc9bc5fcd35b2a22ba167c1fd18406de899b15 | |
parent | e60e0761f5d50206dc121703a7ead2619fb5bedc (diff) |
Transpose the cubic matrix op
-rw-r--r-- | OpenAL32/Include/alu.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 257f0c8f..70beebce 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -170,13 +170,13 @@ inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu) } inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat mu) { - ALfloat mu2 = mu*mu; - ALfloat a0 = -0.5f*val0 + 1.5f*val1 + -1.5f*val2 + 0.5f*val3; - ALfloat a1 = val0 + -2.5f*val1 + 2.0f*val2 + -0.5f*val3; - ALfloat a2 = -0.5f*val0 + 0.5f*val2; - ALfloat a3 = val1; + ALfloat mu2 = mu*mu, mu3 = mu*mu*mu; + ALfloat a0 = -0.5f*mu3 + mu2 + -0.5f*mu; + ALfloat a1 = 1.5f*mu3 + -2.5f*mu2 + 1.0f; + ALfloat a2 = -1.5f*mu3 + 2.0f*mu2 + 0.5f*mu; + ALfloat a3 = 0.5f*mu3 + -0.5f*mu2; - return a0*mu*mu2 + a1*mu2 + a2*mu + a3; + return a0*val0 + a1*val1 + a2*val2 + a3*val3; } |