repo: Clang-format c/cpp/h LVL files using LLVM
Bring all source files in the repo up to date with consistent
coding style/standard.
Change-Id: Iceedbc17109974d3a0437fc4995441c9ad7e0c23
diff --git a/demos/linmath.h b/demos/linmath.h
index 77cc33f..a36b188 100644
--- a/demos/linmath.h
+++ b/demos/linmath.h
@@ -57,9 +57,7 @@
r[1] = a[2] * b[0] - a[0] * b[2];
r[2] = a[0] * b[1] - a[1] * b[0];
}
-static inline float vec3_len(vec3 const v) {
- return sqrtf(vec3_mul_inner(v, v));
-}
+static inline float vec3_len(vec3 const v) { return sqrtf(vec3_mul_inner(v, v)); }
static inline void vec3_norm(vec3 r, vec3 const v) {
float k = 1.f / vec3_len(v);
vec3_scale(r, v, k);
@@ -156,8 +154,7 @@
for (i = 0; i < 4; ++i)
vec4_scale(M[i], a[i], k);
}
-static inline void mat4x4_scale_aniso(mat4x4 M, mat4x4 a, float x, float y,
- float z) {
+static inline void mat4x4_scale_aniso(mat4x4 M, mat4x4 a, float x, float y, float z) {
int i;
vec4_scale(M[0], a[0], x);
vec4_scale(M[1], a[1], y);
@@ -189,8 +186,7 @@
T[3][1] = y;
T[3][2] = z;
}
-static inline void mat4x4_translate_in_place(mat4x4 M, float x, float y,
- float z) {
+static inline void mat4x4_translate_in_place(mat4x4 M, float x, float y, float z) {
vec4 t = {x, y, z, 0};
vec4 r;
int i;
@@ -205,8 +201,7 @@
for (j = 0; j < 4; ++j)
M[i][j] = i < 3 && j < 3 ? a[i] * b[j] : 0.f;
}
-static inline void mat4x4_rotate(mat4x4 R, mat4x4 M, float x, float y, float z,
- float angle) {
+static inline void mat4x4_rotate(mat4x4 R, mat4x4 M, float x, float y, float z, float angle) {
float s = sinf(angle);
float c = cosf(angle);
vec3 u = {x, y, z};
@@ -216,10 +211,7 @@
mat4x4 T;
mat4x4_from_vec3_mul_outer(T, u, u);
- mat4x4 S = {{0, u[2], -u[1], 0},
- {-u[2], 0, u[0], 0},
- {u[1], -u[0], 0, 0},
- {0, 0, 0, 0}};
+ mat4x4 S = {{0, u[2], -u[1], 0}, {-u[2], 0, u[0], 0}, {u[1], -u[0], 0, 0}, {0, 0, 0, 0}};
mat4x4_scale(S, S, s);
mat4x4 C;
@@ -240,28 +232,19 @@
static inline void mat4x4_rotate_X(mat4x4 Q, mat4x4 M, float angle) {
float s = sinf(angle);
float c = cosf(angle);
- mat4x4 R = {{1.f, 0.f, 0.f, 0.f},
- {0.f, c, s, 0.f},
- {0.f, -s, c, 0.f},
- {0.f, 0.f, 0.f, 1.f}};
+ mat4x4 R = {{1.f, 0.f, 0.f, 0.f}, {0.f, c, s, 0.f}, {0.f, -s, c, 0.f}, {0.f, 0.f, 0.f, 1.f}};
mat4x4_mul(Q, M, R);
}
static inline void mat4x4_rotate_Y(mat4x4 Q, mat4x4 M, float angle) {
float s = sinf(angle);
float c = cosf(angle);
- mat4x4 R = {{c, 0.f, s, 0.f},
- {0.f, 1.f, 0.f, 0.f},
- {-s, 0.f, c, 0.f},
- {0.f, 0.f, 0.f, 1.f}};
+ mat4x4 R = {{c, 0.f, s, 0.f}, {0.f, 1.f, 0.f, 0.f}, {-s, 0.f, c, 0.f}, {0.f, 0.f, 0.f, 1.f}};
mat4x4_mul(Q, M, R);
}
static inline void mat4x4_rotate_Z(mat4x4 Q, mat4x4 M, float angle) {
float s = sinf(angle);
float c = cosf(angle);
- mat4x4 R = {{c, s, 0.f, 0.f},
- {-s, c, 0.f, 0.f},
- {0.f, 0.f, 1.f, 0.f},
- {0.f, 0.f, 0.f, 1.f}};
+ mat4x4 R = {{c, s, 0.f, 0.f}, {-s, c, 0.f, 0.f}, {0.f, 0.f, 1.f, 0.f}, {0.f, 0.f, 0.f, 1.f}};
mat4x4_mul(Q, M, R);
}
static inline void mat4x4_invert(mat4x4 T, mat4x4 M) {
@@ -282,8 +265,7 @@
c[5] = M[2][2] * M[3][3] - M[3][2] * M[2][3];
/* Assumes it is invertible */
- float idet = 1.0f / (s[0] * c[5] - s[1] * c[4] + s[2] * c[3] + s[3] * c[2] -
- s[4] * c[1] + s[5] * c[0]);
+ float idet = 1.0f / (s[0] * c[5] - s[1] * c[4] + s[2] * c[3] + s[3] * c[2] - s[4] * c[1] + s[5] * c[0]);
T[0][0] = (M[1][1] * c[5] - M[1][2] * c[4] + M[1][3] * c[3]) * idet;
T[0][1] = (-M[0][1] * c[5] + M[0][2] * c[4] - M[0][3] * c[3]) * idet;
@@ -328,8 +310,7 @@
vec3_norm(R[0], R[0]);
}
-static inline void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t,
- float n, float f) {
+static inline void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t, float n, float f) {
M[0][0] = 2.f * n / (r - l);
M[0][1] = M[0][2] = M[0][3] = 0.f;
@@ -344,8 +325,7 @@
M[3][2] = -2.f * (f * n) / (f - n);
M[3][0] = M[3][1] = M[3][3] = 0.f;
}
-static inline void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t,
- float n, float f) {
+static inline void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, float n, float f) {
M[0][0] = 2.f / (r - l);
M[0][1] = M[0][2] = M[0][3] = 0.f;
@@ -360,8 +340,7 @@
M[3][2] = -(f + n) / (f - n);
M[3][3] = 1.f;
}
-static inline void mat4x4_perspective(mat4x4 m, float y_fov, float aspect,
- float n, float f) {
+static inline void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float n, float f) {
/* NOTE: Degrees are an unhandy unit to work with.
* linmath.h uses radians for everything! */
float const a = (float)(1.f / tan(y_fov / 2.f));