Merged 0.9.6 branch
This commit is contained in:
@@ -91,6 +91,7 @@ namespace glm
|
||||
// Implicit basic constructors
|
||||
|
||||
GLM_FUNC_DECL tquat();
|
||||
GLM_FUNC_DECL tquat(tquat<T, P> const & q);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tquat(tquat<T, Q> const & q);
|
||||
|
||||
@@ -133,10 +134,19 @@ namespace glm
|
||||
|
||||
//////////////////////////////////////
|
||||
// Operators
|
||||
GLM_FUNC_DECL tquat<T, P> & operator+=(tquat<T, P> const & q);
|
||||
GLM_FUNC_DECL tquat<T, P> & operator*=(tquat<T, P> const & q);
|
||||
GLM_FUNC_DECL tquat<T, P> & operator*=(T const & s);
|
||||
GLM_FUNC_DECL tquat<T, P> & operator/=(T const & s);
|
||||
|
||||
GLM_FUNC_DECL tquat<T, P> & operator=(tquat<T, P> const & m);
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator=(tquat<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator+=(tquat<U, P> const & q);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator*=(tquat<U, P> const & q);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator/=(U s);
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
|
||||
@@ -104,6 +104,11 @@ namespace detail
|
||||
# endif
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tquat<T, P> const & q)
|
||||
: x(q.x), y(q.y), z(q.z), w(q.w)
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tquat<T, Q> const & q)
|
||||
@@ -176,7 +181,7 @@ namespace detail
|
||||
this->w = c.x * c.y * c.z + s.x * s.y * s.z;
|
||||
this->x = s.x * c.y * c.z - c.x * s.y * s.z;
|
||||
this->y = c.x * s.y * c.z + s.x * c.y * s.z;
|
||||
this->z = c.x * c.y * s.z - s.x * s.y * c.z;
|
||||
this->z = c.x * c.y * s.z - s.x * s.y * c.z;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
@@ -221,19 +226,43 @@ namespace detail
|
||||
// tquat<valType> operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator+=(tquat<T, P> const & q)
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator=(tquat<T, P> const & q)
|
||||
{
|
||||
this->w += q.w;
|
||||
this->x += q.x;
|
||||
this->y += q.y;
|
||||
this->z += q.z;
|
||||
this->w = q.w;
|
||||
this->x = q.x;
|
||||
this->y = q.y;
|
||||
this->z = q.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator*=(tquat<T, P> const & q)
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator=(tquat<U, P> const & q)
|
||||
{
|
||||
this->w = static_cast<T>(q.w);
|
||||
this->x = static_cast<T>(q.x);
|
||||
this->y = static_cast<T>(q.y);
|
||||
this->z = static_cast<T>(q.z);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator+=(tquat<U, P> const & q)
|
||||
{
|
||||
this->w += static_cast<T>(q.w);
|
||||
this->x += static_cast<T>(q.x);
|
||||
this->y += static_cast<T>(q.y);
|
||||
this->z += static_cast<T>(q.z);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator*=(tquat<U, P> const & r)
|
||||
{
|
||||
tquat<T, P> const p(*this);
|
||||
tquat<T, P> const q(r);
|
||||
|
||||
this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z;
|
||||
this->x = p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y;
|
||||
@@ -242,23 +271,25 @@ namespace detail
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator*=(T const & s)
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator*=(U s)
|
||||
{
|
||||
this->w *= s;
|
||||
this->x *= s;
|
||||
this->y *= s;
|
||||
this->z *= s;
|
||||
this->w *= static_cast<U>(s);
|
||||
this->x *= static_cast<U>(s);
|
||||
this->y *= static_cast<U>(s);
|
||||
this->z *= static_cast<U>(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator/=(T const & s)
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator/=(U s)
|
||||
{
|
||||
this->w /= s;
|
||||
this->x /= s;
|
||||
this->y /= s;
|
||||
this->z /= s;
|
||||
this->w /= static_cast<U>(s);
|
||||
this->x /= static_cast<U>(s);
|
||||
this->y /= static_cast<U>(s);
|
||||
this->z /= static_cast<U>(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user