diff options
author | chai <chaifix@163.com> | 2020-02-22 18:17:06 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-02-22 18:17:06 +0800 |
commit | 9c89460e136ed6c6c43704d9a3a15105e0f006b0 (patch) | |
tree | cd56f1dfc10650cfbfe7007ee3432ee32227edc3 /src/math/vec4.c | |
parent | d49f3d3f73709a9a7c0bce53aa13ed28a2bd27cb (diff) |
*wog
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); } |