Browse Source

Improved debugging of math types using more string conversions.

David Piuva 2 years ago
parent
commit
b727c72bd0

+ 5 - 0
Source/DFPSR/math/FMatrix2x2.h

@@ -75,6 +75,11 @@ inline FMatrix2x2 inverse(const FMatrix2x2& m) {
 	return FMatrix2x2(FVector2D(m.yAxis.y, -m.xAxis.y), FVector2D(-m.yAxis.x, m.xAxis.x)) * (1.0f / determinant(m));
 }
 
+inline String& string_toStreamIndented(String& target, const FMatrix2x2& source, const ReadableString& indentation) {
+	string_append(target, indentation, U"XAxis(", source.xAxis, U"), YAxis(", source.yAxis, U")");
+	return target;
+}
+
 }
 
 #endif

+ 5 - 0
Source/DFPSR/math/FMatrix3x3.h

@@ -120,6 +120,11 @@ inline FMatrix3x3 transpose(const FMatrix3x3& m) {
 	return result;
 }
 
+inline String& string_toStreamIndented(String& target, const FMatrix3x3& source, const ReadableString& indentation) {
+	string_append(target, indentation, U"XAxis(", source.xAxis, U"), YAxis(", source.yAxis, U"), ZAxis(", source.zAxis, U")");
+	return target;
+}
+
 }
 
 #endif

+ 5 - 0
Source/DFPSR/math/FPlane3D.h

@@ -50,6 +50,11 @@ struct FPlane3D {
 	}
 };
 
+inline String& string_toStreamIndented(String& target, const FPlane3D& source, const ReadableString& indentation) {
+	string_append(target, indentation, U"Normal(", source.normal, U"), Offset(", source.offset, U")");
+	return target;
+}
+
 }
 
 #endif

+ 5 - 0
Source/DFPSR/math/Transform3D.h

@@ -85,6 +85,11 @@ inline Transform3D inverse(const Transform3D& m) {
 	return inverseUsingInvDet(m, 1.0f / determinant(m));
 }
 
+inline String& string_toStreamIndented(String& target, const Transform3D& source, const ReadableString& indentation) {
+	string_append(target, indentation, U"XAxis(", source.transform.xAxis, U"), YAxis(", source.transform.yAxis, U"), ZAxis(", source.transform.zAxis, U"), Position(", source.position, U")");
+	return target;
+}
+
 }
 
 #endif

+ 3 - 3
Source/DFPSR/math/vectorMethods.h

@@ -308,19 +308,19 @@ OPPOSITE_COMPARE_2D(VECTOR_TYPE)
 
 #define SERIALIZATION_2D(VECTOR_TYPE) \
 inline String& string_toStreamIndented(String& target, const VECTOR_TYPE& source, const ReadableString& indentation) { \
-	string_append(target, indentation, source.x, U",", source.y); \
+	string_append(target, indentation, source.x, U", ", source.y); \
 	return target; \
 }
 
 #define SERIALIZATION_3D(VECTOR_TYPE) \
 inline String& string_toStreamIndented(String& target, const VECTOR_TYPE& source, const ReadableString& indentation) { \
-	string_append(target, indentation, source.x, U",", source.y, U",", source.z); \
+	string_append(target, indentation, source.x, U", ", source.y, U", ", source.z); \
 	return target; \
 }
 
 #define SERIALIZATION_4D(VECTOR_TYPE) \
 inline String& string_toStreamIndented(String& target, const VECTOR_TYPE& source, const ReadableString& indentation) { \
-	string_append(target, indentation, source.x, U",", source.y, U",", source.z, U",", source.w); \
+	string_append(target, indentation, source.x, U", ", source.y, U", ", source.z, U", ", source.w); \
 	return target; \
 }