Reduced dependencies
This commit is contained in:
@@ -19,10 +19,9 @@
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../gtc/constants.hpp"
|
||||
#include "../ext/scalar_constants.hpp"
|
||||
#include "../geometric.hpp"
|
||||
#include "../trigonometric.hpp"
|
||||
#include "../matrix.hpp"
|
||||
|
||||
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
|
||||
# pragma message("GLM: GLM_EXT_matrix_clip_space extension included")
|
||||
|
||||
@@ -38,33 +38,6 @@ namespace glm
|
||||
/// @see ext_quaternion_transform
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL qua<T, Q> rotate(qua<T, Q> const& q, T const& angle, vec<3, T, Q> const& axis);
|
||||
|
||||
/// Build a look at quaternion based on the default handedness.
|
||||
///
|
||||
/// @param direction Desired forward direction. Needs to be normalized.
|
||||
/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL qua<T, Q> quatLookAt(
|
||||
vec<3, T, Q> const& direction,
|
||||
vec<3, T, Q> const& up);
|
||||
|
||||
/// Build a right-handed look at quaternion.
|
||||
///
|
||||
/// @param direction Desired forward direction onto which the -z-axis gets mapped. Needs to be normalized.
|
||||
/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL qua<T, Q> quatLookAtRH(
|
||||
vec<3, T, Q> const& direction,
|
||||
vec<3, T, Q> const& up);
|
||||
|
||||
/// Build a left-handed look at quaternion.
|
||||
///
|
||||
/// @param direction Desired forward direction onto which the +z-axis gets mapped. Needs to be normalized.
|
||||
/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL qua<T, Q> quatLookAtLH(
|
||||
vec<3, T, Q> const& direction,
|
||||
vec<3, T, Q> const& up);
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
|
||||
@@ -20,39 +20,5 @@ namespace glm
|
||||
|
||||
return q * qua<T, Q>(cos(AngleRad * static_cast<T>(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER qua<T, Q> quatLookAt(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
|
||||
{
|
||||
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
|
||||
return quatLookAtLH(direction, up);
|
||||
# else
|
||||
return quatLookAtRH(direction, up);
|
||||
# endif
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER qua<T, Q> quatLookAtRH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
|
||||
{
|
||||
mat<3, 3, T, Q> Result;
|
||||
|
||||
Result[2] = -direction;
|
||||
Result[0] = normalize(cross(up, Result[2]));
|
||||
Result[1] = cross(Result[2], Result[0]);
|
||||
|
||||
return quat_cast(Result);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER qua<T, Q> quatLookAtLH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
|
||||
{
|
||||
mat<3, 3, T, Q> Result;
|
||||
|
||||
Result[2] = direction;
|
||||
Result[0] = normalize(cross(up, Result[2]));
|
||||
Result[1] = cross(Result[2], Result[0]);
|
||||
|
||||
return quat_cast(Result);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
|
||||
@@ -152,6 +152,32 @@ namespace glm
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, bool, Q> greaterThanEqual(qua<T, Q> const& x, qua<T, Q> const& y);
|
||||
|
||||
/// Build a look at quaternion based on the default handedness.
|
||||
///
|
||||
/// @param direction Desired forward direction. Needs to be normalized.
|
||||
/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL qua<T, Q> quatLookAt(
|
||||
vec<3, T, Q> const& direction,
|
||||
vec<3, T, Q> const& up);
|
||||
|
||||
/// Build a right-handed look at quaternion.
|
||||
///
|
||||
/// @param direction Desired forward direction onto which the -z-axis gets mapped. Needs to be normalized.
|
||||
/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL qua<T, Q> quatLookAtRH(
|
||||
vec<3, T, Q> const& direction,
|
||||
vec<3, T, Q> const& up);
|
||||
|
||||
/// Build a left-handed look at quaternion.
|
||||
///
|
||||
/// @param direction Desired forward direction onto which the +z-axis gets mapped. Needs to be normalized.
|
||||
/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL qua<T, Q> quatLookAtLH(
|
||||
vec<3, T, Q> const& direction,
|
||||
vec<3, T, Q> const& up);
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
|
||||
@@ -157,6 +157,41 @@ namespace glm
|
||||
Result[i] = x[i] >= y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER qua<T, Q> quatLookAt(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
|
||||
{
|
||||
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
|
||||
return quatLookAtLH(direction, up);
|
||||
# else
|
||||
return quatLookAtRH(direction, up);
|
||||
# endif
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER qua<T, Q> quatLookAtRH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
|
||||
{
|
||||
mat<3, 3, T, Q> Result;
|
||||
|
||||
Result[2] = -direction;
|
||||
Result[0] = normalize(cross(up, Result[2]));
|
||||
Result[1] = cross(Result[2], Result[0]);
|
||||
|
||||
return quat_cast(Result);
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER qua<T, Q> quatLookAtLH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
|
||||
{
|
||||
mat<3, 3, T, Q> Result;
|
||||
|
||||
Result[2] = direction;
|
||||
Result[0] = normalize(cross(up, Result[2]));
|
||||
Result[1] = cross(Result[2], Result[0]);
|
||||
|
||||
return quat_cast(Result);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#if GLM_CONFIG_SIMD == GLM_ENABLE
|
||||
|
||||
Reference in New Issue
Block a user