diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-02-14 13:08:02 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-02-14 13:08:02 +0000 |
commit | ec5d61a7d62e31359275f1df293c18a54e33c399 (patch) | |
tree | 63f09f92f4c54dc54c584bbfb3f5f76aebbb4bb6 /utility | |
parent | Construct an Arc from three points (diff) | |
download | ilt-ec5d61a7d62e31359275f1df293c18a54e33c399.tar.bz2 ilt-ec5d61a7d62e31359275f1df293c18a54e33c399.tar.xz ilt-ec5d61a7d62e31359275f1df293c18a54e33c399.zip |
Move stream operators into ns std, add support for Arc
Diffstat (limited to 'utility')
-rw-r--r-- | utility/stream_support.hpp | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/utility/stream_support.hpp b/utility/stream_support.hpp index 9561e58..7e070b0 100644 --- a/utility/stream_support.hpp +++ b/utility/stream_support.hpp @@ -1,30 +1,40 @@ #ifndef STREAM_SUPPORT_H #define STREAM_SUPPORT_H +#include <glm/glm.hpp> #include <iostream> +#include <maths.h> -template<glm::length_t L, glm::length_t R, typename T, glm::qualifier Q> -std::ostream & -operator<<(std::ostream & s, const glm::mat<L, R, T, Q> & m) -{ - for (int y = 0; y < m.length(); y++) { - const auto & col = m[y]; - for (int x = 0; x < col.length(); x++) { - s << col[x] << ", "; +namespace std { + template<glm::length_t L, glm::length_t R, typename T, glm::qualifier Q> + std::ostream & + operator<<(std::ostream & s, const glm::mat<L, R, T, Q> & m) + { + for (int y = 0; y < m.length(); y++) { + const auto & col = m[y]; + for (int x = 0; x < col.length(); x++) { + s << col[x] << ", "; + } + s << "\n"; } - s << "\n"; + return s; + } + + template<glm::length_t L, typename T, glm::qualifier Q> + std::ostream & + operator<<(std::ostream & s, const glm::vec<L, T, Q> & v) + { + for (int x = 0; x < L; x++) { + s << v[x] << ", "; + } + return s; } - return s; -} -template<glm::length_t L, typename T, glm::qualifier Q> -std::ostream & -operator<<(std::ostream & s, const glm::vec<L, T, Q> & v) -{ - for (int x = 0; x < L; x++) { - s << v[x] << ", "; + std::ostream & + operator<<(std::ostream & s, const Arc & arc) + { + return s << arc.first << " ↺ " << arc.second; } - return s; } #endif |