Add ostream operator<< for glm::vec{2,3,4}
This commit is contained in:
parent
b6f053466d
commit
81078a6b49
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
// prettifies some of the maths with vectors
|
// prettifies some of the maths with vectors
|
||||||
|
|
||||||
|
@ -18,3 +19,8 @@ constexpr glm::vec4 operator*(double lhs, glm::vec4 rhs) { return rhs * lhs; }
|
||||||
constexpr glm::vec4 operator/(double lhs, glm::vec4 rhs) { return rhs / lhs; }
|
constexpr glm::vec4 operator/(double lhs, glm::vec4 rhs) { return rhs / lhs; }
|
||||||
|
|
||||||
constexpr glm::vec2 flip(glm::vec2 a) { return {a.y, a.x}; }
|
constexpr glm::vec2 flip(glm::vec2 a) { return {a.y, a.x}; }
|
||||||
|
|
||||||
|
|
||||||
|
inline std::ostream& operator<<(std::ostream& os, vec2 v) { return os << "vec2(" << v.x << ", " << v.y << ")"; }
|
||||||
|
inline std::ostream& operator<<(std::ostream& os, vec3 v) { return os << "vec3(" << v.x << ", " << v.y << ", " << v.z << ")"; }
|
||||||
|
inline std::ostream& operator<<(std::ostream& os, vec4 v) { return os << "vec4(" << v.x << ", " << v.y << ", " << v.z << ", " << v.w << ")"; }
|
||||||
|
|
Loading…
Reference in New Issue