aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-10-25 17:24:22 -0700
committerChris Robinson <[email protected]>2012-10-25 17:24:22 -0700
commite2e502970c08aab91f38f1ccc4e40f02432af370 (patch)
tree8df612952e4e4258d2a2d90439ac09659569c81d
parent404d6016664f7856cf11ae0fba7305dac0faf0fb (diff)
Move some math functions to where they're used
-rw-r--r--Alc/ALu.c25
-rw-r--r--OpenAL32/Include/alu.h26
2 files changed, 25 insertions, 26 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index a30b396e..1ab58de6 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -105,6 +105,31 @@ static WetMixerFunc SelectSendMixer(void)
}
+static __inline void aluCrossproduct(const ALfloat *inVector1, const ALfloat *inVector2, ALfloat *outVector)
+{
+ outVector[0] = inVector1[1]*inVector2[2] - inVector1[2]*inVector2[1];
+ outVector[1] = inVector1[2]*inVector2[0] - inVector1[0]*inVector2[2];
+ outVector[2] = inVector1[0]*inVector2[1] - inVector1[1]*inVector2[0];
+}
+
+static __inline ALfloat aluDotproduct(const ALfloat *inVector1, const ALfloat *inVector2)
+{
+ return inVector1[0]*inVector2[0] + inVector1[1]*inVector2[1] +
+ inVector1[2]*inVector2[2];
+}
+
+static __inline void aluNormalize(ALfloat *inVector)
+{
+ ALfloat lengthsqr = aluDotproduct(inVector, inVector);
+ if(lengthsqr > 0.0f)
+ {
+ ALfloat inv_length = 1.0f/sqrtf(lengthsqr);
+ inVector[0] *= inv_length;
+ inVector[1] *= inv_length;
+ inVector[2] *= inv_length;
+ }
+}
+
static __inline ALvoid aluMatrixVector(ALfloat *vector, ALfloat w, ALfloat (*RESTRICT matrix)[4])
{
ALfloat temp[4] = {
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index e71ee129..11c03332 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -103,32 +103,6 @@ static __inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat
}
-static __inline void aluCrossproduct(const ALfloat *inVector1, const ALfloat *inVector2, ALfloat *outVector)
-{
- outVector[0] = inVector1[1]*inVector2[2] - inVector1[2]*inVector2[1];
- outVector[1] = inVector1[2]*inVector2[0] - inVector1[0]*inVector2[2];
- outVector[2] = inVector1[0]*inVector2[1] - inVector1[1]*inVector2[0];
-}
-
-static __inline ALfloat aluDotproduct(const ALfloat *inVector1, const ALfloat *inVector2)
-{
- return inVector1[0]*inVector2[0] + inVector1[1]*inVector2[1] +
- inVector1[2]*inVector2[2];
-}
-
-static __inline void aluNormalize(ALfloat *inVector)
-{
- ALfloat lengthsqr = aluDotproduct(inVector, inVector);
- if(lengthsqr > 0.0f)
- {
- ALfloat inv_length = 1.0f/sqrtf(lengthsqr);
- inVector[0] *= inv_length;
- inVector[1] *= inv_length;
- inVector[2] *= inv_length;
- }
-}
-
-
ALvoid aluInitPanning(ALCdevice *Device);
ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, ALfloat ingain, ALfloat *gains);