mirror of
https://github.com/g-truc/glm.git
synced 2025-04-05 05:25:02 +00:00
Reuse operators to implement other operators for glm::mat
This commit is contained in:
parent
de92b8fe96
commit
b845c29ef1
27 changed files with 826 additions and 2481 deletions
54
glm/detail/mat2xR_common_operators.hpp
Normal file
54
glm/detail/mat2xR_common_operators.hpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
#pragma once
|
||||
#include "qualifier.hpp"
|
||||
#include "mat_common_operators.hpp"
|
||||
namespace glm {
|
||||
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R,T,Q> operator-(mat<2,R,T,Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R,T,Q>& operator++(mat<2,R,T,Q>& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R,T,Q>& operator--(mat<2,R,T,Q>& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<2,R,T,Q> const& m1, mat<2,R,T,Q> const& m2);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R,T,Q> operator+(mat<2,R,T,Q> const& m1, mat<2,R,T,Q> const& m2);
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R,T,Q>& operator+=(mat<2,R,T,Q>& m1, mat<2,R,U,Q> const& m2);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R,T,Q> operator-(mat<2,R,T,Q> const& m1, mat<2,R,T,Q> const& m2);
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R,T,Q>& operator-=(mat<2,R,T,Q>& m1, mat<2,R,U,Q> const& m2);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R, T, Q> operator+(mat<2,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R, T, Q> operator+(T scalar,mat<2,R, T, Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R, T, Q> operator-(mat<2,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R, T, Q> operator-(T scalar,mat<2,R, T, Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R, T, Q> operator*(mat<2,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R, T, Q> operator*(T scalar,mat<2,R, T, Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R, T, Q> operator/(mat<2,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2,R, T, Q> operator/(T scalar,mat<2,R, T, Q> const& m);
|
||||
|
||||
}
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "mat2xR_common_operators.inl"
|
||||
#endif
|
||||
|
112
glm/detail/mat2xR_common_operators.inl
Normal file
112
glm/detail/mat2xR_common_operators.inl
Normal file
|
@ -0,0 +1,112 @@
|
|||
|
||||
namespace glm {
|
||||
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q> operator-(mat<2,R,T,Q> const& m) {
|
||||
return mat<2,R,T,Q>(-m[0],-m[1]);
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q>& operator++(mat<2,R,T,Q>& m) {
|
||||
++m[0];
|
||||
++m[1];
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q>& operator--(mat<2,R,T,Q>& m) {
|
||||
--m[0];
|
||||
--m[1];
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<2,R,T,Q> const& m1, mat<2,R,T,Q> const& m2) {
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]);
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q> operator+(mat<2,R,T,Q> const& m1, mat<2,R,T,Q> const& m2) {
|
||||
return mat<2,R,T,Q>(m1[0] + m2[0],m1[1] + m2[1]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q>& operator+=(mat<2,R,T,Q>& m1, mat<2,R,U,Q> const& m2) {
|
||||
m1[0] += m2[0];
|
||||
m1[1] += m2[1];
|
||||
return m1;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q> operator-(mat<2,R,T,Q> const& m1, mat<2,R,T,Q> const& m2) {
|
||||
return mat<2,R,T,Q>(m1[0] - m2[0],m1[1] - m2[1]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q>& operator-=(mat<2,R,T,Q>& m1, mat<2,R,U,Q> const& m2) {
|
||||
m1[0] -= m2[0];
|
||||
m1[1] -= m2[1];
|
||||
return m1;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R, T, Q> operator+(mat<2,R, T, Q> const& m, T scalar) {
|
||||
return mat<2,R,T,Q>(m[0] + scalar,m[1] + scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R, T, Q> operator+(T scalar,mat<2,R, T, Q> const& m) {
|
||||
return mat<2,R,T,Q>(scalar + m[0],scalar + m[1]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q>& operator+=(mat<2,R,T,Q>& m, U scalar) {
|
||||
m[0] += scalar;
|
||||
m[1] += scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R, T, Q> operator-(mat<2,R, T, Q> const& m, T scalar) {
|
||||
return mat<2,R,T,Q>(m[0] - scalar,m[1] - scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R, T, Q> operator-(T scalar,mat<2,R, T, Q> const& m) {
|
||||
return mat<2,R,T,Q>(scalar - m[0],scalar - m[1]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q>& operator-=(mat<2,R,T,Q>& m, U scalar) {
|
||||
m[0] -= scalar;
|
||||
m[1] -= scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R, T, Q> operator*(mat<2,R, T, Q> const& m, T scalar) {
|
||||
return mat<2,R,T,Q>(m[0] * scalar,m[1] * scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R, T, Q> operator*(T scalar,mat<2,R, T, Q> const& m) {
|
||||
return mat<2,R,T,Q>(scalar * m[0],scalar * m[1]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q>& operator*=(mat<2,R,T,Q>& m, U scalar) {
|
||||
m[0] *= scalar;
|
||||
m[1] *= scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R, T, Q> operator/(mat<2,R, T, Q> const& m, T scalar) {
|
||||
return mat<2,R,T,Q>(m[0] / scalar,m[1] / scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R, T, Q> operator/(T scalar,mat<2,R, T, Q> const& m) {
|
||||
return mat<2,R,T,Q>(scalar / m[0],scalar / m[1]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2,R,T,Q>& operator/=(mat<2,R,T,Q>& m, U scalar) {
|
||||
m[0] /= scalar;
|
||||
m[1] /= scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
}
|
||||
|
54
glm/detail/mat3xR_common_operators.hpp
Normal file
54
glm/detail/mat3xR_common_operators.hpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
#pragma once
|
||||
#include "qualifier.hpp"
|
||||
#include "mat_common_operators.hpp"
|
||||
namespace glm {
|
||||
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R,T,Q> operator-(mat<3,R,T,Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R,T,Q>& operator++(mat<3,R,T,Q>& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R,T,Q>& operator--(mat<3,R,T,Q>& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<3,R,T,Q> const& m1, mat<3,R,T,Q> const& m2);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R,T,Q> operator+(mat<3,R,T,Q> const& m1, mat<3,R,T,Q> const& m2);
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R,T,Q>& operator+=(mat<3,R,T,Q>& m1, mat<3,R,U,Q> const& m2);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R,T,Q> operator-(mat<3,R,T,Q> const& m1, mat<3,R,T,Q> const& m2);
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R,T,Q>& operator-=(mat<3,R,T,Q>& m1, mat<3,R,U,Q> const& m2);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R, T, Q> operator+(mat<3,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R, T, Q> operator+(T scalar,mat<3,R, T, Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R, T, Q> operator-(mat<3,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R, T, Q> operator-(T scalar,mat<3,R, T, Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R, T, Q> operator*(mat<3,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R, T, Q> operator*(T scalar,mat<3,R, T, Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R, T, Q> operator/(mat<3,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3,R, T, Q> operator/(T scalar,mat<3,R, T, Q> const& m);
|
||||
|
||||
}
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "mat3xR_common_operators.inl"
|
||||
#endif
|
||||
|
120
glm/detail/mat3xR_common_operators.inl
Normal file
120
glm/detail/mat3xR_common_operators.inl
Normal file
|
@ -0,0 +1,120 @@
|
|||
|
||||
namespace glm {
|
||||
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q> operator-(mat<3,R,T,Q> const& m) {
|
||||
return mat<3,R,T,Q>(-m[0],-m[1],-m[2]);
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q>& operator++(mat<3,R,T,Q>& m) {
|
||||
++m[0];
|
||||
++m[1];
|
||||
++m[2];
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q>& operator--(mat<3,R,T,Q>& m) {
|
||||
--m[0];
|
||||
--m[1];
|
||||
--m[2];
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<3,R,T,Q> const& m1, mat<3,R,T,Q> const& m2) {
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q> operator+(mat<3,R,T,Q> const& m1, mat<3,R,T,Q> const& m2) {
|
||||
return mat<3,R,T,Q>(m1[0] + m2[0],m1[1] + m2[1],m1[2] + m2[2]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q>& operator+=(mat<3,R,T,Q>& m1, mat<3,R,U,Q> const& m2) {
|
||||
m1[0] += m2[0];
|
||||
m1[1] += m2[1];
|
||||
m1[2] += m2[2];
|
||||
return m1;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q> operator-(mat<3,R,T,Q> const& m1, mat<3,R,T,Q> const& m2) {
|
||||
return mat<3,R,T,Q>(m1[0] - m2[0],m1[1] - m2[1],m1[2] - m2[2]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q>& operator-=(mat<3,R,T,Q>& m1, mat<3,R,U,Q> const& m2) {
|
||||
m1[0] -= m2[0];
|
||||
m1[1] -= m2[1];
|
||||
m1[2] -= m2[2];
|
||||
return m1;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R, T, Q> operator+(mat<3,R, T, Q> const& m, T scalar) {
|
||||
return mat<3,R,T,Q>(m[0] + scalar,m[1] + scalar,m[2] + scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R, T, Q> operator+(T scalar,mat<3,R, T, Q> const& m) {
|
||||
return mat<3,R,T,Q>(scalar + m[0],scalar + m[1],scalar + m[2]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q>& operator+=(mat<3,R,T,Q>& m, U scalar) {
|
||||
m[0] += scalar;
|
||||
m[1] += scalar;
|
||||
m[2] += scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R, T, Q> operator-(mat<3,R, T, Q> const& m, T scalar) {
|
||||
return mat<3,R,T,Q>(m[0] - scalar,m[1] - scalar,m[2] - scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R, T, Q> operator-(T scalar,mat<3,R, T, Q> const& m) {
|
||||
return mat<3,R,T,Q>(scalar - m[0],scalar - m[1],scalar - m[2]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q>& operator-=(mat<3,R,T,Q>& m, U scalar) {
|
||||
m[0] -= scalar;
|
||||
m[1] -= scalar;
|
||||
m[2] -= scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R, T, Q> operator*(mat<3,R, T, Q> const& m, T scalar) {
|
||||
return mat<3,R,T,Q>(m[0] * scalar,m[1] * scalar,m[2] * scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R, T, Q> operator*(T scalar,mat<3,R, T, Q> const& m) {
|
||||
return mat<3,R,T,Q>(scalar * m[0],scalar * m[1],scalar * m[2]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q>& operator*=(mat<3,R,T,Q>& m, U scalar) {
|
||||
m[0] *= scalar;
|
||||
m[1] *= scalar;
|
||||
m[2] *= scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R, T, Q> operator/(mat<3,R, T, Q> const& m, T scalar) {
|
||||
return mat<3,R,T,Q>(m[0] / scalar,m[1] / scalar,m[2] / scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R, T, Q> operator/(T scalar,mat<3,R, T, Q> const& m) {
|
||||
return mat<3,R,T,Q>(scalar / m[0],scalar / m[1],scalar / m[2]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3,R,T,Q>& operator/=(mat<3,R,T,Q>& m, U scalar) {
|
||||
m[0] /= scalar;
|
||||
m[1] /= scalar;
|
||||
m[2] /= scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
}
|
||||
|
54
glm/detail/mat4xR_common_operators.hpp
Normal file
54
glm/detail/mat4xR_common_operators.hpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
#pragma once
|
||||
#include "qualifier.hpp"
|
||||
#include "mat_common_operators.hpp"
|
||||
namespace glm {
|
||||
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R,T,Q> operator-(mat<4,R,T,Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R,T,Q>& operator++(mat<4,R,T,Q>& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R,T,Q>& operator--(mat<4,R,T,Q>& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<4,R,T,Q> const& m1, mat<4,R,T,Q> const& m2);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R,T,Q> operator+(mat<4,R,T,Q> const& m1, mat<4,R,T,Q> const& m2);
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R,T,Q>& operator+=(mat<4,R,T,Q>& m1, mat<4,R,U,Q> const& m2);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R,T,Q> operator-(mat<4,R,T,Q> const& m1, mat<4,R,T,Q> const& m2);
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R,T,Q>& operator-=(mat<4,R,T,Q>& m1, mat<4,R,U,Q> const& m2);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R, T, Q> operator+(mat<4,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R, T, Q> operator+(T scalar,mat<4,R, T, Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R, T, Q> operator-(mat<4,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R, T, Q> operator-(T scalar,mat<4,R, T, Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R, T, Q> operator*(mat<4,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R, T, Q> operator*(T scalar,mat<4,R, T, Q> const& m);
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R, T, Q> operator/(mat<4,R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4,R, T, Q> operator/(T scalar,mat<4,R, T, Q> const& m);
|
||||
|
||||
}
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "mat4xR_common_operators.inl"
|
||||
#endif
|
||||
|
128
glm/detail/mat4xR_common_operators.inl
Normal file
128
glm/detail/mat4xR_common_operators.inl
Normal file
|
@ -0,0 +1,128 @@
|
|||
|
||||
namespace glm {
|
||||
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q> operator-(mat<4,R,T,Q> const& m) {
|
||||
return mat<4,R,T,Q>(-m[0],-m[1],-m[2],-m[3]);
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q>& operator++(mat<4,R,T,Q>& m) {
|
||||
++m[0];
|
||||
++m[1];
|
||||
++m[2];
|
||||
++m[3];
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q>& operator--(mat<4,R,T,Q>& m) {
|
||||
--m[0];
|
||||
--m[1];
|
||||
--m[2];
|
||||
--m[3];
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<4,R,T,Q> const& m1, mat<4,R,T,Q> const& m2) {
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q> operator+(mat<4,R,T,Q> const& m1, mat<4,R,T,Q> const& m2) {
|
||||
return mat<4,R,T,Q>(m1[0] + m2[0],m1[1] + m2[1],m1[2] + m2[2],m1[3] + m2[3]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q>& operator+=(mat<4,R,T,Q>& m1, mat<4,R,U,Q> const& m2) {
|
||||
m1[0] += m2[0];
|
||||
m1[1] += m2[1];
|
||||
m1[2] += m2[2];
|
||||
m1[3] += m2[3];
|
||||
return m1;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q> operator-(mat<4,R,T,Q> const& m1, mat<4,R,T,Q> const& m2) {
|
||||
return mat<4,R,T,Q>(m1[0] - m2[0],m1[1] - m2[1],m1[2] - m2[2],m1[3] - m2[3]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q>& operator-=(mat<4,R,T,Q>& m1, mat<4,R,U,Q> const& m2) {
|
||||
m1[0] -= m2[0];
|
||||
m1[1] -= m2[1];
|
||||
m1[2] -= m2[2];
|
||||
m1[3] -= m2[3];
|
||||
return m1;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R, T, Q> operator+(mat<4,R, T, Q> const& m, T scalar) {
|
||||
return mat<4,R,T,Q>(m[0] + scalar,m[1] + scalar,m[2] + scalar,m[3] + scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R, T, Q> operator+(T scalar,mat<4,R, T, Q> const& m) {
|
||||
return mat<4,R,T,Q>(scalar + m[0],scalar + m[1],scalar + m[2],scalar + m[3]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q>& operator+=(mat<4,R,T,Q>& m, U scalar) {
|
||||
m[0] += scalar;
|
||||
m[1] += scalar;
|
||||
m[2] += scalar;
|
||||
m[3] += scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R, T, Q> operator-(mat<4,R, T, Q> const& m, T scalar) {
|
||||
return mat<4,R,T,Q>(m[0] - scalar,m[1] - scalar,m[2] - scalar,m[3] - scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R, T, Q> operator-(T scalar,mat<4,R, T, Q> const& m) {
|
||||
return mat<4,R,T,Q>(scalar - m[0],scalar - m[1],scalar - m[2],scalar - m[3]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q>& operator-=(mat<4,R,T,Q>& m, U scalar) {
|
||||
m[0] -= scalar;
|
||||
m[1] -= scalar;
|
||||
m[2] -= scalar;
|
||||
m[3] -= scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R, T, Q> operator*(mat<4,R, T, Q> const& m, T scalar) {
|
||||
return mat<4,R,T,Q>(m[0] * scalar,m[1] * scalar,m[2] * scalar,m[3] * scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R, T, Q> operator*(T scalar,mat<4,R, T, Q> const& m) {
|
||||
return mat<4,R,T,Q>(scalar * m[0],scalar * m[1],scalar * m[2],scalar * m[3]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q>& operator*=(mat<4,R,T,Q>& m, U scalar) {
|
||||
m[0] *= scalar;
|
||||
m[1] *= scalar;
|
||||
m[2] *= scalar;
|
||||
m[3] *= scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R, T, Q> operator/(mat<4,R, T, Q> const& m, T scalar) {
|
||||
return mat<4,R,T,Q>(m[0] / scalar,m[1] / scalar,m[2] / scalar,m[3] / scalar);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R, T, Q> operator/(T scalar,mat<4,R, T, Q> const& m) {
|
||||
return mat<4,R,T,Q>(scalar / m[0],scalar / m[1],scalar / m[2],scalar / m[3]);
|
||||
}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4,R,T,Q>& operator/=(mat<4,R,T,Q>& m, U scalar) {
|
||||
m[0] /= scalar;
|
||||
m[1] /= scalar;
|
||||
m[2] /= scalar;
|
||||
m[3] /= scalar;
|
||||
return m;
|
||||
}
|
||||
|
||||
}
|
||||
|
29
glm/detail/mat_common_operators.hpp
Normal file
29
glm/detail/mat_common_operators.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include "qualifier.hpp"
|
||||
|
||||
namespace glm {
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<C, R, T, Q> operator++(mat<C, R, T, Q>& m, int);
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<C, R, T, Q> operator--(mat<C, R, T, Q>& m, int);
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<C, R, T, Q> operator+(mat<C, R, T, Q> const& m);
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<C, R, T, Q> const& m1, mat<C, R, T, Q> const& m2);
|
||||
|
||||
template<length_t D,typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<D, D, T, Q>::col_type operator/(mat<D, D, T, Q> const& m, typename mat<D, D, T, Q>::row_type const& v);
|
||||
|
||||
template<length_t D,typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<D, D, T, Q>::row_type operator/(typename mat<D, D, T, Q>::col_type const& v, mat<D, D, T, Q> const& m);
|
||||
|
||||
}
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "mat_common_operators.inl"
|
||||
#endif
|
39
glm/detail/mat_common_operators.inl
Normal file
39
glm/detail/mat_common_operators.inl
Normal file
|
@ -0,0 +1,39 @@
|
|||
namespace glm {
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<C, R, T, Q> operator++(mat<C, R, T, Q>& m, int) {
|
||||
mat<C, R, T, Q> Result(m);
|
||||
++m;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<C, R, T, Q> operator--(mat<C, R, T, Q>& m, int) {
|
||||
mat<C, R, T, Q> Result(m);
|
||||
--m;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<C, R, T, Q> operator+(mat<C, R, T, Q> const& m) {
|
||||
return m;
|
||||
}
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(mat<C, R, T, Q> const& m1, mat<C, R, T, Q> const& m2) {
|
||||
return !(m1 == m2);
|
||||
}
|
||||
|
||||
template<length_t D,typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<D, D, T, Q>::col_type operator/(mat<D, D, T, Q> const& m, typename mat<D, D, T, Q>::row_type const& v)
|
||||
{
|
||||
return inverse(m) * v;
|
||||
}
|
||||
|
||||
template<length_t D,typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<D, D, T, Q>::row_type operator/(typename mat<D, D, T, Q>::col_type const& v, mat<D, D, T, Q> const& m)
|
||||
{
|
||||
return v * inverse(m);
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mat2xR_common_operators.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
@ -27,7 +28,7 @@ namespace glm
|
|||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR col_type & operator[](length_type i) GLM_NOEXCEPT;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR col_type& operator[](length_type i) GLM_NOEXCEPT;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
|
||||
|
||||
// -- Constructors --
|
||||
|
@ -70,69 +71,16 @@ namespace glm
|
|||
GLM_CTOR_DECL GLM_EXPLICIT mat(mat<3, 4, T, Q> const& x);
|
||||
GLM_CTOR_DECL GLM_EXPLICIT mat(mat<4, 3, T, Q> const& x);
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator=(mat<2, 2, U, Q> const& m);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat& operator=(mat<2, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator+=(U s);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat& operator*=(mat<2, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator+=(mat<2, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator-=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator-=(mat<2, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator*=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator*=(mat<2, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator/=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator/=(mat<2, 2, U, Q> const& m);
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator++ ();
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator-- ();
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator++(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator--(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat& operator/=(mat<2, 2, U, Q> const& m);
|
||||
};
|
||||
|
||||
// -- Unary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator+(T scalar, mat<2, 2, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator-(T scalar, mat<2, 2, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator*(T scalar, mat<2, 2, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<2, 2, T, Q>::col_type operator*(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v);
|
||||
|
||||
|
@ -148,28 +96,9 @@ namespace glm
|
|||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator/(T scalar, mat<2, 2, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<2, 2, T, Q>::col_type operator/(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<2, 2, T, Q>::row_type operator/(typename mat<2, 2, T, Q>::col_type const& v, mat<2, 2, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
|
||||
} //namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
|
|
|
@ -241,51 +241,6 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>& mat<2, 2, T, Q>::operator+=(U scalar)
|
||||
{
|
||||
this->value[0] += scalar;
|
||||
this->value[1] += scalar;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>& mat<2, 2, T, Q>::operator+=(mat<2, 2, U, Q> const& m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>& mat<2, 2, T, Q>::operator-=(U scalar)
|
||||
{
|
||||
this->value[0] -= scalar;
|
||||
this->value[1] -= scalar;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>& mat<2, 2, T, Q>::operator-=(mat<2, 2, U, Q> const& m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>& mat<2, 2, T, Q>::operator*=(U scalar)
|
||||
{
|
||||
this->value[0] *= scalar;
|
||||
this->value[1] *= scalar;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>& mat<2, 2, T, Q>::operator*=(mat<2, 2, U, Q> const& m)
|
||||
|
@ -293,15 +248,6 @@ namespace glm
|
|||
return (*this = *this * m);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>& mat<2, 2, T, Q>::operator/=(U scalar)
|
||||
{
|
||||
this->value[0] /= scalar;
|
||||
this->value[1] /= scalar;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>& mat<2, 2, T, Q>::operator/=(mat<2, 2, U, Q> const& m)
|
||||
|
@ -309,122 +255,6 @@ namespace glm
|
|||
return *this *= inverse(m);
|
||||
}
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>& mat<2, 2, T, Q>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>& mat<2, 2, T, Q>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> mat<2, 2, T, Q>::operator++(int)
|
||||
{
|
||||
mat<2, 2, T, Q> Result(*this);
|
||||
++*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> mat<2, 2, T, Q>::operator--(int)
|
||||
{
|
||||
mat<2, 2, T, Q> Result(*this);
|
||||
--*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m)
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
-m[0],
|
||||
-m[1]);
|
||||
}
|
||||
|
||||
// -- Binary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator+(T scalar, mat<2, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
m1[0] + m2[0],
|
||||
m1[1] + m2[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
m[0] - scalar,
|
||||
m[1] - scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator-(T scalar, mat<2, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
scalar - m[0],
|
||||
scalar - m[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
m1[0] - m2[0],
|
||||
m1[1] - m2[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator*(T scalar, mat<2, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 2, T, Q>::col_type operator*
|
||||
(
|
||||
|
@ -485,34 +315,6 @@ namespace glm
|
|||
m1[0][1] * m2[3][0] + m1[1][1] * m2[3][1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
m[0] / scalar,
|
||||
m[1] / scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator/(T scalar, mat<2, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 2, T, Q>(
|
||||
scalar / m[0],
|
||||
scalar / m[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 2, T, Q>::col_type operator/(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v)
|
||||
{
|
||||
return inverse(m) * v;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 2, T, Q>::row_type operator/(typename mat<2, 2, T, Q>::col_type const& v, mat<2, 2, T, Q> const& m)
|
||||
{
|
||||
return v * inverse(m);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2)
|
||||
{
|
||||
|
@ -520,17 +322,4 @@ namespace glm
|
|||
return m1_copy /= m2;
|
||||
}
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]);
|
||||
}
|
||||
} //namespace glm
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mat2xR_common_operators.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include <limits>
|
||||
|
@ -74,56 +75,11 @@ namespace glm
|
|||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 3, T, Q> & operator=(mat<2, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 3, T, Q> & operator+=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 3, T, Q> & operator+=(mat<2, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 3, T, Q> & operator-=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 3, T, Q> & operator-=(mat<2, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 3, T, Q> & operator*=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 3, T, Q> & operator/=(U s);
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 3, T, Q> & operator++ ();
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 3, T, Q> & operator-- ();
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator++(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator--(int);
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat& operator=(mat<2, 3, U, Q> const& m);
|
||||
};
|
||||
|
||||
// -- Unary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator*(mat<2, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator*(T scalar, mat<2, 3, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<2, 3, T, Q>::col_type operator*(mat<2, 3, T, Q> const& m, typename mat<2, 3, T, Q>::row_type const& v);
|
||||
|
||||
|
@ -139,19 +95,6 @@ namespace glm
|
|||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator*(mat<2, 3, T, Q> const& m1, mat<4, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator/(mat<2, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator/(T scalar, mat<2, 3, T, Q> const& m);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
|
|
|
@ -241,160 +241,6 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> & mat<2, 3, T, Q>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q>& mat<2, 3, T, Q>::operator+=(mat<2, 3, U, Q> const& m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q>& mat<2, 3, T, Q>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q>& mat<2, 3, T, Q>::operator-=(mat<2, 3, U, Q> const& m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q>& mat<2, 3, T, Q>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> & mat<2, 3, T, Q>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> & mat<2, 3, T, Q>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> & mat<2, 3, T, Q>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> mat<2, 3, T, Q>::operator++(int)
|
||||
{
|
||||
mat<2, 3, T, Q> Result(*this);
|
||||
++*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> mat<2, 3, T, Q>::operator--(int)
|
||||
{
|
||||
mat<2, 3, T, Q> Result(*this);
|
||||
--*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m)
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 3, T, Q>(
|
||||
-m[0],
|
||||
-m[1]);
|
||||
}
|
||||
|
||||
// -- Binary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 3, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2)
|
||||
{
|
||||
return mat<2, 3, T, Q>(
|
||||
m1[0] + m2[0],
|
||||
m1[1] + m2[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 3, T, Q>(
|
||||
m[0] - scalar,
|
||||
m[1] - scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2)
|
||||
{
|
||||
return mat<2, 3, T, Q>(
|
||||
m1[0] - m2[0],
|
||||
m1[1] - m2[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> operator*(mat<2, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 3, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> operator*(T scalar, mat<2, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 3, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 3, T, Q>::col_type operator*
|
||||
(
|
||||
|
@ -463,33 +309,4 @@ namespace glm
|
|||
m1[0][2] * m2[3][0] + m1[1][2] * m2[3][1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> operator/(mat<2, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 3, T, Q>(
|
||||
m[0] / scalar,
|
||||
m[1] / scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q> operator/(T scalar, mat<2, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 3, T, Q>(
|
||||
scalar / m[0],
|
||||
scalar / m[1]);
|
||||
}
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]);
|
||||
}
|
||||
} //namespace glm
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mat2xR_common_operators.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include <limits>
|
||||
|
@ -76,56 +77,11 @@ namespace glm
|
|||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 4, T, Q> & operator=(mat<2, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 4, T, Q> & operator+=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 4, T, Q> & operator+=(mat<2, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 4, T, Q> & operator-=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 4, T, Q> & operator-=(mat<2, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 4, T, Q> & operator*=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 4, T, Q> & operator/=(U s);
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 4, T, Q> & operator++ ();
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 4, T, Q> & operator-- ();
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator++(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator--(int);
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat& operator=(mat<2, 4, U, Q> const& m);
|
||||
};
|
||||
|
||||
// -- Unary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator*(mat<2, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator*(T scalar, mat<2, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<2, 4, T, Q>::col_type operator*(mat<2, 4, T, Q> const& m, typename mat<2, 4, T, Q>::row_type const& v);
|
||||
|
||||
|
@ -141,19 +97,6 @@ namespace glm
|
|||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator*(mat<2, 4, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator/(mat<2, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator/(T scalar, mat<2, 4, T, Q> const& m);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
|
|
|
@ -243,160 +243,6 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q>& mat<2, 4, T, Q>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q>& mat<2, 4, T, Q>::operator+=(mat<2, 4, U, Q> const& m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q>& mat<2, 4, T, Q>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q>& mat<2, 4, T, Q>::operator-=(mat<2, 4, U, Q> const& m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q>& mat<2, 4, T, Q>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> & mat<2, 4, T, Q>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q>& mat<2, 4, T, Q>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q>& mat<2, 4, T, Q>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> mat<2, 4, T, Q>::operator++(int)
|
||||
{
|
||||
mat<2, 4, T, Q> Result(*this);
|
||||
++*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> mat<2, 4, T, Q>::operator--(int)
|
||||
{
|
||||
mat<2, 4, T, Q> Result(*this);
|
||||
--*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m)
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 4, T, Q>(
|
||||
-m[0],
|
||||
-m[1]);
|
||||
}
|
||||
|
||||
// -- Binary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 4, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2)
|
||||
{
|
||||
return mat<2, 4, T, Q>(
|
||||
m1[0] + m2[0],
|
||||
m1[1] + m2[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 4, T, Q>(
|
||||
m[0] - scalar,
|
||||
m[1] - scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2)
|
||||
{
|
||||
return mat<2, 4, T, Q>(
|
||||
m1[0] - m2[0],
|
||||
m1[1] - m2[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> operator*(mat<2, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 4, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> operator*(T scalar, mat<2, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 4, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 4, T, Q>::col_type operator*(mat<2, 4, T, Q> const& m, typename mat<2, 4, T, Q>::row_type const& v)
|
||||
{
|
||||
|
@ -469,33 +315,4 @@ namespace glm
|
|||
m1[0][3] * m2[2][0] + m1[1][3] * m2[2][1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> operator/(mat<2, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<2, 4, T, Q>(
|
||||
m[0] / scalar,
|
||||
m[1] / scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q> operator/(T scalar, mat<2, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<2, 4, T, Q>(
|
||||
scalar / m[0],
|
||||
scalar / m[1]);
|
||||
}
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]);
|
||||
}
|
||||
} //namespace glm
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mat3xR_common_operators.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include <limits>
|
||||
|
@ -81,56 +82,11 @@ namespace glm
|
|||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 2, T, Q> & operator=(mat<3, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 2, T, Q> & operator+=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 2, T, Q> & operator+=(mat<3, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 2, T, Q> & operator-=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 2, T, Q> & operator-=(mat<3, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 2, T, Q> & operator*=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 2, T, Q> & operator/=(U s);
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 2, T, Q> & operator++ ();
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 2, T, Q> & operator-- ();
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator++(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator--(int);
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat& operator=(mat<3, 2, U, Q> const& m);
|
||||
};
|
||||
|
||||
// -- Unary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator*(mat<3, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator*(T scalar, mat<3, 2, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<3, 2, T, Q>::col_type operator*(mat<3, 2, T, Q> const& m, typename mat<3, 2, T, Q>::row_type const& v);
|
||||
|
||||
|
@ -145,21 +101,6 @@ namespace glm
|
|||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator/(mat<3, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator/(T scalar, mat<3, 2, T, Q> const& m);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
|
||||
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
|
|
|
@ -261,175 +261,6 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
this->value[2] += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator+=(mat<3, 2, U, Q> const& m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
this->value[2] += m[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
this->value[2] -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator-=(mat<3, 2, U, Q> const& m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
this->value[2] -= m[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
this->value[2] *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> & mat<3, 2, T, Q>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
this->value[2] /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
++this->value[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
--this->value[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> mat<3, 2, T, Q>::operator++(int)
|
||||
{
|
||||
mat<3, 2, T, Q> Result(*this);
|
||||
++*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> mat<3, 2, T, Q>::operator--(int)
|
||||
{
|
||||
mat<3, 2, T, Q> Result(*this);
|
||||
--*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m)
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 2, T, Q>(
|
||||
-m[0],
|
||||
-m[1],
|
||||
-m[2]);
|
||||
}
|
||||
|
||||
// -- Binary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 2, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar,
|
||||
m[2] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2)
|
||||
{
|
||||
return mat<3, 2, T, Q>(
|
||||
m1[0] + m2[0],
|
||||
m1[1] + m2[1],
|
||||
m1[2] + m2[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 2, T, Q>(
|
||||
m[0] - scalar,
|
||||
m[1] - scalar,
|
||||
m[2] - scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2)
|
||||
{
|
||||
return mat<3, 2, T, Q>(
|
||||
m1[0] - m2[0],
|
||||
m1[1] - m2[1],
|
||||
m1[2] - m2[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> operator*(mat<3, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 2, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> operator*(T scalar, mat<3, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 2, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 2, T, Q>::col_type operator*(mat<3, 2, T, Q> const& m, typename mat<3, 2, T, Q>::row_type const& v)
|
||||
{
|
||||
|
@ -483,35 +314,4 @@ namespace glm
|
|||
m1[0][1] * m2[3][0] + m1[1][1] * m2[3][1] + m1[2][1] * m2[3][2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> operator/(mat<3, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 2, T, Q>(
|
||||
m[0] / scalar,
|
||||
m[1] / scalar,
|
||||
m[2] / scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q> operator/(T scalar, mat<3, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 2, T, Q>(
|
||||
scalar / m[0],
|
||||
scalar / m[1],
|
||||
scalar / m[2]);
|
||||
}
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
|
||||
}
|
||||
} //namespace glm
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mat3xR_common_operators.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
@ -80,66 +81,15 @@ namespace glm
|
|||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator=(mat<3, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator+=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator+=(mat<3, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator-=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator-=(mat<3, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator*=(U s);
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat& operator=(mat<3, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator*=(mat<3, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator/=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator/=(mat<3, 3, U, Q> const& m);
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator++();
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 3, T, Q> & operator--();
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator++(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator--(int);
|
||||
};
|
||||
|
||||
// -- Unary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator+(T scalar, mat<3, 3, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator-(T scalar, mat<3, 3, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator*(mat<3, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator*(T scalar, mat<3, 3, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<3, 3, T, Q>::col_type operator*(mat<3, 3, T, Q> const& m, typename mat<3, 3, T, Q>::row_type const& v);
|
||||
|
||||
|
@ -155,28 +105,9 @@ namespace glm
|
|||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator*(mat<3, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator/(mat<3, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator/(T scalar, mat<3, 3, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<3, 3, T, Q>::col_type operator/(mat<3, 3, T, Q> const& m, typename mat<3, 3, T, Q>::row_type const& v);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<3, 3, T, Q>::row_type operator/(typename mat<3, 3, T, Q>::col_type const& v, mat<3, 3, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator/(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
|
|
|
@ -264,57 +264,6 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> & mat<3, 3, T, Q>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
this->value[2] += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> & mat<3, 3, T, Q>::operator+=(mat<3, 3, U, Q> const& m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
this->value[2] += m[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> & mat<3, 3, T, Q>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
this->value[2] -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> & mat<3, 3, T, Q>::operator-=(mat<3, 3, U, Q> const& m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
this->value[2] -= m[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> & mat<3, 3, T, Q>::operator*=(U s)
|
||||
{
|
||||
col_type sv(s);
|
||||
this->value[0] *= sv;
|
||||
this->value[1] *= sv;
|
||||
this->value[2] *= sv;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> & mat<3, 3, T, Q>::operator*=(mat<3, 3, U, Q> const& m)
|
||||
|
@ -322,16 +271,6 @@ namespace glm
|
|||
return (*this = *this * m);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> & mat<3, 3, T, Q>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
this->value[2] /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> & mat<3, 3, T, Q>::operator/=(mat<3, 3, U, Q> const& m)
|
||||
|
@ -339,133 +278,6 @@ namespace glm
|
|||
return *this *= inverse(m);
|
||||
}
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> & mat<3, 3, T, Q>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
++this->value[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> & mat<3, 3, T, Q>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
--this->value[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> mat<3, 3, T, Q>::operator++(int)
|
||||
{
|
||||
mat<3, 3, T, Q> Result(*this);
|
||||
++*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> mat<3, 3, T, Q>::operator--(int)
|
||||
{
|
||||
mat<3, 3, T, Q> Result(*this);
|
||||
--*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
-m[0],
|
||||
-m[1],
|
||||
-m[2]);
|
||||
}
|
||||
|
||||
// -- Binary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar,
|
||||
m[2] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator+(T scalar, mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar,
|
||||
m[2] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
m1[0] + m2[0],
|
||||
m1[1] + m2[1],
|
||||
m1[2] + m2[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
m[0] - scalar,
|
||||
m[1] - scalar,
|
||||
m[2] - scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator-(T scalar, mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
scalar - m[0],
|
||||
scalar - m[1],
|
||||
scalar - m[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
m1[0] - m2[0],
|
||||
m1[1] - m2[1],
|
||||
m1[2] - m2[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator*(mat<3, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator*(T scalar, mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, T, Q>::col_type operator*(mat<3, 3, T, Q> const& m, typename mat<3, 3, T, Q>::row_type const& v)
|
||||
{
|
||||
|
@ -578,36 +390,6 @@ namespace glm
|
|||
m1[0][2] * m2[3][0] + m1[1][2] * m2[3][1] + m1[2][2] * m2[3][2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator/(mat<3, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
m[0] / scalar,
|
||||
m[1] / scalar,
|
||||
m[2] / scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator/(T scalar, mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 3, T, Q>(
|
||||
scalar / m[0],
|
||||
scalar / m[1],
|
||||
scalar / m[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, T, Q>::col_type operator/(mat<3, 3, T, Q> const& m, typename mat<3, 3, T, Q>::row_type const& v)
|
||||
{
|
||||
return inverse(m) * v;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, T, Q>::row_type operator/(typename mat<3, 3, T, Q>::col_type const& v, mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
return v * inverse(m);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q> operator/(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2)
|
||||
{
|
||||
|
@ -615,17 +397,4 @@ namespace glm
|
|||
return m1_copy /= m2;
|
||||
}
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
|
||||
}
|
||||
} //namespace glm
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mat3xR_common_operators.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include <limits>
|
||||
|
@ -28,7 +29,7 @@ namespace glm
|
|||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR col_type & operator[](length_type i) GLM_NOEXCEPT;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR col_type& operator[](length_type i) GLM_NOEXCEPT;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
|
||||
|
||||
// -- Constructors --
|
||||
|
@ -78,59 +79,11 @@ namespace glm
|
|||
GLM_CTOR_DECL GLM_EXPLICIT mat(mat<4, 2, T, Q> const& x);
|
||||
GLM_CTOR_DECL GLM_EXPLICIT mat(mat<4, 3, T, Q> const& x);
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat& operator=(mat<3, 4, U, Q> const& m);
|
||||
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 4, T, Q> & operator=(mat<3, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 4, T, Q> & operator+=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 4, T, Q> & operator+=(mat<3, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 4, T, Q> & operator-=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 4, T, Q> & operator-=(mat<3, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 4, T, Q> & operator*=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 4, T, Q> & operator/=(U s);
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 4, T, Q> & operator++();
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<3, 4, T, Q> & operator--();
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator++(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator--(int);
|
||||
};
|
||||
|
||||
// -- Unary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator*(mat<3, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator*(T scalar, mat<3, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<3, 4, T, Q>::col_type operator*(mat<3, 4, T, Q> const& m, typename mat<3, 4, T, Q>::row_type const& v);
|
||||
|
||||
|
@ -138,27 +91,14 @@ namespace glm
|
|||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<3, 4, T, Q>::row_type operator*(typename mat<3, 4, T, Q>::col_type const& v, mat<3, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1, mat<2, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1, mat<3, 3, T, Q> const& m2);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1, mat<3, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator/(mat<3, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator/(T scalar, mat<3, 4, T, Q> const& m);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
|
|
|
@ -267,175 +267,6 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q>& mat<3, 4, T, Q>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
this->value[2] += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q>& mat<3, 4, T, Q>::operator+=(mat<3, 4, U, Q> const& m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
this->value[2] += m[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q>& mat<3, 4, T, Q>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
this->value[2] -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q>& mat<3, 4, T, Q>::operator-=(mat<3, 4, U, Q> const& m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
this->value[2] -= m[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q>& mat<3, 4, T, Q>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
this->value[2] *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> & mat<3, 4, T, Q>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
this->value[2] /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q>& mat<3, 4, T, Q>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
++this->value[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q>& mat<3, 4, T, Q>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
--this->value[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> mat<3, 4, T, Q>::operator++(int)
|
||||
{
|
||||
mat<3, 4, T, Q> Result(*this);
|
||||
++*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> mat<3, 4, T, Q>::operator--(int)
|
||||
{
|
||||
mat<3, 4, T, Q> Result(*this);
|
||||
--*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m)
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 4, T, Q>(
|
||||
-m[0],
|
||||
-m[1],
|
||||
-m[2]);
|
||||
}
|
||||
|
||||
// -- Binary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 4, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar,
|
||||
m[2] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2)
|
||||
{
|
||||
return mat<3, 4, T, Q>(
|
||||
m1[0] + m2[0],
|
||||
m1[1] + m2[1],
|
||||
m1[2] + m2[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 4, T, Q>(
|
||||
m[0] - scalar,
|
||||
m[1] - scalar,
|
||||
m[2] - scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2)
|
||||
{
|
||||
return mat<3, 4, T, Q>(
|
||||
m1[0] - m2[0],
|
||||
m1[1] - m2[1],
|
||||
m1[2] - m2[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> operator*(mat<3, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 4, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> operator*(T scalar, mat<3, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 4, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 4, T, Q>::col_type operator*
|
||||
(
|
||||
|
@ -516,36 +347,4 @@ namespace glm
|
|||
m1[0][2] * m2[2][0] + m1[1][2] * m2[2][1] + m1[2][2] * m2[2][2],
|
||||
m1[0][3] * m2[2][0] + m1[1][3] * m2[2][1] + m1[2][3] * m2[2][2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> operator/(mat<3, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<3, 4, T, Q>(
|
||||
m[0] / scalar,
|
||||
m[1] / scalar,
|
||||
m[2] / scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q> operator/(T scalar, mat<3, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<3, 4, T, Q>(
|
||||
scalar / m[0],
|
||||
scalar / m[1],
|
||||
scalar / m[2]);
|
||||
}
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
|
||||
}
|
||||
} //namespace glm
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mat4xR_common_operators.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include <limits>
|
||||
|
@ -83,59 +84,12 @@ namespace glm
|
|||
GLM_CTOR_DECL mat(mat<4, 3, T, Q> const& x);
|
||||
GLM_CTOR_DECL mat(mat<3, 4, T, Q> const& x);
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 2, T, Q> & operator=(mat<4, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 2, T, Q> & operator+=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 2, T, Q> & operator+=(mat<4, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 2, T, Q> & operator-=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 2, T, Q> & operator-=(mat<4, 2, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 2, T, Q> & operator*=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 2, T, Q> & operator/=(U s);
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 2, T, Q> & operator++ ();
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 2, T, Q> & operator-- ();
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator++(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator--(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat& operator=(mat<4, 2, U, Q> const& m);
|
||||
};
|
||||
|
||||
// -- Unary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator*(mat<4, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator*(T scalar, mat<4, 2, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<4, 2, T, Q>::col_type operator*(mat<4, 2, T, Q> const& m, typename mat<4, 2, T, Q>::row_type const& v);
|
||||
|
||||
|
@ -151,19 +105,6 @@ namespace glm
|
|||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator*(mat<4, 2, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator/(mat<4, 2, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator/(T scalar, mat<4, 2, T, Q> const& m);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
|
|
|
@ -281,190 +281,6 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> & mat<4, 2, T, Q>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
this->value[2] += s;
|
||||
this->value[3] += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> & mat<4, 2, T, Q>::operator+=(mat<4, 2, U, Q> const& m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
this->value[2] += m[2];
|
||||
this->value[3] += m[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> & mat<4, 2, T, Q>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
this->value[2] -= s;
|
||||
this->value[3] -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> & mat<4, 2, T, Q>::operator-=(mat<4, 2, U, Q> const& m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
this->value[2] -= m[2];
|
||||
this->value[3] -= m[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> & mat<4, 2, T, Q>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
this->value[2] *= s;
|
||||
this->value[3] *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> & mat<4, 2, T, Q>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
this->value[2] /= s;
|
||||
this->value[3] /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> & mat<4, 2, T, Q>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
++this->value[2];
|
||||
++this->value[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> & mat<4, 2, T, Q>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
--this->value[2];
|
||||
--this->value[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> mat<4, 2, T, Q>::operator++(int)
|
||||
{
|
||||
mat<4, 2, T, Q> Result(*this);
|
||||
++*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> mat<4, 2, T, Q>::operator--(int)
|
||||
{
|
||||
mat<4, 2, T, Q> Result(*this);
|
||||
--*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m)
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 2, T, Q>(
|
||||
-m[0],
|
||||
-m[1],
|
||||
-m[2],
|
||||
-m[3]);
|
||||
}
|
||||
|
||||
// -- Binary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 2, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar,
|
||||
m[2] + scalar,
|
||||
m[3] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2)
|
||||
{
|
||||
return mat<4, 2, T, Q>(
|
||||
m1[0] + m2[0],
|
||||
m1[1] + m2[1],
|
||||
m1[2] + m2[2],
|
||||
m1[3] + m2[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 2, T, Q>(
|
||||
m[0] - scalar,
|
||||
m[1] - scalar,
|
||||
m[2] - scalar,
|
||||
m[3] - scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2)
|
||||
{
|
||||
return mat<4, 2, T, Q>(
|
||||
m1[0] - m2[0],
|
||||
m1[1] - m2[1],
|
||||
m1[2] - m2[2],
|
||||
m1[3] - m2[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> operator*(mat<4, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 2, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar,
|
||||
m[3] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> operator*(T scalar, mat<4, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 2, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar,
|
||||
m[3] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 2, T, Q>::col_type operator*(mat<4, 2, T, Q> const& m, typename mat<4, 2, T, Q>::row_type const& v)
|
||||
{
|
||||
|
@ -519,37 +335,4 @@ namespace glm
|
|||
m1[0][1] * m2[3][0] + m1[1][1] * m2[3][1] + m1[2][1] * m2[3][2] + m1[3][1] * m2[3][3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> operator/(mat<4, 2, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 2, T, Q>(
|
||||
m[0] / scalar,
|
||||
m[1] / scalar,
|
||||
m[2] / scalar,
|
||||
m[3] / scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q> operator/(T scalar, mat<4, 2, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 2, T, Q>(
|
||||
scalar / m[0],
|
||||
scalar / m[1],
|
||||
scalar / m[2],
|
||||
scalar / m[3]);
|
||||
}
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
|
||||
}
|
||||
} //namespace glm
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mat4xR_common_operators.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include <limits>
|
||||
|
@ -28,7 +29,7 @@ namespace glm
|
|||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR col_type & operator[](length_type i) GLM_NOEXCEPT;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR col_type& operator[](length_type i) GLM_NOEXCEPT;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
|
||||
|
||||
// -- Constructors --
|
||||
|
@ -83,58 +84,11 @@ namespace glm
|
|||
GLM_CTOR_DECL mat(mat<4, 2, T, Q> const& x);
|
||||
GLM_CTOR_DECL mat(mat<3, 4, T, Q> const& x);
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 3, T, Q> & operator=(mat<4, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 3, T, Q> & operator+=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 3, T, Q> & operator+=(mat<4, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 3, T, Q> & operator-=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 3, T, Q> & operator-=(mat<4, 3, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 3, T, Q> & operator*=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 3, T, Q> & operator/=(U s);
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 3, T, Q>& operator++();
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 3, T, Q>& operator--();
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator++(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator--(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat& operator=(mat<4, 3, U, Q> const& m);
|
||||
};
|
||||
|
||||
// -- Unary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator*(T scalar, mat<4, 3, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<4, 3, T, Q>::col_type operator*(mat<4, 3, T, Q> const& m, typename mat<4, 3, T, Q>::row_type const& v);
|
||||
|
@ -146,24 +100,11 @@ namespace glm
|
|||
GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1, mat<2, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1, mat<3, 4, T, Q> const& m2);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1, mat<3, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator/(mat<4, 3, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 3, T, Q> operator/(T scalar, mat<4, 3, T, Q> const& m);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
|
|
|
@ -281,190 +281,6 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> & mat<4, 3, T, Q>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
this->value[2] += s;
|
||||
this->value[3] += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> & mat<4, 3, T, Q>::operator+=(mat<4, 3, U, Q> const& m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
this->value[2] += m[2];
|
||||
this->value[3] += m[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> & mat<4, 3, T, Q>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
this->value[2] -= s;
|
||||
this->value[3] -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> & mat<4, 3, T, Q>::operator-=(mat<4, 3, U, Q> const& m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
this->value[2] -= m[2];
|
||||
this->value[3] -= m[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> & mat<4, 3, T, Q>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
this->value[2] *= s;
|
||||
this->value[3] *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> & mat<4, 3, T, Q>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
this->value[2] /= s;
|
||||
this->value[3] /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> & mat<4, 3, T, Q>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
++this->value[2];
|
||||
++this->value[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> & mat<4, 3, T, Q>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
--this->value[2];
|
||||
--this->value[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> mat<4, 3, T, Q>::operator++(int)
|
||||
{
|
||||
mat<4, 3, T, Q> Result(*this);
|
||||
++*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> mat<4, 3, T, Q>::operator--(int)
|
||||
{
|
||||
mat<4, 3, T, Q> Result(*this);
|
||||
--*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m)
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 3, T, Q>(
|
||||
-m[0],
|
||||
-m[1],
|
||||
-m[2],
|
||||
-m[3]);
|
||||
}
|
||||
|
||||
// -- Binary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 3, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar,
|
||||
m[2] + scalar,
|
||||
m[3] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2)
|
||||
{
|
||||
return mat<4, 3, T, Q>(
|
||||
m1[0] + m2[0],
|
||||
m1[1] + m2[1],
|
||||
m1[2] + m2[2],
|
||||
m1[3] + m2[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 3, T, Q>(
|
||||
m[0] - scalar,
|
||||
m[1] - scalar,
|
||||
m[2] - scalar,
|
||||
m[3] - scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2)
|
||||
{
|
||||
return mat<4, 3, T, Q>(
|
||||
m1[0] - m2[0],
|
||||
m1[1] - m2[1],
|
||||
m1[2] - m2[2],
|
||||
m1[3] - m2[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 3, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar,
|
||||
m[3] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> operator*(T scalar, mat<4, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 3, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar,
|
||||
m[3] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 3, T, Q>::col_type operator*
|
||||
(
|
||||
|
@ -535,37 +351,4 @@ namespace glm
|
|||
m1[0][2] * m2[3][0] + m1[1][2] * m2[3][1] + m1[2][2] * m2[3][2] + m1[3][2] * m2[3][3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> operator/(mat<4, 3, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 3, T, Q>(
|
||||
m[0] / scalar,
|
||||
m[1] / scalar,
|
||||
m[2] / scalar,
|
||||
m[3] / scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q> operator/(T scalar, mat<4, 3, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 3, T, Q>(
|
||||
scalar / m[0],
|
||||
scalar / m[1],
|
||||
scalar / m[2],
|
||||
scalar / m[3]);
|
||||
}
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
|
||||
}
|
||||
} //namespace glm
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mat4xR_common_operators.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
@ -85,66 +86,13 @@ namespace glm
|
|||
// -- Unary arithmetic operators --
|
||||
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator=(mat<4, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator+=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator+=(mat<4, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator-=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator-=(mat<4, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator*=(U s);
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat& operator=(mat<4, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator*=(mat<4, 4, U, Q> const& m);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator/=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator/=(mat<4, 4, U, Q> const& m);
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator++();
|
||||
GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q> & operator--();
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator++(int);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator--(int);
|
||||
};
|
||||
|
||||
// -- Unary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator+(T scalar, mat<4, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator-(T scalar, mat<4, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator*(T scalar, mat<4, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<4, 4, T, Q>::col_type operator*(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v);
|
||||
|
||||
|
@ -160,28 +108,9 @@ namespace glm
|
|||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m, T scalar);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator/(T scalar, mat<4, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<4, 4, T, Q>::col_type operator/(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR typename mat<4, 4, T, Q>::row_type operator/(typename mat<4, 4, T, Q>::col_type const& v, mat<4, 4, T, Q> const& m);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
|
|
|
@ -315,61 +315,6 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q>& mat<4, 4, T, Q>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
this->value[2] += s;
|
||||
this->value[3] += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q>& mat<4, 4, T, Q>::operator+=(mat<4, 4, U, Q> const& m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
this->value[2] += m[2];
|
||||
this->value[3] += m[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> & mat<4, 4, T, Q>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
this->value[2] -= s;
|
||||
this->value[3] -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> & mat<4, 4, T, Q>::operator-=(mat<4, 4, U, Q> const& m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
this->value[2] -= m[2];
|
||||
this->value[3] -= m[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> & mat<4, 4, T, Q>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
this->value[2] *= s;
|
||||
this->value[3] *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> & mat<4, 4, T, Q>::operator*=(mat<4, 4, U, Q> const& m)
|
||||
|
@ -377,17 +322,6 @@ namespace glm
|
|||
return (*this = *this * m);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> & mat<4, 4, T, Q>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
this->value[2] /= s;
|
||||
this->value[3] /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> & mat<4, 4, T, Q>::operator/=(mat<4, 4, U, Q> const& m)
|
||||
|
@ -395,144 +329,6 @@ namespace glm
|
|||
return *this *= inverse(m);
|
||||
}
|
||||
|
||||
// -- Increment and decrement operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> & mat<4, 4, T, Q>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
++this->value[2];
|
||||
++this->value[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> & mat<4, 4, T, Q>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
--this->value[2];
|
||||
--this->value[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> mat<4, 4, T, Q>::operator++(int)
|
||||
{
|
||||
mat<4, 4, T, Q> Result(*this);
|
||||
++*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> mat<4, 4, T, Q>::operator--(int)
|
||||
{
|
||||
mat<4, 4, T, Q> Result(*this);
|
||||
--*this;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// -- Unary constant operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
-m[0],
|
||||
-m[1],
|
||||
-m[2],
|
||||
-m[3]);
|
||||
}
|
||||
|
||||
// -- Binary arithmetic operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar,
|
||||
m[2] + scalar,
|
||||
m[3] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator+(T scalar, mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
m[0] + scalar,
|
||||
m[1] + scalar,
|
||||
m[2] + scalar,
|
||||
m[3] + scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
m1[0] + m2[0],
|
||||
m1[1] + m2[1],
|
||||
m1[2] + m2[2],
|
||||
m1[3] + m2[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
m[0] - scalar,
|
||||
m[1] - scalar,
|
||||
m[2] - scalar,
|
||||
m[3] - scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator-(T scalar, mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
scalar - m[0],
|
||||
scalar - m[1],
|
||||
scalar - m[2],
|
||||
scalar - m[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
m1[0] - m2[0],
|
||||
m1[1] - m2[1],
|
||||
m1[2] - m2[2],
|
||||
m1[3] - m2[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar,
|
||||
m[3] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator*(T scalar, mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
m[0] * scalar,
|
||||
m[1] * scalar,
|
||||
m[2] * scalar,
|
||||
m[3] * scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 4, T, Q>::col_type operator*
|
||||
(
|
||||
|
@ -706,38 +502,6 @@ namespace glm
|
|||
return detail::mul4x4<T, Q, detail::is_aligned<Q>::value>::call(m1, m2);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m, T scalar)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
m[0] / scalar,
|
||||
m[1] / scalar,
|
||||
m[2] / scalar,
|
||||
m[3] / scalar);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator/(T scalar, mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
return mat<4, 4, T, Q>(
|
||||
scalar / m[0],
|
||||
scalar / m[1],
|
||||
scalar / m[2],
|
||||
scalar / m[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 4, T, Q>::col_type operator/(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v)
|
||||
{
|
||||
return inverse(m) * v;
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 4, T, Q>::row_type operator/(typename mat<4, 4, T, Q>::col_type const& v, mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
return v * inverse(m);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2)
|
||||
{
|
||||
|
@ -745,19 +509,6 @@ namespace glm
|
|||
return m1_copy /= m2;
|
||||
}
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#if GLM_CONFIG_SIMD == GLM_ENABLE
|
||||
|
|
209
util/generate_common_mat_operators.py
Normal file
209
util/generate_common_mat_operators.py
Normal file
|
@ -0,0 +1,209 @@
|
|||
import itertools
|
||||
import sys
|
||||
|
||||
def make_unary_minus(column_count,filename):
|
||||
mat_def = f"mat<{column_count},R,T,Q>"
|
||||
sys.stdout = open(f"{filename}.hpp", 'a')
|
||||
print(f"""
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR {mat_def} operator-({mat_def} const& m);
|
||||
""" ,end="")
|
||||
sys.stdout.close()
|
||||
|
||||
sys.stdout = open(f"{filename}.inl", 'a')
|
||||
print(f"""
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR {mat_def} operator-({mat_def} const& m) {{
|
||||
return {mat_def}({",".join([f"-m[{i}]" for i in range(0,column_count)])});
|
||||
}}
|
||||
""" ,end="")
|
||||
sys.stdout.close()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def make_prefix_incr_decr_funcs(column_count,filename):
|
||||
op_symbols = ["++","--"]
|
||||
sys.stdout = open(f"{filename}.hpp", 'a')
|
||||
mat_def = f"mat<{column_count},R,T,Q>"
|
||||
for op_symbol in op_symbols:
|
||||
print(f"""
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR {mat_def}& operator{op_symbol}({mat_def}& m);
|
||||
""" ,end="")
|
||||
sys.stdout.close()
|
||||
|
||||
sys.stdout = open(f"{filename}.inl", 'a')
|
||||
for op_symbol in op_symbols:
|
||||
print(f"""
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR {mat_def}& operator{op_symbol}({mat_def}& m) {{
|
||||
{" ".join([f"{op_symbol}m[{i}];" + ("\n" if i != column_count-1 else "") for i in range(0,column_count)])}
|
||||
return m;
|
||||
}}
|
||||
""" ,end="")
|
||||
sys.stdout.close()
|
||||
|
||||
|
||||
|
||||
|
||||
def make_equality_funcs(column_count,filename):
|
||||
sys.stdout = open(f"{filename}.hpp", 'a')
|
||||
mat_def = f"mat<{column_count},R,T,Q>"
|
||||
print(f"""
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==({mat_def} const& m1, {mat_def} const& m2);
|
||||
""" ,end="")
|
||||
sys.stdout.close()
|
||||
|
||||
sys.stdout = open(f"{filename}.inl", 'a')
|
||||
print(f"""
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR bool operator==({mat_def} const& m1, {mat_def} const& m2) {{
|
||||
return {" && ".join([f"(m1[{i}] == m2[{i}])" for i in range(0,column_count)])};
|
||||
}}
|
||||
""" ,end="")
|
||||
sys.stdout.close()
|
||||
|
||||
def make_binary_scalar_funcs(op_symbols,column_count,filename):
|
||||
mat_def = f"mat<{column_count},R,T,Q>"
|
||||
col_range = range(0,column_count)
|
||||
template = """
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<{column_count},R, T, Q> operator{op_symbol}(mat<{column_count},R, T, Q> const& m, T scalar);
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR mat<{column_count},R, T, Q> operator{op_symbol}(T scalar,mat<{column_count},R, T, Q> const& m);
|
||||
"""
|
||||
sys.stdout = open(f"{filename}.hpp", 'a')
|
||||
for op_symbol in op_symbols:
|
||||
print(template.format(
|
||||
op_symbol= op_symbol,
|
||||
column_count= column_count
|
||||
),end="")
|
||||
sys.stdout.close()
|
||||
|
||||
|
||||
sys.stdout = open(f"{filename}.inl", 'a')
|
||||
for op_symbol in op_symbols:
|
||||
print(f"""
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<{column_count},R, T, Q> operator{op_symbol}(mat<{column_count},R, T, Q> const& m, T scalar) {{
|
||||
return mat<{column_count},R,T,Q>({",".join([f"m[{i}] {op_symbol} scalar" for i in range(0,column_count)])});
|
||||
}}
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<{column_count},R, T, Q> operator{op_symbol}(T scalar,mat<{column_count},R, T, Q> const& m) {{
|
||||
return mat<{column_count},R,T,Q>({",".join([f"scalar {op_symbol} m[{i}]" for i in range(0,column_count)])});
|
||||
}}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR {mat_def}& operator{op_symbol}=({mat_def}& m, U scalar) {{
|
||||
{" ".join([f"m[{i}] {op_symbol}= scalar;" + ("\n" if i != col_range.stop-1 else "") for i in col_range])}
|
||||
return m;
|
||||
}}
|
||||
""",end="")
|
||||
sys.stdout.close()
|
||||
|
||||
|
||||
def make_binary_mat_funcs(op_symbols,column_count,filename):
|
||||
col_range = range(0,column_count)
|
||||
mat_def = f"mat<{column_count},R,T,Q>"
|
||||
mat_def_U = f"mat<{column_count},R,U,Q>"
|
||||
|
||||
sys.stdout = open(f"{filename}.hpp", 'a')
|
||||
for op_symbol in op_symbols:
|
||||
|
||||
print(f"""
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR {mat_def} operator{op_symbol}({mat_def} const& m1, {mat_def} const& m2);
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR {mat_def}& operator{op_symbol}=({mat_def}& m1, {mat_def_U} const& m2);
|
||||
""",end="")
|
||||
sys.stdout.close()
|
||||
|
||||
|
||||
sys.stdout = open(f"{filename}.inl", 'a')
|
||||
for op_symbol in op_symbols:
|
||||
print(f"""
|
||||
template<length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR {mat_def} operator{op_symbol}({mat_def} const& m1, {mat_def} const& m2) {{
|
||||
return {mat_def}({",".join([f"m1[{i}] {op_symbol} m2[{i}]" for i in col_range])});
|
||||
}}
|
||||
template<length_t R, typename T, qualifier Q,typename U>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR {mat_def}& operator{op_symbol}=({mat_def}& m1, {mat_def_U} const& m2) {{
|
||||
{" ".join([f"m1[{i}] {op_symbol}= m2[{i}];" + ("\n" if i != col_range.stop-1 else "") for i in col_range])}
|
||||
return m1;
|
||||
}}
|
||||
""",end="")
|
||||
sys.stdout.close()
|
||||
|
||||
|
||||
def make_scalar_commutative_operators(op_symbols,filename):
|
||||
template = """
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> operator{op_symbol}(T scalar,vec<L, T, Q> const& v);
|
||||
"""
|
||||
sys.stdout = open(f"{filename}.hpp", 'a')
|
||||
for op_symbol in op_symbols:
|
||||
print(template.format(
|
||||
op_symbol= op_symbol
|
||||
),end="")
|
||||
sys.stdout.close()
|
||||
|
||||
template = """
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator{op_symbol}(T scalar,vec<L, T, Q> const& v) {{
|
||||
return v {op_symbol} scalar;
|
||||
}}
|
||||
"""
|
||||
sys.stdout = open(f"{filename}.inl", 'a')
|
||||
for op_symbol in op_symbols:
|
||||
print(template.format(
|
||||
op_symbol= op_symbol
|
||||
),end="")
|
||||
sys.stdout.close()
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
for C in range(2,5):
|
||||
filename = f"mat{C}xR_common_operators"
|
||||
sys.stdout = open(f"{filename}.hpp",'w')
|
||||
print("""
|
||||
#pragma once
|
||||
#include "qualifier.hpp"
|
||||
#include "mat_common_operators.hpp"
|
||||
namespace glm {
|
||||
""")
|
||||
sys.stdout.close()
|
||||
|
||||
sys.stdout = open(f"{filename}.inl",'w')
|
||||
print("""
|
||||
namespace glm {
|
||||
""")
|
||||
sys.stdout.close()
|
||||
|
||||
make_unary_minus(C,filename)
|
||||
make_prefix_incr_decr_funcs(C,filename)
|
||||
make_equality_funcs(C,filename)
|
||||
make_binary_mat_funcs(['+', '-'],C,filename)
|
||||
make_binary_scalar_funcs(['+', '-', '*','/'],C,filename)
|
||||
|
||||
sys.stdout = open(f"{filename}.hpp",'a')
|
||||
print(f"""
|
||||
}}
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "{filename}.inl"
|
||||
#endif
|
||||
""")
|
||||
sys.stdout.close()
|
||||
|
||||
|
||||
sys.stdout = open(f"{filename}.inl",'a')
|
||||
print("""
|
||||
}
|
||||
""")
|
||||
sys.stdout.close()
|
||||
|
||||
#make_scalar_commutative_operators(['+', '*'],"mat")
|
Loading…
Add table
Reference in a new issue