summaryrefslogtreecommitdiff
path: root/lib/stream_support.hpp
blob: 449708c15882f1f17165aa2b8da17bcfa14aeba7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include <glm/glm.hpp>
#include <iostream>
#include <maths.h>

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";
		}
		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;
	}

	inline std::ostream &
	operator<<(std::ostream & s, const Arc & arc)
	{
		return s << arc.first << " ↺ " << arc.second;
	}
}

#define CLOG(x) std::clog << #x " : " << x << "\n";