aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/alu.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-11-11 08:19:33 -0800
committerChris Robinson <[email protected]>2015-11-11 08:19:33 -0800
commit5d039309b355c350fd087a48c4b896d31871d174 (patch)
treedc47089479cadef370435273fbfe18fed5d6dd0e /OpenAL32/Include/alu.h
parentff62d22d3178ce640966f0fc1ff44d53cb98391a (diff)
Use doubles for the constructed listener matrix
This helps the stability of transforms to local space for sources that are at or near the listener. With a single-precision matrix, even FLT_EPSILON might not be enough to detect matching positions.
Diffstat (limited to 'OpenAL32/Include/alu.h')
-rw-r--r--OpenAL32/Include/alu.h49
1 files changed, 37 insertions, 12 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 0832fbfb..a309c4ab 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -72,12 +72,12 @@ inline void aluVectorSet(aluVector *vector, ALfloat x, ALfloat y, ALfloat z, ALf
}
-typedef union aluMatrix {
+typedef union aluMatrixf {
alignas(16) ALfloat m[4][4];
-} aluMatrix;
+} aluMatrixf;
-inline void aluMatrixSetRow(aluMatrix *matrix, ALuint row,
- ALfloat m0, ALfloat m1, ALfloat m2, ALfloat m3)
+inline void aluMatrixfSetRow(aluMatrixf *matrix, ALuint row,
+ ALfloat m0, ALfloat m1, ALfloat m2, ALfloat m3)
{
matrix->m[row][0] = m0;
matrix->m[row][1] = m1;
@@ -85,15 +85,40 @@ inline void aluMatrixSetRow(aluMatrix *matrix, ALuint row,
matrix->m[row][3] = m3;
}
-inline void aluMatrixSet(aluMatrix *matrix, ALfloat m00, ALfloat m01, ALfloat m02, ALfloat m03,
- ALfloat m10, ALfloat m11, ALfloat m12, ALfloat m13,
- ALfloat m20, ALfloat m21, ALfloat m22, ALfloat m23,
- ALfloat m30, ALfloat m31, ALfloat m32, ALfloat m33)
+inline void aluMatrixfSet(aluMatrixf *matrix, ALfloat m00, ALfloat m01, ALfloat m02, ALfloat m03,
+ ALfloat m10, ALfloat m11, ALfloat m12, ALfloat m13,
+ ALfloat m20, ALfloat m21, ALfloat m22, ALfloat m23,
+ ALfloat m30, ALfloat m31, ALfloat m32, ALfloat m33)
{
- aluMatrixSetRow(matrix, 0, m00, m01, m02, m03);
- aluMatrixSetRow(matrix, 1, m10, m11, m12, m13);
- aluMatrixSetRow(matrix, 2, m20, m21, m22, m23);
- aluMatrixSetRow(matrix, 3, m30, m31, m32, m33);
+ aluMatrixfSetRow(matrix, 0, m00, m01, m02, m03);
+ aluMatrixfSetRow(matrix, 1, m10, m11, m12, m13);
+ aluMatrixfSetRow(matrix, 2, m20, m21, m22, m23);
+ aluMatrixfSetRow(matrix, 3, m30, m31, m32, m33);
+}
+
+
+typedef union aluMatrixd {
+ alignas(16) ALdouble m[4][4];
+} aluMatrixd;
+
+inline void aluMatrixdSetRow(aluMatrixd *matrix, ALuint row,
+ ALdouble m0, ALdouble m1, ALdouble m2, ALdouble m3)
+{
+ matrix->m[row][0] = m0;
+ matrix->m[row][1] = m1;
+ matrix->m[row][2] = m2;
+ matrix->m[row][3] = m3;
+}
+
+inline void aluMatrixdSet(aluMatrixd *matrix, ALdouble m00, ALdouble m01, ALdouble m02, ALdouble m03,
+ ALdouble m10, ALdouble m11, ALdouble m12, ALdouble m13,
+ ALdouble m20, ALdouble m21, ALdouble m22, ALdouble m23,
+ ALdouble m30, ALdouble m31, ALdouble m32, ALdouble m33)
+{
+ aluMatrixdSetRow(matrix, 0, m00, m01, m02, m03);
+ aluMatrixdSetRow(matrix, 1, m10, m11, m12, m13);
+ aluMatrixdSetRow(matrix, 2, m20, m21, m22, m23);
+ aluMatrixdSetRow(matrix, 3, m30, m31, m32, m33);
}