From b849a79c3f888708378bcc4ecec99640da971bd2 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 11 Aug 2016 14:16:23 -0600 Subject: [PATCH] light: move GetDir to mathlib --- include/common/mathlib.h | 9 +++++++++ light/ltface.cc | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/common/mathlib.h b/include/common/mathlib.h index d3fb87f9..dae8f786 100644 --- a/include/common/mathlib.h +++ b/include/common/mathlib.h @@ -172,6 +172,15 @@ VectorNormalize(vec3_t v) return (vec_t)length; } +// returns the normalized direction from `start` to `stop` in the `dir` param +// returns the distance from `start` to `stop` +static inline vec_t +GetDir(const vec3_t start, const vec3_t stop, vec3_t dir) +{ + VectorSubtract(stop, start, dir); + return VectorNormalize(dir); +} + /* Shortcut for output of warnings/errors */ const char *VecStr(const vec3_t vec); const char *VecStrf(const vec3_t vec); diff --git a/light/ltface.cc b/light/ltface.cc index ba9b8645..e79bbab6 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -1459,12 +1459,6 @@ LightFace_Sky(const sun_t *sun, const lightsurf_t *lightsurf, lightmap_t *lightm Lightmap_Save(lightmaps, lightsurf, lightmap, 0); } -static vec_t GetDir(const vec3_t start, const vec3_t stop, vec3_t dir) -{ - VectorSubtract(stop, start, dir); - return VectorNormalize(dir); -} - /* * ============ * LightFace_Min