Skip to content

Commit

Permalink
Switch to Julia-style Matrix4 printouts
Browse files Browse the repository at this point in the history
Multi-line format does not work well in GTest output, where the first row is
indented and misaligned relative to the subsequent rows. The Julia format is a
single line with columns separated by spaces and rows separated by semicolons,
i.e.:

[1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1]
  • Loading branch information
Matthew Mott committed Mar 20, 2021
1 parent 94c69a4 commit 7f007e1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions libs/math/Matrix4.h
Expand Up @@ -1146,13 +1146,12 @@ inline void Matrix4::scaleBy(const Vector3& scale, const Vector3& pivot)
translateBy(-pivot);
}

/** Stream insertion operator for Matrix4.
*/
/// Debug stream insertion operator for Matrix4
inline std::ostream& operator<<(std::ostream& st, const Matrix4& m)
{
st << "|" << m[0] << ", " << m[4] << ", " << m[8] << ", " << m[12] << "|\n";
st << "|" << m[1] << ", " << m[5] << ", " << m[9] << ", " << m[13] << "|\n";
st << "|" << m[2] << ", " << m[6] << ", " << m[10] << ", " << m[14] << "|\n";
st << "|" << m[3] << ", " << m[7] << ", " << m[11] << ", " << m[15] << "|\n";
st << "[" << m[0] << " " << m[4] << " " << m[8] << " " << m[12] << "; ";
st << m[1] << " " << m[5] << " " << m[9] << " " << m[13] << "; ";
st << m[2] << " " << m[6] << " " << m[10] << " " << m[14] << "; ";
st << m[3] << " " << m[7] << " " << m[11] << " " << m[15] << "]";
return st;
}

0 comments on commit 7f007e1

Please sign in to comment.