mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 02:04:35 +00:00
Fixed glm::to_string on quaternions wrong components order #681
This commit is contained in:
parent
1bf24f8344
commit
a2497e6174
@ -446,15 +446,15 @@ namespace detail
|
||||
{
|
||||
char const * PrefixStr = prefix<T>::value();
|
||||
char const * LiteralStr = literal<T, std::numeric_limits<T>::is_iec559>::value();
|
||||
std::string FormatStr(detail::format("%squat(%s, %s, %s, %s)",
|
||||
std::string FormatStr(detail::format("%squat(%s, {%s, %s, %s})",
|
||||
PrefixStr,
|
||||
LiteralStr, LiteralStr, LiteralStr, LiteralStr));
|
||||
|
||||
return detail::format(FormatStr.c_str(),
|
||||
static_cast<typename cast<T>::value_type>(x[3]),
|
||||
static_cast<typename cast<T>::value_type>(x[0]),
|
||||
static_cast<typename cast<T>::value_type>(x[1]),
|
||||
static_cast<typename cast<T>::value_type>(x[2]),
|
||||
static_cast<typename cast<T>::value_type>(x[3]));
|
||||
static_cast<typename cast<T>::value_type>(x[2]));
|
||||
}
|
||||
};
|
||||
|
||||
@ -465,19 +465,19 @@ namespace detail
|
||||
{
|
||||
char const * PrefixStr = prefix<T>::value();
|
||||
char const * LiteralStr = literal<T, std::numeric_limits<T>::is_iec559>::value();
|
||||
std::string FormatStr(detail::format("%sdualquat((%s, %s, %s, %s), (%s, %s, %s, %s))",
|
||||
std::string FormatStr(detail::format("%sdualquat((%s, {%s, %s, %s}), (%s, {%s, %s, %s}))",
|
||||
PrefixStr,
|
||||
LiteralStr, LiteralStr, LiteralStr, LiteralStr));
|
||||
|
||||
return detail::format(FormatStr.c_str(),
|
||||
static_cast<typename cast<T>::value_type>(x.real[3]),
|
||||
static_cast<typename cast<T>::value_type>(x.real[0]),
|
||||
static_cast<typename cast<T>::value_type>(x.real[1]),
|
||||
static_cast<typename cast<T>::value_type>(x.real[2]),
|
||||
static_cast<typename cast<T>::value_type>(x.real[3]),
|
||||
static_cast<typename cast<T>::value_type>(x.dual[3]),
|
||||
static_cast<typename cast<T>::value_type>(x.dual[0]),
|
||||
static_cast<typename cast<T>::value_type>(x.dual[1]),
|
||||
static_cast<typename cast<T>::value_type>(x.dual[2]),
|
||||
static_cast<typename cast<T>::value_type>(x.dual[3]));
|
||||
static_cast<typename cast<T>::value_type>(x.dual[2]));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -102,6 +102,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
|
||||
- Fixed GLM_HAS_OPENMP when OpenMP is not enabled
|
||||
- Fixed Better follow GLSL min and max specification #372
|
||||
- Fixed quaternion constructor from two vectors special cases #469
|
||||
- Fixed glm::to_string on quaternions wrong components order #681
|
||||
|
||||
#### Deprecation:
|
||||
- Requires Visual Studio 2013, GCC 4.7, Clang 3.4, Cuda 7, ICC 2013 or a C++11 compiler
|
||||
|
@ -117,11 +117,24 @@ int test_string_cast_matrix()
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_string_cast_quaternion()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::quat Q0 = glm::quat(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
std::string S0 = glm::to_string(Q0);
|
||||
Error += S0 != std::string("quat(1.000000, {2.000000, 3.000000, 4.000000})") ? 1 : 0;
|
||||
|
||||
return Error;
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
Error += test_string_cast_vector();
|
||||
Error += test_string_cast_matrix();
|
||||
Error += test_string_cast_quaternion();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user