-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.hpp
67 lines (54 loc) · 1.57 KB
/
util.hpp
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef UTIL_H
#define UTIL_H
#include <string>
#include <iostream>
#include <glm/glm.hpp>
#define vec2Type typename glm::tvec2<T,P>
#define vec3Type typename glm::tvec3<T,P>
#define vec4Type typename glm::tvec4<T,P>
template <typename T, glm::precision P>
std::ostream& operator<<(std::ostream& os, const vec3Type& vec) {
os << "(" << vec[0] << ", " << vec[1] << ", " << vec[2] << ")";
return os;
}
template <typename T, glm::precision P>
std::istream& operator>>(std::istream& is, vec3Type& vec) {
is >> vec[0];
is >> vec[1];
is >> vec[2];
return is;
}
template <typename T, glm::precision P>
std::ostream& operator<<(std::ostream& os, const vec4Type& vec) {
os << "(" << vec[0] << ", " << vec[1] << ", " << vec[2] << ", " << vec[3] << ")";
return os;
}
template <typename T, glm::precision P>
std::ostream& operator<<(std::ostream& os, const vec2Type& vec) {
os << "(" << vec[0] << ", " << vec[1] << ")";
return os;
}
template <typename T, glm::precision P>
std::istream& operator>>(std::istream& is, vec4Type& vec) {
is >> vec[0];
is >> vec[1];
is >> vec[2];
is >> vec[3];
return is;
}
template <typename T, glm::precision P>
std::istream& operator>>(std::istream& is, vec2Type& vec) {
is >> vec[0];
is >> vec[1];
return is;
}
template <typename T, glm::precision P>
vec3Type::bool_type operator>(const vec3Type& v1, T x) {
return glm::greaterThan(v1,vec3Type(x));
}
template <typename T, glm::precision P>
vec3Type::bool_type operator<(const vec3Type& v1, T x) {
return glm::lessThan(v1,vec3Type(x));
}
void printGLErrorLog();
#endif /* UTIL_H */