From 69d8af71d6882e801496fcd7ed971081c0b720d8 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 8 Dec 2019 21:29:29 +0800 Subject: *misc --- src/math/math.h | 2 ++ src/math/vec4.c | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'src/math') 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 -- cgit v1.1-26-g67d0