diff options
Diffstat (limited to 'src/math/vec4.c')
-rw-r--r-- | src/math/vec4.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/math/vec4.c b/src/math/vec4.c index 71ec6b6..3d6df46 100644 --- a/src/math/vec4.c +++ b/src/math/vec4.c @@ -16,6 +16,15 @@ void vec4_dividew(Vec4* v, Vec3* out) { out->z = v->z * w; } +void vec4_dividewnoz(Vec4* v, Vec4* out) { + ssr_assert(out && v); + float w = 1.f / v->w; + out->x = v->x * w; + out->y = v->y * w; + out->z = v->z; + out->w = v->w; +} + void vec4_tostring(Vec4* v, char buf[]) { sprintf(buf, "%8.3f %8.3f %8.3f %8.3f", v->x, v->y, v->z, v->w); } |