summaryrefslogtreecommitdiff
path: root/src/code/sys_matrix.c
diff options
context:
space:
mode:
authorkrimtonz <33664508+krimtonz@users.noreply.github.com>2020-04-27 23:14:27 -0500
committerGitHub <noreply@github.com>2020-04-28 00:14:27 -0400
commit58e38276c655acc60c00022a339aa3dc355219f8 (patch)
treec01d42a4e8571faf129d83a729232e78952cd6ed /src/code/sys_matrix.c
parentd58983494c33d02838dc0aa6647dbe1c9fc5274b (diff)
rename Matrix_TranslateThenRotateZYX to Matrix_RotateRPYf (#96)
* rename Matrix_TranslateThenRotateZYX to Matrix_RotateRPYf * rename Matrix_RotateRPYf to Matrix_JointPosition * rename Matrix_RotateZYX to Matrix_RotateRPY
Diffstat (limited to 'src/code/sys_matrix.c')
-rw-r--r--src/code/sys_matrix.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c
index 814b8fa2c..62e5b7487 100644
--- a/src/code/sys_matrix.c
+++ b/src/code/sys_matrix.c
@@ -301,7 +301,7 @@ void Matrix_RotateZ(f32 z, u8 mode) {
* by `x` degrees. (roll-pitch-yaw)
* Original Name: Matrix_RotateXYZ, changed to reflect rotation order.
*/
-void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode) {
+void Matrix_RotateRPY(s16 x, s16 y, s16 z, u8 mode) {
MtxF* cmf = sCurrentMatrix;
f32 temp1;
f32 temp2;
@@ -387,10 +387,9 @@ void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode) {
}
/*
- * Translates the top of the matrix stack by `translation` units,
- * then rotates that matrix by `rotation` in Z-Y-X order (roll-pitch-yaw)
+ * Roll-pitch-yaw rotation and position
*/
-void Matrix_TranslateThenRotateZYX(Vec3f* translation, Vec3s* rotation) {
+void Matrix_JointPosition(Vec3f* position, Vec3s* rotation) {
MtxF* cmf = sCurrentMatrix;
f32 sin;
f32 cos;
@@ -402,25 +401,25 @@ void Matrix_TranslateThenRotateZYX(Vec3f* translation, Vec3s* rotation) {
temp1 = cmf->xx;
temp2 = cmf->yx;
- cmf->wx += temp1 * translation->x + temp2 * translation->y + cmf->zx * translation->z;
+ cmf->wx += temp1 * position->x + temp2 * position->y + cmf->zx * position->z;
cmf->xx = temp1 * cos + temp2 * sin;
cmf->yx = temp2 * cos - temp1 * sin;
temp1 = cmf->xy;
temp2 = cmf->yy;
- cmf->wy += temp1 * translation->x + temp2 * translation->y + cmf->zy * translation->z;
+ cmf->wy += temp1 * position->x + temp2 * position->y + cmf->zy * position->z;
cmf->xy = temp1 * cos + temp2 * sin;
cmf->yy = temp2 * cos - temp1 * sin;
temp1 = cmf->xz;
temp2 = cmf->yz;
- cmf->wz += temp1 * translation->x + temp2 * translation->y + cmf->zz * translation->z;
+ cmf->wz += temp1 * position->x + temp2 * position->y + cmf->zz * position->z;
cmf->xz = temp1 * cos + temp2 * sin;
cmf->yz = temp2 * cos - temp1 * sin;
temp1 = cmf->xw;
temp2 = cmf->yw;
- cmf->ww += temp1 * translation->x + temp2 * translation->y + cmf->zw * translation->z;
+ cmf->ww += temp1 * position->x + temp2 * position->y + cmf->zw * position->z;
cmf->xw = temp1 * cos + temp2 * sin;
cmf->yw = temp2 * cos - temp1 * sin;