Skip to content

Commit

Permalink
Added loging glm vectors, matrix and quaternios (TheCherno#361)
Browse files Browse the repository at this point in the history
Co-authored-by: lovely_santa <[email protected]>
  • Loading branch information
Stolkerve and LovelySanta authored Sep 14, 2021
1 parent cad1429 commit 670ce2d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Hazel/src/Hazel/Core/Log.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "glm/gtx/string_cast.hpp"

#include "Hazel/Core/Base.h"

// This ignores all warnings raised inside External headers
Expand All @@ -25,6 +27,24 @@ namespace Hazel {

}

template<typename OStream, glm::length_t L, typename T, glm::qualifier Q>
inline OStream& operator<<(OStream& os, const glm::vec<L, T, Q>& vector)
{
return os << glm::to_string(vector);
}

template<typename OStream, glm::length_t C, glm::length_t R, typename T, glm::qualifier Q>
inline OStream& operator<<(OStream& os, const glm::mat<C, R, T, Q>& matrix)
{
return os << glm::to_string(matrix);
}

template<typename OStream, typename T, glm::qualifier Q>
inline OStream& operator<<(OStream& os, glm::qua<T, Q> quaternio)
{
return os << glm::to_string(quaternio);
}

// Core log macros
#define HZ_CORE_TRACE(...) ::Hazel::Log::GetCoreLogger()->trace(__VA_ARGS__)
#define HZ_CORE_INFO(...) ::Hazel::Log::GetCoreLogger()->info(__VA_ARGS__)
Expand Down

0 comments on commit 670ce2d

Please sign in to comment.