aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-12-16 06:29:31 -0800
committerChris Robinson <[email protected]>2014-12-16 06:29:31 -0800
commit97f6d302fe61529ca590d67af9c32bb42e75cdf5 (patch)
tree8a0d3aa0a879c529ded8f4d8d563479469849c82 /OpenAL32
parent1b7c5540687d31d75b54ae85b3b7b4c2b5bc99ef (diff)
Add explicit matrix and vector types to operate with
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alListener.h5
-rw-r--r--OpenAL32/Include/alu.h38
2 files changed, 41 insertions, 2 deletions
diff --git a/OpenAL32/Include/alListener.h b/OpenAL32/Include/alListener.h
index ee07d87c..d7e495fe 100644
--- a/OpenAL32/Include/alListener.h
+++ b/OpenAL32/Include/alListener.h
@@ -2,6 +2,7 @@
#define _AL_LISTENER_H_
#include "alMain.h"
+#include "alu.h"
#ifdef __cplusplus
extern "C" {
@@ -16,8 +17,8 @@ typedef struct ALlistener {
volatile ALfloat MetersPerUnit;
struct {
- ALfloat Matrix[4][4];
- ALfloat Velocity[3];
+ aluMatrix Matrix;
+ aluVector Velocity;
} Params;
} ALlistener;
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 41182749..0baf0cf8 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -41,6 +41,44 @@ struct ALsource;
struct ALvoice;
+typedef union aluVector {
+ alignas(16) ALfloat v[4];
+} aluVector;
+
+inline void aluVectorSet(aluVector *restrict vector, ALfloat x, ALfloat y, ALfloat z, ALfloat w)
+{
+ vector->v[0] = x;
+ vector->v[1] = y;
+ vector->v[2] = z;
+ vector->v[3] = w;
+}
+
+
+typedef union aluMatrix {
+ alignas(16) ALfloat m[4][4];
+} aluMatrix;
+
+inline void aluMatrixSetRow(aluMatrix *restrict matrix, ALuint row,
+ ALfloat m0, ALfloat m1, ALfloat m2, ALfloat m3)
+{
+ matrix->m[row][0] = m0;
+ matrix->m[row][1] = m1;
+ matrix->m[row][2] = m2;
+ matrix->m[row][3] = m3;
+}
+
+inline void aluMatrixSet(aluMatrix *restrict 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);
+}
+
+
enum ActiveFilters {
AF_None = 0,
AF_LowPass = 1,