Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-05-18 22:27:43 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-05-19 00:01:07 +0300
commitc4c6ea7ea9f151ef79a13ae933029b1c6060eb69 (patch)
tree82cf2c25ccd6c2b06a177b7f706641824f564b3a /source/blender/blenlib/BLI_float4x4.hh
parentc34e3f0f1925aa3a90f5d2a157ae42310d1f7e84 (diff)
BLI: float4x4: Add << operator
Use nice formating to have lining up rows.
Diffstat (limited to 'source/blender/blenlib/BLI_float4x4.hh')
-rw-r--r--source/blender/blenlib/BLI_float4x4.hh19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_float4x4.hh b/source/blender/blenlib/BLI_float4x4.hh
index 9f7fbffc692..1ed4d2f1ae1 100644
--- a/source/blender/blenlib/BLI_float4x4.hh
+++ b/source/blender/blenlib/BLI_float4x4.hh
@@ -246,6 +246,25 @@ struct float4x4 {
}
return h;
}
+
+ friend std::ostream &operator<<(std::ostream &stream, const float4x4 &mat)
+ {
+ char fchar[16];
+ stream << "(\n";
+ for (int i = 0; i < 4; i++) {
+ stream << "(";
+ for (int j = 0; j < 4; j++) {
+ snprintf(fchar, sizeof(fchar), "%11.6f", mat[j][i]);
+ stream << fchar;
+ if (i != 3) {
+ stream << ", ";
+ }
+ }
+ stream << ")\n";
+ }
+ stream << ")\n";
+ return stream;
+ }
};
} // namespace blender