mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 18:24:35 +00:00
Reduced dependencies
This commit is contained in:
parent
0ceb2b755f
commit
6543cc9ad1
@ -19,10 +19,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
#include "../gtc/constants.hpp"
|
#include "../ext/scalar_constants.hpp"
|
||||||
#include "../geometric.hpp"
|
#include "../geometric.hpp"
|
||||||
#include "../trigonometric.hpp"
|
#include "../trigonometric.hpp"
|
||||||
#include "../matrix.hpp"
|
|
||||||
|
|
||||||
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
|
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
|
||||||
# pragma message("GLM: GLM_EXT_matrix_clip_space extension included")
|
# pragma message("GLM: GLM_EXT_matrix_clip_space extension included")
|
||||||
|
@ -38,33 +38,6 @@ namespace glm
|
|||||||
/// @see ext_quaternion_transform
|
/// @see ext_quaternion_transform
|
||||||
template<typename T, qualifier Q>
|
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);
|
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
|
} //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);
|
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
|
}//namespace glm
|
||||||
|
|
||||||
|
@ -152,6 +152,32 @@ namespace glm
|
|||||||
template<typename T, qualifier Q>
|
template<typename T, qualifier Q>
|
||||||
GLM_FUNC_DECL vec<4, bool, Q> greaterThanEqual(qua<T, Q> const& x, qua<T, Q> const& y);
|
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
|
} //namespace glm
|
||||||
|
|
||||||
|
@ -157,6 +157,41 @@ namespace glm
|
|||||||
Result[i] = x[i] >= y[i];
|
Result[i] = x[i] >= y[i];
|
||||||
return Result;
|
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
|
}//namespace glm
|
||||||
|
|
||||||
#if GLM_CONFIG_SIMD == GLM_ENABLE
|
#if GLM_CONFIG_SIMD == GLM_ENABLE
|
||||||
|
@ -65,9 +65,11 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
|
|||||||
- Redesigned constexpr support which excludes both SIMD and constexpr #783
|
- Redesigned constexpr support which excludes both SIMD and constexpr #783
|
||||||
- Added detection of Visual C++ 2017 toolsets
|
- Added detection of Visual C++ 2017 toolsets
|
||||||
- Added identity functions #765
|
- Added identity functions #765
|
||||||
- Split headers to improve compilation time #670
|
- Splitted headers into EXT extensions to improve compilation time #670
|
||||||
|
- Added separated performance tests
|
||||||
|
|
||||||
#### Fixes:
|
#### Fixes:
|
||||||
|
- Fixed SIMD detection on Clang and GCC
|
||||||
- Fixed build problems due to printf and std::clock_t #778
|
- Fixed build problems due to printf and std::clock_t #778
|
||||||
- Fixed int mod
|
- Fixed int mod
|
||||||
- Anonymous unions require C++ language extensions
|
- Anonymous unions require C++ language extensions
|
||||||
|
Loading…
Reference in New Issue
Block a user