Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add explicit matrix conversion operators to quat #275

Merged
merged 4 commits into from
Nov 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion glm/gtc/quaternion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ namespace glm
template <typename U, precision Q>
GLM_FUNC_DECL tquat(tquat<U, Q> const & q);
# endif


// explicit conversion operators
GLM_FUNC_DECL explicit operator tmat3x3<T, P>();
GLM_FUNC_DECL explicit operator tmat4x4<T, P>();

/// Create a quaternion from two normalized axis
///
/// @param u A first normalized axis
Expand Down
12 changes: 12 additions & 0 deletions glm/gtc/quaternion.inl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ namespace detail
{
*this = quat_cast(m);
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P>::operator tmat3x3<T, P>()
{
return mat3_cast(*this);
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P>::operator tmat4x4<T, P>()
{
return mat4_cast(*this);
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> conjugate(tquat<T, P> const & q)
Expand Down