Updated equal and not equal operators for matrices

This commit is contained in:
Christophe Riccio 2011-01-19 12:05:28 +00:00
parent efce35f901
commit c6e7d14555
9 changed files with 207 additions and 0 deletions

View File

@ -583,5 +583,28 @@ namespace detail
m[1] - T(1));
}
//////////////////////////////////////
// Boolean operators
template <typename T>
inline bool operator==
(
tmat2x2<T> const & m1,
tmat2x2<T> const & m2
)
{
return (m1[0] == m2[0]) && (m1[1] == m2[1]);
}
template <typename T>
inline bool operator!=
(
tmat2x2<T> const & m1,
tmat2x2<T> const & m2
)
{
return (m1[0] != m2[0]) || (m1[1] != m2[1]);
}
} //namespace detail
} //namespace glm

View File

@ -514,5 +514,28 @@ namespace detail
m[1] - typename tmat2x3<T>::value_type(1));
}
//////////////////////////////////////
// Boolean operators
template <typename T>
inline bool operator==
(
tmat2x3<T> const & m1,
tmat2x3<T> const & m2
)
{
return (m1[0] == m2[0]) && (m1[1] == m2[1]);
}
template <typename T>
inline bool operator!=
(
tmat2x3<T> const & m1,
tmat2x3<T> const & m2
)
{
return (m1[0] != m2[0]) || (m1[1] != m2[1]);
}
} //namespace detail
} //namespace glm

View File

@ -542,5 +542,28 @@ namespace detail
m[1] - typename tmat2x4<T>::value_type(1));
}
//////////////////////////////////////
// Boolean operators
template <typename T>
inline bool operator==
(
tmat2x4<T> const & m1,
tmat2x4<T> const & m2
)
{
return (m1[0] == m2[0]) && (m1[1] == m2[1]);
}
template <typename T>
inline bool operator!=
(
tmat2x4<T> const & m1,
tmat2x4<T> const & m2
)
{
return (m1[0] != m2[0]) || (m1[1] != m2[1]);
}
} //namespace detail
} //namespace glm

View File

@ -548,5 +548,28 @@ namespace detail
m[2] - One);
}
//////////////////////////////////////
// Boolean operators
template <typename T>
inline bool operator==
(
tmat3x2<T> const & m1,
tmat3x2<T> const & m2
)
{
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
}
template <typename T>
inline bool operator!=
(
tmat3x2<T> const & m1,
tmat3x2<T> const & m2
)
{
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
}
} //namespace detail
} //namespace glm

View File

@ -677,5 +677,28 @@ namespace detail
m[2] - T(1));
}
//////////////////////////////////////
// Boolean operators
template <typename T>
inline bool operator==
(
tmat3x3<T> const & m1,
tmat3x3<T> const & m2
)
{
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
}
template <typename T>
inline bool operator!=
(
tmat3x3<T> const & m1,
tmat3x3<T> const & m2
)
{
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
}
} //namespace detail
} //namespace glm

View File

@ -582,5 +582,28 @@ namespace detail
m[2] - T(1));
}
//////////////////////////////////////
// Boolean operators
template <typename T>
inline bool operator==
(
tmat3x4<T> const & m1,
tmat3x4<T> const & m2
)
{
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
}
template <typename T>
inline bool operator!=
(
tmat3x4<T> const & m1,
tmat3x4<T> const & m2
)
{
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
}
} //namespace detail
} //namespace glm

View File

@ -591,5 +591,28 @@ namespace detail
m[3] - typename tmat4x2<T>::value_type(1));
}
//////////////////////////////////////
// Boolean operators
template <typename T>
inline bool operator==
(
tmat4x2<T> const & m1,
tmat4x2<T> const & m2
)
{
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
}
template <typename T>
inline bool operator!=
(
tmat4x2<T> const & m1,
tmat4x2<T> const & m2
)
{
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
}
} //namespace detail
} //namespace glm

View File

@ -595,6 +595,29 @@ namespace detail
m[3] - T(1));
}
//////////////////////////////////////
// Boolean operators
template <typename T>
inline bool operator==
(
tmat4x3<T> const & m1,
tmat4x3<T> const & m2
)
{
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
}
template <typename T>
inline bool operator!=
(
tmat4x3<T> const & m1,
tmat4x3<T> const & m2
)
{
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
}
} //namespace detail
} //namespace glm

View File

@ -732,5 +732,28 @@ namespace detail
m[3] - typename tmat4x4<T>::value_type(1));
}
//////////////////////////////////////
// Boolean operators
template <typename T>
inline bool operator==
(
tmat4x4<T> const & m1,
tmat4x4<T> const & m2
)
{
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
}
template <typename T>
inline bool operator!=
(
tmat4x4<T> const & m1,
tmat4x4<T> const & m2
)
{
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
}
} //namespace detail
} //namespace glm