mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Code cleanups.
This commit is contained in:
parent
3ad79cc970
commit
7ea1051b9a
2 changed files with 15 additions and 18 deletions
|
@ -36,8 +36,8 @@
|
|||
# define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
|
||||
#endif
|
||||
|
||||
extern vec3_t vec3_origin;
|
||||
extern int nanmask;
|
||||
extern vec3_t vec3_origin;
|
||||
|
||||
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
|
||||
|
||||
|
|
|
@ -100,7 +100,8 @@ PerpendicularVector (vec3_t dst, const vec3_t src)
|
|||
# pragma optimize( "", off )
|
||||
#endif
|
||||
|
||||
void VectorVectors(const vec3_t forward, vec3_t right, vec3_t up)
|
||||
void
|
||||
VectorVectors(const vec3_t forward, vec3_t right, vec3_t up)
|
||||
{
|
||||
float d;
|
||||
|
||||
|
@ -411,33 +412,29 @@ vec_t
|
|||
_Length (vec3_t v)
|
||||
{
|
||||
float length;
|
||||
int i;
|
||||
|
||||
length = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
length += v[i] * v[i];
|
||||
length = sqrt (length); // FIXME
|
||||
|
||||
length = sqrt (DotProduct (v, v));
|
||||
return length;
|
||||
}
|
||||
|
||||
float
|
||||
VectorNormalize (vec3_t v)
|
||||
{
|
||||
float length, ilength;
|
||||
float length;
|
||||
|
||||
length = v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
|
||||
length = sqrt (length); // FIXME
|
||||
length = DotProduct (v, v);
|
||||
if (length)
|
||||
{
|
||||
float ilength;
|
||||
|
||||
if (length) {
|
||||
ilength = 1 / length;
|
||||
length = sqrt (length);
|
||||
ilength = 1.0 / length;
|
||||
v[0] *= ilength;
|
||||
v[1] *= ilength;
|
||||
v[2] *= ilength;
|
||||
}
|
||||
|
||||
return length;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue