Rename Vector3Scale and QuatCompScale.

They are now VectorCompMult and QuatCompMult.
This commit is contained in:
Bill Currie 2011-12-30 20:04:55 +09:00
parent bcdcd7b36d
commit edb05fdfce
2 changed files with 26 additions and 26 deletions

View file

@ -52,8 +52,8 @@
#endif
extern int nanmask;
extern const vec_t * const vec3_origin;
extern const vec_t * const quat_origin;
extern const vec_t *const vec3_origin;
extern const vec_t *const quat_origin;
#define EQUAL_EPSILON 0.001
#define RINT(x) (floor ((x) + 0.5))
@ -105,7 +105,7 @@ extern const vec_t * const quat_origin;
(c)[1] = (a)[1] * (b); \
(c)[2] = (a)[2] * (b); \
} while (0)
#define Vector3Scale(a,b,c) \
#define VectorCompMult(a,b,c) \
do { \
(c)[0] = (a)[0] * (b)[0]; \
(c)[1] = (a)[1] * (b)[1]; \
@ -152,6 +152,17 @@ extern const vec_t * const quat_origin;
//For printf etc
#define VectorExpand(v) (v)[0], (v)[1], (v)[2]
/*
* VectorDistance, the distance between two points.
* Yes, this is the same as sqrt(VectorSubtract then DotProduct),
* however that way would involve more vars, this is cheaper.
*/
#define VectorDistance_fast(a, b) \
((((a)[0] - (b)[0]) * ((a)[0] - (b)[0])) + \
(((a)[1] - (b)[1]) * ((a)[1] - (b)[1])) + \
(((a)[2] - (b)[2]) * ((a)[2] - (b)[2])))
#define VectorDistance(a, b) sqrt(VectorDistance_fast(a, b))
#define QDotProduct(a,b) ((a)[0] * (b)[0] + (a)[1] * (b)[1] \
+ (a)[2] * (b)[2] + (a)[3] * (b)[3])
#define QuatSubtract(a,b,c) \
@ -213,7 +224,7 @@ extern const vec_t * const quat_origin;
(c)[3] = (a)[3] * (b); \
} while (0)
#define QuatCompScale(a,b,c) \
#define QuatCompMult(a,b,c) \
do { \
(c)[0] = (a)[0] * (b)[0]; \
(c)[1] = (a)[1] * (b)[1]; \
@ -267,17 +278,6 @@ extern const vec_t * const quat_origin;
//For printf etc
#define QuatExpand(q) (q)[0], (q)[1], (q)[2], (q)[3]
/*
* VectorDistance, the distance between two points.
* Yes, this is the same as sqrt(VectorSubtract then DotProduct),
* however that way would involve more vars, this is cheaper.
*/
#define VectorDistance_fast(a, b) \
((((a)[0] - (b)[0]) * ((a)[0] - (b)[0])) + \
(((a)[1] - (b)[1]) * ((a)[1] - (b)[1])) + \
(((a)[2] - (b)[2]) * ((a)[2] - (b)[2])))
#define VectorDistance(a, b) sqrt(VectorDistance_fast(a, b))
#define qfrandom(MAX) ((float) MAX * (rand() * (1.0 / (RAND_MAX + 1.0))))

View file

@ -121,7 +121,7 @@ init_box (const trace_t *trace, clipbox_t *box, const vec3_t vel)
//FIXME rotated box
for (i = 0; i < 3; i++)
u[i] = (vel[i] >= 0 ? 1 : -1);
Vector3Scale (u, trace->extents, p);
VectorCompMult (u, trace->extents, p);
for (i = 0; i < 3; i++) {
box->portals[i].planenum = i;
box->portals[i].next[0] = 0;
@ -154,17 +154,17 @@ init_box (const trace_t *trace, clipbox_t *box, const vec3_t vel)
box->edges[i].points[j][a]
= s[k] * u[i] * box->edges[i].points[j - 1][b];
}
Vector3Scale (box->points[i].points[j - 1], trace->extents,
box->points[i].points[j - 1]);
Vector3Scale (box->edges[i].points[j - 1], trace->extents,
box->edges[i].points[j - 1]);
VectorCompMult (box->points[i].points[j - 1], trace->extents,
box->points[i].points[j - 1]);
VectorCompMult (box->edges[i].points[j - 1], trace->extents,
box->edges[i].points[j - 1]);
VectorScale (box->edges[i].points[j - 1], 2,
box->edges[i].points[j - 1]);
}
Vector3Scale (box->points[i].points[3], trace->extents,
box->points[i].points[3]);
Vector3Scale (box->edges[i].points[3], trace->extents,
box->edges[i].points[3]);
VectorCompMult (box->points[i].points[3], trace->extents,
box->points[i].points[3]);
VectorCompMult (box->edges[i].points[3], trace->extents,
box->edges[i].points[3]);
VectorScale (box->edges[i].points[3], 2,
box->edges[i].points[3]);
}
@ -567,8 +567,8 @@ portal_intersect (trace_t *trace, clipport_t *portal, plane_t *plane,
vec3_t p1, p2, imp, dist;
vec_t t1, t2, frac;
Vector3Scale (trace->extents, verts[i][0], p1);
Vector3Scale (trace->extents, verts[i][1], p2);
VectorCompMult (trace->extents, verts[i][0], p1);
VectorCompMult (trace->extents, verts[i][1], p2);
t1 = PlaneDiff (p1, plane) + o_n;
t2 = PlaneDiff (p2, plane) + o_n;
// if both ends of the box edge are on the same side (or touching) the