Add missing functions

This commit is contained in:
jaburns 2020-10-18 16:56:35 -06:00
parent d6869af30e
commit f889fa0522
3 changed files with 42 additions and 0 deletions

View file

@ -2313,3 +2313,37 @@ s32 anim_spline_poll(Vec3f result) {
return hasEnded;
}
// From object_helpers.c
/**
* Multiply a vector by a matrix of the form
* | ? ? ? 0 |
* | ? ? ? 0 |
* | ? ? ? 0 |
* | 0 0 0 1 |
* i.e. a matrix representing a linear transformation over 3 space.
*/
void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
s32 i;
for (i = 0; i < 3; i++) {
dst[i] = m[0][i] * v[0] + m[1][i] * v[1] + m[2][i] * v[2];
}
}
/**
* Multiply a vector by the transpose of a matrix of the form
* | ? ? ? 0 |
* | ? ? ? 0 |
* | ? ? ? 0 |
* | 0 0 0 1 |
* i.e. a matrix representing a linear transformation over 3 space.
*/
void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
s32 i;
for (i = 0; i < 3; i++) {
dst[i] = m[i][0] * v[0] + m[i][1] * v[1] + m[i][2] * v[2];
}
}

View file

@ -73,4 +73,10 @@ void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c);
void anim_spline_init(Vec4s *keyFrames);
s32 anim_spline_poll(Vec3f result);
// From object_helpers.c
void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v);
void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v);
#endif // MATH_UTIL_H

View file

@ -1,3 +1,5 @@
#include <math.h>
#include "../engine/math_util.h"
#include "../engine/surface_collision.h"
#include "level_update.h"