goat3d
diff libs/vmath/matrix.inl @ 28:9ba3e2fb8a33
modified vmath to work with vs2012, still memory corruptions in 3dsmax...
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 29 Sep 2013 08:46:19 +0300 |
parents | 4deb0b12fe14 |
children |
line diff
1.1 --- a/libs/vmath/matrix.inl Sun Sep 29 08:20:19 2013 +0300 1.2 +++ b/libs/vmath/matrix.inl Sun Sep 29 08:46:19 2013 +0300 1.3 @@ -23,13 +23,13 @@ 1.4 #endif /* __cplusplus */ 1.5 1.6 /* C matrix 3x3 functions */ 1.7 -static inline void m3_identity(mat3_t m) 1.8 +static VMATH_INLINE void m3_identity(mat3_t m) 1.9 { 1.10 static const mat3_t id = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}; 1.11 memcpy(m, id, sizeof id); 1.12 } 1.13 1.14 -static inline void m3_cons(mat3_t m, 1.15 +static VMATH_INLINE void m3_cons(mat3_t m, 1.16 scalar_t m11, scalar_t m12, scalar_t m13, 1.17 scalar_t m21, scalar_t m22, scalar_t m23, 1.18 scalar_t m31, scalar_t m32, scalar_t m33) 1.19 @@ -39,20 +39,20 @@ 1.20 m[2][0] = m31; m[2][1] = m32; m[2][2] = m33; 1.21 } 1.22 1.23 -static inline void m3_copy(mat3_t dest, mat3_t src) 1.24 +static VMATH_INLINE void m3_copy(mat3_t dest, mat3_t src) 1.25 { 1.26 memcpy(dest, src, sizeof(mat3_t)); 1.27 } 1.28 1.29 1.30 /* C matrix 4x4 functions */ 1.31 -static inline void m4_identity(mat4_t m) 1.32 +static VMATH_INLINE void m4_identity(mat4_t m) 1.33 { 1.34 static const mat4_t id = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}; 1.35 memcpy(m, id, sizeof id); 1.36 } 1.37 1.38 -static inline void m4_cons(mat4_t m, 1.39 +static VMATH_INLINE void m4_cons(mat4_t m, 1.40 scalar_t m11, scalar_t m12, scalar_t m13, scalar_t m14, 1.41 scalar_t m21, scalar_t m22, scalar_t m23, scalar_t m24, 1.42 scalar_t m31, scalar_t m32, scalar_t m33, scalar_t m34, 1.43 @@ -64,12 +64,12 @@ 1.44 m[3][0] = m41; m[3][1] = m42; m[3][2] = m43; m[3][3] = m44; 1.45 } 1.46 1.47 -static inline void m4_copy(mat4_t dest, mat4_t src) 1.48 +static VMATH_INLINE void m4_copy(mat4_t dest, mat4_t src) 1.49 { 1.50 memcpy(dest, src, sizeof(mat4_t)); 1.51 } 1.52 1.53 -static inline void m4_mult(mat4_t res, mat4_t m1, mat4_t m2) 1.54 +static VMATH_INLINE void m4_mult(mat4_t res, mat4_t m1, mat4_t m2) 1.55 { 1.56 mat4_t tmp; 1.57 1.58 @@ -105,7 +105,7 @@ 1.59 m4_copy(res, tmp); 1.60 } 1.61 1.62 -static inline void m4_set_column(mat4_t m, vec4_t v, int idx) 1.63 +static VMATH_INLINE void m4_set_column(mat4_t m, vec4_t v, int idx) 1.64 { 1.65 m[0][idx] = v.x; 1.66 m[1][idx] = v.y; 1.67 @@ -113,7 +113,7 @@ 1.68 m[3][idx] = v.w; 1.69 } 1.70 1.71 -static inline void m4_set_row(mat4_t m, vec4_t v, int idx) 1.72 +static VMATH_INLINE void m4_set_row(mat4_t m, vec4_t v, int idx) 1.73 { 1.74 m[idx][0] = v.x; 1.75 m[idx][1] = v.y; 1.76 @@ -125,8 +125,8 @@ 1.77 } /* extern "C" */ 1.78 1.79 1.80 -/* unrolled to hell and inline */ 1.81 -inline Matrix4x4 operator *(const Matrix4x4 &m1, const Matrix4x4 &m2) 1.82 +/* unrolled to hell and VMATH_INLINE */ 1.83 +VMATH_INLINE Matrix4x4 operator *(const Matrix4x4 &m1, const Matrix4x4 &m2) 1.84 { 1.85 Matrix4x4 res; 1.86 1.87 @@ -161,39 +161,39 @@ 1.88 return res; 1.89 } 1.90 1.91 -inline void operator *=(Matrix4x4 &m1, const Matrix4x4 &m2) 1.92 +VMATH_INLINE void operator *=(Matrix4x4 &m1, const Matrix4x4 &m2) 1.93 { 1.94 Matrix4x4 res = m1 * m2; 1.95 m1 = res; 1.96 } 1.97 1.98 1.99 -inline scalar_t *Matrix3x3::operator [](int index) 1.100 +VMATH_INLINE scalar_t *Matrix3x3::operator [](int index) 1.101 { 1.102 return m[index]; 1.103 } 1.104 1.105 -inline const scalar_t *Matrix3x3::operator [](int index) const 1.106 +VMATH_INLINE const scalar_t *Matrix3x3::operator [](int index) const 1.107 { 1.108 return m[index]; 1.109 } 1.110 1.111 -inline void Matrix3x3::reset_identity() 1.112 +VMATH_INLINE void Matrix3x3::reset_identity() 1.113 { 1.114 *this = identity; 1.115 } 1.116 1.117 -inline scalar_t *Matrix4x4::operator [](int index) 1.118 +VMATH_INLINE scalar_t *Matrix4x4::operator [](int index) 1.119 { 1.120 return m[index]; 1.121 } 1.122 1.123 -inline const scalar_t *Matrix4x4::operator [](int index) const 1.124 +VMATH_INLINE const scalar_t *Matrix4x4::operator [](int index) const 1.125 { 1.126 return m[index]; 1.127 } 1.128 1.129 -inline void Matrix4x4::reset_identity() 1.130 +VMATH_INLINE void Matrix4x4::reset_identity() 1.131 { 1.132 *this = identity; 1.133 }