Added GLM_FORCE_EXPLICIT_CTOR to require explicit type conversions #269
This commit is contained in:
@@ -95,6 +95,14 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Convertions
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tquat(tquat<U, Q> const & q);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tquat(tquat<U, Q> const & q);
|
||||
# endif
|
||||
|
||||
/// Create a quaternion from two normalized axis
|
||||
///
|
||||
/// @param u A first normalized axis
|
||||
@@ -102,6 +110,7 @@ namespace glm
|
||||
/// @see gtc_quaternion
|
||||
/// @see http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
|
||||
GLM_FUNC_DECL explicit tquat(tvec3<T, P> const & u, tvec3<T, P> const & v);
|
||||
|
||||
/// Build a quaternion from euler angles (pitch, yaw, roll), in radians.
|
||||
GLM_FUNC_DECL explicit tquat(tvec3<T, P> const & eulerAngles);
|
||||
GLM_FUNC_DECL explicit tquat(tmat3x3<T, P> const & m);
|
||||
|
||||
@@ -106,12 +106,21 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(T const & w, T const & x, T const & y, T const & z)
|
||||
: x(x), y(y), z(z), w(w)
|
||||
: x(x), y(y), z(z), w(w)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Conversions
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tquat<U, Q> const & q)
|
||||
: x(static_cast<T>(q.x))
|
||||
, y(static_cast<T>(q.y))
|
||||
, z(static_cast<T>(q.z))
|
||||
, w(static_cast<T>(q.w))
|
||||
{}
|
||||
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER tquat<valType>::tquat
|
||||
//(
|
||||
|
||||
Reference in New Issue
Block a user