Add ostream operator<< for glm::vec{2,3,4}

This commit is contained in:
Peder Bergebakken Sundt 2019-04-02 23:26:53 +02:00
parent b6f053466d
commit 81078a6b49
1 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#pragma once
#include <GLFW/glfw3.h>
#include <iostream>
// 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::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 << ")"; }