mirror of
https://github.com/g-truc/glm.git
synced 2024-11-16 06:44:35 +00:00
Add templated conversions from smaller vector types to larger ones
This commit is contained in:
parent
185e9e257b
commit
7ed3456ca3
@ -161,6 +161,10 @@ namespace glm
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tvec3(tvec3<U, Q> const & v);
|
||||
|
||||
/// Other explicit conversions
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tvec3(tvec2<U, Q> const & v);
|
||||
|
||||
// -- Swizzle constructors --
|
||||
|
||||
# if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
|
||||
|
@ -166,6 +166,14 @@ namespace glm
|
||||
z(static_cast<T>(v.z))
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec2<U, Q> const & v) :
|
||||
x(static_cast<T>(v.x)),
|
||||
y(static_cast<T>(v.y)),
|
||||
z(static_cast<T>(0))
|
||||
{}
|
||||
|
||||
// -- Component accesses --
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
|
@ -244,6 +244,13 @@ namespace detail
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tvec4(tvec4<U, Q> const & v);
|
||||
|
||||
/// Other explicit conversions
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tvec4(tvec2<U, Q> const & v);
|
||||
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tvec4(tvec3<U, Q> const & v);
|
||||
|
||||
// -- Swizzle constructors --
|
||||
|
||||
# if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
|
||||
|
@ -268,6 +268,24 @@ namespace glm
|
||||
w(static_cast<T>(v.w))
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec2<U, Q> const & v) :
|
||||
x(static_cast<T>(v.x)),
|
||||
y(static_cast<T>(v.y)),
|
||||
z(static_cast<T>(0)),
|
||||
w(static_cast<T>(0))
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec3<U, Q> const & v) :
|
||||
x(static_cast<T>(v.x)),
|
||||
y(static_cast<T>(v.y)),
|
||||
z(static_cast<T>(v.z)),
|
||||
w(static_cast<T>(0))
|
||||
{}
|
||||
|
||||
// -- Component accesses --
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
|
Loading…
Reference in New Issue
Block a user