Converted VectorNormalize to float

This commit is contained in:
Aaron Dean 2023-09-07 13:13:47 -04:00
parent 884100cc13
commit 9320c9c453
2 changed files with 23 additions and 1 deletions

View file

@ -117,6 +117,27 @@ skipwhite:
return buffer;
}
// Action Add
float VectorNormalize (vec3_t v)
{
float length, ilength;
length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
if (length)
{
length = sqrtf(length); // FIXME
ilength = 1/length;
v[0] *= ilength;
v[1] *= ilength;
v[2] *= ilength;
}
return length;
}
// Action Add end
/*
============================================================================

View file

@ -220,7 +220,8 @@ size_t Q_strlcat(char* dst, const char* src, size_t siz);
//======================================================================
//void AddPointToBounds (const vec3_t v, vec3_t mins, vec3_t maxs);
vec3_t VectorNormalize (vec3_t v); // returns vector length
float VectorNormalize (vec3_t v); // returns vector length
vec3_t VectorNormalize2 (const vec3_t v, vec3_t out);
int Q_log2 (int val);