summaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-12-08 21:29:29 +0800
committerchai <chaifix@163.com>2019-12-08 21:29:29 +0800
commit69d8af71d6882e801496fcd7ed971081c0b720d8 (patch)
tree452f7d037cf977e4a934d433bd2f12c03ed1ea10 /src/math
parent31be0df6255ef704bed28d2be56acbe1cea7caad (diff)
*misc
Diffstat (limited to 'src/math')
-rw-r--r--src/math/math.h2
-rw-r--r--src/math/vec4.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/src/math/math.h b/src/math/math.h
index 35219a3..1db7df7 100644
--- a/src/math/math.h
+++ b/src/math/math.h
@@ -182,6 +182,8 @@ void vec4_dividew(Vec4* v, Vec3* out);
void vec4_tostring(Vec4* v, char buf[]);
void vec4_print(Vec4* v);
+void vec4_lerp(Vec4* a, Vec4* b, float t, Vec4* out);
+
/************************************************************************/
/* Matrix */
/************************************************************************/
diff --git a/src/math/vec4.c b/src/math/vec4.c
index ca64820..b79adca 100644
--- a/src/math/vec4.c
+++ b/src/math/vec4.c
@@ -21,4 +21,11 @@ void vec4_tostring(Vec4* v, char buf[]) {
void vec4_print(Vec4* v) {
vec4_tostring(v, printbuffer);
printf("\n%s\n", printbuffer);
+}
+
+void vec4_lerp(Vec4* a, Vec4* b, float t, Vec4* out) {
+ out->x = lerp(a->x, b->x, t);
+ out->y = lerp(a->y, b->y, t);
+ out->z = lerp(a->z, b->z, t);
+ out->w = lerp(a->w, b->w, t);
} \ No newline at end of file