mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-23 10:50:58 +00:00
[math] Split out Quat/Vector compare implementations
This renames existing VectorCompCompare (and quaternion equivalent) to VectorCompCompareAll and makes VectorCompCompare produce a vector of results with optional negation (converting 0,1 to 0,-1 for compatibility with simd semantics).
This commit is contained in:
parent
97034d9dde
commit
9aa8f18d73
4 changed files with 21 additions and 8 deletions
|
@ -115,10 +115,17 @@ extern const vec_t *const quat_origin;
|
|||
(c)[2] = (a)[2] / (b)[2]; \
|
||||
(c)[3] = (a)[3] / (b)[3]; \
|
||||
} while (0)
|
||||
#define QuatCompCompare(x, op, y) \
|
||||
#define QuatCompCompare(m, a, op, b, c) \
|
||||
do { \
|
||||
(c)[0] = m((a)[0] op (b)[0]); \
|
||||
(c)[1] = m((a)[1] op (b)[1]); \
|
||||
(c)[2] = m((a)[2] op (b)[2]); \
|
||||
(c)[3] = m((a)[3] op (b)[3]); \
|
||||
} while (0)
|
||||
#define QuatCompCompareAll(x, op, y) \
|
||||
(((x)[0] op (y)[0]) && ((x)[1] op (y)[1]) \
|
||||
&& ((x)[2] op (y)[2]) && ((x)[3] op (y)[3]))
|
||||
#define QuatCompare(x, y) QuatCompCompare (x, ==, y)
|
||||
#define QuatCompare(x, y) QuatCompCompareAll (x, ==, y)
|
||||
#define QuatCompMin(a, b, c) \
|
||||
do { \
|
||||
(c)[0] = min ((a)[0], (b)[0]); \
|
||||
|
|
|
@ -131,9 +131,15 @@ extern const vec_t *const vec3_origin;
|
|||
(c)[1] = (a)[1] / (b)[1]; \
|
||||
(c)[2] = (a)[2] / (b)[2]; \
|
||||
} while (0)
|
||||
#define VectorCompCompare(x, op, y) \
|
||||
#define VectorCompCompare(c, m, a, op, b) \
|
||||
do { \
|
||||
(c)[0] = m((a)[0] op (b)[0]); \
|
||||
(c)[1] = m((a)[1] op (b)[1]); \
|
||||
(c)[2] = m((a)[2] op (b)[2]); \
|
||||
} while (0)
|
||||
#define VectorCompCompareAll(x, op, y) \
|
||||
(((x)[0] op (y)[0]) && ((x)[1] op (y)[1]) && ((x)[2] op (y)[2]))
|
||||
#define VectorCompare(x, y) VectorCompCompare (x, ==, y)
|
||||
#define VectorCompare(x, y) VectorCompCompareAll (x, ==, y)
|
||||
#define VectorCompMin(a, b, c) \
|
||||
do { \
|
||||
(c)[0] = min ((a)[0], (b)[0]); \
|
||||
|
|
|
@ -484,8 +484,8 @@ SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove)
|
|||
// entity?
|
||||
c_absmin = SVvector (check, absmin);
|
||||
c_absmax = SVvector (check, absmax);
|
||||
if (VectorCompCompare (c_absmin, >=, maxs)
|
||||
|| VectorCompCompare (c_absmax, <=, mins))
|
||||
if (VectorCompCompareAll (c_absmin, >=, maxs)
|
||||
|| VectorCompCompareAll (c_absmax, <=, mins))
|
||||
continue;
|
||||
|
||||
if (!SV_TestEntityPosition (check))
|
||||
|
|
|
@ -487,8 +487,8 @@ SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove)
|
|||
// entity?
|
||||
c_absmin = SVvector (check, absmin);
|
||||
c_absmax = SVvector (check, absmax);
|
||||
if (VectorCompCompare (c_absmin, >=, maxs)
|
||||
|| VectorCompCompare (c_absmax, <=, mins))
|
||||
if (VectorCompCompareAll (c_absmin, >=, maxs)
|
||||
|| VectorCompCompareAll (c_absmax, <=, mins))
|
||||
continue;
|
||||
|
||||
if (!SV_TestEntityPosition (check))
|
||||
|
|
Loading…
Reference in a new issue