mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +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 int nanmask;
|
||||
extern vec3_t vec3_origin;
|
||||
|
||||
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
|
||||
|
||||
|
@ -84,7 +84,7 @@ void _VectorCopy (vec3_t in, vec3_t out);
|
|||
int _VectorCompare (vec3_t v1, vec3_t v2);
|
||||
//vec_t Length (vec3_t v);
|
||||
void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross);
|
||||
float VectorNormalize (vec3_t v); // returns vector length
|
||||
float VectorNormalize (vec3_t v); // returns vector length
|
||||
void VectorInverse (vec3_t v);
|
||||
void _VectorScale (vec3_t in, vec_t scale, vec3_t out);
|
||||
int Q_log2(int val);
|
||||
|
|
|
@ -71,7 +71,7 @@ ProjectPointOnPlane (vec3_t dst, const vec3_t p, const vec3_t normal)
|
|||
dst[2] = p[2] - d * n[2];
|
||||
}
|
||||
|
||||
// assumes "src" is normalized
|
||||
// assumes "src" is normalized
|
||||
void
|
||||
PerpendicularVector (vec3_t dst, const vec3_t src)
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
@ -112,7 +113,7 @@ void VectorVectors(const vec3_t forward, vec3_t right, vec3_t up)
|
|||
right[0] -= d * forward[0];
|
||||
right[1] -= d * forward[1];
|
||||
right[2] -= d * forward[2];
|
||||
VectorNormalize(right);
|
||||
VectorNormalize (right);
|
||||
CrossProduct(right, forward, up);
|
||||
}
|
||||
|
||||
|
@ -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