-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Hi,
When attempting to compile code which includes both glm/gtc/quaternion.hpp and glm/gtx/compatibility.hpp, I receive the following error:
error: call of overloaded ‘slerp(const quat&, const quat&, const float&)’ is ambiguous
const glm::quat slerped_quat = glm::slerp(first_keyframe_rot, second_keyframe_rot, interpolation_value);
.../animation.cpp:67:109: note: candidates are:
In file included from /usr/local/include/glm/gtc/quaternion.hpp:365:0,
from .../keyframe.h:9,
from .../animation.h:6,
from .../animation.cpp:1:
/usr/local/include/glm/gtc/quaternion.inl:485:33: note: glm::tquat<T, P> glm::slerp(const glm::tquat<T, P>&, const glm::tquat<T, P>&, const T&) [with T = float; glm::precision P = (glm::precision)0u]
GLM_FUNC_QUALIFIER tquat<T, P> slerp(tquat<T, P> const & x, tquat<T, P> const & y, T const & a)
^
In file included from .../animation.cpp:7:0:
/usr/local/include/glm/gtx/compatibility.hpp:76:58: note: T glm::slerp(const glm::tquat<T, P>&, const glm::tquat<T, P>&, const T&) [with T = float; glm::precision P = (glm::precision)0u]
template <typename T, precision P> GLM_FUNC_QUALIFIER T slerp(tquat<T, P> const & x, tquat<T, P> const & y, T const & a){return mix(x, y, a);} //!< \brief Returns the slurp interpolation between two quaternions.
And here's the function call I'm making, with the definitions of the relevant variables:
const float first_keyframe_time = m_keyframes[i-1].Time();
const glm::quat first_keyframe_rot = m_keyframes[i-1].GetRotation(bone_name);
const float second_keyframe_time = m_keyframes[i].Time();
const glm::quat second_keyframe_rot = m_keyframes[i].GetRotation(bone_name);
const float interpolation_value = (normalised_time - first_keyframe_time)/(second_keyframe_time - first_keyframe_time);
const glm::quat slerped_quat = glm::slerp(first_keyframe_rot, second_keyframe_rot, interpolation_value);
If I remove either include (and comment out the functions from that header), the code compiles fine. I get the same results in both 0.9.6 and 0.9.5.
I'm afraid I'm not the most experienced with this sort of thing, so if it's a mistake on my end, I apologise in advance for taking up your time. If there's anything else I can provide, please let me know.
Thanks for your great work on GLM,
~Richard Williams
Edit: I've fixed where I accidentally referred to gtc/quaternion as gtx/quaternion and then subsequently referred to a function from gtx/quaternion.