summaryrefslogtreecommitdiffstats
path: root/Common/interface
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-02-02 03:53:52 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-02-02 03:53:52 +0000
commit30d6e99e9ae0d7fa9fc5148222052bca6cd8c73c (patch)
tree0615f4886016669e7c080f9dab62639f1110fd46 /Common/interface
parentReworked ShaderResourceLayoutTest.FormattedBuffers and ShaderResourceLayoutTe... (diff)
downloadDiligentCore-30d6e99e9ae0d7fa9fc5148222052bca6cd8c73c.tar.gz
DiligentCore-30d6e99e9ae0d7fa9fc5148222052bca6cd8c73c.zip
MathLib: added stream insreters for vector types
Diffstat (limited to 'Common/interface')
-rw-r--r--Common/interface/BasicMath.hpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/Common/interface/BasicMath.hpp b/Common/interface/BasicMath.hpp
index 782e428c..9b882a46 100644
--- a/Common/interface/BasicMath.hpp
+++ b/Common/interface/BasicMath.hpp
@@ -50,6 +50,7 @@
#include <cmath>
#include <algorithm>
+#include <iostream>
#include "HashUtils.hpp"
@@ -2209,6 +2210,47 @@ typename std::enable_if<std::is_enum<T>::value, T>::type ExtractLSB(T& bits)
return static_cast<T>(ExtractLSB(reinterpret_cast<typename std::underlying_type<T>::type&>(bits)));
}
+
+inline std::ostream& operator<<(std::ostream& os, const float4& vec)
+{
+ return os << "float4(" << vec.x << ", " << vec.y << ", " << vec.z << ", " << vec.w << ')';
+}
+inline std::ostream& operator<<(std::ostream& os, const float3& vec)
+{
+ return os << "float3(" << vec.x << ", " << vec.y << ", " << vec.z << ')';
+}
+inline std::ostream& operator<<(std::ostream& os, const float2& vec)
+{
+ return os << "float2(" << vec.x << ", " << vec.y << ')';
+}
+
+inline std::ostream& operator<<(std::ostream& os, const int4& vec)
+{
+ return os << "int4(" << vec.x << ", " << vec.y << ", " << vec.z << ", " << vec.w << ')';
+}
+inline std::ostream& operator<<(std::ostream& os, const int3& vec)
+{
+ return os << "int3(" << vec.x << ", " << vec.y << ", " << vec.z << ')';
+}
+inline std::ostream& operator<<(std::ostream& os, const int2& vec)
+{
+ return os << "int2(" << vec.x << ", " << vec.y << ')';
+}
+
+
+inline std::ostream& operator<<(std::ostream& os, const uint4& vec)
+{
+ return os << "uint4(" << vec.x << ", " << vec.y << ", " << vec.z << ", " << vec.w << ')';
+}
+inline std::ostream& operator<<(std::ostream& os, const uint3& vec)
+{
+ return os << "uint3(" << vec.x << ", " << vec.y << ", " << vec.z << ')';
+}
+inline std::ostream& operator<<(std::ostream& os, const uint2& vec)
+{
+ return os << "uint2(" << vec.x << ", " << vec.y << ')';
+}
+
} // namespace Diligent