stream operator for all variants of glm vec
This commit is contained in:
parent
f70ea1c215
commit
a6bcc2a4d9
|
@ -647,18 +647,6 @@ int lineColor(SDL_Renderer* renderer, const Segment& segment, const Color& color
|
|||
}
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const glm::vec2& vector)
|
||||
{
|
||||
out << "{" << vector.x << ", " << vector.y << "}";
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const glm::vec3& vector)
|
||||
{
|
||||
out << "{" << vector.x << ", " << vector.y << ", " << vector.z << "}";
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const SDL_Color& color)
|
||||
{
|
||||
out << "{" << static_cast<int>(color.r) << ", " << static_cast<int>(color.g) << ", " <<
|
||||
|
|
|
@ -202,8 +202,24 @@ std::ostream& operator<<(std::ostream& out, const std::vector<T>& members)
|
|||
return out;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream&, const glm::vec2&);
|
||||
std::ostream& operator<<(std::ostream&, const glm::vec3&);
|
||||
/* Stream a text representation of a glm::vec of any type or dimension */
|
||||
template<int dimensions, typename Type>
|
||||
std::ostream& operator<<(std::ostream& out, const glm::vec<dimensions, Type, glm::defaultp> vec)
|
||||
{
|
||||
out << "{" << vec.x << ", " << vec.y;
|
||||
if constexpr (dimensions > 2)
|
||||
{
|
||||
out << ", " << vec.z;
|
||||
if constexpr (dimensions > 3)
|
||||
{
|
||||
out << ", " << vec.w;
|
||||
}
|
||||
}
|
||||
out << "}";
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream&, const SDL_Color&);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue