Fixed division operator

This commit is contained in:
Christophe Riccio 2010-10-04 13:01:05 +01:00
parent d280567f61
commit 54ac116806
5 changed files with 38 additions and 16 deletions

View File

@ -11,48 +11,78 @@ int main()
glm::mat2x3 m(1.0f); glm::mat2x3 m(1.0f);
glm::vec2 u(1.0f); glm::vec2 u(1.0f);
glm::vec3 v(1.0f); glm::vec3 v(1.0f);
float x = 1.0f;
glm::vec3 a = m * u; glm::vec3 a = m * u;
glm::vec2 b = v * m; glm::vec2 b = v * m;
glm::mat2x3 n = x / m;
glm::mat2x3 o = m / x;
glm::mat2x3 p = x * m;
glm::mat2x3 q = m * x;
} }
{ {
glm::mat2x4 m(1.0f); glm::mat2x4 m(1.0f);
glm::vec2 u(1.0f); glm::vec2 u(1.0f);
glm::vec4 v(1.0f); glm::vec4 v(1.0f);
float x = 1.0f;
glm::vec4 a = m * u; glm::vec4 a = m * u;
glm::vec2 b = v * m; glm::vec2 b = v * m;
glm::mat2x4 n = x / m;
glm::mat2x4 o = m / x;
glm::mat2x4 p = x * m;
glm::mat2x4 q = m * x;
} }
{ {
glm::mat3x2 m(1.0f); glm::mat3x2 m(1.0f);
glm::vec3 u(1.0f); glm::vec3 u(1.0f);
glm::vec2 v(1.0f); glm::vec2 v(1.0f);
float x = 1.0f;
glm::vec2 a = m * u; glm::vec2 a = m * u;
glm::vec3 b = v * m; glm::vec3 b = v * m;
glm::mat3x2 n = x / m;
glm::mat3x2 o = m / x;
glm::mat3x2 p = x * m;
glm::mat3x2 q = m * x;
} }
{ {
glm::mat3x4 m(1.0f); glm::mat3x4 m(1.0f);
glm::vec3 u(1.0f); glm::vec3 u(1.0f);
glm::vec4 v(1.0f); glm::vec4 v(1.0f);
float x = 1.0f;
glm::vec4 a = m * u; glm::vec4 a = m * u;
glm::vec3 b = v * m; glm::vec3 b = v * m;
glm::mat3x4 n = x / m;
glm::mat3x4 o = m / x;
glm::mat3x4 p = x * m;
glm::mat3x4 q = m * x;
} }
{ {
glm::mat4x2 m(1.0f); glm::mat4x2 m(1.0f);
glm::vec4 u(1.0f); glm::vec4 u(1.0f);
glm::vec2 v(1.0f); glm::vec2 v(1.0f);
float x = 1.0f;
glm::vec2 a = m * u; glm::vec2 a = m * u;
glm::vec4 b = v * m; glm::vec4 b = v * m;
glm::mat4x2 n = x / m;
glm::mat4x2 o = m / x;
glm::mat4x2 p = x * m;
glm::mat4x2 q = m * x;
} }
{ {
glm::mat4x3 m(1.0f); glm::mat4x3 m(1.0f);
glm::vec4 u(1.0f); glm::vec4 u(1.0f);
glm::vec3 v(1.0f); glm::vec3 v(1.0f);
float x = 1.0f;
glm::vec3 a = m * u; glm::vec3 a = m * u;
glm::vec4 b = v * m; glm::vec4 b = v * m;
glm::mat4x3 n = x / m;
glm::mat4x3 o = m / x;
glm::mat4x3 p = x * m;
glm::mat4x3 q = m * x;
} }
//{ //{

View File

@ -157,12 +157,12 @@ namespace glm
tmat3x2<T> const & m2); tmat3x2<T> const & m2);
template <typename T> template <typename T>
tmat3x2<T> operator/ ( tmat2x3<T> operator/ (
tmat2x3<T> const & m, tmat2x3<T> const & m,
typename tmat2x3<T>::value_type const & s); typename tmat2x3<T>::value_type const & s);
template <typename T> template <typename T>
tmat3x2<T> operator/ ( tmat2x3<T> operator/ (
typename tmat2x3<T>::value_type const & s, typename tmat2x3<T>::value_type const & s,
tmat2x3<T> const & m); tmat2x3<T> const & m);

View File

@ -463,8 +463,7 @@ namespace detail
{ {
return tmat2x3<T>( return tmat2x3<T>(
m[0] / s, m[0] / s,
m[1] / s, m[1] / s);
m[2] / s);
} }
template <typename T> template <typename T>
@ -476,8 +475,7 @@ namespace detail
{ {
return tmat2x3<T>( return tmat2x3<T>(
s / m[0], s / m[0],
s / m[1], s / m[1]);
s / m[2]);
} }
// Unary constant operators // Unary constant operators

View File

@ -480,9 +480,7 @@ namespace detail
{ {
return tmat2x4<T>( return tmat2x4<T>(
m[0] / s, m[0] / s,
m[1] / s, m[1] / s);
m[2] / s,
m[3] / s);
} }
template <typename T> template <typename T>
@ -494,9 +492,7 @@ namespace detail
{ {
return tmat2x4<T>( return tmat2x4<T>(
s / m[0], s / m[0],
s / m[1], s / m[1]);
s / m[2],
s / m[3]);
} }
// Unary constant operators // Unary constant operators

View File

@ -491,8 +491,7 @@ namespace detail
return tmat3x2<T>( return tmat3x2<T>(
m[0] / s, m[0] / s,
m[1] / s, m[1] / s,
m[2] / s, m[2] / s);
m[3] / s);
} }
template <typename T> template <typename T>
@ -505,8 +504,7 @@ namespace detail
return tmat3x2<T>( return tmat3x2<T>(
s / m[0], s / m[0],
s / m[1], s / m[1],
s / m[2], s / m[2]);
s / m[3]);
} }
// Unary constant operators // Unary constant operators