summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2022-07-29 12:01:26 +0200
committerRay <[email protected]>2022-07-29 12:01:26 +0200
commite4229e1be7e4bf0aec253301745d71330653214b (patch)
tree4ef8618cbfe07cf0dbf7d4924e627f59f109df89 /src
parentbb6b43b7cbe29dca7f21a78e6944455c6171ead8 (diff)
parent52345fd883cb2fc7bed84d6a8dcc4e9e6dc9eb78 (diff)
downloadraylib-e4229e1be7e4bf0aec253301745d71330653214b.tar.gz
raylib-e4229e1be7e4bf0aec253301745d71330653214b.zip
Merge branch 'master' of https://github.com/raysan5/raylib
Diffstat (limited to 'src')
-rw-r--r--src/raymath.h49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/raymath.h b/src/raymath.h
index 479ece8a..e0fd8d9c 100644
--- a/src/raymath.h
+++ b/src/raymath.h
@@ -1326,8 +1326,8 @@ RMAPI Matrix MatrixRotateX(float angle)
float sinres = sinf(angle);
result.m5 = cosres;
- result.m6 = -sinres;
- result.m9 = sinres;
+ result.m6 = sinres;
+ result.m9 = -sinres;
result.m10 = cosres;
return result;
@@ -1346,8 +1346,8 @@ RMAPI Matrix MatrixRotateY(float angle)
float sinres = sinf(angle);
result.m0 = cosres;
- result.m2 = sinres;
- result.m8 = -sinres;
+ result.m2 = -sinres;
+ result.m8 = sinres;
result.m10 = cosres;
return result;
@@ -1366,13 +1366,14 @@ RMAPI Matrix MatrixRotateZ(float angle)
float sinres = sinf(angle);
result.m0 = cosres;
- result.m1 = -sinres;
- result.m4 = sinres;
+ result.m1 = sinres;
+ result.m4 = -sinres;
result.m5 = cosres;
return result;
}
+
// Get xyz-rotation matrix
// NOTE: Angle must be provided in radians
RMAPI Matrix MatrixRotateXYZ(Vector3 angle)
@@ -1390,15 +1391,15 @@ RMAPI Matrix MatrixRotateXYZ(Vector3 angle)
float sinx = sinf(-angle.x);
result.m0 = cosz*cosy;
- result.m4 = (cosz*siny*sinx) - (sinz*cosx);
- result.m8 = (cosz*siny*cosx) + (sinz*sinx);
+ result.m1 = (cosz*siny*sinx) - (sinz*cosx);
+ result.m2 = (cosz*siny*cosx) + (sinz*sinx);
- result.m1 = sinz*cosy;
+ result.m4 = sinz*cosy;
result.m5 = (sinz*siny*sinx) + (cosz*cosx);
- result.m9 = (sinz*siny*cosx) - (cosz*sinx);
+ result.m6 = (sinz*siny*cosx) - (cosz*sinx);
- result.m2 = -siny;
- result.m6 = cosy*sinx;
+ result.m8 = -siny;
+ result.m9 = cosy*sinx;
result.m10= cosy*cosx;
return result;
@@ -1418,23 +1419,23 @@ RMAPI Matrix MatrixRotateZYX(Vector3 angle)
float sx = sinf(angle.x);
result.m0 = cz*cy;
- result.m1 = cz*sy*sx - cx*sz;
- result.m2 = sz*sx + cz*cx*sy;
- result.m3 = 0;
+ result.m4 = cz*sy*sx - cx*sz;
+ result.m8 = sz*sx + cz*cx*sy;
+ result.m12 = 0;
- result.m4 = cy*sz;
+ result.m1 = cy*sz;
result.m5 = cz*cx + sz*sy*sx;
- result.m6 = cx*sz*sy - cz*sx;
- result.m7 = 0;
+ result.m9 = cx*sz*sy - cz*sx;
+ result.m13 = 0;
- result.m8 = -sy;
- result.m9 = cy*sx;
+ result.m2 = -sy;
+ result.m6 = cy*sx;
result.m10 = cy*cx;
- result.m11 = 0;
-
- result.m12 = 0;
- result.m13 = 0;
result.m14 = 0;
+
+ result.m3 = 0;
+ result.m7 = 0;
+ result.m11 = 0;
result.m15 = 1;
return result;