X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=progs%2Fdemos%2Fspaceball%2Fvmath.inl;fp=progs%2Fdemos%2Fspaceball%2Fvmath.inl;h=5b1871edee4fb8180e9dac7a0f6e9accbbac91e0;hb=c862b512b9ace48acc01d43414b3a8a70f0af006;hp=0284a117db006b2ea9d84a4b45e5ce97ce5e6250;hpb=41f324f096010d965a38290059cfd5c6b43496df;p=freeglut diff --git a/progs/demos/spaceball/vmath.inl b/progs/demos/spaceball/vmath.inl index 0284a11..5b1871e 100644 --- a/progs/demos/spaceball/vmath.inl +++ b/progs/demos/spaceball/vmath.inl @@ -1,5 +1,5 @@ /* vector functions */ -static inline vec3_t v3_cons(float x, float y, float z) +static INLINE vec3_t v3_cons(float x, float y, float z) { vec3_t res; res.x = x; @@ -8,7 +8,7 @@ static inline vec3_t v3_cons(float x, float y, float z) return res; } -static inline vec3_t quat_vec(quat_t q) +static INLINE vec3_t quat_vec(quat_t q) { vec3_t v; v.x = q.x; @@ -17,13 +17,13 @@ static inline vec3_t quat_vec(quat_t q) return v; } -static inline float v3_dot(vec3_t v1, vec3_t v2) +static INLINE float v3_dot(vec3_t v1, vec3_t v2) { return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; } /* quaternion functions */ -static inline quat_t quat_cons(float s, float x, float y, float z) +static INLINE quat_t quat_cons(float s, float x, float y, float z) { quat_t q; q.x = x; @@ -33,7 +33,7 @@ static inline quat_t quat_cons(float s, float x, float y, float z) return q; } -static inline quat_t quat_mul(quat_t q1, quat_t q2) +static INLINE quat_t quat_mul(quat_t q1, quat_t q2) { quat_t res; vec3_t v1 = quat_vec(q1); @@ -46,16 +46,16 @@ static inline quat_t quat_mul(quat_t q1, quat_t q2) return res; } -static inline void quat_to_mat(mat4_t res, quat_t q) +static INLINE void quat_to_mat(mat4_t res, quat_t q) { - m4_cons(res, 1.0 - 2.0 * q.y*q.y - 2.0 * q.z*q.z, 2.0 * q.x * q.y + 2.0 * q.w * q.z, 2.0 * q.z * q.x - 2.0 * q.w * q.y, 0, - 2.0 * q.x * q.y - 2.0 * q.w * q.z, 1.0 - 2.0 * q.x*q.x - 2.0 * q.z*q.z, 2.0 * q.y * q.z + 2.0 * q.w * q.x, 0, - 2.0 * q.z * q.x + 2.0 * q.w * q.y, 2.0 * q.y * q.z - 2.0 * q.w * q.x, 1.0 - 2.0 * q.x*q.x - 2.0 * q.y*q.y, 0, + m4_cons(res, 1.0f - 2.0f * q.y*q.y - 2.0f * q.z*q.z, 2.0f * q.x * q.y + 2.0f * q.w * q.z, 2.0f * q.z * q.x - 2.0f * q.w * q.y, 0, + 2.0f * q.x * q.y - 2.0f * q.w * q.z, 1.0f - 2.0f * q.x*q.x - 2.0f * q.z*q.z, 2.0f * q.y * q.z + 2.0f * q.w * q.x, 0, + 2.0f * q.z * q.x + 2.0f * q.w * q.y, 2.0f * q.y * q.z - 2.0f * q.w * q.x, 1.0f - 2.0f * q.x*q.x - 2.0f * q.y*q.y, 0, 0, 0, 0, 1); } /* matrix functions */ -static inline void m4_cons(mat4_t m, +static INLINE void m4_cons(mat4_t m, float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34,