manually promote glm values to double when stringifying (to prevent -Wdouble-promotion "error")

This commit is contained in:
humbletim 2017-05-04 19:21:32 -04:00
parent f9d29256e0
commit c17d1a6d88
3 changed files with 4 additions and 4 deletions

View file

@ -69,7 +69,7 @@ glm::vec3 Mat4::getUp(const glm::mat4& m) const {
}
void Mat4::print(const QString& label, const glm::mat4& m, bool transpose) const {
glm::mat4 out = transpose ? glm::transpose(m) : m;
glm::dmat4 out = transpose ? glm::transpose(m) : m;
QString message = QString("%1 %2").arg(qPrintable(label));
message = message.arg(glm::to_string(out).c_str());
qCDebug(scriptengine) << message;

View file

@ -119,9 +119,9 @@ float Quat::dot(const glm::quat& q1, const glm::quat& q2) {
void Quat::print(const QString& label, const glm::quat& q, bool asDegrees) {
QString message = QString("%1 %2").arg(qPrintable(label));
if (asDegrees) {
message = message.arg(glm::to_string(safeEulerAngles(q)).c_str());
message = message.arg(glm::to_string(glm::dvec3(safeEulerAngles(q))).c_str());
} else {
message = message.arg(glm::to_string(q).c_str());
message = message.arg(glm::to_string(glm::dquat(q)).c_str());
}
qCDebug(scriptengine) << message;
if (ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine())) {

View file

@ -29,7 +29,7 @@ float Vec3::orientedAngle(const glm::vec3& v1, const glm::vec3& v2, const glm::v
void Vec3::print(const QString& label, const glm::vec3& v) {
QString message = QString("%1 %2").arg(qPrintable(label));
message = message.arg(glm::to_string(v).c_str());
message = message.arg(glm::to_string(glm::dvec3(v)).c_str());
qCDebug(scriptengine) << message;
if (ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine())) {
scriptEngine->print(message);