From ca755a2fba305de397d1786c8e094b9910d6a09c Mon Sep 17 00:00:00 2001 From: leozide Date: Wed, 19 Jul 2017 15:31:47 -0700 Subject: [PATCH] Added QDebug operators to math classes. --- common/lc_math.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/common/lc_math.h b/common/lc_math.h index d6ef5ddc..969445a9 100644 --- a/common/lc_math.h +++ b/common/lc_math.h @@ -363,9 +363,32 @@ inline bool operator!=(const lcVector3& a, const lcVector3& b) #ifndef QT_NO_DEBUG -inline QDebug operator<<(QDebug d, const lcVector3& v) +inline QDebug operator<<(QDebug Debug, const lcVector3& v) { - return d << v.x << v.y << v.z; + QDebugStateSaver Saver(Debug); + Debug.nospace() << '(' << v.x << ", " << v.y << ", " << v.z << ')'; + return Debug; +} + +inline QDebug operator<<(QDebug Debug, const lcVector4& v) +{ + QDebugStateSaver Saver(Debug); + Debug.nospace() << '(' << v.x << ", " << v.y << ", " << v.z << ", " << v.w << ')'; + return Debug; +} + +inline QDebug operator<<(QDebug Debug, const lcMatrix33& m) +{ + QDebugStateSaver Saver(Debug); + Debug.nospace() << '[' << m[0] << ", " << m[1] << ", " << m[2] << ']'; + return Debug; +} + +inline QDebug operator<<(QDebug Debug, const lcMatrix44& m) +{ + QDebugStateSaver Saver(Debug); + Debug.nospace() << '[' << m[0] << ", " << m[1] << ", " << m[2] << ", " << m[3] << ']'; + return Debug; } #endif