glm_lerpc(), glm_step(), glm_smoothstep(), glm_smoothinterp() (#98)

* lerp, step, smoothstep

* glm_lerp() and friends are no longer clamped, use glm_lerpc() and friends
* mix() function as wrapper of lerp()
* no there are clamp and raw version of lerp functions
This commit is contained in:
Luigi Castelli
2019-08-25 21:17:36 +02:00
committed by Recep Aslantas
parent 43b36f1dc1
commit 4639f3184a
13 changed files with 978 additions and 23 deletions

View File

@@ -33,6 +33,7 @@
CGLM_INLINE mat3s glms_quat_mat3(versors q)
CGLM_INLINE mat3s glms_quat_mat3t(versors q)
CGLM_INLINE versors glms_quat_lerp(versors from, versors to, float t)
CGLM_INLINE versors glms_quat_lerpc(versors from, versors to, float t)
CGLM_INLINE versors glms_quat_slerp(versors from, versors to, float t)
CGLM_INLINE mat4s. glms_quat_look(vec3s eye, versors ori)
CGLM_INLINE versors glms_quat_for(vec3s dir, vec3s fwd, vec3s up)
@@ -372,7 +373,7 @@ glms_quat_mat3t(versors q) {
*
* @param[in] from from
* @param[in] to to
* @param[in] t interpolant (amount) clamped between 0 and 1
* @param[in] t interpolant (amount)
* @returns result quaternion
*/
CGLM_INLINE
@@ -383,6 +384,23 @@ glms_quat_lerp(versors from, versors to, float t) {
return dest;
}
/*!
* @brief interpolates between two quaternions
* using linear interpolation (LERP)
*
* @param[in] from from
* @param[in] to to
* @param[in] t interpolant (amount) clamped between 0 and 1
* @returns result quaternion
*/
CGLM_INLINE
versors
glms_quat_lerpc(versors from, versors to, float t) {
versors dest;
glm_quat_lerpc(from.raw, to.raw, t, dest.raw);
return dest;
}
/*!
* @brief interpolates between two quaternions
* using spherical linear interpolation (SLERP)