Prechádzať zdrojové kódy

Removed trailing whitespace from all source files (#688)

Jorrit Rouwe 1 rok pred
rodič
commit
58445d6c26
100 zmenil súbory, kde vykonal 924 pridanie a 924 odobranie
  1. 13 13
      Jolt/AABBTree/AABBTreeBuilder.cpp
  2. 6 6
      Jolt/AABBTree/AABBTreeToBuffer.h
  3. 9 9
      Jolt/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h
  4. 10 10
      Jolt/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h
  5. 3 3
      Jolt/Core/Color.h
  6. 1 1
      Jolt/Core/FPControlWord.h
  7. 10 10
      Jolt/Core/Factory.cpp
  8. 2 2
      Jolt/Core/FixedSizeFreeList.inl
  9. 3 3
      Jolt/Core/HashCombine.h
  10. 4 4
      Jolt/Core/IssueReporting.cpp
  11. 2 2
      Jolt/Core/IssueReporting.h
  12. 25 25
      Jolt/Core/JobSystem.h
  13. 2 2
      Jolt/Core/JobSystemSingleThreaded.cpp
  14. 5 5
      Jolt/Core/JobSystemThreadPool.cpp
  15. 3 3
      Jolt/Core/JobSystemThreadPool.h
  16. 2 2
      Jolt/Core/JobSystemWithBarrier.cpp
  17. 4 4
      Jolt/Core/LockFreeHashMap.h
  18. 9 9
      Jolt/Core/LockFreeHashMap.inl
  19. 1 1
      Jolt/Core/Mutex.h
  20. 5 5
      Jolt/Core/MutexArray.h
  21. 23 23
      Jolt/Core/Profiler.cpp
  22. 25 25
      Jolt/Core/Profiler.h
  23. 1 1
      Jolt/Core/Profiler.inl
  24. 2 2
      Jolt/Core/QuickSort.h
  25. 23 23
      Jolt/Core/RTTI.cpp
  26. 9 9
      Jolt/Core/RTTI.h
  27. 15 15
      Jolt/Core/Reference.h
  28. 1 1
      Jolt/Core/STLAllocator.h
  29. 3 3
      Jolt/Core/StaticArray.h
  30. 1 1
      Jolt/Core/StreamIn.h
  31. 2 2
      Jolt/Core/StringTools.cpp
  32. 1 1
      Jolt/Core/TempAllocator.h
  33. 3 3
      Jolt/Core/TickCounter.cpp
  34. 1 1
      Jolt/Core/TickCounter.h
  35. 10 10
      Jolt/Geometry/AABox.h
  36. 15 15
      Jolt/Geometry/AABox4.h
  37. 7 7
      Jolt/Geometry/ClipPoly.h
  38. 81 81
      Jolt/Geometry/ClosestPoint.h
  39. 27 27
      Jolt/Geometry/ConvexHullBuilder.cpp
  40. 2 2
      Jolt/Geometry/ConvexHullBuilder.h
  41. 4 4
      Jolt/Geometry/ConvexHullBuilder2D.cpp
  42. 3 3
      Jolt/Geometry/ConvexHullBuilder2D.h
  43. 3 3
      Jolt/Geometry/ConvexSupport.h
  44. 3 3
      Jolt/Geometry/Ellipse.h
  45. 14 14
      Jolt/Geometry/GJKClosestPoint.h
  46. 16 16
      Jolt/Geometry/OrientedBox.cpp
  47. 1 1
      Jolt/Geometry/OrientedBox.h
  48. 2 2
      Jolt/Geometry/RayAABox.h
  49. 1 1
      Jolt/Geometry/RayAABox8.h
  50. 2 2
      Jolt/Geometry/RaySphere.h
  51. 3 3
      Jolt/Geometry/RayTriangle.h
  52. 6 6
      Jolt/Geometry/RayTriangle8.h
  53. 3 3
      Jolt/Geometry/Sphere.h
  54. 9 9
      Jolt/Math/DMat44.inl
  55. 5 5
      Jolt/Math/DVec3.h
  56. 24 24
      Jolt/Math/DVec3.inl
  57. 4 4
      Jolt/Math/Double3.h
  58. 8 8
      Jolt/Math/EigenValueSymmetric.h
  59. 1 1
      Jolt/Math/FindRoot.h
  60. 4 4
      Jolt/Math/Float3.h
  61. 4 4
      Jolt/Math/Float4.h
  62. 10 10
      Jolt/Math/GaussianElimination.h
  63. 3 3
      Jolt/Math/HalfFloat.h
  64. 22 22
      Jolt/Math/Matrix.h
  65. 18 18
      Jolt/Math/Quat.h
  66. 43 43
      Jolt/Math/Quat.inl
  67. 3 3
      Jolt/Math/UVec4.h
  68. 25 25
      Jolt/Math/UVec4.inl
  69. 3 3
      Jolt/Math/UVec8.h
  70. 1 1
      Jolt/Math/UVec8.inl
  71. 2 2
      Jolt/Math/Vec3.cpp
  72. 4 4
      Jolt/Math/Vec3.h
  73. 34 34
      Jolt/Math/Vec3.inl
  74. 3 3
      Jolt/Math/Vec4.h
  75. 51 51
      Jolt/Math/Vec4.inl
  76. 4 4
      Jolt/Math/Vec8.h
  77. 3 3
      Jolt/Math/Vec8.inl
  78. 10 10
      Jolt/Math/Vector.h
  79. 14 14
      Jolt/ObjectStream/GetPrimitiveTypeOfType.h
  80. 1 1
      Jolt/ObjectStream/ObjectStreamBinaryIn.cpp
  81. 1 1
      Jolt/ObjectStream/ObjectStreamBinaryOut.h
  82. 99 99
      Jolt/ObjectStream/ObjectStreamIn.cpp
  83. 6 6
      Jolt/ObjectStream/ObjectStreamIn.h
  84. 12 12
      Jolt/ObjectStream/ObjectStreamOut.cpp
  85. 6 6
      Jolt/ObjectStream/ObjectStreamOut.h
  86. 20 20
      Jolt/ObjectStream/ObjectStreamTextIn.cpp
  87. 1 1
      Jolt/ObjectStream/ObjectStreamTextOut.cpp
  88. 1 1
      Jolt/ObjectStream/ObjectStreamTextOut.h
  89. 1 1
      Jolt/ObjectStream/SerializableAttribute.h
  90. 2 2
      Jolt/ObjectStream/SerializableAttributeEnum.h
  91. 1 1
      Jolt/ObjectStream/SerializableAttributeTyped.h
  92. 2 2
      Jolt/ObjectStream/TypeDeclarations.cpp
  93. 3 3
      Jolt/Physics/Body/BodyFilter.h
  94. 6 6
      Jolt/Physics/Body/BodyID.h
  95. 4 4
      Jolt/Physics/Body/BodyLock.h
  96. 4 4
      Jolt/Physics/Body/BodyLockInterface.h
  97. 5 5
      Jolt/Physics/Body/BodyLockMulti.h
  98. 2 2
      Jolt/Physics/Body/MassProperties.cpp
  99. 1 1
      Jolt/Physics/Body/MassProperties.h
  100. 2 2
      Jolt/Physics/Body/MotionQuality.h

+ 13 - 13
Jolt/AABBTree/AABBTreeBuilder.cpp

@@ -9,15 +9,15 @@
 JPH_NAMESPACE_BEGIN
 
 AABBTreeBuilder::Node::Node()
-{ 
-	mChild[0] = nullptr; 
-	mChild[1] = nullptr; 
+{
+	mChild[0] = nullptr;
+	mChild[1] = nullptr;
 }
 
-AABBTreeBuilder::Node::~Node() 
-{ 
-	delete mChild[0]; 
-	delete mChild[1]; 
+AABBTreeBuilder::Node::~Node()
+{
+	delete mChild[0];
+	delete mChild[1];
 }
 
 uint AABBTreeBuilder::Node::GetMinDepth() const
@@ -106,7 +106,7 @@ void AABBTreeBuilder::Node::GetNChildren(uint inN, Array<const Node *> &outChild
 		{
 			// If there only triangle nodes left, we have to terminate
 			if (all_triangles)
-				return; 
+				return;
 			next = 0;
 			all_triangles = true;
 		}
@@ -130,8 +130,8 @@ void AABBTreeBuilder::Node::GetNChildren(uint inN, Array<const Node *> &outChild
 float AABBTreeBuilder::Node::CalculateSAHCostInternal(float inCostTraversalDivSurfaceArea, float inCostLeafDivSurfaceArea) const
 {
 	if (HasChildren())
-		return inCostTraversalDivSurfaceArea * mBounds.GetSurfaceArea() 
-			+ mChild[0]->CalculateSAHCostInternal(inCostTraversalDivSurfaceArea, inCostLeafDivSurfaceArea) 
+		return inCostTraversalDivSurfaceArea * mBounds.GetSurfaceArea()
+			+ mChild[0]->CalculateSAHCostInternal(inCostTraversalDivSurfaceArea, inCostLeafDivSurfaceArea)
 			+ mChild[1]->CalculateSAHCostInternal(inCostTraversalDivSurfaceArea, inCostLeafDivSurfaceArea);
 	else
 		return inCostLeafDivSurfaceArea * mBounds.GetSurfaceArea() * GetTriangleCount();
@@ -153,10 +153,10 @@ void AABBTreeBuilder::Node::GetTriangleCountPerNodeInternal(float &outAverage, u
 	}
 }
 
-AABBTreeBuilder::AABBTreeBuilder(TriangleSplitter &inSplitter, uint inMaxTrianglesPerLeaf) : 
+AABBTreeBuilder::AABBTreeBuilder(TriangleSplitter &inSplitter, uint inMaxTrianglesPerLeaf) :
 	mTriangleSplitter(inSplitter),
-	mMaxTrianglesPerLeaf(inMaxTrianglesPerLeaf) 
-{ 
+	mMaxTrianglesPerLeaf(inMaxTrianglesPerLeaf)
+{
 }
 
 AABBTreeBuilder::Node *AABBTreeBuilder::Build(AABBTreeBuilderStats &outStats)

+ 6 - 6
Jolt/AABBTree/AABBTreeToBuffer.h

@@ -69,13 +69,13 @@ public:
 			uint *							mParentChildNodeStart = nullptr;			// Where to store mNodeStart (to patch mChildNodeStart of my parent)
 			uint *							mParentTrianglesStart = nullptr;			// Where to store mTriangleStart (to patch mChildTrianglesStart of my parent)
 		};
-		
+
 		Deque<NodeData *> to_process;
 		Deque<NodeData *> to_process_triangles;
 		Array<NodeData> node_list;
 
 		node_list.reserve(node_count); // Needed to ensure that array is not reallocated, so we can keep pointers in the array
-		
+
 		NodeData root;
 		root.mNode = inRoot;
 		root.mNodeBoundsMin = inRoot->mBounds.mMin;
@@ -155,7 +155,7 @@ public:
 					}
 				}
 				else
-				{				
+				{
 					// Add triangles
 					node_data->mTriangleStart = tri_ctx.Pack(node_data->mNode->mTriangles, mTree, outError);
 					if (node_data->mTriangleStart == uint(-1))
@@ -176,12 +176,12 @@ public:
 			else
 				to_process.swap(to_process_triangles);
 		}
-		
+
 		// Finalize all nodes
 		for (NodeData &n : node_list)
 			if (!node_ctx.NodeFinalize(n.mNode, n.mNodeStart, n.mNumChildren, n.mChildNodeStart, n.mChildTrianglesStart, mTree, outError))
 				return false;
-		
+
 		// Finalize the triangles
 		tri_ctx.Finalize(inVertices, triangle_header, mTree);
 
@@ -236,7 +236,7 @@ public:
 	{
 		return mTree.Get<void>(HeaderSize + TriangleHeaderSize);
 	}
-	
+
 private:
 	ByteBuffer						mTree;									///< Resulting tree structure
 	uint							mNodesSize;								///< Size in bytes of the nodes in the buffer

+ 9 - 9
Jolt/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h

@@ -27,7 +27,7 @@ public:
 
 	/// Size of the header (an empty struct is always > 0 bytes so this needs a separate variable)
 	static constexpr int				HeaderSize = sizeof(Header);
-	
+
 	/// Stack size to use during DecodingContext::sWalkTree
 	static constexpr int				StackSize = 128;
 
@@ -54,7 +54,7 @@ public:
 		HalfFloat						mBoundsMaxZ[4];
 		uint32							mNodeProperties[4];		///< 4 child node properties
 	};
-	
+
 	static_assert(sizeof(Node) == 64, "Node should be 64 bytes");
 
 	/// This class encodes and compresses quad tree nodes
@@ -67,7 +67,7 @@ public:
 			return inNodeCount * (sizeof(Node) + Alignment - 1);
 		}
 
-		/// Allocate a new node for inNode. 
+		/// Allocate a new node for inNode.
 		/// Algorithm can modify the order of ioChildren to indicate in which order children should be compressed
 		/// Algorithm can enlarge the bounding boxes of the children during compression and returns these in outChildBoundsMin, outChildBoundsMax
 		/// inNodeBoundsMin, inNodeBoundsMax is the bounding box if inNode possibly widened by compressing the parent node
@@ -77,7 +77,7 @@ public:
 			// We don't emit nodes for leafs
 			if (!inNode->HasChildren())
 				return (uint)ioBuffer.size();
-				
+
 			// Align the buffer
 			ioBuffer.Align(Alignment);
 			uint node_start = (uint)ioBuffer.size();
@@ -110,7 +110,7 @@ public:
 				else
 				{
 					// Make this an invalid triangle node
-					node->mNodeProperties[i] = uint32(TRIANGLE_COUNT_MASK) << TRIANGLE_COUNT_SHIFT; 
+					node->mNodeProperties[i] = uint32(TRIANGLE_COUNT_MASK) << TRIANGLE_COUNT_SHIFT;
 
 					// Make bounding box invalid
 					node->mBoundsMinX[i] = HALF_FLT_MAX;
@@ -188,7 +188,7 @@ public:
 			}
 
 			return true;
-		}		
+		}
 	};
 
 	/// This class decodes and decompresses quad tree nodes
@@ -231,7 +231,7 @@ public:
 					UVec4 bounds_minxy = UVec4::sLoadInt4(reinterpret_cast<const uint32 *>(&node->mBoundsMinX[0]));
 					Vec4 bounds_minx = HalfFloatConversion::ToFloat(bounds_minxy);
 					Vec4 bounds_miny = HalfFloatConversion::ToFloat(bounds_minxy.Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_UNUSED, SWIZZLE_UNUSED>());
-					
+
 					UVec4 bounds_minzmaxx = UVec4::sLoadInt4(reinterpret_cast<const uint32 *>(&node->mBoundsMinZ[0]));
 					Vec4 bounds_minz = HalfFloatConversion::ToFloat(bounds_minzmaxx);
 					Vec4 bounds_maxx = HalfFloatConversion::ToFloat(bounds_minzmaxx.Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_UNUSED, SWIZZLE_UNUSED>());
@@ -252,7 +252,7 @@ public:
 					mTop += num_results;
 				}
 				else if (tri_count != TRIANGLE_COUNT_MASK) // TRIANGLE_COUNT_MASK indicates a padding node, normally we shouldn't visit these nodes but when querying with a big enough box you could touch HALF_FLT_MAX (about 65K)
-				{	
+				{
 					// Node contains triangles, do individual tests
 					uint32 triangle_block_id = node_properties & OFFSET_MASK;
 					const void *triangles = sGetTriangleBlockStart(inBufferStart, triangle_block_id);
@@ -265,7 +265,7 @@ public:
 					break;
 
 				// Fetch next node until we find one that the visitor wants to see
-				do 
+				do
 					--mTop;
 				while (mTop >= 0 && !ioVisitor.ShouldVisitNode(mTop));
 			}

+ 10 - 10
Jolt/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h

@@ -34,7 +34,7 @@ public:
 	static constexpr int			TriangleHeaderSize = sizeof(TriangleHeader);
 
 	/// If this codec could return a different offset than the current buffer size when calling Pack()
-	static constexpr bool			ChangesOffsetOnPack = false; 
+	static constexpr bool			ChangesOffsetOnPack = false;
 
 	/// Amount of bits per component
 	enum EComponentData : uint32
@@ -67,7 +67,7 @@ public:
 	};
 
 	static_assert(sizeof(VertexData) == 8, "Compiler added padding");
-	
+
 	/// A block of 4 triangles
 	struct TriangleBlock
 	{
@@ -257,10 +257,10 @@ public:
 		{
 			JPH_ASSERT(inNumTriangles > 0);
 			const TriangleBlockHeader *header = reinterpret_cast<const TriangleBlockHeader *>(inTriangleStart);
-			const VertexData *vertices = header->GetVertexData();			
+			const VertexData *vertices = header->GetVertexData();
 			const TriangleBlock *t = header->GetTriangleBlock();
 			const TriangleBlock *end = t + ((inNumTriangles + 3) >> 2);
-			
+
 			int triangles_left = inNumTriangles;
 
 			do
@@ -291,7 +291,7 @@ public:
 				}
 
 				++t;
-			} 
+			}
 			while (t < end);
 		}
 
@@ -300,7 +300,7 @@ public:
 		{
 			JPH_ASSERT(inNumTriangles > 0);
 			const TriangleBlockHeader *header = reinterpret_cast<const TriangleBlockHeader *>(inTriangleStart);
-			const VertexData *vertices = header->GetVertexData();			
+			const VertexData *vertices = header->GetVertexData();
 			const TriangleBlock *t = header->GetTriangleBlock();
 			const TriangleBlock *end = t + ((inNumTriangles + 3) >> 2);
 
@@ -336,7 +336,7 @@ public:
 				// Next block
 				++t;
 				start_triangle_idx += UVec4::sReplicate(4);
-			} 
+			}
 			while (t < end);
 
 			// Get the smallest component
@@ -380,13 +380,13 @@ public:
 		}
 
 		/// Get flags for entire triangle block
-		JPH_INLINE static void		sGetFlags(const void *inTriangleStart, uint32 inNumTriangles, uint8 *outTriangleFlags) 
+		JPH_INLINE static void		sGetFlags(const void *inTriangleStart, uint32 inNumTriangles, uint8 *outTriangleFlags)
 		{
 			JPH_ASSERT(inNumTriangles > 0);
 			const TriangleBlockHeader *header = reinterpret_cast<const TriangleBlockHeader *>(inTriangleStart);
 			const TriangleBlock *t = header->GetTriangleBlock();
 			const TriangleBlock *end = t + ((inNumTriangles + 3) >> 2);
-			
+
 			int triangles_left = inNumTriangles;
 			do
 			{
@@ -394,7 +394,7 @@ public:
 					*outTriangleFlags++ = t->mFlags[i];
 
 				++t;
-			} 
+			}
 			while (t < end);
 		}
 

+ 3 - 3
Jolt/Core/Color.h

@@ -22,11 +22,11 @@ public:
 	explicit constexpr		Color(uint32 inColor)													: mU32(inColor) { }
 	constexpr				Color(uint8 inRed, uint8 inGreen, uint8 inBlue, uint8 inAlpha = 255)	: r(inRed), g(inGreen), b(inBlue), a(inAlpha) { }
 	constexpr				Color(ColorArg inRHS, uint8 inAlpha)									: r(inRHS.r), g(inRHS.g), b(inRHS.b), a(inAlpha) { }
-											
-	/// Comparison			
+
+	/// Comparison
 	inline bool				operator == (ColorArg inRHS) const										{ return mU32 == inRHS.mU32; }
 	inline bool				operator != (ColorArg inRHS) const										{ return mU32 != inRHS.mU32; }
-	
+
 	/// Convert to uint32
 	uint32					GetUInt32() const														{ return mU32; }
 

+ 1 - 1
Jolt/Core/FPControlWord.h

@@ -28,7 +28,7 @@ public:
 	}
 
 private:
-	uint		mPrevState;	
+	uint		mPrevState;
 };
 
 #elif defined(JPH_CPU_ARM) && defined(JPH_COMPILER_MSVC)

+ 10 - 10
Jolt/Core/Factory.cpp

@@ -11,25 +11,25 @@ JPH_NAMESPACE_BEGIN
 Factory *Factory::sInstance = nullptr;
 
 void *Factory::CreateObject(const char *inName)
-{ 
-	const RTTI *ci = Find(inName); 
-	return ci != nullptr? ci->CreateObject() : nullptr; 
+{
+	const RTTI *ci = Find(inName);
+	return ci != nullptr? ci->CreateObject() : nullptr;
 }
 
 const RTTI *Factory::Find(const char *inName)
-{ 
-	ClassNameMap::iterator c = mClassNameMap.find(inName); 
-	return c != mClassNameMap.end()? c->second : nullptr; 
+{
+	ClassNameMap::iterator c = mClassNameMap.find(inName);
+	return c != mClassNameMap.end()? c->second : nullptr;
 }
 
 const RTTI *Factory::Find(uint32 inHash)
-{ 
-	ClassHashMap::iterator c = mClassHashMap.find(inHash); 
-	return c != mClassHashMap.end()? c->second : nullptr; 
+{
+	ClassHashMap::iterator c = mClassHashMap.find(inHash);
+	return c != mClassHashMap.end()? c->second : nullptr;
 }
 
 bool Factory::Register(const RTTI *inRTTI)
-{ 
+{
 	// Check if we already know the type
 	if (Find(inRTTI->GetName()) != nullptr)
 		return true;

+ 2 - 2
Jolt/Core/FixedSizeFreeList.inl

@@ -161,7 +161,7 @@ void FixedSizeFreeList<Object>::DestructObjectBatch(Batch &ioBatch)
 				// Mark the batch as freed
 #ifdef JPH_ENABLE_ASSERTS
 				ioBatch.mNumObjects = uint32(-1);
-#endif		
+#endif
 				return;
 			}
 		}
@@ -174,7 +174,7 @@ void FixedSizeFreeList<Object>::DestructObject(uint32 inObjectIndex)
 	JPH_ASSERT(inObjectIndex != cInvalidObjectIndex);
 
 	// Call destructor
-	ObjectStorage &storage = GetStorage(inObjectIndex); 
+	ObjectStorage &storage = GetStorage(inObjectIndex);
 	storage.mObject.~Object();
 
 	// Add to object free list

+ 3 - 3
Jolt/Core/HashCombine.h

@@ -53,16 +53,16 @@ inline void HashCombineHelper(size_t &ioSeed, const T &inValue)
 ///
 /// Usage:
 ///
-///		struct SomeHashKey 
+///		struct SomeHashKey
 ///		{
 ///		    std::string key1;
 ///		    std::string key2;
 ///		    bool key3;
 ///		};
-/// 
+///
 ///		JPH_MAKE_HASHABLE(SomeHashKey, t.key1, t.key2, t.key3)
 template <typename... Values>
-inline void HashCombine(std::size_t &ioSeed, Values... inValues) 
+inline void HashCombine(std::size_t &ioSeed, Values... inValues)
 {
 	// Hash all values together using a fold expression
 	(HashCombineHelper(ioSeed, inValues), ...);

+ 4 - 4
Jolt/Core/IssueReporting.cpp

@@ -10,9 +10,9 @@ JPH_SUPPRESS_WARNINGS_STD_END
 
 JPH_NAMESPACE_BEGIN
 
-static void DummyTrace([[maybe_unused]] const char *inFMT, ...) 
-{ 
-	JPH_ASSERT(false); 
+static void DummyTrace([[maybe_unused]] const char *inFMT, ...)
+{
+	JPH_ASSERT(false);
 };
 
 TraceFunction Trace = DummyTrace;
@@ -20,7 +20,7 @@ TraceFunction Trace = DummyTrace;
 #ifdef JPH_ENABLE_ASSERTS
 
 static bool DummyAssertFailed(const char *inExpression, const char *inMessage, const char *inFile, uint inLine)
-{ 
+{
 	return true; // Trigger breakpoint
 };
 

+ 2 - 2
Jolt/Core/IssueReporting.h

@@ -5,7 +5,7 @@
 #pragma once
 
 JPH_NAMESPACE_BEGIN
-	
+
 /// Trace function, needs to be overridden by application. This should output a line of text to the log / TTY.
 using TraceFunction = void (*)(const char *inFMT, ...);
 JPH_EXPORT extern TraceFunction Trace;
@@ -32,7 +32,7 @@ JPH_EXPORT extern TraceFunction Trace;
 #else
     #define JPH_ASSERT(...)					((void)0)
 
-	#define JPH_IF_ENABLE_ASSERTS(...)	
+	#define JPH_IF_ENABLE_ASSERTS(...)
 #endif // JPH_ENABLE_ASSERTS
 
 JPH_NAMESPACE_END

+ 25 - 25
Jolt/Core/JobSystem.h

@@ -15,29 +15,29 @@ JPH_NAMESPACE_BEGIN
 
 /// A class that allows units of work (Jobs) to be scheduled across multiple threads.
 /// It allows dependencies between the jobs so that the jobs form a graph.
-/// 
+///
 /// The pattern for using this class is:
-/// 
+///
 ///		// Create job system
 ///		JobSystem *job_system = new JobSystemThreadPool(...);
-///		
+///
 ///		// Create some jobs
 ///		JobHandle second_job = job_system->CreateJob("SecondJob", Color::sRed, []() { ... }, 1); // Create a job with 1 dependency
 ///		JobHandle first_job = job_system->CreateJob("FirstJob", Color::sGreen, [second_job]() { ....; second_job.RemoveDependency(); }, 0); // Job can start immediately, will start second job when it's done
 ///		JobHandle third_job = job_system->CreateJob("ThirdJob", Color::sBlue, []() { ... }, 0); // This job can run immediately as well and can run in parallel to job 1 and 2
-///		
+///
 ///		// Add the jobs to the barrier so that we can execute them while we're waiting
 ///		Barrier *barrier = job_system->CreateBarrier();
 ///		barrier->AddJob(first_job);
 ///		barrier->AddJob(second_job);
 ///		barrier->AddJob(third_job);
 ///		job_system->WaitForJobs(barrier);
-///		
+///
 /// 	// Clean up
 /// 	job_system->DestroyBarrier(barrier);
 /// 	delete job_system;
-///	
-///	Jobs are guaranteed to be started in the order that their dependency counter becomes zero (in case they're scheduled on a background thread) 
+///
+///	Jobs are guaranteed to be started in the order that their dependency counter becomes zero (in case they're scheduled on a background thread)
 ///	or in the order they're added to the barrier (when dependency count is zero and when executing on the thread that calls WaitForJobs).
 ///
 /// If you want to implement your own job system, inherit from JobSystem and implement:
@@ -51,18 +51,18 @@ JPH_NAMESPACE_BEGIN
 ///
 /// JobSystem::Barrier is used to track the completion of a set of jobs. Jobs will be created by other jobs and added to the barrier while it is being waited on. This means that you cannot
 /// create a dependency graph beforehand as the graph changes while jobs are running. Implement the following functions:
-/// 
+///
 /// * Barrier::AddJob/AddJobs - Add a job to the barrier, any call to WaitForJobs will now also wait for this job to complete.
 /// If you store the job in a data structure in the Barrier you need to call AddRef() on the job to keep it alive and Release() after you're done with it.
 /// * Barrier::OnJobFinished - This function is called when a job has finished executing, you can use this to track completion and remove the job from the list of jobs to wait on.
 ///
 /// The functions on JobSystem that need to be implemented to support barriers are:
-/// 
+///
 /// * JobSystem::CreateBarrier - Create a new barrier.
 /// * JobSystem::DestroyBarrier - Destroy a barrier.
 /// * JobSystem::WaitForJobs - This is the main function that is used to wait for all jobs that have been added to a Barrier. WaitForJobs can execute jobs that have
-/// been added to the barrier while waiting. It is not wise to execute other jobs that touch physics structures as this can cause race conditions and deadlocks. Please keep in mind that the barrier is 
-/// only intended to wait on the completion of the Jolt jobs added to it, if you scheduled any jobs in your engine's job system to execute the Jolt jobs as part of QueueJob/QueueJobs, you might still need 
+/// been added to the barrier while waiting. It is not wise to execute other jobs that touch physics structures as this can cause race conditions and deadlocks. Please keep in mind that the barrier is
+/// only intended to wait on the completion of the Jolt jobs added to it, if you scheduled any jobs in your engine's job system to execute the Jolt jobs as part of QueueJob/QueueJobs, you might still need
 /// to wait for these in this function after the barrier is finished waiting.
 ///
 /// An example implementation is JobSystemThreadPool. If you don't want to write the Barrier class you can also inherit from JobSystemWithBarrier.
@@ -79,7 +79,7 @@ public:
 	class JobHandle : private Ref<Job>
 	{
 	public:
-		/// Constructor 
+		/// Constructor
 		inline				JobHandle()									= default;
 		inline				JobHandle(const JobHandle &inHandle)		= default;
 		inline				JobHandle(JobHandle &&inHandle) noexcept	: Ref<Job>(std::move(inHandle)) { }
@@ -97,7 +97,7 @@ public:
 		/// Check if this job has finished executing
 		inline bool			IsDone() const								{ return GetPtr() != nullptr && GetPtr()->IsDone(); }
 
-		/// Add to the dependency counter. 
+		/// Add to the dependency counter.
 		inline void			AddDependency(int inCount = 1) const		{ GetPtr()->AddDependency(inCount); }
 
 		/// Remove from the dependency counter. Job will start whenever the dependency counter reaches zero
@@ -173,15 +173,15 @@ protected:
 		JPH_OVERRIDE_NEW_DELETE
 
 		/// Constructor
-							Job([[maybe_unused]] const char *inJobName, [[maybe_unused]] ColorArg inColor, JobSystem *inJobSystem, const JobFunction &inJobFunction, uint32 inNumDependencies) : 
+							Job([[maybe_unused]] const char *inJobName, [[maybe_unused]] ColorArg inColor, JobSystem *inJobSystem, const JobFunction &inJobFunction, uint32 inNumDependencies) :
 		#if defined(JPH_EXTERNAL_PROFILE) || defined(JPH_PROFILE_ENABLED)
-			mJobName(inJobName), 
-			mColor(inColor), 
+			mJobName(inJobName),
+			mColor(inColor),
 		#endif // defined(JPH_EXTERNAL_PROFILE) || defined(JPH_PROFILE_ENABLED)
-			mJobSystem(inJobSystem), 
-			mJobFunction(inJobFunction), 
-			mNumDependencies(inNumDependencies) 
-		{ 
+			mJobSystem(inJobSystem),
+			mJobFunction(inJobFunction),
+			mNumDependencies(inNumDependencies)
+		{
 		}
 
 		/// Get the jobs system to which this job belongs
@@ -192,7 +192,7 @@ protected:
 		{
 			// Adding a reference can use relaxed memory ordering
 			mReferenceCount.fetch_add(1, memory_order_relaxed);
-		} 
+		}
 		inline void			Release()
 		{
 			// Releasing a reference must use release semantics...
@@ -204,7 +204,7 @@ protected:
 			}
 		}
 
-		/// Add to the dependency counter. 
+		/// Add to the dependency counter.
 		inline void			AddDependency(int inCount);
 
 		/// Remove from the dependency counter. Returns true whenever the dependency counter reaches zero
@@ -217,10 +217,10 @@ protected:
 
 		/// Set the job barrier that this job belongs to and returns false if this was not possible because the job already finished
 		inline bool			SetBarrier(Barrier *inBarrier)
-		{ 
-			intptr_t barrier = 0; 
+		{
+			intptr_t barrier = 0;
 			if (mBarrier.compare_exchange_strong(barrier, reinterpret_cast<intptr_t>(inBarrier), memory_order_relaxed))
-				return true; 
+				return true;
 			JPH_ASSERT(barrier == cBarrierDoneState, "A job can only belong to 1 barrier");
 			return false;
 		}

+ 2 - 2
Jolt/Core/JobSystemSingleThreaded.cpp

@@ -19,10 +19,10 @@ JobHandle JobSystemSingleThreaded::CreateJob(const char *inJobName, ColorArg inC
 	uint32 index = mJobs.ConstructObject(inJobName, inColor, this, inJobFunction, inNumDependencies);
 	JPH_ASSERT(index != AvailableJobs::cInvalidObjectIndex);
 	Job *job = &mJobs.Get(index);
-	
+
 	// Construct handle to keep a reference, the job is queued below and will immediately complete
 	JobHandle handle(job);
-	
+
 	// If there are no dependencies, queue the job now
 	if (inNumDependencies == 0)
 		QueueJob(job);

+ 5 - 5
Jolt/Core/JobSystemThreadPool.cpp

@@ -125,10 +125,10 @@ JobHandle JobSystemThreadPool::CreateJob(const char *inJobName, ColorArg inColor
 		std::this_thread::sleep_for(std::chrono::microseconds(100));
 	}
 	Job *job = &mJobs.Get(index);
-	
+
 	// Construct handle to keep a reference, the job is queued below and may immediately complete
 	JobHandle handle(job);
-	
+
 	// If there are no dependencies, queue the job now
 	if (inNumDependencies == 0)
 		QueueJob(job);
@@ -170,12 +170,12 @@ void JobSystemThreadPool::QueueJobInternal(Job *inJob)
 			// We calculated the head outside of the loop, update head (and we also need to update tail to prevent it from passing head)
 			head = GetHead();
 			old_value = mTail;
-	
+
 			// Second check if there's space in the queue
 			if (old_value - head >= cQueueLength)
 			{
 				// Wake up all threads in order to ensure that they can clear any nullptrs they may not have processed yet
-				mSemaphore.Release((uint)mThreads.size()); 
+				mSemaphore.Release((uint)mThreads.size());
 
 				// Sleep a little (we have to wait for other threads to update their head pointer in order for us to be able to continue)
 				std::this_thread::sleep_for(std::chrono::microseconds(100));
@@ -187,7 +187,7 @@ void JobSystemThreadPool::QueueJobInternal(Job *inJob)
 		Job *expected_job = nullptr;
 		bool success = mQueue[old_value & (cQueueLength - 1)].compare_exchange_strong(expected_job, inJob);
 
-		// Regardless of who wrote the slot, we will update the tail (if the successful thread got scheduled out 
+		// Regardless of who wrote the slot, we will update the tail (if the successful thread got scheduled out
 		// after writing the pointer we still want to be able to continue)
 		mTail.compare_exchange_strong(old_value, old_value + 1);
 

+ 3 - 3
Jolt/Core/JobSystemThreadPool.h

@@ -18,7 +18,7 @@ JPH_NAMESPACE_BEGIN
 using std::thread;
 
 /// Implementation of a JobSystem using a thread pool
-/// 
+///
 /// Note that this is considered an example implementation. It is expected that when you integrate
 /// the physics engine into your own project that you'll provide your own implementation of the
 /// JobSystem built on top of whatever job system your project uses.
@@ -45,7 +45,7 @@ public:
 
 	/// Change the max concurrency after initialization
 	void					SetNumThreads(int inNumThreads)					{ StopThreads(); StartThreads(inNumThreads); }
-	
+
 protected:
 	// See JobSystem
 	virtual void			QueueJob(Job *inJob) override;
@@ -56,7 +56,7 @@ private:
 	/// Start/stop the worker threads
 	void					StartThreads(int inNumThreads);
 	void					StopThreads();
-	
+
 	/// Entry point for a thread
 	void					ThreadMain(int inThreadIndex);
 

+ 2 - 2
Jolt/Core/JobSystemWithBarrier.cpp

@@ -117,7 +117,7 @@ void JobSystemWithBarrier::BarrierImpl::Wait()
 
 				// Loop through the jobs and erase jobs from the beginning of the list that are done
 				while (mJobReadIndex < mJobWriteIndex)
-				{				
+				{
 					atomic<Job *> &job = mJobs[mJobReadIndex & (cMaxJobs - 1)];
 					Job *job_ptr = job.load();
 					if (job_ptr == nullptr || !job_ptr->IsDone())
@@ -154,7 +154,7 @@ void JobSystemWithBarrier::BarrierImpl::Wait()
 
 	// All jobs should be done now, release them
 	while (mJobReadIndex < mJobWriteIndex)
-	{				
+	{
 		atomic<Job *> &job = mJobs[mJobReadIndex & (cMaxJobs - 1)];
 		Job *job_ptr = job.load();
 		JPH_ASSERT(job_ptr != nullptr && job_ptr->IsDone());

+ 4 - 4
Jolt/Core/LockFreeHashMap.h

@@ -84,7 +84,7 @@ public:
 	/// Remove all elements.
 	/// Note that this cannot happen simultaneously with adding new elements.
 	void					Clear();
-	
+
 	/// Get the current amount of buckets that the map is using
 	uint32					GetNumBuckets() const			{ return mNumBuckets; }
 
@@ -115,7 +115,7 @@ public:
 	/// Multiple threads can be inserting in the map at the same time.
 	template <class... Params>
 	inline KeyValue *		Create(LFHMAllocatorContext &ioContext, const Key &inKey, uint64 inKeyHash, int inExtraBytes, Params &&... inConstructorParams);
-	
+
 	/// Find an element, returns null if not found
 	inline const KeyValue *	Find(const Key &inKey, uint64 inKeyHash) const;
 
@@ -150,12 +150,12 @@ public:
 		/// Next item
 		Iterator &			operator ++ ();
 
-		MapType *			mMap;		
+		MapType *			mMap;
 		uint32				mBucket;
 		uint32				mOffset;
 	};
 
-	/// Iterate over the map, note that it is not safe to do this in parallel to Clear(). 
+	/// Iterate over the map, note that it is not safe to do this in parallel to Clear().
 	/// It is safe to do this while adding elements to the map, but newly added elements may or may not be returned by the iterator.
 	Iterator				begin();
 	Iterator				end();

+ 9 - 9
Jolt/Core/LockFreeHashMap.inl

@@ -77,10 +77,10 @@ inline T *LFHMAllocator::FromOffset(uint32 inOffset) const
 // LFHMAllocatorContext
 ///////////////////////////////////////////////////////////////////////////////////
 
-inline LFHMAllocatorContext::LFHMAllocatorContext(LFHMAllocator &inAllocator, uint32 inBlockSize) : 
-	mAllocator(inAllocator), 
-	mBlockSize(inBlockSize) 
-{ 
+inline LFHMAllocatorContext::LFHMAllocatorContext(LFHMAllocator &inAllocator, uint32 inBlockSize) :
+	mAllocator(inAllocator),
+	mBlockSize(inBlockSize)
+{
 }
 
 inline bool LFHMAllocatorContext::Allocate(uint32 inSize, uint32 inAlignment, uint32 &outWriteOffset)
@@ -89,7 +89,7 @@ inline bool LFHMAllocatorContext::Allocate(uint32 inSize, uint32 inAlignment, ui
 	JPH_ASSERT(IsPowerOf2(inAlignment));
 	uint32 alignment_mask = inAlignment - 1;
 	uint32 alignment = (inAlignment - (mBegin & alignment_mask)) & alignment_mask;
-	
+
 	// Check if we have space
 	if (mEnd - mBegin < inSize + alignment)
 	{
@@ -98,7 +98,7 @@ inline bool LFHMAllocatorContext::Allocate(uint32 inSize, uint32 inAlignment, ui
 
 		// Update alignment
 		alignment = (inAlignment - (mBegin & alignment_mask)) & alignment_mask;
-		
+
 		// Check if we have space again
 		if (mEnd - mBegin < inSize + alignment)
 			return false;
@@ -163,7 +163,7 @@ void LockFreeHashMap<Key, Value>::SetNumBuckets(uint32 inNumBuckets)
 	JPH_ASSERT(inNumBuckets <= mMaxBuckets);
 	JPH_ASSERT(inNumBuckets >= 4 && IsPowerOf2(inNumBuckets));
 
-	mNumBuckets = inNumBuckets;	
+	mNumBuckets = inNumBuckets;
 }
 
 template <class Key, class Value>
@@ -280,7 +280,7 @@ typename LockFreeHashMap<Key, Value>::KeyValue &LockFreeHashMap<Key, Value>::Ite
 	JPH_ASSERT(mOffset != cInvalidHandle);
 
 	return *mMap->mAllocator.template FromOffset<KeyValue>(mOffset);
-}		
+}
 
 template <class Key, class Value>
 typename LockFreeHashMap<Key, Value>::Iterator &LockFreeHashMap<Key, Value>::Iterator::operator++ ()
@@ -340,7 +340,7 @@ void LockFreeHashMap<Key, Value>::TraceStats() const
 	}
 
 	Trace("max_objects_per_bucket = %d, num_buckets = %d, num_objects = %d", max_objects_per_bucket, mNumBuckets, num_objects);
-	
+
 	for (int i = 0; i < cMaxPerBucket; ++i)
 		if (histogram[i] != 0)
 			Trace("%d: %d", i, histogram[i]);

+ 1 - 1
Jolt/Core/Mutex.h

@@ -116,7 +116,7 @@ using SharedMutexBase = shared_mutex;
 
 #if defined(JPH_ENABLE_ASSERTS) || defined(JPH_PROFILE_ENABLED) || defined(JPH_EXTERNAL_PROFILE)
 
-/// Very simple wrapper around MutexBase which tracks lock contention in the profiler 
+/// Very simple wrapper around MutexBase which tracks lock contention in the profiler
 /// and asserts that locks/unlocks take place on the same thread
 class Mutex : public MutexBase
 {

+ 5 - 5
Jolt/Core/MutexArray.h

@@ -27,13 +27,13 @@ public:
 
 	/// Initialization
 	/// @param inNumMutexes The amount of mutexes to allocate
-	void					Init(uint inNumMutexes) 
-	{ 
-		JPH_ASSERT(mMutexStorage == nullptr); 
+	void					Init(uint inNumMutexes)
+	{
+		JPH_ASSERT(mMutexStorage == nullptr);
 		JPH_ASSERT(inNumMutexes > 0 && IsPowerOf2(inNumMutexes));
 
-		mMutexStorage = new MutexStorage[inNumMutexes]; 
-		mNumMutexes = inNumMutexes; 
+		mMutexStorage = new MutexStorage[inNumMutexes];
+		mNumMutexes = inNumMutexes;
 	}
 
 	/// Get the number of mutexes that were allocated

+ 23 - 23
Jolt/Core/Profiler.cpp

@@ -61,20 +61,20 @@ void Profiler::Dump(const string_view &inTag)
 	mDumpTag = inTag;
 }
 
-void Profiler::AddThread(ProfileThread *inThread)										
-{ 
-	std::lock_guard lock(mLock); 
+void Profiler::AddThread(ProfileThread *inThread)
+{
+	std::lock_guard lock(mLock);
 
-	mThreads.push_back(inThread); 
+	mThreads.push_back(inThread);
 }
 
-void Profiler::RemoveThread(ProfileThread *inThread)									
-{ 
-	std::lock_guard lock(mLock); 
-	
-	Array<ProfileThread *>::iterator i = find(mThreads.begin(), mThreads.end(), inThread); 
-	JPH_ASSERT(i != mThreads.end()); 
-	mThreads.erase(i); 
+void Profiler::RemoveThread(ProfileThread *inThread)
+{
+	std::lock_guard lock(mLock);
+
+	Array<ProfileThread *>::iterator i = find(mThreads.begin(), mThreads.end(), inThread);
+	JPH_ASSERT(i != mThreads.end());
+	mThreads.erase(i);
 }
 
 void Profiler::sAggregate(int inDepth, uint32 inColor, ProfileSample *&ioSample, const ProfileSample *inEnd, Aggregators &ioAggregators, KeyToAggregator &ioKeyToAggregator)
@@ -141,7 +141,7 @@ void Profiler::DumpInternal()
 	Threads threads;
 	for (ProfileThread *t : mThreads)
 		threads.push_back({ t->mThreadName, t->mSamples, t->mSamples + t->mCurrentSample });
-	
+
 	// Shift all samples so that the first sample is at zero
 	uint64 min_cycle = 0xffffffffffffffffUL;
 	for (const ThreadSamples &t : threads)
@@ -197,7 +197,7 @@ void Profiler::DumpList(const char *inTag, const Aggregators &inAggregators)
 	// Open file
 	std::ofstream f;
 	f.open(StringFormat("profile_list_%s.html", inTag).c_str(), std::ofstream::out | std::ofstream::trunc);
-	if (!f.is_open()) 
+	if (!f.is_open())
 		return;
 
 	// Write header
@@ -235,11 +235,11 @@ void Profiler::DumpList(const char *inTag, const Aggregators &inAggregators)
 
 	// Get cycles per second
 	uint64 cycles_per_second = GetProcessorTicksPerSecond();
-	
+
 	// Sort the list
 	Aggregators aggregators = inAggregators;
 	QuickSort(aggregators.begin(), aggregators.end());
-	
+
 	// Write all aggregators
 	for (const Aggregator &item : aggregators)
 	{
@@ -248,14 +248,14 @@ void Profiler::DumpList(const char *inTag, const Aggregators &inAggregators)
 		char str[2048];
 		snprintf(str, sizeof(str), R"(<tr>
 	<td style="text-align: left;">%s</td>
-	<td>%.1f</td>						
-	<td>%.1f</td>						
+	<td>%.1f</td>
+	<td>%.1f</td>
 	<td>%u</td>
-	<td>%.2f</td>						
-	<td>%.2f</td>						
-	<td>%.2f</td>						
-	<td>%.2f</td>						
-</tr>)", 
+	<td>%.2f</td>
+	<td>%.2f</td>
+	<td>%.2f</td>
+	<td>%.2f</td>
+</tr>)",
 			sHTMLEncode(item.mName).c_str(),															// Description
 			100.0 * item.mTotalCyclesInCallWithChildren / total_time,									// Total time with children
 			100.0 * cycles_in_call_no_children / total_time,											// Total time no children
@@ -277,7 +277,7 @@ void Profiler::DumpChart(const char *inTag, const Threads &inThreads, const KeyT
 	// Open file
 	std::ofstream f;
 	f.open(StringFormat("profile_chart_%s.html", inTag).c_str(), std::ofstream::out | std::ofstream::trunc);
-	if (!f.is_open()) 
+	if (!f.is_open())
 		return;
 
 	// Write header

+ 25 - 25
Jolt/Core/Profiler.h

@@ -21,8 +21,8 @@ JPH_NAMESPACE_BEGIN
 /// Left unimplemented intentionally. Needs to be implemented by the user of the library.
 /// On construction a measurement should start, on destruction it should be stopped.
 class alignas(16) ExternalProfileMeasurement : public NonCopyable
-{	
-public:						
+{
+public:
 	/// Constructor
 									ExternalProfileMeasurement(const char *inName, uint32 inColor = 0);
 									~ExternalProfileMeasurement();
@@ -34,18 +34,18 @@ private:
 JPH_NAMESPACE_END
 
 //////////////////////////////////////////////////////////////////////////////////////////
-// Macros to do the actual profiling	
+// Macros to do the actual profiling
 //////////////////////////////////////////////////////////////////////////////////////////
 
 JPH_SUPPRESS_WARNING_PUSH
 JPH_CLANG_SUPPRESS_WARNING("-Wc++98-compat-pedantic")
 
 // Dummy implementations
-#define JPH_PROFILE_THREAD_START(name)			
-#define JPH_PROFILE_THREAD_END()				
-#define JPH_PROFILE_NEXTFRAME()			
-#define JPH_PROFILE_DUMP(...)				
-								
+#define JPH_PROFILE_THREAD_START(name)
+#define JPH_PROFILE_THREAD_END()
+#define JPH_PROFILE_NEXTFRAME()
+#define JPH_PROFILE_DUMP(...)
+
 // Scope profiling measurement
 #define JPH_PROFILE_TAG2(line)		profile##line
 #define JPH_PROFILE_TAG(line)		JPH_PROFILE_TAG2(line)
@@ -94,7 +94,7 @@ public:
 
 	/// Singleton instance
 	static Profiler *			sInstance;
-								
+
 private:
 	/// Helper class to freeze ProfileSamples per thread while processing them
 	struct ThreadSamples
@@ -105,12 +105,12 @@ private:
 	};
 
 	/// Helper class to aggregate ProfileSamples
-	class Aggregator			
-	{	
-	public:						
+	class Aggregator
+	{
+	public:
 		/// Constructor
 								Aggregator(const char *inName)										: mName(inName) { }
-								
+
 		/// Accumulate results for a measurement
 		void					AccumulateMeasurement(uint64 inCyclesInCallWithChildren, uint64 inCyclesInChildren)
 		{
@@ -127,16 +127,16 @@ private:
 			return mTotalCyclesInCallWithChildren > inRHS.mTotalCyclesInCallWithChildren;
 		}
 
-		/// Identification			
+		/// Identification
 		const char *			mName;																///< User defined name of this item
-								
-		/// Statistics				
+
+		/// Statistics
 		uint32					mCallCounter = 0;													///< Number of times AccumulateMeasurement was called
 		uint64					mTotalCyclesInCallWithChildren = 0;									///< Total amount of cycles spent in this scope
 		uint64					mTotalCyclesInChildren = 0;											///< Total amount of cycles spent in children of this scope
 		uint64					mMinCyclesInCallWithChildren = 0xffffffffffffffffUL;				///< Minimum amount of cycles spent per call
 		uint64					mMaxCyclesInCallWithChildren = 0;									///< Maximum amount of cycles spent per call
-	};							
+	};
 
 	using Threads = Array<ThreadSamples>;
 	using Aggregators = Array<Aggregator>;
@@ -154,7 +154,7 @@ private:
 	Array<ProfileThread *>		mThreads;															///< List of all active threads
 	bool						mDump = false;														///< When true, the samples are dumped next frame
 	String						mDumpTag;															///< When not empty, this overrides the auto incrementing number of the dump filename
-};							
+};
 
 // Class that contains the information of a single scoped measurement
 class alignas(16) JPH_EXPORT ProfileSample : public NonCopyable
@@ -200,12 +200,12 @@ private:
 
 /// Create this class on the stack to start sampling timing information of a particular scope
 class JPH_EXPORT ProfileMeasurement : public NonCopyable
-{	
-public:						
+{
+public:
 	/// Constructor
 	inline						ProfileMeasurement(const char *inName, uint32 inColor = 0);
 	inline						~ProfileMeasurement();
-							
+
 private:
 	ProfileSample *				mSample;
 	ProfileSample				mTemp;
@@ -218,7 +218,7 @@ JPH_NAMESPACE_END
 #include "Profiler.inl"
 
 //////////////////////////////////////////////////////////////////////////////////////////
-// Macros to do the actual profiling	
+// Macros to do the actual profiling
 //////////////////////////////////////////////////////////////////////////////////////////
 
 JPH_SUPPRESS_WARNING_PUSH
@@ -235,7 +235,7 @@ JPH_CLANG_SUPPRESS_WARNING("-Wc++98-compat-pedantic")
 
 /// End instrumenting a thread
 #define JPH_PROFILE_THREAD_END()		do { delete ProfileThread::sGetInstance(); ProfileThread::sSetInstance(nullptr); } while (false)
-								
+
 /// Scope profiling measurement
 #define JPH_PROFILE_TAG2(line)			profile##line
 #define JPH_PROFILE_TAG(line)			JPH_PROFILE_TAG2(line)
@@ -243,8 +243,8 @@ JPH_CLANG_SUPPRESS_WARNING("-Wc++98-compat-pedantic")
 
 /// Scope profiling for function
 #define JPH_PROFILE_FUNCTION()			JPH_PROFILE(JPH_FUNCTION_NAME)
-								
-/// Update frame counter								
+
+/// Update frame counter
 #define JPH_PROFILE_NEXTFRAME()			Profiler::sInstance->NextFrame()
 
 /// Dump profiling info

+ 1 - 1
Jolt/Core/Profiler.inl

@@ -23,7 +23,7 @@ ProfileThread::~ProfileThread()
 // ProfileMeasurement
 //////////////////////////////////////////////////////////////////////////////////////////
 
-ProfileMeasurement::ProfileMeasurement(const char *inName, uint32 inColor)	
+ProfileMeasurement::ProfileMeasurement(const char *inName, uint32 inColor)
 {
 	ProfileThread *current_thread = ProfileThread::sGetInstance();
 	if (current_thread == nullptr)

+ 2 - 2
Jolt/Core/QuickSort.h

@@ -13,11 +13,11 @@ template <typename Iterator, typename Compare>
 inline void QuickSortMedianOfThree(Iterator inFirst, Iterator inMiddle, Iterator inLast, Compare inCompare)
 {
 	// This should be guaranteed because we switch over to insertion sort when there's 32 or less elements
-	JPH_ASSERT(inFirst != inMiddle && inMiddle != inLast); 
+	JPH_ASSERT(inFirst != inMiddle && inMiddle != inLast);
 
 	if (inCompare(*inMiddle, *inFirst))
 		swap(*inFirst, *inMiddle);
-	
+
 	if (inCompare(*inLast, *inFirst))
 		swap(*inFirst, *inLast);
 

+ 23 - 23
Jolt/Core/RTTI.cpp

@@ -34,41 +34,41 @@ RTTI::RTTI(const char *inName, int inSize, pCreateObjectFunction inCreateObject,
 }
 
 int RTTI::GetBaseClassCount() const
-{ 
-	return (int)mBaseClasses.size(); 
+{
+	return (int)mBaseClasses.size();
 }
 
-const RTTI *RTTI::GetBaseClass(int inIdx) const								
-{ 
-	return mBaseClasses[inIdx].mRTTI; 
+const RTTI *RTTI::GetBaseClass(int inIdx) const
+{
+	return mBaseClasses[inIdx].mRTTI;
 }
 
 uint32 RTTI::GetHash() const
-{ 
+{
 	// Perform diffusion step to get from 64 to 32 bits (see https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function)
 	uint64 hash = HashString(mName);
 	return (uint32)(hash ^ (hash >> 32));
 }
 
 void *RTTI::CreateObject() const
-{ 
-	return IsAbstract()? nullptr : mCreate(); 
+{
+	return IsAbstract()? nullptr : mCreate();
 }
 
 void RTTI::DestructObject(void *inObject) const
-{ 
-	mDestruct(inObject); 
+{
+	mDestruct(inObject);
 }
 
 void RTTI::AddBaseClass(const RTTI *inRTTI, int inOffset)
-{ 
+{
 	JPH_ASSERT(inOffset >= 0 && inOffset < mSize, "Base class not contained in derived class");
 
 	// Add base class
 	BaseClass base;
 	base.mRTTI = inRTTI;
 	base.mOffset = inOffset;
-	mBaseClasses.push_back(base); 
+	mBaseClasses.push_back(base);
 
 	// Add attributes of base class
 	for (const SerializableAttribute &a : inRTTI->mAttributes)
@@ -76,9 +76,9 @@ void RTTI::AddBaseClass(const RTTI *inRTTI, int inOffset)
 }
 
 bool RTTI::operator == (const RTTI &inRHS) const
-{ 
-	// Compare addresses 
-	if (this == &inRHS) 
+{
+	// Compare addresses
+	if (this == &inRHS)
 		return true;
 
 	// Check that the names differ (if that is the case we probably have two instances
@@ -104,7 +104,7 @@ bool RTTI::IsKindOf(const RTTI *inRTTI) const
 const void *RTTI::CastTo(const void *inObject, const RTTI *inRTTI) const
 {
 	JPH_ASSERT(inObject != nullptr);
-	
+
 	// Check if this is the same type
 	if (this == inRTTI)
 		return inObject;
@@ -126,18 +126,18 @@ const void *RTTI::CastTo(const void *inObject, const RTTI *inRTTI) const
 }
 
 void RTTI::AddAttribute(const SerializableAttribute &inAttribute)
-{ 
-	mAttributes.push_back(inAttribute); 
+{
+	mAttributes.push_back(inAttribute);
 }
 
-int RTTI::GetAttributeCount() const									
-{ 
-	return (int)mAttributes.size(); 
+int RTTI::GetAttributeCount() const
+{
+	return (int)mAttributes.size();
 }
 
 const SerializableAttribute &RTTI::GetAttribute(int inIdx) const
-{ 
-	return mAttributes[inIdx]; 
+{
+	return mAttributes[inIdx];
 }
 
 JPH_NAMESPACE_END

+ 9 - 9
Jolt/Core/RTTI.h

@@ -19,7 +19,7 @@ JPH_NAMESPACE_BEGIN
 /// class)
 ///
 /// Notes:
-///  - An extra virtual member function is added. This adds 8 bytes to the size of 
+///  - An extra virtual member function is added. This adds 8 bytes to the size of
 ///    an instance of the class (unless you are already using virtual functions).
 ///
 /// To use RTTI on a specific class use:
@@ -43,7 +43,7 @@ JPH_NAMESPACE_BEGIN
 ///		}
 ///
 ///		JPH_IMPLEMENT_RTTI_VIRTUAL(Bar)
-///		{ 
+///		{
 ///			JPH_ADD_BASE_CLASS(Bar, Foo) // Multiple inheritance is allowed, just do JPH_ADD_BASE_CLASS for every base class
 ///		}
 ///
@@ -74,7 +74,7 @@ JPH_NAMESPACE_BEGIN
 ///		}
 ///
 ///		JPH_IMPLEMENT_RTTI_VIRTUAL(Bar)
-///		{ 
+///		{
 ///			JPH_ADD_BASE_CLASS(Bar, Foo)
 ///		}
 ///
@@ -97,14 +97,14 @@ JPH_NAMESPACE_BEGIN
 ///		DynamicCast<Bar>(bar_ptr) returns bar_ptr casted to pBar
 ///
 /// Other feature of DynamicCast:
-/// 
+///
 ///		class A { int data[5]; };
 ///		class B { int data[7]; };
 ///		class C : public A, public B { int data[9]; };
-///		
+///
 ///		C *c = new C;
 ///		A *a = c;
-/// 
+///
 /// Note that:
 ///
 ///		B *b = (B *)a;
@@ -116,7 +116,7 @@ JPH_NAMESPACE_BEGIN
 /// doesn't compile, and
 ///
 ///		B *b = DynamicCast<B>(a);
-/// 
+///
 /// does the correct cast
 class JPH_EXPORT RTTI
 {
@@ -151,7 +151,7 @@ public:
 
 	/// Add base class
 	void						AddBaseClass(const RTTI *inRTTI, int inOffset);
-	
+
 	/// Equality operators
 	bool						operator == (const RTTI &inRHS) const;
 	bool						operator != (const RTTI &inRHS) const						{ return !(*this == inRHS); }
@@ -333,7 +333,7 @@ public:																												\
 /// Define very dirty macro to get the offset of a baseclass into a class
 #define JPH_BASE_CLASS_OFFSET(inClass, inBaseClass)	((int(uint64((inBaseClass *)((inClass *)0x10000))))-0x10000)
 
-// JPH_ADD_BASE_CLASS 
+// JPH_ADD_BASE_CLASS
 #define JPH_ADD_BASE_CLASS(class_name, base_class_name)																\
 								inRTTI.AddBaseClass(JPH_RTTI(base_class_name), JPH_BASE_CLASS_OFFSET(class_name, base_class_name));
 

+ 15 - 15
Jolt/Core/Reference.h

@@ -31,8 +31,8 @@ template <class T> class RefConst;
 /// (and particularly identifying who owns who in the class hierarchy) you can avoid
 /// these problems.
 template <class T>
-class RefTarget		
-{	
+class RefTarget
+{
 public:
 	/// Constructor
 	inline					RefTarget() = default;
@@ -75,7 +75,7 @@ protected:
 	static constexpr uint32 cEmbedded = 0x0ebedded;							///< A large value that gets added to the refcount to mark the object as embedded
 
 	mutable atomic<uint32>	mRefCount = 0;									///< Current reference count
-};							
+};
 
 /// Pure virtual version of RefTarget
 class JPH_EXPORT RefTargetVirtual
@@ -106,15 +106,15 @@ public:
 	inline					Ref(const Ref<T> &inRHS)						: mPtr(inRHS.mPtr) { AddRef(); }
 	inline					Ref(Ref<T> &&inRHS) noexcept					: mPtr(inRHS.mPtr) { inRHS.mPtr = nullptr; }
 	inline					~Ref()											{ Release(); }
-						
+
 	/// Assignment operators
 	inline Ref<T> &			operator = (T *inRHS) 							{ if (mPtr != inRHS) { Release(); mPtr = inRHS; AddRef(); } return *this; }
 	inline Ref<T> &			operator = (const Ref<T> &inRHS)				{ if (mPtr != inRHS.mPtr) { Release(); mPtr = inRHS.mPtr; AddRef(); } return *this; }
 	inline Ref<T> &			operator = (Ref<T> &&inRHS) noexcept			{ if (mPtr != inRHS.mPtr) { Release(); mPtr = inRHS.mPtr; inRHS.mPtr = nullptr; } return *this; }
-						
+
 	/// Casting operators
 	inline					operator T *() const							{ return mPtr; }
-						
+
 	/// Access like a normal pointer
 	inline T * 				operator -> () const							{ return mPtr; }
 	inline T &				operator * () const								{ return *mPtr; }
@@ -137,9 +137,9 @@ private:
 	/// Use "variable = nullptr;" to release an object, do not call these functions
 	inline void				AddRef()										{ if (mPtr != nullptr) mPtr->AddRef(); }
 	inline void				Release()										{ if (mPtr != nullptr) mPtr->Release(); }
-	
+
 	T *						mPtr;											///< Pointer to object that we are reference counting
-};						
+};
 
 /// Class for automatic referencing, this is the equivalent of a CONST pointer to type T
 /// if you assign a value to this class it will increment the reference count by one
@@ -158,17 +158,17 @@ public:
 	inline					RefConst(const Ref<T> &inRHS)					: mPtr(inRHS.mPtr) { AddRef(); }
 	inline					RefConst(Ref<T> &&inRHS) noexcept				: mPtr(inRHS.mPtr) { inRHS.mPtr = nullptr; }
 	inline					~RefConst()										{ Release(); }
-						
+
 	/// Assignment operators
 	inline RefConst<T> &	operator = (const T * inRHS) 					{ if (mPtr != inRHS) { Release(); mPtr = inRHS; AddRef(); } return *this; }
 	inline RefConst<T> &	operator = (const RefConst<T> &inRHS)			{ if (mPtr != inRHS.mPtr) { Release(); mPtr = inRHS.mPtr; AddRef(); } return *this; }
 	inline RefConst<T> &	operator = (RefConst<T> &&inRHS) noexcept		{ if (mPtr != inRHS.mPtr) { Release(); mPtr = inRHS.mPtr; inRHS.mPtr = nullptr; } return *this; }
 	inline RefConst<T> &	operator = (const Ref<T> &inRHS)				{ if (mPtr != inRHS.mPtr) { Release(); mPtr = inRHS.mPtr; AddRef(); } return *this; }
 	inline RefConst<T> &	operator = (Ref<T> &&inRHS) noexcept			{ if (mPtr != inRHS.mPtr) { Release(); mPtr = inRHS.mPtr; inRHS.mPtr = nullptr; } return *this; }
-						
+
 	/// Casting operators
 	inline					operator const T * () const						{ return mPtr; }
-						
+
 	/// Access like a normal pointer
 	inline const T * 	 	operator -> () const							{ return mPtr; }
 	inline const T &		operator * () const								{ return *mPtr; }
@@ -191,9 +191,9 @@ private:
 	/// Use "variable = nullptr;" to release an object, do not call these functions
 	inline void				AddRef()										{ if (mPtr != nullptr) mPtr->AddRef(); }
 	inline void				Release()										{ if (mPtr != nullptr) mPtr->Release(); }
-	
+
 	const T *				mPtr;											///< Pointer to object that we are reference counting
-};						
+};
 
 JPH_NAMESPACE_END
 
@@ -203,7 +203,7 @@ JPH_CLANG_SUPPRESS_WARNING("-Wc++98-compat")
 namespace std
 {
 	/// Declare std::hash for Ref
-	template <class T> 
+	template <class T>
 	struct hash<JPH::Ref<T>>
 	{
 		size_t operator () (const JPH::Ref<T> &inRHS) const
@@ -213,7 +213,7 @@ namespace std
 	};
 
 	/// Declare std::hash for RefConst
-	template <class T> 
+	template <class T>
 	struct hash<JPH::RefConst<T>>
 	{
 		size_t operator () (const JPH::RefConst<T> &inRHS) const

+ 1 - 1
Jolt/Core/STLAllocator.h

@@ -89,7 +89,7 @@ JPH_NAMESPACE_END
 namespace std
 {
 	/// Declare std::hash for String, for some reason on Linux based platforms template deduction takes the wrong variant
-	template <> 
+	template <>
 	struct hash<JPH::String>
 	{
 		inline size_t operator () (const JPH::String &inRHS) const

+ 3 - 3
Jolt/Core/StaticArray.h

@@ -65,7 +65,7 @@ public:
 	/// Construct element at the back of the array
 	template <class... A>
 	void				emplace_back(A &&... inElement)
-	{	
+	{
 		JPH_ASSERT(mSize < N);
 		::new (&mElements[mSize++]) T(std::forward<A>(inElement)...);
 	}
@@ -245,7 +245,7 @@ public:
 
 		return *this;
 	}
-	
+
 	/// Comparing arrays
 	bool				operator == (const StaticArray<T, N> &inRHS) const
 	{
@@ -266,7 +266,7 @@ public:
 				return true;
 		return false;
 	}
-	
+
 protected:
 	struct alignas(T) Storage
 	{

+ 1 - 1
Jolt/Core/StreamIn.h

@@ -28,7 +28,7 @@ public:
 	{
 		ReadBytes(&outT, sizeof(outT));
 	}
-	
+
 	/// Read a vector of primitives from the binary stream
 	template <class T, class A>
 	void				Read(std::vector<T, A> &outT)

+ 2 - 2
Jolt/Core/StringTools.cpp

@@ -31,7 +31,7 @@ void StringReplace(String &ioString, const string_view &inSearch, const string_v
 	for (;;)
 	{
 		 index = ioString.find(inSearch, index);
-		 if (index == String::npos) 
+		 if (index == String::npos)
 			 break;
 
 		 ioString.replace(index, inSearch.size(), inReplace);
@@ -46,7 +46,7 @@ void StringToVector(const string_view &inString, Array<String> &outVector, const
 
 	// Ensure vector empty
 	if (inClearVector)
-		outVector.clear(); 
+		outVector.clear();
 
 	// No string? no elements
 	if (inString.empty())

+ 1 - 1
Jolt/Core/TempAllocator.h

@@ -8,7 +8,7 @@
 
 JPH_NAMESPACE_BEGIN
 
-/// Allocator for temporary allocations. 
+/// Allocator for temporary allocations.
 /// This allocator works as a stack: The blocks must always be freed in the reverse order as they are allocated.
 /// Note that allocations and frees can take place from different threads, but the order is guaranteed though
 /// job dependencies, so it is not needed to use any form of locking.

+ 3 - 3
Jolt/Core/TickCounter.cpp

@@ -58,7 +58,7 @@ static const uint64 sProcessorTicksPerSecond = []() {
 	return uint64(mhz) * 1000000UL;
 #elif defined(JPH_PLATFORM_BLUE)
 	return JPH_PLATFORM_BLUE_GET_TICK_FREQUENCY();
-#elif defined(JPH_PLATFORM_LINUX) || defined(JPH_PLATFORM_ANDROID) 
+#elif defined(JPH_PLATFORM_LINUX) || defined(JPH_PLATFORM_ANDROID)
 	// Open /proc/cpuinfo
     std::ifstream ifs("/proc/cpuinfo");
     if (ifs.is_open())
@@ -69,7 +69,7 @@ static const uint64 sProcessorTicksPerSecond = []() {
 			// Get next line
 			string line;
 			getline(ifs, line);
-		
+
 		#if defined(JPH_CPU_X86)
 			const char *cpu_str = "cpu MHz";
 		#elif defined(JPH_CPU_ARM)
@@ -85,7 +85,7 @@ static const uint64 sProcessorTicksPerSecond = []() {
 				// Find ':'
 				string::size_type pos = line.find(':', num_chars);
 				if (pos != String::npos)
-				{		
+				{
 					// Convert to number
 					string freq = line.substr(pos + 1);
 					return uint64(stod(freq) * 1000000.0);

+ 1 - 1
Jolt/Core/TickCounter.h

@@ -6,7 +6,7 @@
 
 // Include for __rdtsc
 #if defined(JPH_PLATFORM_WINDOWS)
-	#include <intrin.h> 
+	#include <intrin.h>
 #elif defined(JPH_CPU_X86) && defined(JPH_COMPILER_GCC)
 	#include <x86intrin.h>
 #endif

+ 10 - 10
Jolt/Geometry/AABox.h

@@ -50,15 +50,15 @@ public:
 	}
 
 	/// Encapsulate point in bounding box
-	void			Encapsulate(Vec3Arg inPos)						
-	{ 
-		mMin = Vec3::sMin(mMin, inPos); 
-		mMax = Vec3::sMax(mMax, inPos); 
+	void			Encapsulate(Vec3Arg inPos)
+	{
+		mMin = Vec3::sMin(mMin, inPos);
+		mMax = Vec3::sMax(mMax, inPos);
 	}
 
 	/// Encapsulate bounding box in bounding box
-	void			Encapsulate(const AABox &inRHS)			
-	{ 
+	void			Encapsulate(const AABox &inRHS)
+	{
 		mMin = Vec3::sMin(mMin, inRHS.mMin);
 		mMax = Vec3::sMax(mMax, inRHS.mMax);
 	}
@@ -93,7 +93,7 @@ public:
 		Vec3 min_length = Vec3::sReplicate(inMinEdgeLength);
 		mMax = Vec3::sSelect(mMax, mMin + min_length, Vec3::sLess(mMax - mMin, min_length));
 	}
-	
+
 	/// Widen the box on both sides by inVector
 	void			ExpandBy(Vec3Arg inVector)
 	{
@@ -120,8 +120,8 @@ public:
 	}
 
 	/// Get surface area of bounding box
-	float			GetSurfaceArea() const							
-	{ 
+	float			GetSurfaceArea() const
+	{
 		Vec3 extent = mMax - mMin;
 		return 2.0f * (extent.GetX() * extent.GetY() + extent.GetX() * extent.GetZ() + extent.GetY() * extent.GetZ());
 	}
@@ -186,7 +186,7 @@ public:
 		// Start with the translation of the matrix
 		Vec3 new_min, new_max;
 		new_min = new_max = inMatrix.GetTranslation();
-		
+
 		// Now find the extreme points by considering the product of the min and max with each column of inMatrix
 		for (int c = 0; c < 3; ++c)
 		{

+ 15 - 15
Jolt/Geometry/AABox4.h

@@ -92,11 +92,11 @@ JPH_INLINE UVec4 AABox4VsBox(Mat44Arg inOrientation, Vec3Arg inHalfExtents, Vec4
 	// Note that the code is swapped around: A is the aabox and B is the oriented box (this saves us from having to invert the orientation of the oriented box)
 
 	// Compute translation vector t (the translation of B in the space of A)
-	Vec4 t[3] { 
-		inOrientation.GetTranslation().SplatX() - 0.5f * (inBoxMinX + inBoxMaxX), 
-		inOrientation.GetTranslation().SplatY() - 0.5f * (inBoxMinY + inBoxMaxY), 
+	Vec4 t[3] {
+		inOrientation.GetTranslation().SplatX() - 0.5f * (inBoxMinX + inBoxMaxX),
+		inOrientation.GetTranslation().SplatY() - 0.5f * (inBoxMinY + inBoxMaxY),
 		inOrientation.GetTranslation().SplatZ() - 0.5f * (inBoxMinZ + inBoxMaxZ) };
-	
+
 	// Compute common subexpressions. Add in an epsilon term to
 	// counteract arithmetic errors when two edges are parallel and
 	// their cross product is (near) null (see text for details)
@@ -104,9 +104,9 @@ JPH_INLINE UVec4 AABox4VsBox(Mat44Arg inOrientation, Vec3Arg inHalfExtents, Vec4
 	Vec3 abs_r[3] { inOrientation.GetAxisX().Abs() + epsilon, inOrientation.GetAxisY().Abs() + epsilon, inOrientation.GetAxisZ().Abs() + epsilon };
 
 	// Half extents for a
-	Vec4 a_half_extents[3] { 
-		0.5f * (inBoxMaxX - inBoxMinX), 
-		0.5f * (inBoxMaxY - inBoxMinY), 
+	Vec4 a_half_extents[3] {
+		0.5f * (inBoxMaxX - inBoxMinX),
+		0.5f * (inBoxMaxY - inBoxMinY),
 		0.5f * (inBoxMaxZ - inBoxMinZ) };
 
 	// Half extents of b
@@ -119,7 +119,7 @@ JPH_INLINE UVec4 AABox4VsBox(Mat44Arg inOrientation, Vec3Arg inHalfExtents, Vec4
 
 	// Test axes L = A0, L = A1, L = A2
 	Vec4 ra, rb;
-	for (int i = 0; i < 3; i++) 
+	for (int i = 0; i < 3; i++)
 	{
 		ra = a_half_extents[i];
 		rb = b_half_extents_x * abs_r[0][i] + b_half_extents_y * abs_r[1][i] + b_half_extents_z * abs_r[2][i];
@@ -127,7 +127,7 @@ JPH_INLINE UVec4 AABox4VsBox(Mat44Arg inOrientation, Vec3Arg inHalfExtents, Vec4
 	}
 
 	// Test axes L = B0, L = B1, L = B2
-	for (int i = 0; i < 3; i++) 
+	for (int i = 0; i < 3; i++)
 	{
 		ra = a_half_extents[0] * abs_r[i][0] + a_half_extents[1] * abs_r[i][1] + a_half_extents[2] * abs_r[i][2];
 		rb = Vec4::sReplicate(inHalfExtents[i]);
@@ -151,34 +151,34 @@ JPH_INLINE UVec4 AABox4VsBox(Mat44Arg inOrientation, Vec3Arg inHalfExtents, Vec4
 
 	// Test axis L = A1 x B0
 	ra = a_half_extents[0] * abs_r[0][2] + a_half_extents[2] * abs_r[0][0];
-	rb = b_half_extents_y * abs_r[2][1] + b_half_extents_z * abs_r[1][1];	
+	rb = b_half_extents_y * abs_r[2][1] + b_half_extents_z * abs_r[1][1];
 	overlaps = UVec4::sAnd(overlaps, Vec4::sLessOrEqual((t[0] * inOrientation(2, 0) - t[2] * inOrientation(0, 0)).Abs(), ra + rb));
 
 	// Test axis L = A1 x B1
 	ra = a_half_extents[0] * abs_r[1][2] + a_half_extents[2] * abs_r[1][0];
 	rb = b_half_extents_x * abs_r[2][1] + b_half_extents_z * abs_r[0][1];
 	overlaps = UVec4::sAnd(overlaps, Vec4::sLessOrEqual((t[0] * inOrientation(2, 1) - t[2] * inOrientation(0, 1)).Abs(), ra + rb));
-	
+
 	// Test axis L = A1 x B2
 	ra = a_half_extents[0] * abs_r[2][2] + a_half_extents[2] * abs_r[2][0];
 	rb = b_half_extents_x * abs_r[1][1] + b_half_extents_y * abs_r[0][1];
 	overlaps = UVec4::sAnd(overlaps, Vec4::sLessOrEqual((t[0] * inOrientation(2, 2) - t[2] * inOrientation(0, 2)).Abs(), ra + rb));
-	
+
 	// Test axis L = A2 x B0
 	ra = a_half_extents[0] * abs_r[0][1] + a_half_extents[1] * abs_r[0][0];
 	rb = b_half_extents_y * abs_r[2][2] + b_half_extents_z * abs_r[1][2];
 	overlaps = UVec4::sAnd(overlaps, Vec4::sLessOrEqual((t[1] * inOrientation(0, 0) - t[0] * inOrientation(1, 0)).Abs(), ra + rb));
-	
+
 	// Test axis L = A2 x B1
 	ra = a_half_extents[0] * abs_r[1][1] + a_half_extents[1] * abs_r[1][0];
 	rb = b_half_extents_x * abs_r[2][2] + b_half_extents_z * abs_r[0][2];
 	overlaps = UVec4::sAnd(overlaps, Vec4::sLessOrEqual((t[1] * inOrientation(0, 1) - t[0] * inOrientation(1, 1)).Abs(), ra + rb));
-	
+
 	// Test axis L = A2 x B2
 	ra = a_half_extents[0] * abs_r[2][1] + a_half_extents[1] * abs_r[2][0];
 	rb = b_half_extents_x * abs_r[1][2] + b_half_extents_y * abs_r[0][2];
 	overlaps = UVec4::sAnd(overlaps, Vec4::sLessOrEqual((t[1] * inOrientation(0, 2) - t[0] * inOrientation(1, 2)).Abs(), ra + rb));
-	
+
 	// Return if the OBB vs AABBs are intersecting
 	return overlaps;
 }

+ 7 - 7
Jolt/Geometry/ClipPoly.h

@@ -19,7 +19,7 @@ void ClipPolyVsPlane(const VERTEX_ARRAY &inPolygonToClip, Vec3Arg inPlaneOrigin,
 	// Determine state of last point
 	Vec3 e1 = inPolygonToClip[inPolygonToClip.size() - 1];
 	float prev_num = (inPlaneOrigin - e1).Dot(inPlaneNormal);
-	bool prev_inside = prev_num < 0.0f; 
+	bool prev_inside = prev_num < 0.0f;
 
 	// Loop through all vertices
 	for (typename VERTEX_ARRAY::size_type j = 0; j < inPolygonToClip.size(); ++j)
@@ -73,13 +73,13 @@ void ClipPolyVsPoly(const VERTEX_ARRAY &inPolygonToClip, const VERTEX_ARRAY &inC
 		Vec3 clip_e1 = inClippingPolygon[i];
 		Vec3 clip_e2 = inClippingPolygon[(i + 1) % inClippingPolygon.size()];
 		Vec3 clip_normal = inClippingPolygonNormal.Cross(clip_e2 - clip_e1); // Pointing inward to the clipping polygon
-		
+
 		// Get source and target polygon
 		const VERTEX_ARRAY &src_polygon = (i == 0)? inPolygonToClip : tmp_vertices[tmp_vertices_idx];
 		tmp_vertices_idx ^= 1;
 		VERTEX_ARRAY &tgt_polygon = (i == inClippingPolygon.size() - 1)? outClippedPolygon : tmp_vertices[tmp_vertices_idx];
 		tgt_polygon.clear();
-		
+
 		// Clip against the edge
 		ClipPolyVsPlane(src_polygon, clip_e1, clip_normal, tgt_polygon);
 
@@ -115,8 +115,8 @@ void ClipPolyVsEdge(const VERTEX_ARRAY &inPolygonToClip, Vec3Arg inEdgeVertex1,
 	// Determine state of last point
 	Vec3 e1 = inPolygonToClip[inPolygonToClip.size() - 1];
 	float prev_num = (inEdgeVertex1 - e1).Dot(edge_normal);
-	bool prev_inside = prev_num < 0.0f; 
-	
+	bool prev_inside = prev_num < 0.0f;
+
 	// Loop through all vertices
 	for (typename VERTEX_ARRAY::size_type j = 0; j < inPolygonToClip.size(); ++j)
 	{
@@ -142,7 +142,7 @@ void ClipPolyVsEdge(const VERTEX_ARRAY &inPolygonToClip, Vec3Arg inEdgeVertex1,
 			else
 				outClippedPolygon.push_back(clipped_point);
 		}
-		
+
 		// Update previous state
 		prev_num = num;
 		prev_inside = cur_inside;
@@ -159,7 +159,7 @@ void ClipPolyVsAABox(const VERTEX_ARRAY &inPolygonToClip, const AABox &inAABox,
 
 	VERTEX_ARRAY tmp_vertices[2];
 	int tmp_vertices_idx = 0;
-	
+
 	for (int coord = 0; coord < 3; ++coord)
 		for (int side = 0; side < 2; ++side)
 		{

+ 81 - 81
Jolt/Geometry/ClosestPoint.h

@@ -40,7 +40,7 @@ namespace ClosestPoint
 			outU = 1.0f - outV;
 		}
 	}
-	
+
 	/// Compute barycentric coordinates of closest point to origin for plane defined by (inA, inB, inC)
 	/// Point can then be computed as inA * outU + inB * outV + inC * outW
 	inline void GetBaryCentricCoordinates(Vec3Arg inA, Vec3Arg inB, Vec3Arg inC, float &outU, float &outV, float &outW)
@@ -55,15 +55,15 @@ namespace ClosestPoint
 		Vec3 v2 = inC - inB;
 
 		// Make sure that the shortest edge is included in the calculation to keep the products a * b - c * d as small as possible to preserve accuracy
-		float d00 = v0.Dot(v0); 
-		float d11 = v1.Dot(v1); 
+		float d00 = v0.Dot(v0);
+		float d11 = v1.Dot(v1);
 		float d22 = v2.Dot(v2);
 		if (d00 <= d22)
 		{
 			// Use v0 and v1 to calculate barycentric coordinates
-			float d01 = v0.Dot(v1); 
-		
-			float denominator = d00 * d11 - d01 * d01; 
+			float d01 = v0.Dot(v1);
+
+			float denominator = d00 * d11 - d01 * d01;
 			if (abs(denominator) < 1.0e-12f)
 			{
 				// Degenerate triangle, return coordinates along longest edge
@@ -81,18 +81,18 @@ namespace ClosestPoint
 			else
 			{
 				float a0 = inA.Dot(v0);
-				float a1 = inA.Dot(v1); 
-				outV = (d01 * a1 - d11 * a0) / denominator; 
-				outW = (d01 * a0 - d00 * a1) / denominator; 
+				float a1 = inA.Dot(v1);
+				outV = (d01 * a1 - d11 * a0) / denominator;
+				outW = (d01 * a0 - d00 * a1) / denominator;
 				outU = 1.0f - outV - outW;
 			}
 		}
 		else
 		{
 			// Use v1 and v2 to calculate barycentric coordinates
-			float d12 = v1.Dot(v2); 
-		
-			float denominator = d11 * d22 - d12 * d12; 
+			float d12 = v1.Dot(v2);
+
+			float denominator = d11 * d22 - d12 * d12;
 			if (abs(denominator) < 1.0e-12f)
 			{
 				// Degenerate triangle, return coordinates along longest edge
@@ -110,9 +110,9 @@ namespace ClosestPoint
 			else
 			{
 				float c1 = inC.Dot(v1);
-				float c2 = inC.Dot(v2); 
-				outU = (d22 * c1 - d12 * c2) / denominator; 
-				outV = (d11 * c2 - d12 * c1) / denominator; 
+				float c2 = inC.Dot(v2);
+				outU = (d22 * c1 - d12 * c2) / denominator;
+				outV = (d11 * c2 - d12 * c1) / denominator;
 				outW = 1.0f - outU - outV;
 			}
 		}
@@ -120,7 +120,7 @@ namespace ClosestPoint
 
 	/// Get the closest point to the origin of line (inA, inB)
 	/// outSet describes which features are closest: 1 = a, 2 = b, 3 = line segment ab
-	inline Vec3	GetClosestPointOnLine(Vec3Arg inA, Vec3Arg inB, uint32 &outSet) 
+	inline Vec3	GetClosestPointOnLine(Vec3Arg inA, Vec3Arg inB, uint32 &outSet)
 	{
 		float u, v;
 		GetBaryCentricCoordinates(inA, inB, u, v);
@@ -255,67 +255,67 @@ namespace ClosestPoint
 			return closest_point;
 		}
 
-		// Check if P in vertex region outside A 
-		Vec3 ap = -a; 
-		float d1 = ab.Dot(ap); 
-		float d2 = ac.Dot(ap); 
+		// Check if P in vertex region outside A
+		Vec3 ap = -a;
+		float d1 = ab.Dot(ap);
+		float d2 = ac.Dot(ap);
 		if (d1 <= 0.0f && d2 <= 0.0f)
 		{
 			outSet = swap_ac.GetX()? 0b0100 : 0b0001;
 			return a; // barycentric coordinates (1,0,0)
 		}
 
-		// Check if P in vertex region outside B 
-		Vec3 bp = -inB; 
-		float d3 = ab.Dot(bp); 
-		float d4 = ac.Dot(bp); 
-		if (d3 >= 0.0f && d4 <= d3) 
+		// Check if P in vertex region outside B
+		Vec3 bp = -inB;
+		float d3 = ab.Dot(bp);
+		float d4 = ac.Dot(bp);
+		if (d3 >= 0.0f && d4 <= d3)
 		{
 			outSet = 0b0010;
 			return inB; // barycentric coordinates (0,1,0)
 		}
 
-		// Check if P in edge region of AB, if so return projection of P onto AB 
-		if (d1 * d4 <= d3 * d2 && d1 >= 0.0f && d3 <= 0.0f) 
-		{ 
-			float v = d1 / (d1 - d3); 
+		// Check if P in edge region of AB, if so return projection of P onto AB
+		if (d1 * d4 <= d3 * d2 && d1 >= 0.0f && d3 <= 0.0f)
+		{
+			float v = d1 / (d1 - d3);
 			outSet = swap_ac.GetX()? 0b0110 : 0b0011;
-			return a + v * ab; // barycentric coordinates (1-v,v,0) 
+			return a + v * ab; // barycentric coordinates (1-v,v,0)
 		}
 
-		// Check if P in vertex region outside C 
-		Vec3 cp = -c; 
-		float d5 = ab.Dot(cp); 
-		float d6 = ac.Dot(cp); 
-		if (d6 >= 0.0f && d5 <= d6) 
+		// Check if P in vertex region outside C
+		Vec3 cp = -c;
+		float d5 = ab.Dot(cp);
+		float d6 = ac.Dot(cp);
+		if (d6 >= 0.0f && d5 <= d6)
 		{
 			outSet = swap_ac.GetX()? 0b0001 : 0b0100;
 			return c; // barycentric coordinates (0,0,1)
 		}
 
-		// Check if P in edge region of AC, if so return projection of P onto AC 
-		if (d5 * d2 <= d1 * d6 && d2 >= 0.0f && d6 <= 0.0f) 
-		{ 
-			float w = d2 / (d2 - d6); 
+		// Check if P in edge region of AC, if so return projection of P onto AC
+		if (d5 * d2 <= d1 * d6 && d2 >= 0.0f && d6 <= 0.0f)
+		{
+			float w = d2 / (d2 - d6);
 			outSet = 0b0101;
-			return a + w * ac; // barycentric coordinates (1-w,0,w) 
+			return a + w * ac; // barycentric coordinates (1-w,0,w)
 		}
 
-		// Check if P in edge region of BC, if so return projection of P onto BC 
+		// Check if P in edge region of BC, if so return projection of P onto BC
 		float d4_d3 = d4 - d3;
 		float d5_d6 = d5 - d6;
-		if (d3 * d6 <= d5 * d4 && d4_d3 >= 0.0f && d5_d6 >= 0.0f) 
-		{ 
-			float w = d4_d3 / (d4_d3 + d5_d6); 
+		if (d3 * d6 <= d5 * d4 && d4_d3 >= 0.0f && d5_d6 >= 0.0f)
+		{
+			float w = d4_d3 / (d4_d3 + d5_d6);
 			outSet = swap_ac.GetX()? 0b0011 : 0b0110;
-			return inB + w * (c - inB); // barycentric coordinates (0,1-w,w) 
+			return inB + w * (c - inB); // barycentric coordinates (0,1-w,w)
 		}
 
 		// P inside face region.
 		// Here we deviate from Christer Ericson's article to improve accuracy.
 		// Determine distance between triangle and origin: distance = (centroid - origin) . normal / |normal|
 		// Closest point to origin is then: distance . normal / |normal|
-		// Note that this way of calculating the closest point is much more accurate than first calculating barycentric coordinates 
+		// Note that this way of calculating the closest point is much more accurate than first calculating barycentric coordinates
 		// and then calculating the closest point based on those coordinates.
 		outSet = 0b0111;
 		return n * (a + inB + c).Dot(n) / (3.0f * n_len_sq);
@@ -327,22 +327,22 @@ namespace ClosestPoint
 		// Taken from: Real-Time Collision Detection - Christer Ericson (Section: Closest Point on Tetrahedron to Point)
 		// With p = 0
 
-		// Test if point p and d lie on opposite sides of plane through abc 
+		// Test if point p and d lie on opposite sides of plane through abc
 		Vec3 n = (inB - inA).Cross(inC - inA);
 		float signp = inA.Dot(n); // [AP AB AC]
-		float signd = (inD - inA).Dot(n); // [AD AB AC] 
-													   
+		float signd = (inD - inA).Dot(n); // [AD AB AC]
+
 		// Points on opposite sides if expression signs are the same
 		// Note that we left out the minus sign in signp so we need to check > 0 instead of < 0 as in Christer's book
 		// We compare against a small negative value to allow for a little bit of slop in the calculations
-		return signp * signd > -FLT_EPSILON; 
+		return signp * signd > -FLT_EPSILON;
 	}
 
 	/// Returns for each of the planes of the tetrahedron if the origin is inside it
-	/// Roughly equivalent to: 
-	///	[OriginOutsideOfPlane(inA, inB, inC, inD), 
-	///	 OriginOutsideOfPlane(inA, inC, inD, inB), 
-	///	 OriginOutsideOfPlane(inA, inD, inB, inC), 
+	/// Roughly equivalent to:
+	///	[OriginOutsideOfPlane(inA, inB, inC, inD),
+	///	 OriginOutsideOfPlane(inA, inC, inD, inB),
+	///	 OriginOutsideOfPlane(inA, inD, inB, inC),
 	///	 OriginOutsideOfPlane(inB, inD, inC, inA)]
 	inline UVec4 OriginOutsideOfTetrahedronPlanes(Vec3Arg inA, Vec3Arg inB, Vec3Arg inC, Vec3Arg inD)
 	{
@@ -356,7 +356,7 @@ namespace ClosestPoint
 		Vec3 ac_cross_ad = ac.Cross(ad);
 		Vec3 ad_cross_ab = ad.Cross(ab);
 		Vec3 bd_cross_bc = bd.Cross(bc);
-		
+
 		// For each plane get the side on which the origin is
 		float signp0 = inA.Dot(ab_cross_ac); // ABC
 		float signp1 = inA.Dot(ac_cross_ad); // ACD
@@ -400,15 +400,15 @@ namespace ClosestPoint
 		// Taken from: Real-Time Collision Detection - Christer Ericson (Section: Closest Point on Tetrahedron to Point)
 		// With p = 0
 
-		// Start out assuming point inside all halfspaces, so closest to itself 
+		// Start out assuming point inside all halfspaces, so closest to itself
 		uint32 closest_set = 0b1111;
-		Vec3 closest_point = Vec3::sZero(); 
-		float best_dist_sq = FLT_MAX; 
-		
+		Vec3 closest_point = Vec3::sZero();
+		float best_dist_sq = FLT_MAX;
+
 		// Determine for each of the faces of the tetrahedron if the origin is in front of the plane
 		UVec4 origin_out_of_planes = OriginOutsideOfTetrahedronPlanes(inA, inB, inC, inD);
 
-		// If point outside face abc then compute closest point on abc 
+		// If point outside face abc then compute closest point on abc
 		if (origin_out_of_planes.GetX()) // OriginOutsideOfPlane(inA, inB, inC, inD)
 		{
 			if constexpr (MustIncludeD)
@@ -421,18 +421,18 @@ namespace ClosestPoint
 			else
 			{
 				// Test the face normally
-				closest_point = GetClosestPointOnTriangle<false>(inA, inB, inC, closest_set); 
+				closest_point = GetClosestPointOnTriangle<false>(inA, inB, inC, closest_set);
 			}
 			best_dist_sq = closest_point.LengthSq();
 		}
-		
-		// Repeat test for face acd 
+
+		// Repeat test for face acd
 		if (origin_out_of_planes.GetY()) // OriginOutsideOfPlane(inA, inC, inD, inB)
-		{ 
+		{
 			uint32 set;
-			Vec3 q = GetClosestPointOnTriangle<MustIncludeD>(inA, inC, inD, set); 
-			float dist_sq = q.LengthSq(); 
-			if (dist_sq < best_dist_sq) 
+			Vec3 q = GetClosestPointOnTriangle<MustIncludeD>(inA, inC, inD, set);
+			float dist_sq = q.LengthSq();
+			if (dist_sq < best_dist_sq)
 			{
 				best_dist_sq = dist_sq;
 				closest_point = q;
@@ -440,39 +440,39 @@ namespace ClosestPoint
 			}
 		}
 
-		// Repeat test for face adb 
+		// Repeat test for face adb
 		if (origin_out_of_planes.GetZ()) // OriginOutsideOfPlane(inA, inD, inB, inC)
 		{
 			// Keep original vertex order, it doesn't matter if the triangle is facing inward or outward
 			// and it improves consistency for GJK which will always add a new vertex D and keep the closest
 			// feature from the previous iteration in ABC
 			uint32 set;
-			Vec3 q = GetClosestPointOnTriangle<MustIncludeD>(inA, inB, inD, set); 
-			float dist_sq = q.LengthSq(); 
-			if (dist_sq < best_dist_sq) 
+			Vec3 q = GetClosestPointOnTriangle<MustIncludeD>(inA, inB, inD, set);
+			float dist_sq = q.LengthSq();
+			if (dist_sq < best_dist_sq)
 			{
 				best_dist_sq = dist_sq;
 				closest_point = q;
-				closest_set = (set & 0b0011) + ((set & 0b0100) << 1); 
+				closest_set = (set & 0b0011) + ((set & 0b0100) << 1);
 			}
-		} 
-		
-		// Repeat test for face bdc 
+		}
+
+		// Repeat test for face bdc
 		if (origin_out_of_planes.GetW()) // OriginOutsideOfPlane(inB, inD, inC, inA)
-		{ 
+		{
 			// Keep original vertex order, it doesn't matter if the triangle is facing inward or outward
 			// and it improves consistency for GJK which will always add a new vertex D and keep the closest
 			// feature from the previous iteration in ABC
 			uint32 set;
-			Vec3 q = GetClosestPointOnTriangle<MustIncludeD>(inB, inC, inD, set); 
-			float dist_sq = q.LengthSq(); 
-			if (dist_sq < best_dist_sq) 
+			Vec3 q = GetClosestPointOnTriangle<MustIncludeD>(inB, inC, inD, set);
+			float dist_sq = q.LengthSq();
+			if (dist_sq < best_dist_sq)
 			{
 				closest_point = q;
 				closest_set = set << 1;
 			}
-		} 
-	
+		}
+
 		outSet = closest_set;
 		return closest_point;
 	}

+ 27 - 27
Jolt/Geometry/ConvexHullBuilder.cpp

@@ -26,8 +26,8 @@ ConvexHullBuilder::Face::~Face()
 	Edge *e = mFirstEdge;
 	if (e != nullptr)
 	{
-		do 
-		{ 
+		do
+		{
 			Edge *next = e->mNextEdge;
 			delete e;
 			e = next;
@@ -228,7 +228,7 @@ bool ConvexHullBuilder::AssignPointToFace(int inPositionIdx, const Faces &inFace
 				best_face->mConflictList.push_back(best_face->mConflictList.back());
 				best_face->mConflictList[best_face->mConflictList.size() - 2] = inPositionIdx;
 			}
-			
+
 			return true;
 		}
 	}
@@ -251,8 +251,8 @@ int ConvexHullBuilder::GetNumVerticesUsed() const
 	for (Face *f : mFaces)
 	{
 		Edge *e = f->mFirstEdge;
-		do 
-		{ 
+		do
+		{
 			used_verts.insert(e->mStartIdx);
 			e = e->mNextEdge;
 		} while (e != f->mFirstEdge);
@@ -270,15 +270,15 @@ bool ConvexHullBuilder::ContainsFace(const Array<int> &inIndices) const
 		{
 			size_t matches = 0;
 
-			do 
-			{ 
+			do
+			{
 				// Check if index matches
 				if (*index != e->mStartIdx)
 					break;
 
 				// Increment number of matches
 				matches++;
-				
+
 				// Next index in list of inIndices
 				index++;
 				if (index == inIndices.end())
@@ -287,7 +287,7 @@ bool ConvexHullBuilder::ContainsFace(const Array<int> &inIndices) const
 				// Next edge
 				e = e->mNextEdge;
 			} while (e != f->mFirstEdge);
-			
+
 			if (matches == inIndices.size())
 				return true;
 		}
@@ -313,7 +313,7 @@ ConvexHullBuilder::EResult ConvexHullBuilder::Initialize(int inMaxVertices, floa
 
 	// Increase desired tolerance if accuracy doesn't allow it
 	float tolerance_sq = max(coplanar_tolerance_sq, Square(inTolerance));
-	
+
 	// Find point furthest from the origin
 	int idx1 = -1;
 	float max_dist_sq = -1.0f;
@@ -646,7 +646,7 @@ void ConvexHullBuilder::AddPoint(Face *inFacingFace, int inIdx, float inCoplanar
 		Face *f = CreateTriangle(e.mStartIdx, e.mEndIdx, inIdx);
 		outNewFaces.push_back(f);
 	}
-		
+
 	// Link edges
 	for (Faces::size_type i = 0; i < outNewFaces.size(); ++i)
 	{
@@ -722,8 +722,8 @@ void ConvexHullBuilder::FreeFace(Face *inFace)
 	// Make sure that this face is not connected
 	Edge *e = inFace->mFirstEdge;
 	if (e != nullptr)
-		do 
-		{ 
+		do
+		{
 			JPH_ASSERT(e->mNeighbourEdge == nullptr);
 			e = e->mNextEdge;
 		} while (e != inFace->mFirstEdge);
@@ -753,8 +753,8 @@ void ConvexHullBuilder::sUnlinkFace(Face *inFace)
 {
 	// Unlink from neighbours
 	Edge *e = inFace->mFirstEdge;
-	do 
-	{ 
+	do
+	{
 		if (e->mNeighbourEdge != nullptr)
 		{
 			// Validate that neighbour points to us
@@ -958,7 +958,7 @@ void ConvexHullBuilder::MergeDegenerateFace(Face *inFace, Faces &ioAffectedFaces
 				max_length_sq = length_sq;
 				longest_edge = e;
 			}
-			p1 = p2;	
+			p1 = p2;
 			e = next;
 		} while (e != inFace->mFirstEdge);
 
@@ -990,7 +990,7 @@ void ConvexHullBuilder::MergeCoplanarOrConcaveFaces(Face *inFace, float inCoplan
 		float signed_dist_face_centroid_sq = abs(dist_face_centroid) * dist_face_centroid;
 		float face_normal_len_sq = inFace->mNormal.LengthSq();
 		float other_face_normal_len_sq = other_face->mNormal.LengthSq();
-		if ((signed_dist_other_face_centroid_sq > -inCoplanarToleranceSq * face_normal_len_sq 
+		if ((signed_dist_other_face_centroid_sq > -inCoplanarToleranceSq * face_normal_len_sq
 			|| signed_dist_face_centroid_sq > -inCoplanarToleranceSq * other_face_normal_len_sq)
 			&& inFace->mNormal.Dot(other_face->mNormal) > 0.0f) // Never merge faces that are back to back
 		{
@@ -1013,7 +1013,7 @@ void ConvexHullBuilder::sMarkAffected(Face *inFace, Faces &ioAffectedFaces)
 
 void ConvexHullBuilder::RemoveInvalidEdges(Face *inFace, Faces &ioAffectedFaces)
 {
-	// This marks that the plane needs to be recalculated (we delay this until the end of the 
+	// This marks that the plane needs to be recalculated (we delay this until the end of the
 	// function since we don't use the plane and we want to avoid calculating it multiple times)
 	bool recalculate_plane = false;
 
@@ -1174,8 +1174,8 @@ void ConvexHullBuilder::DumpFace(const Face *inFace) const
 	Trace("f:0x%p", inFace);
 
 	const Edge *e = inFace->mFirstEdge;
-	do 
-	{ 
+	do
+	{
 		Trace("\te:0x%p { i:%d e:0x%p f:0x%p }", e, e->mStartIdx, e->mNeighbourEdge, e->mNeighbourEdge->mFace);
 		e = e->mNextEdge;
 	} while (e != inFace->mFirstEdge);
@@ -1196,8 +1196,8 @@ void ConvexHullBuilder::ValidateFace(const Face *inFace) const
 	{
 		const Edge *e = inFace->mFirstEdge;
 		if (e != nullptr)
-			do 
-			{ 
+			do
+			{
 				JPH_ASSERT(e->mNeighbourEdge == nullptr);
 				e = e->mNextEdge;
 			} while (e != inFace->mFirstEdge);
@@ -1207,8 +1207,8 @@ void ConvexHullBuilder::ValidateFace(const Face *inFace) const
 		int edge_count = 0;
 
 		const Edge *e = inFace->mFirstEdge;
-		do 
-		{ 
+		do
+		{
 			// Count edge
 			++edge_count;
 
@@ -1275,7 +1275,7 @@ void ConvexHullBuilder::GetCenterOfMassAndVolume(Vec3 &outCenterOfMass, float &o
 		Vec3 v2 = mPositions[e->mStartIdx];
 
 		for (e = e->mNextEdge; e != f->mFirstEdge; e = e->mNextEdge)
-		{ 
+		{
 			// Fetch the last point of the triangle
 			Vec3 v3 = mPositions[e->mStartIdx];
 
@@ -1423,7 +1423,7 @@ void ConvexHullBuilder::DrawWireFace(const Face *inFace, ColorArg inColor) const
 	const Edge *e = inFace->mFirstEdge;
 	RVec3 prev = cDrawScale * (mOffset + mPositions[e->mStartIdx]);
 	do
-	{ 
+	{
 		const Edge *next = e->mNextEdge;
 		RVec3 cur = cDrawScale * (mOffset + mPositions[next->mStartIdx]);
 		DebugRenderer::sInstance->DrawArrow(prev, cur, inColor, 0.01f);
@@ -1451,7 +1451,7 @@ void ConvexHullBuilder::DumpShape() const
 
 	std::ofstream f;
 	f.open(StringFormat("dumped_shape%d.cpp", shape_no).c_str(), std::ofstream::out | std::ofstream::trunc);
-	if (!f.is_open()) 
+	if (!f.is_open())
 		return;
 
 	f << "{\n";

+ 2 - 2
Jolt/Geometry/ConvexHullBuilder.h

@@ -207,7 +207,7 @@ private:
 	/// Merges inFace with a neighbour if it is degenerate (a sliver)
 	void				MergeDegenerateFace(Face *inFace, Faces &ioAffectedFaces);
 
-	/// Merges any coplanar as well as neighbours that form a non-convex edge into inFace. 
+	/// Merges any coplanar as well as neighbours that form a non-convex edge into inFace.
 	/// Faces are considered coplanar if the distance^2 of the other face's centroid is smaller than inToleranceSq.
 	void				MergeCoplanarOrConcaveFaces(Face *inFace, float inToleranceSq, Faces &ioAffectedFaces);
 
@@ -267,7 +267,7 @@ private:
 	CoplanarList		mCoplanarList;						///< List of positions that are coplanar to a face but outside of the face, these are added to the hull at the end
 
 #ifdef JPH_CONVEX_BUILDER_DEBUG
-	int					mIteration;							///< Number of iterations we've had so far (for debug purposes)	
+	int					mIteration;							///< Number of iterations we've had so far (for debug purposes)
 	mutable RVec3		mOffset;							///< Offset to use for state drawing
 	Vec3				mDelta;								///< Delta offset between next states
 #endif

+ 4 - 4
Jolt/Geometry/ConvexHullBuilder2D.cpp

@@ -19,10 +19,10 @@ void ConvexHullBuilder2D::Edge::CalculateNormalAndCenter(const Vec3 *inPositions
 
 	// Center of edge
 	mCenter = 0.5f * (p1 + p2);
-			
-	// Create outward pointing normal. 
+
+	// Create outward pointing normal.
 	// We have two choices for the normal (which satisfies normal . edge = 0):
-	// normal1 = (-edge.y, edge.x, 0) 
+	// normal1 = (-edge.y, edge.x, 0)
 	// normal2 = (edge.y, -edge.x, 0)
 	// We want (normal x edge).z > 0 so that the normal points out of the polygon. Only normal2 satisfies this condition.
 	Vec3 edge = p2 - p1;
@@ -99,7 +99,7 @@ void ConvexHullBuilder2D::ValidateEdges() const
 
 		++count;
 		edge = edge->mNextEdge;
-	} while (edge != mFirstEdge);	
+	} while (edge != mFirstEdge);
 
 	// Validate that count matches
 	JPH_ASSERT(count == mNumEdges);

+ 3 - 3
Jolt/Geometry/ConvexHullBuilder2D.h

@@ -10,16 +10,16 @@
 
 JPH_NAMESPACE_BEGIN
 
-/// A convex hull builder that tries to create 2D hulls as accurately as possible. Used for offline processing. 
+/// A convex hull builder that tries to create 2D hulls as accurately as possible. Used for offline processing.
 class JPH_EXPORT ConvexHullBuilder2D : public NonCopyable
 {
 public:
-	using Positions = Array<Vec3>; 
+	using Positions = Array<Vec3>;
 	using Edges = Array<int>;
 
 	/// Constructor
 	/// @param inPositions Positions used to make the hull. Uses X and Y component of Vec3 only!
-	explicit			ConvexHullBuilder2D(const Positions &inPositions); 
+	explicit			ConvexHullBuilder2D(const Positions &inPositions);
 
 	/// Destructor
 						~ConvexHullBuilder2D();

+ 3 - 3
Jolt/Geometry/ConvexSupport.h

@@ -50,7 +50,7 @@ struct AddConvexRadius
 	{
 	}
 
-	/// Calculate the support vector for this convex shape. 
+	/// Calculate the support vector for this convex shape.
 	Vec3					GetSupport(Vec3Arg inDirection) const
 	{
 		float length = inDirection.Length();
@@ -71,7 +71,7 @@ struct MinkowskiDifference
 	{
 	}
 
-	/// Calculate the support vector for this convex shape. 
+	/// Calculate the support vector for this convex shape.
 	Vec3					GetSupport(Vec3Arg inDirection) const
 	{
 		return mObjectA.GetSupport(inDirection) - mObjectB.GetSupport(-inDirection);
@@ -159,7 +159,7 @@ struct PolygonConvexSupport
 	{
 		Vec3 support_point = mVertices[0];
 		float best_dot = mVertices[0].Dot(inDirection);
-		
+
 		for (typename VERTEX_ARRAY::const_iterator v = mVertices.begin() + 1; v < mVertices.end(); ++v)
 		{
 			float dot = v->Dot(inDirection);

+ 3 - 3
Jolt/Geometry/Ellipse.h

@@ -52,13 +52,13 @@ public:
 				return Float2(a_sq * inPoint.x / t_plus_a_sq, b_sq * inPoint.y / t_plus_b_sq);
 
 			// Get derivative dg/dt = g'(t) = -2 (b^2 y^2 / (t + b^2)^3 + a^2 x^2 / (t + a^2)^3)
-			float gt_accent = -2.0f * 
-				(a_sq * Square(inPoint.x) / Cubed(t_plus_a_sq) 
+			float gt_accent = -2.0f *
+				(a_sq * Square(inPoint.x) / Cubed(t_plus_a_sq)
 				+ b_sq * Square(inPoint.y) / Cubed(t_plus_b_sq));
 
 			// Calculate t for next iteration: tn+1 = tn - g(t) / g'(t)
 			float tn = t - gt / gt_accent;
-			t = tn;			
+			t = tn;
 		}
 	}
 

+ 14 - 14
Jolt/Geometry/GJKClosestPoint.h

@@ -28,7 +28,7 @@ private:
 	/// @param outV Closest point
 	/// @param outVLenSq |outV|^2
 	/// @param outSet Set of points that form the new simplex closest to the origin (bit 1 = mY[0], bit 2 = mY[1], ...)
-	/// 
+	///
 	/// If LastPointPartOfClosestFeature is true then the last point added will be assumed to be part of the closest feature and the function will do less work.
 	///
 	/// @return True if new closest point was found.
@@ -166,10 +166,10 @@ private:
 	// Calculate closest points on A and B
 	void		CalculatePointAAndB(Vec3 &outPointA, Vec3 &outPointB) const
 	{
-		switch (mNumPoints)		
+		switch (mNumPoints)
 		{
 		case 1:
-			outPointA = mP[0]; 
+			outPointA = mP[0];
 			outPointB = mQ[0];
 			break;
 
@@ -199,7 +199,7 @@ private:
 			break;
 		}
 	}
-	
+
 public:
 	/// Test if inA and inB intersect
 	///
@@ -517,7 +517,7 @@ public:
 	///	@param inTolerance The minimal distance between the ray and A before it is considered colliding
 	/// @param inA A convex object that has the GetSupport(Vec3) function
 	/// @param ioLambda The max fraction along the ray, on output updated with the actual collision fraction.
-	/// 
+	///
 	///	@return true if a hit was found, ioLambda is the solution for lambda.
 	template <typename A>
 	bool		CastRay(Vec3Arg inRayOrigin, Vec3Arg inRayDirection, float inTolerance, const A &inA, float &ioLambda)
@@ -532,7 +532,7 @@ public:
 		Vec3 v = x - inA.GetSupport(Vec3::sZero());
 		float v_len_sq = FLT_MAX;
 		bool allow_restart = false;
-				
+
 		for (;;)
 		{
 #ifdef JPH_GJK_DEBUG
@@ -579,7 +579,7 @@ public:
 
 				// Update x to new closest point on the ray
 				x = inRayOrigin + lambda * inRayDirection;
-				
+
 				// We've shifted x, so reset v_len_sq so that it is not used as early out for GetClosest
 				v_len_sq = FLT_MAX;
 
@@ -626,7 +626,7 @@ public:
 
 			if (needs_restart)
 			{
-				// Only allow 1 restart, if we still can't get a closest point 
+				// Only allow 1 restart, if we still can't get a closest point
 				// we're so close that we return this as a hit
 				if (!allow_restart)
 					break;
@@ -699,7 +699,7 @@ public:
 	///	@param outPointA is the contact point on A (if outSeparatingAxis is near zero, this may not be not the deepest point)
 	///	@param outPointB is the contact point on B (if outSeparatingAxis is near zero, this may not be not the deepest point)
 	/// @param outSeparatingAxis On return this will contain a vector that points from A to B along the smallest distance of separation.
-	/// The length of this vector indicates the separation of A and B without their convex radius. 
+	/// The length of this vector indicates the separation of A and B without their convex radius.
 	/// If it is near zero, the direction may not be accurate as the bodies may overlap when lambda = 0.
 	///
 	///	@return true if a hit was found, ioLambda is the solution for lambda and outPoint and outSeparatingAxis are valid.
@@ -783,7 +783,7 @@ public:
 
 				// Update x to new closest point on the ray
 				x = lambda * inDirection;
-				
+
 				// We've shifted x, so reset v_len_sq so that it is not used as early out when GetClosest returns false
 				v_len_sq = FLT_MAX;
 
@@ -835,7 +835,7 @@ public:
 
 			if (needs_restart)
 			{
-				// Only allow 1 restart, if we still can't get a closest point 
+				// Only allow 1 restart, if we still can't get a closest point
 				// we're so close that we return this as a hit
 				if (!allow_restart)
 					break;
@@ -881,10 +881,10 @@ public:
 
 		// Get the contact point
 		// Note that A and B will coincide when lambda > 0. In this case we calculate only B as it is more accurate as it contains less terms.
-		switch (mNumPoints)		
+		switch (mNumPoints)
 		{
 		case 1:
-			outPointB = mQ[0] + convex_radius_b; 
+			outPointB = mQ[0] + convex_radius_b;
 			outPointA = lambda > 0.0f? outPointB : mP[0] - convex_radius_a;
 			break;
 
@@ -908,7 +908,7 @@ public:
 			break;
 		}
 
-		// Store separating axis, in case we have a convex radius we can just return v, 
+		// Store separating axis, in case we have a convex radius we can just return v,
 		// otherwise v will be very small and we resort to returning previous v as an approximation.
 		outSeparatingAxis = sum_convex_radius > 0.0f? -v : -prev_v;
 

+ 16 - 16
Jolt/Geometry/OrientedBox.cpp

@@ -30,7 +30,7 @@ bool OrientedBox::Overlaps(const AABox &inBox, float inEpsilon) const
 
 	// Test axes L = A0, L = A1, L = A2
 	float ra, rb;
-	for (int i = 0; i < 3; i++) 
+	for (int i = 0; i < 3; i++)
 	{
 		ra = a_half_extents[i];
 		rb = mHalfExtents[0] * abs_r[0][i] + mHalfExtents[1] * abs_r[1][i] + mHalfExtents[2] * abs_r[2][i];
@@ -38,7 +38,7 @@ bool OrientedBox::Overlaps(const AABox &inBox, float inEpsilon) const
 	}
 
 	// Test axes L = B0, L = B1, L = B2
-	for (int i = 0; i < 3; i++) 
+	for (int i = 0; i < 3; i++)
 	{
 		ra = a_half_extents.Dot(abs_r[i]);
 		rb = mHalfExtents[i];
@@ -62,34 +62,34 @@ bool OrientedBox::Overlaps(const AABox &inBox, float inEpsilon) const
 
 	// Test axis L = A1 x B0
 	ra = a_half_extents[0] * abs_r[0][2] + a_half_extents[2] * abs_r[0][0];
-	rb = mHalfExtents[1] * abs_r[2][1] + mHalfExtents[2] * abs_r[1][1];	
+	rb = mHalfExtents[1] * abs_r[2][1] + mHalfExtents[2] * abs_r[1][1];
 	if (abs(rot(0, 3) * rot(2, 0) - rot(2, 3) * rot(0, 0)) > ra + rb) return false;
 
 	// Test axis L = A1 x B1
 	ra = a_half_extents[0] * abs_r[1][2] + a_half_extents[2] * abs_r[1][0];
 	rb = mHalfExtents[0] * abs_r[2][1] + mHalfExtents[2] * abs_r[0][1];
 	if (abs(rot(0, 3) * rot(2, 1) - rot(2, 3) * rot(0, 1)) > ra + rb) return false;
-	
+
 	// Test axis L = A1 x B2
 	ra = a_half_extents[0] * abs_r[2][2] + a_half_extents[2] * abs_r[2][0];
 	rb = mHalfExtents[0] * abs_r[1][1] + mHalfExtents[1] * abs_r[0][1];
 	if (abs(rot(0, 3) * rot(2, 2) - rot(2, 3) * rot(0, 2)) > ra + rb) return false;
-	
+
 	// Test axis L = A2 x B0
 	ra = a_half_extents[0] * abs_r[0][1] + a_half_extents[1] * abs_r[0][0];
 	rb = mHalfExtents[1] * abs_r[2][2] + mHalfExtents[2] * abs_r[1][2];
 	if (abs(rot(1, 3) * rot(0, 0) - rot(0, 3) * rot(1, 0)) > ra + rb) return false;
-	
+
 	// Test axis L = A2 x B1
 	ra = a_half_extents[0] * abs_r[1][1] + a_half_extents[1] * abs_r[1][0];
 	rb = mHalfExtents[0] * abs_r[2][2] + mHalfExtents[2] * abs_r[0][2];
 	if (abs(rot(1, 3) * rot(0, 1) - rot(0, 3) * rot(1, 1)) > ra + rb) return false;
-	
+
 	// Test axis L = A2 x B2
 	ra = a_half_extents[0] * abs_r[2][1] + a_half_extents[1] * abs_r[2][0];
 	rb = mHalfExtents[0] * abs_r[1][2] + mHalfExtents[1] * abs_r[0][2];
 	if (abs(rot(1, 3) * rot(0, 2) - rot(0, 3) * rot(1, 2)) > ra + rb) return false;
-	
+
 	// Since no separating axis is found, the OBB and AAB must be intersecting
 	return true;
 }
@@ -111,7 +111,7 @@ bool OrientedBox::Overlaps(const OrientedBox &inBox, float inEpsilon) const
 
 	// Test axes L = A0, L = A1, L = A2
 	float ra, rb;
-	for (int i = 0; i < 3; i++) 
+	for (int i = 0; i < 3; i++)
 	{
 		ra = mHalfExtents[i];
 		rb = inBox.mHalfExtents[0] * abs_r[0][i] + inBox.mHalfExtents[1] * abs_r[1][i] + inBox.mHalfExtents[2] * abs_r[2][i];
@@ -119,7 +119,7 @@ bool OrientedBox::Overlaps(const OrientedBox &inBox, float inEpsilon) const
 	}
 
 	// Test axes L = B0, L = B1, L = B2
-	for (int i = 0; i < 3; i++) 
+	for (int i = 0; i < 3; i++)
 	{
 		ra = mHalfExtents.Dot(abs_r[i]);
 		rb = inBox.mHalfExtents[i];
@@ -143,34 +143,34 @@ bool OrientedBox::Overlaps(const OrientedBox &inBox, float inEpsilon) const
 
 	// Test axis L = A1 x B0
 	ra = mHalfExtents[0] * abs_r[0][2] + mHalfExtents[2] * abs_r[0][0];
-	rb = inBox.mHalfExtents[1] * abs_r[2][1] + inBox.mHalfExtents[2] * abs_r[1][1];	
+	rb = inBox.mHalfExtents[1] * abs_r[2][1] + inBox.mHalfExtents[2] * abs_r[1][1];
 	if (abs(rot(0, 3) * rot(2, 0) - rot(2, 3) * rot(0, 0)) > ra + rb) return false;
 
 	// Test axis L = A1 x B1
 	ra = mHalfExtents[0] * abs_r[1][2] + mHalfExtents[2] * abs_r[1][0];
 	rb = inBox.mHalfExtents[0] * abs_r[2][1] + inBox.mHalfExtents[2] * abs_r[0][1];
 	if (abs(rot(0, 3) * rot(2, 1) - rot(2, 3) * rot(0, 1)) > ra + rb) return false;
-	
+
 	// Test axis L = A1 x B2
 	ra = mHalfExtents[0] * abs_r[2][2] + mHalfExtents[2] * abs_r[2][0];
 	rb = inBox.mHalfExtents[0] * abs_r[1][1] + inBox.mHalfExtents[1] * abs_r[0][1];
 	if (abs(rot(0, 3) * rot(2, 2) - rot(2, 3) * rot(0, 2)) > ra + rb) return false;
-	
+
 	// Test axis L = A2 x B0
 	ra = mHalfExtents[0] * abs_r[0][1] + mHalfExtents[1] * abs_r[0][0];
 	rb = inBox.mHalfExtents[1] * abs_r[2][2] + inBox.mHalfExtents[2] * abs_r[1][2];
 	if (abs(rot(1, 3) * rot(0, 0) - rot(0, 3) * rot(1, 0)) > ra + rb) return false;
-	
+
 	// Test axis L = A2 x B1
 	ra = mHalfExtents[0] * abs_r[1][1] + mHalfExtents[1] * abs_r[1][0];
 	rb = inBox.mHalfExtents[0] * abs_r[2][2] + inBox.mHalfExtents[2] * abs_r[0][2];
 	if (abs(rot(1, 3) * rot(0, 1) - rot(0, 3) * rot(1, 1)) > ra + rb) return false;
-	
+
 	// Test axis L = A2 x B2
 	ra = mHalfExtents[0] * abs_r[2][1] + mHalfExtents[1] * abs_r[2][0];
 	rb = inBox.mHalfExtents[0] * abs_r[1][2] + inBox.mHalfExtents[1] * abs_r[0][2];
 	if (abs(rot(1, 3) * rot(0, 2) - rot(0, 3) * rot(1, 2)) > ra + rb) return false;
-	
+
 	// Since no separating axis is found, the OBBs must be intersecting
 	return true;
 }

+ 1 - 1
Jolt/Geometry/OrientedBox.h

@@ -31,7 +31,7 @@ public:
 
 	/// Test if two oriented boxes overlap eachother
 	bool			Overlaps(const OrientedBox &inBox, float inEpsilon = 1.0e-6f) const;
-						
+
 	Mat44			mOrientation;														///< Transform that positions and rotates the local space axis aligned box into world space
 	Vec3			mHalfExtents;														///< Half extents (half the size of the edge) of the local space axis aligned box
 };

+ 2 - 2
Jolt/Geometry/RayAABox.h

@@ -89,7 +89,7 @@ JPH_INLINE Vec4 RayAABox4(Vec3Arg inOrigin, const RayInvDirection &inInvDirectio
 	Vec4 invdirx = inInvDirection.mInvDirection.SplatX();
 	Vec4 invdiry = inInvDirection.mInvDirection.SplatY();
 	Vec4 invdirz = inInvDirection.mInvDirection.SplatZ();
-	
+
 	// Test against all three axii simultaneously.
 	Vec4 t1x = (inBoundsMinX - originx) * invdirx;
 	Vec4 t1y = (inBoundsMinY - originy) * invdiry;
@@ -219,7 +219,7 @@ JPH_INLINE bool RayAABoxHits(Vec3Arg inOrigin, Vec3Arg inDirection, Vec3Arg inBo
 
 	Vec3 diff = 2.0f * inOrigin - inBoundsMin - inBoundsMax;
 	Vec3 abs_diff = diff.Abs();
-		
+
 	UVec4 no_intersection = UVec4::sAnd(Vec3::sGreater(abs_diff, extents), Vec3::sGreaterOrEqual(diff * inDirection, Vec3::sZero()));
 
 	Vec3 abs_dir = inDirection.Abs();

+ 1 - 1
Jolt/Geometry/RayAABox8.h

@@ -31,7 +31,7 @@ JPH_INLINE Vec8 RayAABox8(Vec3Arg inOrigin, const RayInvDirection &inInvDirectio
 	Vec8 invdirx = Vec8::sSplatX(Vec4(inInvDirection.mInvDirection));
 	Vec8 invdiry = Vec8::sSplatY(Vec4(inInvDirection.mInvDirection));
 	Vec8 invdirz = Vec8::sSplatZ(Vec4(inInvDirection.mInvDirection));
-	
+
 	// Test against all three axii simultaneously.
 	Vec8 t1x = (inBoundsMinX - originx) * invdirx;
 	Vec8 t1y = (inBoundsMinY - originy) * invdiry;

+ 2 - 2
Jolt/Geometry/RaySphere.h

@@ -8,7 +8,7 @@
 
 JPH_NAMESPACE_BEGIN
 
-/// Tests a ray starting at inRayOrigin and extending infinitely in inRayDirection against a sphere, 
+/// Tests a ray starting at inRayOrigin and extending infinitely in inRayDirection against a sphere,
 /// @return FLT_MAX if there is no intersection, otherwise the fraction along the ray.
 /// @param inRayOrigin Ray origin. If the ray starts inside the sphere, the returned fraction will be 0.
 /// @param inRayDirection Ray direction. Does not need to be normalized.
@@ -41,7 +41,7 @@ JPH_INLINE float RaySphere(Vec3Arg inRayOrigin, Vec3Arg inRayDirection, Vec3Arg
 	return FLT_MAX;
 }
 
-/// Tests a ray starting at inRayOrigin and extending infinitely in inRayDirection against a sphere. 
+/// Tests a ray starting at inRayOrigin and extending infinitely in inRayDirection against a sphere.
 /// Outputs entry and exit points (outMinFraction and outMaxFraction) along the ray (which could be negative if the hit point is before the start of the ray).
 /// @param inRayOrigin Ray origin. If the ray starts inside the sphere, the returned fraction will be 0.
 /// @param inRayDirection Ray direction. Does not need to be normalized.

+ 3 - 3
Jolt/Geometry/RayTriangle.h

@@ -49,7 +49,7 @@ JPH_INLINE float RayTriangle(Vec3Arg inOrigin, Vec3Arg inDirection, Vec3Arg inV0
 	Vec3 t = Vec3::sReplicate(e2.Dot(q)) / det;
 
 	// Check if there is an intersection
-	UVec4 no_intersection = 
+	UVec4 no_intersection =
 		UVec4::sOr
 		(
 			UVec4::sOr
@@ -61,10 +61,10 @@ JPH_INLINE float RayTriangle(Vec3Arg inOrigin, Vec3Arg inDirection, Vec3Arg inV0
 				),
 				UVec4::sOr
 				(
-					Vec3::sLess(v, zero), 
+					Vec3::sLess(v, zero),
 					Vec3::sGreater(u + v, one)
 				)
-			), 
+			),
 			Vec3::sLess(t, zero)
 		);
 

+ 6 - 6
Jolt/Geometry/RayTriangle8.h

@@ -35,7 +35,7 @@ JPH_INLINE Vec8 RayTriangle8(Vec3Arg inOrigin, Vec3Arg inDirection, Vec8Arg inV0
 	Vec8 px = dy * e2z - dz * e2y;
 	Vec8 py = dz * e2x - dx * e2z;
 	Vec8 pz = dx * e2y - dy * e2x;
-	
+
 	// if determinant is near zero, ray lies in plane of triangle
 	Vec8 det = e1x * px + e1y * py + e1z * pz;
 
@@ -57,7 +57,7 @@ JPH_INLINE Vec8 RayTriangle8(Vec3Arg inOrigin, Vec3Arg inDirection, Vec8Arg inV0
 	Vec8 qx = sy * e1z - sz * e1y;
 	Vec8 qy = sz * e1x - sx * e1z;
 	Vec8 qz = sx * e1y - sy * e1x;
-				    
+
 	// Calculate v parameter and flip sign if determinant was negative
 	Vec8 v = (dx * qx + dy * qy + dz * qz) / det;
 
@@ -65,22 +65,22 @@ JPH_INLINE Vec8 RayTriangle8(Vec3Arg inOrigin, Vec3Arg inDirection, Vec8Arg inV0
 	Vec8 t = (e2x * qx + e2y * qy + e2z * qz) / det;
 
 	// Check if there is an intersection
-	UVec8 no_intersection = 
+	UVec8 no_intersection =
 		UVec8::sOr
 		(
 			UVec8::sOr
 			(
 				UVec8::sOr
 				(
-					det_near_zero, 
+					det_near_zero,
 					Vec8::sLess(u, zero)
 				),
 				UVec8::sOr
 				(
-					Vec8::sLess(v, zero), 
+					Vec8::sLess(v, zero),
 					Vec8::sGreater(u + v, one)
 				)
-			), 
+			),
 			Vec8::sLess(t, zero)
 		);
 

+ 3 - 3
Jolt/Geometry/Sphere.h

@@ -30,9 +30,9 @@ public:
 	inline float		GetRadius() const										{ return mRadius; }
 
 	/// Test if two spheres overlap
-	inline bool			Overlaps(const Sphere &inB) const						
-	{ 
-		return (Vec3::sLoadFloat3Unsafe(mCenter) - Vec3::sLoadFloat3Unsafe(inB.mCenter)).LengthSq() <= Square(mRadius + inB.mRadius); 
+	inline bool			Overlaps(const Sphere &inB) const
+	{
+		return (Vec3::sLoadFloat3Unsafe(mCenter) - Vec3::sLoadFloat3Unsafe(inB.mCenter)).LengthSq() <= Square(mRadius + inB.mRadius);
 	}
 
 	/// Check if this sphere overlaps with a box

+ 9 - 9
Jolt/Math/DMat44.inl

@@ -8,13 +8,13 @@
 
 JPH_NAMESPACE_BEGIN
 
-DMat44::DMat44(Vec4Arg inC1, Vec4Arg inC2, Vec4Arg inC3, DVec3Arg inC4) : 
+DMat44::DMat44(Vec4Arg inC1, Vec4Arg inC2, Vec4Arg inC3, DVec3Arg inC4) :
 	mCol { inC1, inC2, inC3 },
 	mCol3(inC4)
-{ 
+{
 }
 
-DMat44::DMat44(Type inC1, Type inC2, Type inC3, DTypeArg inC4) : 
+DMat44::DMat44(Type inC1, Type inC2, Type inC3, DTypeArg inC4) :
 	mCol { inC1, inC2, inC3 },
 	mCol3(inC4)
 {
@@ -89,8 +89,8 @@ DVec3 DMat44::operator * (Vec3Arg inV) const
 	return DVec3::sFixW({ low, high });
 #else
 	return DVec3(
-		mCol3.mF64[0] + double(mCol[0].mF32[0] * inV.mF32[0] + mCol[1].mF32[0] * inV.mF32[1] + mCol[2].mF32[0] * inV.mF32[2]), 
-		mCol3.mF64[1] + double(mCol[0].mF32[1] * inV.mF32[0] + mCol[1].mF32[1] * inV.mF32[1] + mCol[2].mF32[1] * inV.mF32[2]), 
+		mCol3.mF64[0] + double(mCol[0].mF32[0] * inV.mF32[0] + mCol[1].mF32[0] * inV.mF32[1] + mCol[2].mF32[0] * inV.mF32[2]),
+		mCol3.mF64[1] + double(mCol[0].mF32[1] * inV.mF32[0] + mCol[1].mF32[1] * inV.mF32[1] + mCol[2].mF32[1] * inV.mF32[2]),
 		mCol3.mF64[2] + double(mCol[0].mF32[2] * inV.mF32[0] + mCol[1].mF32[2] * inV.mF32[1] + mCol[2].mF32[2] * inV.mF32[2]));
 #endif
 }
@@ -132,8 +132,8 @@ DVec3 DMat44::operator * (DVec3Arg inV) const
 	return DVec3::sFixW({ t_low, t_high });
 #else
 	return DVec3(
-		mCol3.mF64[0] + double(mCol[0].mF32[0]) * inV.mF64[0] + double(mCol[1].mF32[0]) * inV.mF64[1] + double(mCol[2].mF32[0]) * inV.mF64[2], 
-		mCol3.mF64[1] + double(mCol[0].mF32[1]) * inV.mF64[0] + double(mCol[1].mF32[1]) * inV.mF64[1] + double(mCol[2].mF32[1]) * inV.mF64[2], 
+		mCol3.mF64[0] + double(mCol[0].mF32[0]) * inV.mF64[0] + double(mCol[1].mF32[0]) * inV.mF64[1] + double(mCol[2].mF32[0]) * inV.mF64[2],
+		mCol3.mF64[1] + double(mCol[0].mF32[1]) * inV.mF64[0] + double(mCol[1].mF32[1]) * inV.mF64[1] + double(mCol[2].mF32[1]) * inV.mF64[2],
 		mCol3.mF64[2] + double(mCol[0].mF32[2]) * inV.mF64[0] + double(mCol[1].mF32[2]) * inV.mF64[1] + double(mCol[2].mF32[2]) * inV.mF64[2]);
 #endif
 }
@@ -175,8 +175,8 @@ DVec3 DMat44::Multiply3x3(DVec3Arg inV) const
 	return DVec3::sFixW({ t_low, t_high });
 #else
 	return DVec3(
-		double(mCol[0].mF32[0]) * inV.mF64[0] + double(mCol[1].mF32[0]) * inV.mF64[1] + double(mCol[2].mF32[0]) * inV.mF64[2], 
-		double(mCol[0].mF32[1]) * inV.mF64[0] + double(mCol[1].mF32[1]) * inV.mF64[1] + double(mCol[2].mF32[1]) * inV.mF64[2], 
+		double(mCol[0].mF32[0]) * inV.mF64[0] + double(mCol[1].mF32[0]) * inV.mF64[1] + double(mCol[2].mF32[0]) * inV.mF64[2],
+		double(mCol[0].mF32[1]) * inV.mF64[0] + double(mCol[1].mF32[1]) * inV.mF64[1] + double(mCol[2].mF32[1]) * inV.mF64[2],
 		double(mCol[0].mF32[2]) * inV.mF64[0] + double(mCol[1].mF32[2]) * inV.mF64[1] + double(mCol[2].mF32[2]) * inV.mF64[2]);
 #endif
 }

+ 5 - 5
Jolt/Math/DVec3.h

@@ -8,7 +8,7 @@
 
 JPH_NAMESPACE_BEGIN
 
-/// 3 component vector of doubles (stored as 4 vectors). 
+/// 3 component vector of doubles (stored as 4 vectors).
 /// Note that we keep the 4th component the same as the 3rd component to avoid divisions by zero when JPH_FLOATING_POINT_EXCEPTIONS_ENABLED defined
 class [[nodiscard]] alignas(JPH_DVECTOR_ALIGNMENT) DVec3
 {
@@ -57,7 +57,7 @@ public:
 
 	/// Replicate inV across all components
 	static JPH_INLINE DVec3		sReplicate(double inV);
-		
+
 	/// Vector with all NaN's
 	static JPH_INLINE DVec3		sNaN();
 
@@ -148,12 +148,12 @@ public:
 	JPH_INLINE double			GetY() const									{ return mF64[1]; }
 	JPH_INLINE double			GetZ() const									{ return mF64[2]; }
 #endif
-	
+
 	/// Set individual components
 	JPH_INLINE void				SetX(double inX)								{ mF64[0] = inX; }
 	JPH_INLINE void				SetY(double inY)								{ mF64[1] = inY; }
 	JPH_INLINE void				SetZ(double inZ)								{ mF64[2] = mF64[3] = inZ; } // Assure Z and W are the same
-	
+
 	/// Get double component by index
 	JPH_INLINE double			operator [] (uint inCoordinate) const			{ JPH_ASSERT(inCoordinate < 3); return mF64[inCoordinate]; }
 
@@ -263,7 +263,7 @@ public:
 
 	/// Internal helper function that checks that W is equal to Z, so e.g. dividing by it should not generate div by 0
 	JPH_INLINE void				CheckW() const;
-	
+
 	/// Internal helper function that ensures that the Z component is replicated to the W component to prevent divisions by zero
 	static JPH_INLINE Type		sFixW(TypeArg inValue);
 

+ 24 - 24
Jolt/Math/DVec3.inl

@@ -84,10 +84,10 @@ void DVec3::CheckW() const
 {
 #ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
 	// Avoid asserts when both components are NaN
-	JPH_ASSERT(reinterpret_cast<const uint64 *>(mF64)[2] == reinterpret_cast<const uint64 *>(mF64)[3]); 
+	JPH_ASSERT(reinterpret_cast<const uint64 *>(mF64)[2] == reinterpret_cast<const uint64 *>(mF64)[3]);
 #endif // JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
-} 
-	
+}
+
 /// Internal helper function that ensures that the Z component is replicated to the W component to prevent divisions by zero
 DVec3::Type DVec3::sFixW(TypeArg inValue)
 {
@@ -199,8 +199,8 @@ DVec3 DVec3::sMin(DVec3Arg inV1, DVec3Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return DVec3({ vminq_f64(inV1.mValue.val[0], inV2.mValue.val[0]), vminq_f64(inV1.mValue.val[1], inV2.mValue.val[1]) });
 #else
-	return DVec3(min(inV1.mF64[0], inV2.mF64[0]), 
-				 min(inV1.mF64[1], inV2.mF64[1]), 
+	return DVec3(min(inV1.mF64[0], inV2.mF64[0]),
+				 min(inV1.mF64[1], inV2.mF64[1]),
 				 min(inV1.mF64[2], inV2.mF64[2]));
 #endif
 }
@@ -214,8 +214,8 @@ DVec3 DVec3::sMax(DVec3Arg inV1, DVec3Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return DVec3({ vmaxq_f64(inV1.mValue.val[0], inV2.mValue.val[0]), vmaxq_f64(inV1.mValue.val[1], inV2.mValue.val[1]) });
 #else
-	return DVec3(max(inV1.mF64[0], inV2.mF64[0]), 
-				 max(inV1.mF64[1], inV2.mF64[1]), 
+	return DVec3(max(inV1.mF64[0], inV2.mF64[0]),
+				 max(inV1.mF64[1], inV2.mF64[1]),
 				 max(inV1.mF64[2], inV2.mF64[2]));
 #endif
 }
@@ -234,8 +234,8 @@ DVec3 DVec3::sEquals(DVec3Arg inV1, DVec3Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return DVec3({ vreinterpretq_u64_f64(vceqq_f64(inV1.mValue.val[0], inV2.mValue.val[0])), vreinterpretq_u64_f64(vceqq_f64(inV1.mValue.val[1], inV2.mValue.val[1])) });
 #else
-	return DVec3(inV1.mF64[0] == inV2.mF64[0]? cTrue : cFalse, 
-				 inV1.mF64[1] == inV2.mF64[1]? cTrue : cFalse, 
+	return DVec3(inV1.mF64[0] == inV2.mF64[0]? cTrue : cFalse,
+				 inV1.mF64[1] == inV2.mF64[1]? cTrue : cFalse,
 				 inV1.mF64[2] == inV2.mF64[2]? cTrue : cFalse);
 #endif
 }
@@ -249,8 +249,8 @@ DVec3 DVec3::sLess(DVec3Arg inV1, DVec3Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return DVec3({ vreinterpretq_u64_f64(vcltq_f64(inV1.mValue.val[0], inV2.mValue.val[0])), vreinterpretq_u64_f64(vcltq_f64(inV1.mValue.val[1], inV2.mValue.val[1])) });
 #else
-	return DVec3(inV1.mF64[0] < inV2.mF64[0]? cTrue : cFalse, 
-				 inV1.mF64[1] < inV2.mF64[1]? cTrue : cFalse, 
+	return DVec3(inV1.mF64[0] < inV2.mF64[0]? cTrue : cFalse,
+				 inV1.mF64[1] < inV2.mF64[1]? cTrue : cFalse,
 				 inV1.mF64[2] < inV2.mF64[2]? cTrue : cFalse);
 #endif
 }
@@ -264,8 +264,8 @@ DVec3 DVec3::sLessOrEqual(DVec3Arg inV1, DVec3Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return DVec3({ vreinterpretq_u64_f64(vcleq_f64(inV1.mValue.val[0], inV2.mValue.val[0])), vreinterpretq_u64_f64(vcleq_f64(inV1.mValue.val[1], inV2.mValue.val[1])) });
 #else
-	return DVec3(inV1.mF64[0] <= inV2.mF64[0]? cTrue : cFalse, 
-				 inV1.mF64[1] <= inV2.mF64[1]? cTrue : cFalse, 
+	return DVec3(inV1.mF64[0] <= inV2.mF64[0]? cTrue : cFalse,
+				 inV1.mF64[1] <= inV2.mF64[1]? cTrue : cFalse,
 				 inV1.mF64[2] <= inV2.mF64[2]? cTrue : cFalse);
 #endif
 }
@@ -279,8 +279,8 @@ DVec3 DVec3::sGreater(DVec3Arg inV1, DVec3Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return DVec3({ vreinterpretq_u64_f64(vcgtq_f64(inV1.mValue.val[0], inV2.mValue.val[0])), vreinterpretq_u64_f64(vcgtq_f64(inV1.mValue.val[1], inV2.mValue.val[1])) });
 #else
-	return DVec3(inV1.mF64[0] > inV2.mF64[0]? cTrue : cFalse, 
-				 inV1.mF64[1] > inV2.mF64[1]? cTrue : cFalse, 
+	return DVec3(inV1.mF64[0] > inV2.mF64[0]? cTrue : cFalse,
+				 inV1.mF64[1] > inV2.mF64[1]? cTrue : cFalse,
 				 inV1.mF64[2] > inV2.mF64[2]? cTrue : cFalse);
 #endif
 }
@@ -294,8 +294,8 @@ DVec3 DVec3::sGreaterOrEqual(DVec3Arg inV1, DVec3Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return DVec3({ vreinterpretq_u64_f64(vcgeq_f64(inV1.mValue.val[0], inV2.mValue.val[0])), vreinterpretq_u64_f64(vcgeq_f64(inV1.mValue.val[1], inV2.mValue.val[1])) });
 #else
-	return DVec3(inV1.mF64[0] >= inV2.mF64[0]? cTrue : cFalse, 
-				 inV1.mF64[1] >= inV2.mF64[1]? cTrue : cFalse, 
+	return DVec3(inV1.mF64[0] >= inV2.mF64[0]? cTrue : cFalse,
+				 inV1.mF64[1] >= inV2.mF64[1]? cTrue : cFalse,
 				 inV1.mF64[2] >= inV2.mF64[2]? cTrue : cFalse);
 #endif
 }
@@ -402,8 +402,8 @@ bool DVec3::TestAllTrue() const
 	return GetTrues() == 0x7;
 }
 
-bool DVec3::operator == (DVec3Arg inV2) const 
-{ 
+bool DVec3::operator == (DVec3Arg inV2) const
+{
 	return sEquals(*this, inV2).TestAllTrue();
 }
 
@@ -790,9 +790,9 @@ DVec3 DVec3::Normalized() const
 	return *this / Length();
 }
 
-bool DVec3::IsNormalized(double inTolerance) const 
-{ 
-	return abs(LengthSq() - 1.0) <= inTolerance; 
+bool DVec3::IsNormalized(double inTolerance) const
+{
+	return abs(LengthSq() - 1.0) <= inTolerance;
 }
 
 bool DVec3::IsNaN() const
@@ -825,8 +825,8 @@ DVec3 DVec3::GetSign() const
 	float64x2_t one = vdupq_n_f64(1.0f);
 	return DVec3({ vorrq_s64(vandq_s64(mValue.val[0], minus_one), one), vorrq_s64(vandq_s64(mValue.val[1], minus_one), one) });
 #else
-	return DVec3(std::signbit(mF64[0])? -1.0 : 1.0, 
-				 std::signbit(mF64[1])? -1.0 : 1.0, 
+	return DVec3(std::signbit(mF64[0])? -1.0 : 1.0,
+				 std::signbit(mF64[1])? -1.0 : 1.0,
 				 std::signbit(mF64[2])? -1.0 : 1.0);
 #endif
 }

+ 4 - 4
Jolt/Math/Double3.h

@@ -19,10 +19,10 @@ public:
 	Double3 &	operator = (const Double3 &inRHS) = default;
 				Double3(double inX, double inY, double inZ) : x(inX), y(inY), z(inZ) { }
 
-	double		operator [] (int inCoordinate) const	
-	{ 
-		JPH_ASSERT(inCoordinate < 3); 
-		return *(&x + inCoordinate); 
+	double		operator [] (int inCoordinate) const
+	{
+		JPH_ASSERT(inCoordinate < 3);
+		return *(&x + inCoordinate);
 	}
 
 	bool		operator == (const Double3 &inRHS) const

+ 8 - 8
Jolt/Math/EigenValueSymmetric.h

@@ -37,7 +37,7 @@ bool EigenValueSymmetric(const Matrix &inMatrix, Matrix &outEigVec, Vector &outE
 
 	// Get problem dimension
 	const uint n = inMatrix.GetRows();
-	
+
 	// Make sure the dimensions are right
 	JPH_ASSERT(inMatrix.GetRows() == n);
 	JPH_ASSERT(inMatrix.GetCols() == n);
@@ -50,7 +50,7 @@ bool EigenValueSymmetric(const Matrix &inMatrix, Matrix &outEigVec, Vector &outE
 	Matrix a = inMatrix;
 
 	Vector b, z;
-	
+
 	for (uint ip = 0; ip < n; ++ip)
 	{
 		// Initialize b to diagonal of a
@@ -99,9 +99,9 @@ bool EigenValueSymmetric(const Matrix &inMatrix, Matrix &outEigVec, Vector &outE
 			for (uint iq = ip + 1; iq < n; ++iq)
 			{
 				float g = 100.0f * abs(a(ip, iq));
-				
+
 				// After four sweeps, skip the rotation if the off-diagonal element is small
-				if (sweep > 4 
+				if (sweep > 4
 					&& abs(outEigVal[ip]) + g == abs(outEigVal[ip])
 					&& abs(outEigVal[iq]) + g == abs(outEigVal[iq]))
 				{
@@ -122,12 +122,12 @@ bool EigenValueSymmetric(const Matrix &inMatrix, Matrix &outEigVec, Vector &outE
 						t = 1.0f / (abs(theta) + sqrt(1.0f + theta * theta)); // Warning: Squaring large value can make it inf
 						if (theta < 0.0f) t = -t;
 					}
-					
+
 					float c = 1.0f / sqrt(1.0f + t * t);
 					float s = t * c;
 					float tau = s / (1.0f + c);
 					h = t * a(ip, iq);
-					
+
 					a(ip, iq) = 0.0f;
 
 					// !Modification from Numerical Recipes!
@@ -137,7 +137,7 @@ bool EigenValueSymmetric(const Matrix &inMatrix, Matrix &outEigVec, Vector &outE
 					{
 						z[ip] -= h;
 						z[iq] += h;
-					
+
 						outEigVal[ip] -= h;
 						outEigVal[iq] += h;
 
@@ -152,7 +152,7 @@ bool EigenValueSymmetric(const Matrix &inMatrix, Matrix &outEigVec, Vector &outE
 						for (j = ip + 1; j < iq; ++j)	JPH_EVS_ROTATE(a, ip, j, j, iq);
 						for (j = iq + 1; j < n; ++j)	JPH_EVS_ROTATE(a, ip, j, iq, j);
 						for (j = 0; j < n; ++j)			JPH_EVS_ROTATE(outEigVec, j, ip, j, iq);
-					
+
 						#undef JPH_EVS_ROTATE
 					}
 				}

+ 1 - 1
Jolt/Math/FindRoot.h

@@ -28,7 +28,7 @@ inline int FindRoot(const T inA, const T inB, const T inC, T &outX1, T &outX2)
 	T det = Square(inB) - T(4) * inA * inC;
 	if (det < T(0))
 		return 0;
-	T q = (inB + Sign(inB) * sqrt(det)) / T(-2);	
+	T q = (inB + Sign(inB) * sqrt(det)) / T(-2);
 	outX1 = q / inA;
 	if (q == T(0))
 	{

+ 4 - 4
Jolt/Math/Float3.h

@@ -19,10 +19,10 @@ public:
 	Float3 &	operator = (const Float3 &inRHS) = default;
 				Float3(float inX, float inY, float inZ) : x(inX), y(inY), z(inZ) { }
 
-	float		operator [] (int inCoordinate) const	
-	{ 
-		JPH_ASSERT(inCoordinate < 3); 
-		return *(&x + inCoordinate); 
+	float		operator [] (int inCoordinate) const
+	{
+		JPH_ASSERT(inCoordinate < 3);
+		return *(&x + inCoordinate);
 	}
 
 	bool		operator == (const Float3 &inRHS) const

+ 4 - 4
Jolt/Math/Float4.h

@@ -16,10 +16,10 @@ public:
 				Float4(const Float4 &inRHS) = default;
 				Float4(float inX, float inY, float inZ, float inW) : x(inX), y(inY), z(inZ), w(inW) { }
 
-	float		operator [] (int inCoordinate) const	
-	{ 
-		JPH_ASSERT(inCoordinate < 4); 
-		return *(&x + inCoordinate); 
+	float		operator [] (int inCoordinate) const
+	{
+		JPH_ASSERT(inCoordinate < 4);
+		return *(&x + inCoordinate);
 	}
 
 	float		x;

+ 10 - 10
Jolt/Math/GaussianElimination.h

@@ -6,14 +6,14 @@
 
 JPH_NAMESPACE_BEGIN
 
-/// This function performs Gauss-Jordan elimination to solve a matrix equation. 
+/// This function performs Gauss-Jordan elimination to solve a matrix equation.
 /// A must be an NxN matrix and B must be an NxM matrix forming the equation A * x = B
 /// on output B will contain x and A will be destroyed.
 ///
 /// This code can be used for example to compute the inverse of a matrix.
 /// Set A to the matrix to invert, set B to identity and let GaussianElimination solve
 /// the equation, on return B will be the inverse of A. And A is destroyed.
-/// 
+///
 /// Taken and adapted from Numerical Recipies in C paragraph 2.1
 template <class MatrixA, class MatrixB>
 bool GaussianElimination(MatrixA &ioA, MatrixB &ioB, float inTolerance = 1.0e-16f)
@@ -35,7 +35,7 @@ bool GaussianElimination(MatrixA &ioA, MatrixB &ioB, float inTolerance = 1.0e-16
 		// Initialize pivot element as the diagonal
 		uint pivot_row = i, pivot_col = i;
 
-		// Determine pivot element 
+		// Determine pivot element
 		float largest_element = 0.0f;
 		for (uint j = 0; j < n; ++j)
 			if (ipiv[j] != 1)
@@ -63,9 +63,9 @@ bool GaussianElimination(MatrixA &ioA, MatrixB &ioB, float inTolerance = 1.0e-16
 		// Exchange rows when needed so that the pivot element is at ioA(pivot_col, pivot_col) instead of at ioA(pivot_row, pivot_col)
 		if (pivot_row != pivot_col)
 		{
-			for (uint j = 0; j < n; ++j) 
+			for (uint j = 0; j < n; ++j)
 				swap(ioA(pivot_row, j), ioA(pivot_col, j));
-			for (uint j = 0; j < m; ++j) 
+			for (uint j = 0; j < m; ++j)
 				swap(ioB(pivot_row, j), ioB(pivot_col, j));
 		}
 
@@ -75,21 +75,21 @@ bool GaussianElimination(MatrixA &ioA, MatrixB &ioB, float inTolerance = 1.0e-16
 			return false;
 
 		// Divide the whole row by the pivot element, making ioA(pivot_col, pivot_col) = 1
-		for (uint j = 0; j < n; ++j) 
+		for (uint j = 0; j < n; ++j)
 			ioA(pivot_col, j) /= diagonal_element;
-		for (uint j = 0; j < m; ++j) 
+		for (uint j = 0; j < m; ++j)
 			ioB(pivot_col, j) /= diagonal_element;
 		ioA(pivot_col, pivot_col) = 1.0f;
 
-		// Next reduce the rows, except for the pivot one, 
+		// Next reduce the rows, except for the pivot one,
 		// after this step the pivot_col column is zero except for the pivot element which is 1
 		for (uint j = 0; j < n; ++j)
 			if (j != pivot_col)
 			{
 				float element = ioA(j, pivot_col);
-				for (uint k = 0; k < n; ++k) 
+				for (uint k = 0; k < n; ++k)
 					ioA(j, k) -= ioA(pivot_col, k) * element;
-				for (uint k = 0; k < m; ++k) 
+				for (uint k = 0; k < m; ++k)
 					ioB(j, k) -= ioB(pivot_col, k) * element;
 				ioA(j, pivot_col) = 0.0f;
 			}

+ 3 - 3
Jolt/Math/HalfFloat.h

@@ -77,7 +77,7 @@ inline HalfFloat FromFloatFallback(float inV)
 		bool round_up = RoundingMode == ROUND_TO_NEAREST || (hf_sign == 0) == (RoundingMode == ROUND_TO_POS_INF);
 		return hf_sign | (round_up? HALF_FLT_INF : HALF_FLT_MAX);
 	}
-	
+
 	// Check underflow to zero
 	if (rebiased_exponent < -HALF_FLT_MANTISSA_BITS)
 	{
@@ -136,7 +136,7 @@ JPH_INLINE HalfFloat FromFloat(float inV)
 	{
 		__m128i		u128;
 		HalfFloat	u16[8];
-	} hf;	
+	} hf;
 	__m128 val = _mm_load_ss(&inV);
 	switch (RoundingMode)
 	{
@@ -148,7 +148,7 @@ JPH_INLINE HalfFloat FromFloat(float inV)
 		break;
 	case ROUND_TO_NEAREST:
 		hf.u128 = _mm_cvtps_ph(val, _MM_FROUND_TO_NEAREST_INT);
-		break;		
+		break;
 	}
 	return hf.u16[0];
 #else

+ 22 - 22
Jolt/Math/Matrix.h

@@ -68,11 +68,11 @@ public:
 			mCol[rc].mF32[rc] = inV[rc];
 	}
 
-	inline static Matrix					sDiagonal(const Vector<Rows < Cols? Rows : Cols> &inV)	
-	{ 
-		Matrix m; 
-		m.SetDiagonal(inV); 
-		return m; 
+	inline static Matrix					sDiagonal(const Vector<Rows < Cols? Rows : Cols> &inV)
+	{
+		Matrix m;
+		m.SetDiagonal(inV);
+		return m;
 	}
 
 	/// Copy a (part) of another matrix into this matrix
@@ -85,20 +85,20 @@ public:
 		}
 
 	/// Get float component by element index
-	inline float							operator () (uint inRow, uint inColumn) const			
-	{ 
-		JPH_ASSERT(inRow < Rows); 
-		JPH_ASSERT(inColumn < Cols); 
-		return mCol[inColumn].mF32[inRow]; 
+	inline float							operator () (uint inRow, uint inColumn) const
+	{
+		JPH_ASSERT(inRow < Rows);
+		JPH_ASSERT(inColumn < Cols);
+		return mCol[inColumn].mF32[inRow];
 	}
-	
+
 	inline float &							operator () (uint inRow, uint inColumn)
-	{ 
-		JPH_ASSERT(inRow < Rows); 
-		JPH_ASSERT(inColumn < Cols); 
-		return mCol[inColumn].mF32[inRow]; 
+	{
+		JPH_ASSERT(inRow < Rows);
+		JPH_ASSERT(inColumn < Cols);
+		return mCol[inColumn].mF32[inRow];
 	}
-	
+
 	/// Comparison
 	inline bool								operator == (const Matrix &inM2) const
 	{
@@ -163,9 +163,9 @@ public:
 		return m;
 	}
 
-	inline friend Matrix					operator * (float inV, const Matrix &inM)				
-	{ 
-		return inM * inV; 
+	inline friend Matrix					operator * (float inV, const Matrix &inM)
+	{
+		return inM * inV;
 	}
 
 	/// Per element addition of matrix
@@ -193,7 +193,7 @@ public:
 		for (uint r = 0; r < Rows; ++r)
 			for (uint c = 0; c < Cols; ++c)
 				m.mCol[r].mF32[c] = mCol[c].mF32[r];
-		return m;		
+		return m;
 	}
 
 	/// Inverse matrix
@@ -201,7 +201,7 @@ public:
 	{
 		if constexpr (Rows != Cols) JPH_ASSERT(false);
 		Matrix copy(inM);
-		SetIdentity(); 
+		SetIdentity();
 		return GaussianElimination(copy, *this);
 	}
 
@@ -250,7 +250,7 @@ inline bool Matrix<2, 2>::SetInversed(const Matrix<2, 2> &inM)
 	mCol[0].mF32[0] = d / det;
 	mCol[1].mF32[0] = -b / det;
 	mCol[0].mF32[1] = -c / det;
-	mCol[1].mF32[1] = a / det;	
+	mCol[1].mF32[1] = a / det;
 	return true;
 }
 

+ 18 - 18
Jolt/Math/Quat.h

@@ -17,7 +17,7 @@ JPH_NAMESPACE_BEGIN
 /// \f$q = w + x \: i + y \: j + z \: k\f$
 ///
 /// or in vector notation:
-/// 
+///
 /// \f$q = [w, v] = [w, x, y, z]\f$
 ///
 /// Where:
@@ -25,7 +25,7 @@ JPH_NAMESPACE_BEGIN
 /// w = the real part
 /// v = the imaginary part, (x, y, z)
 ///
-/// Note that we store the quaternion in a Vec4 as [x, y, z, w] because that makes 
+/// Note that we store the quaternion in a Vec4 as [x, y, z, w] because that makes
 /// it easy to extract the rotation axis of the quaternion:
 ///
 /// q = [cos(angle / 2), sin(angle / 2) * rotation_axis]
@@ -42,8 +42,8 @@ public:
 	inline						Quat(float inX, float inY, float inZ, float inW)				: mValue(inX, inY, inZ, inW) { }
 	inline explicit				Quat(Vec4Arg inV)												: mValue(inV) { }
 	///@}
-								
-	///@name Tests					
+
+	///@name Tests
 	///@{
 
 	/// Check if two quaternions are exactly equal
@@ -60,7 +60,7 @@ public:
 
 	/// If any component of this quaternion is a NaN (not a number)
 	inline bool					IsNaN() const													{ return mValue.IsNaN(); }
-	
+
 	///@}
 	///@name Get components
 	///@{
@@ -115,16 +115,16 @@ public:
 	/// Conversion to Euler angles. Rotation order is X then Y then Z (RotZ * RotY * RotX). Angles in radians.
 	inline Vec3					GetEulerAngles() const;
 
-	///@name Length / normalization operations													
+	///@name Length / normalization operations
 	///@{
 
-	/// Squared length of quaternion. 
+	/// Squared length of quaternion.
 	/// @return Squared length of quaternion (\f$|v|^2\f$)
 	JPH_INLINE float			LengthSq() const												{ return mValue.LengthSq(); }
 
 	/// Length of quaternion.
 	/// @return Length of quaternion (\f$|v|\f$)
-	JPH_INLINE float			Length() const													{ return mValue.Length(); }	
+	JPH_INLINE float			Length() const													{ return mValue.Length(); }
 
 	/// Normalize the quaternion (make it length 1)
 	JPH_INLINE Quat				Normalized() const												{ return Quat(mValue.Normalized()); }
@@ -147,7 +147,7 @@ public:
 
 	///@}
 
-	/// Rotate a vector by this quaternion 
+	/// Rotate a vector by this quaternion
 	JPH_INLINE Vec3				operator * (Vec3Arg inValue) const;
 
 	/// Rotate a vector by the inverse of this quaternion
@@ -155,16 +155,16 @@ public:
 
 	/// Rotate a the vector (1, 0, 0) with this quaternion
 	JPH_INLINE Vec3				RotateAxisX() const;
-								
+
 	/// Rotate a the vector (0, 1, 0) with this quaternion
 	JPH_INLINE Vec3				RotateAxisY() const;
-								
+
 	/// Rotate a the vector (0, 0, 1) with this quaternion
 	JPH_INLINE Vec3				RotateAxisZ() const;
-								
-	/// Dot product				
+
+	/// Dot product
 	JPH_INLINE float			Dot(QuatArg inRHS) const										{ return mValue.Dot(inRHS.mValue); }
-								
+
 	/// The conjugate [w, -x, -y, -z] is the same as the inverse for unit quaternions
 	JPH_INLINE Quat				Conjugated() const												{ return Quat(Vec4::sXor(mValue, UVec4(0x80000000, 0x80000000, 0x80000000, 0).ReinterpretAsFloat())); }
 
@@ -212,8 +212,8 @@ public:
 	///
 	/// @see Gino van den Bergen - Rotational Joint Limits in Quaternion Space - GDC 2016
 	JPH_INLINE void				GetSwingTwist(Quat &outSwing, Quat &outTwist) const;
-								
-	/// Linear interpolation between two quaternions (for small steps). 
+
+	/// Linear interpolation between two quaternions (for small steps).
 	/// @param inFraction is in the range [0, 1]
 	/// @param inDestination The destination quaternion
 	/// @return (1 - inFraction) * this + fraction * inDestination
@@ -222,10 +222,10 @@ public:
 	/// Spherical linear interpolation between two quaternions.
 	/// @param inFraction is in the range [0, 1]
 	/// @param inDestination The destination quaternion
-	/// @return When fraction is zero this quaternion is returned, when fraction is 1 inDestination is returned. 
+	/// @return When fraction is zero this quaternion is returned, when fraction is 1 inDestination is returned.
 	/// When fraction is between 0 and 1 an interpolation along the shortest path is returned.
 	JPH_INLINE Quat				SLERP(QuatArg inDestination, float inFraction) const;
-	
+
 	/// Load 3 floats from memory (X, Y and Z component and then calculates W) reads 32 bits extra which it doesn't use
 	static JPH_INLINE Quat		sLoadFloat3Unsafe(const Float3 &inV);
 

+ 43 - 43
Jolt/Math/Quat.inl

@@ -5,7 +5,7 @@
 JPH_NAMESPACE_BEGIN
 
 Quat Quat::operator * (QuatArg inRHS) const
-{ 
+{
 #if defined(JPH_USE_SSE4_1)
 	// Taken from: http://momchil-velikov.blogspot.nl/2013/10/fast-sse-quternion-multiplication.html
 	__m128 abcd = mValue.mValue;
@@ -13,42 +13,42 @@ Quat Quat::operator * (QuatArg inRHS) const
 
 	__m128 t0 = _mm_shuffle_ps(abcd, abcd, _MM_SHUFFLE(3, 3, 3, 3));
 	__m128 t1 = _mm_shuffle_ps(xyzw, xyzw, _MM_SHUFFLE(2, 3, 0, 1));
- 
+
 	__m128 t3 = _mm_shuffle_ps(abcd, abcd, _MM_SHUFFLE(0, 0, 0, 0));
 	__m128 t4 = _mm_shuffle_ps(xyzw, xyzw, _MM_SHUFFLE(1, 0, 3, 2));
- 
+
 	__m128 t5 = _mm_shuffle_ps(abcd, abcd, _MM_SHUFFLE(1, 1, 1, 1));
 	__m128 t6 = _mm_shuffle_ps(xyzw, xyzw, _MM_SHUFFLE(2, 0, 3, 1));
- 
+
 	// [d,d,d,d] * [z,w,x,y] = [dz,dw,dx,dy]
 	__m128 m0 = _mm_mul_ps(t0, t1);
- 
+
 	// [a,a,a,a] * [y,x,w,z] = [ay,ax,aw,az]
 	__m128 m1 = _mm_mul_ps(t3, t4);
- 
+
 	// [b,b,b,b] * [z,x,w,y] = [bz,bx,bw,by]
 	__m128 m2 = _mm_mul_ps(t5, t6);
- 
+
 	// [c,c,c,c] * [w,z,x,y] = [cw,cz,cx,cy]
 	__m128 t7 = _mm_shuffle_ps(abcd, abcd, _MM_SHUFFLE(2, 2, 2, 2));
-	__m128 t8 = _mm_shuffle_ps(xyzw, xyzw, _MM_SHUFFLE(3, 2, 0, 1)); 
+	__m128 t8 = _mm_shuffle_ps(xyzw, xyzw, _MM_SHUFFLE(3, 2, 0, 1));
 	__m128 m3 = _mm_mul_ps(t7, t8);
- 
+
 	// [dz,dw,dx,dy] + -[ay,ax,aw,az] = [dz+ay,dw-ax,dx+aw,dy-az]
 	__m128 e = _mm_addsub_ps(m0, m1);
- 
+
 	// [dx+aw,dz+ay,dy-az,dw-ax]
 	e = _mm_shuffle_ps(e, e, _MM_SHUFFLE(1, 3, 0, 2));
- 
+
 	// [dx+aw,dz+ay,dy-az,dw-ax] + -[bz,bx,bw,by] = [dx+aw+bz,dz+ay-bx,dy-az+bw,dw-ax-by]
 	e = _mm_addsub_ps(e, m2);
- 
+
 	// [dz+ay-bx,dw-ax-by,dy-az+bw,dx+aw+bz]
 	e = _mm_shuffle_ps(e, e, _MM_SHUFFLE(2, 0, 1, 3));
- 
+
 	// [dz+ay-bx,dw-ax-by,dy-az+bw,dx+aw+bz] + -[cw,cz,cx,cy] = [dz+ay-bx+cw,dw-ax-by-cz,dy-az+bw+cx,dx+aw+bz-cy]
 	e = _mm_addsub_ps(e, m3);
- 
+
 	// [dw-ax-by-cz,dz+ay-bx+cw,dy-az+bw+cx,dx+aw+bz-cy]
 	return Quat(Vec4(_mm_shuffle_ps(e, e, _MM_SHUFFLE(2, 3, 1, 0))));
 #else
@@ -86,7 +86,7 @@ void Quat::GetAxisAngle(Vec3 &outAxis, float &outAngle) const
 	Quat w_pos = EnsureWPositive();
 	float abs_w = w_pos.GetW();
 	if (abs_w >= 1.0f)
-	{ 
+	{
 		outAxis = Vec3::sZero();
 		outAngle = 0.0f;
 	}
@@ -99,18 +99,18 @@ void Quat::GetAxisAngle(Vec3 &outAxis, float &outAngle) const
 
 Quat Quat::sFromTo(Vec3Arg inFrom, Vec3Arg inTo)
 {
-	/* 
-		Uses (inFrom = v1, inTo = v2): 
+	/*
+		Uses (inFrom = v1, inTo = v2):
 
 		angle = arcos(v1 . v2 / |v1||v2|)
 		axis = normalize(v1 x v2)
 
 		Quaternion is then:
 
-		s = sin(angle / 2) 
-		x = axis.x * s 
-		y = axis.y * s 
-		z = axis.z * s 
+		s = sin(angle / 2)
+		x = axis.x * s
+		y = axis.y * s
+		z = axis.z * s
 		w = cos(angle / 2)
 
 		Using identities:
@@ -141,7 +141,7 @@ Quat Quat::sFromTo(Vec3Arg inFrom, Vec3Arg inTo)
 		}
 		else
 		{
-			// If vectors are perpendicular, take one of the many 180 degree rotations that exist	
+			// If vectors are perpendicular, take one of the many 180 degree rotations that exist
 			return Quat(Vec4(inFrom.GetNormalizedPerpendicular(), 0));
 		}
 	}
@@ -197,13 +197,13 @@ Vec3 Quat::GetEulerAngles() const
 
 	// Z
 	float t3 = 2.0f * (GetW() * GetZ() + GetX() * GetY());
-	float t4 = 1.0f - 2.0f * (y_sq + GetZ() * GetZ());  
+	float t4 = 1.0f - 2.0f * (y_sq + GetZ() * GetZ());
 
 	return Vec3(ATan2(t0, t1), ASin(t2), ATan2(t3, t4));
 }
 
 Quat Quat::GetTwist(Vec3Arg inAxis) const
-{ 
+{
 	Quat twist(Vec4(GetXYZ().Dot(inAxis) * inAxis, GetW()));
 	float twist_len = twist.LengthSq();
 	if (twist_len != 0.0f)
@@ -236,33 +236,33 @@ Quat Quat::LERP(QuatArg inDestination, float inFraction) const
 }
 
 Quat Quat::SLERP(QuatArg inDestination, float inFraction) const
-{	
+{
     // Difference at which to LERP instead of SLERP
 	const float delta = 0.0001f;
 
 	// Calc cosine
 	float sign_scale1 = 1.0f;
     float cos_omega = Dot(inDestination);
-	
+
 	// Adjust signs (if necessary)
 	if (cos_omega < 0.0f)
 	{
 		cos_omega = -cos_omega;
 		sign_scale1 = -1.0f;
 	}
-	
+
 	// Calculate coefficients
 	float scale0, scale1;
-	if (1.0f - cos_omega > delta) 
+	if (1.0f - cos_omega > delta)
 	{
 		// Standard case (slerp)
 		float omega = ACos(cos_omega);
 		float sin_omega = Sin(omega);
 		scale0 = Sin((1.0f - inFraction) * omega) / sin_omega;
 		scale1 = sign_scale1 * Sin(inFraction * omega) / sin_omega;
-	} 
-	else 
-	{        
+	}
+	else
+	{
 		// Quaternions are very close so we can do a linear interpolation
 		scale0 = 1.0f - inFraction;
 		scale1 = sign_scale1 * inFraction;
@@ -285,31 +285,31 @@ Vec3 Quat::InverseRotate(Vec3Arg inValue) const
 	return Vec3((Conjugated() * Quat(Vec4(inValue, 0)) * *this).mValue);
 }
 
-Vec3 Quat::RotateAxisX() const												
-{ 
+Vec3 Quat::RotateAxisX() const
+{
 	// This is *this * Vec3::sAxisX() written out:
 	JPH_ASSERT(IsNormalized());
 	float x = GetX(), y = GetY(), z = GetZ(), w = GetW();
-	float tx = 2.0f * x, tw = 2.0f * w; 
-	return Vec3(tx * x + tw * w - 1.0f, tx * y + z * tw, tx * z - y * tw); 
+	float tx = 2.0f * x, tw = 2.0f * w;
+	return Vec3(tx * x + tw * w - 1.0f, tx * y + z * tw, tx * z - y * tw);
 }
 
-Vec3 Quat::RotateAxisY() const												
-{ 
+Vec3 Quat::RotateAxisY() const
+{
 	// This is *this * Vec3::sAxisY() written out:
 	JPH_ASSERT(IsNormalized());
 	float x = GetX(), y = GetY(), z = GetZ(), w = GetW();
-	float ty = 2.0f * y, tw = 2.0f * w; 
-	return Vec3(x * ty - z * tw, tw * w + ty * y - 1.0f, x * tw + ty * z); 
+	float ty = 2.0f * y, tw = 2.0f * w;
+	return Vec3(x * ty - z * tw, tw * w + ty * y - 1.0f, x * tw + ty * z);
 }
 
-Vec3 Quat::RotateAxisZ() const												
-{ 
+Vec3 Quat::RotateAxisZ() const
+{
 	// This is *this * Vec3::sAxisZ() written out:
 	JPH_ASSERT(IsNormalized());
 	float x = GetX(), y = GetY(), z = GetZ(), w = GetW();
-	float tz = 2.0f * z, tw = 2.0f * w; 
-	return Vec3(x * tz + y * tw, y * tz - x * tw, tw * w + tz * z - 1.0f); 
+	float tz = 2.0f * z, tw = 2.0f * w;
+	return Vec3(x * tz + y * tw, y * tz - x * tw, tw * w + tz * z - 1.0f);
 }
 
 void Quat::StoreFloat3(Float3 *outV) const

+ 3 - 3
Jolt/Math/UVec4.h

@@ -179,11 +179,11 @@ public:
 	JPH_INLINE UVec4			ArithmeticShiftRight() const;
 
 	/// Takes the lower 4 16 bits and expands them to X, Y, Z and W
-	JPH_INLINE UVec4			Expand4Uint16Lo() const;	
+	JPH_INLINE UVec4			Expand4Uint16Lo() const;
 
 	/// Takes the upper 4 16 bits and expands them to X, Y, Z and W
 	JPH_INLINE UVec4			Expand4Uint16Hi() const;
-	
+
 	/// Takes byte 0 .. 3 and expands them to X, Y, Z and W
 	JPH_INLINE UVec4			Expand4Byte0() const;
 
@@ -192,7 +192,7 @@ public:
 
 	/// Takes byte 8 .. 11 and expands them to X, Y, Z and W
 	JPH_INLINE UVec4			Expand4Byte8() const;
-	
+
 	/// Takes byte 12 .. 15 and expands them to X, Y, Z and W
 	JPH_INLINE UVec4			Expand4Byte12() const;
 

+ 25 - 25
Jolt/Math/UVec4.inl

@@ -142,9 +142,9 @@ UVec4 UVec4::sEquals(UVec4Arg inV1, UVec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vceqq_u32(inV1.mValue, inV2.mValue);
 #else
-	return UVec4(inV1.mU32[0] == inV2.mU32[0]? 0xffffffffu : 0, 
-				 inV1.mU32[1] == inV2.mU32[1]? 0xffffffffu : 0, 
-				 inV1.mU32[2] == inV2.mU32[2]? 0xffffffffu : 0, 
+	return UVec4(inV1.mU32[0] == inV2.mU32[0]? 0xffffffffu : 0,
+				 inV1.mU32[1] == inV2.mU32[1]? 0xffffffffu : 0,
+				 inV1.mU32[2] == inV2.mU32[2]? 0xffffffffu : 0,
 				 inV1.mU32[3] == inV2.mU32[3]? 0xffffffffu : 0);
 #endif
 }
@@ -170,9 +170,9 @@ UVec4 UVec4::sOr(UVec4Arg inV1, UVec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vorrq_u32(inV1.mValue, inV2.mValue);
 #else
-	return UVec4(inV1.mU32[0] | inV2.mU32[0], 
-				 inV1.mU32[1] | inV2.mU32[1], 
-				 inV1.mU32[2] | inV2.mU32[2], 
+	return UVec4(inV1.mU32[0] | inV2.mU32[0],
+				 inV1.mU32[1] | inV2.mU32[1],
+				 inV1.mU32[2] | inV2.mU32[2],
 				 inV1.mU32[3] | inV2.mU32[3]);
 #endif
 }
@@ -184,9 +184,9 @@ UVec4 UVec4::sXor(UVec4Arg inV1, UVec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return veorq_u32(inV1.mValue, inV2.mValue);
 #else
-	return UVec4(inV1.mU32[0] ^ inV2.mU32[0], 
-				 inV1.mU32[1] ^ inV2.mU32[1], 
-				 inV1.mU32[2] ^ inV2.mU32[2], 
+	return UVec4(inV1.mU32[0] ^ inV2.mU32[0],
+				 inV1.mU32[1] ^ inV2.mU32[1],
+				 inV1.mU32[2] ^ inV2.mU32[2],
 				 inV1.mU32[3] ^ inV2.mU32[3]);
 #endif
 }
@@ -198,9 +198,9 @@ UVec4 UVec4::sAnd(UVec4Arg inV1, UVec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vandq_u32(inV1.mValue, inV2.mValue);
 #else
-	return UVec4(inV1.mU32[0] & inV2.mU32[0], 
-				 inV1.mU32[1] & inV2.mU32[1], 
-				 inV1.mU32[2] & inV2.mU32[2], 
+	return UVec4(inV1.mU32[0] & inV2.mU32[0],
+				 inV1.mU32[1] & inV2.mU32[1],
+				 inV1.mU32[2] & inV2.mU32[2],
 				 inV1.mU32[3] & inV2.mU32[3]);
 #endif
 }
@@ -254,9 +254,9 @@ UVec4 UVec4::operator + (UVec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vaddq_u32(mValue, inV2.mValue);
 #else
-	return UVec4(mU32[0] + inV2.mU32[0], 
-				 mU32[1] + inV2.mU32[1], 
-				 mU32[2] + inV2.mU32[2], 
+	return UVec4(mU32[0] + inV2.mU32[0],
+				 mU32[1] + inV2.mU32[1],
+				 mU32[2] + inV2.mU32[2],
 				 mU32[3] + inV2.mU32[3]);
 #endif
 }
@@ -445,9 +445,9 @@ UVec4 UVec4::ArithmeticShiftRight() const
 #elif defined(JPH_USE_NEON)
 	return vshrq_n_s32(mValue, Count);
 #else
-	return UVec4(uint32(int32_t(mU32[0]) >> Count), 
-				 uint32(int32_t(mU32[1]) >> Count), 
-				 uint32(int32_t(mU32[2]) >> Count), 
+	return UVec4(uint32(int32_t(mU32[0]) >> Count),
+				 uint32(int32_t(mU32[1]) >> Count),
+				 uint32(int32_t(mU32[2]) >> Count),
 				 uint32(int32_t(mU32[3]) >> Count));
 #endif
 }
@@ -461,9 +461,9 @@ UVec4 UVec4::Expand4Uint16Lo() const
 	int16x4_t zero = vdup_n_s16(0);
 	return vcombine_s16(vzip1_s16(value, zero), vzip2_s16(value, zero));
 #else
-	return UVec4(mU32[0] & 0xffff, 
-				 (mU32[0] >> 16) & 0xffff, 
-				 mU32[1] & 0xffff, 
+	return UVec4(mU32[0] & 0xffff,
+				 (mU32[0] >> 16) & 0xffff,
+				 mU32[1] & 0xffff,
 				 (mU32[1] >> 16) & 0xffff);
 #endif
 }
@@ -477,9 +477,9 @@ UVec4 UVec4::Expand4Uint16Hi() const
 	int16x4_t zero = vdup_n_s16(0);
 	return vcombine_s16(vzip1_s16(value, zero), vzip2_s16(value, zero));
 #else
-	return UVec4(mU32[2] & 0xffff, 
-				 (mU32[2] >> 16) & 0xffff, 
-				 mU32[3] & 0xffff, 
+	return UVec4(mU32[2] & 0xffff,
+				 (mU32[2] >> 16) & 0xffff,
+				 mU32[3] & 0xffff,
 				 (mU32[3] >> 16) & 0xffff);
 #endif
 }
@@ -547,7 +547,7 @@ UVec4 UVec4::Expand4Byte12() const
 UVec4 UVec4::ShiftComponents4Minus(int inCount) const
 {
 #if defined(JPH_USE_SSE4_1) || defined(JPH_USE_NEON)
-	alignas(UVec4) static constexpr uint32 sFourMinusXShuffle[5][4] = 
+	alignas(UVec4) static constexpr uint32 sFourMinusXShuffle[5][4] =
 	{
 		{ 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff },
 		{ 0x0f0e0d0c, 0xffffffff, 0xffffffff, 0xffffffff },

+ 3 - 3
Jolt/Math/UVec8.h

@@ -19,7 +19,7 @@ public:
 
 	/// Set 256 bit vector from 2 128 bit vectors
 	JPH_INLINE					UVec8(UVec4Arg inLo, UVec4Arg inHi);
-	
+
 	/// Comparison
 	JPH_INLINE bool				operator == (UVec8Arg inV2) const;
 	JPH_INLINE bool				operator != (UVec8Arg inV2) const					{ return !(*this == inV2); }
@@ -54,7 +54,7 @@ public:
 	/// Get float component by index
 	JPH_INLINE uint32			operator [] (uint inCoordinate) const				{ JPH_ASSERT(inCoordinate < 8); return mU32[inCoordinate]; }
 	JPH_INLINE uint32 &			operator [] (uint inCoordinate)						{ JPH_ASSERT(inCoordinate < 8); return mU32[inCoordinate]; }
-	
+
 	/// 256 bit variant of Vec::Swizzle (no cross 128 bit lane swizzle)
 	template<uint32 SwizzleX, uint32 SwizzleY, uint32 SwizzleZ, uint32 SwizzleW>
 	JPH_INLINE UVec8			Swizzle() const;
@@ -73,7 +73,7 @@ public:
 
 	/// Converts int to float
 	JPH_INLINE Vec8				ToFloat() const;
-	
+
 	/// Shift all components by Count bits to the left (filling with zeros from the left)
 	template <const uint Count>
 	JPH_INLINE UVec8			LogicalShiftLeft() const;

+ 1 - 1
Jolt/Math/UVec8.inl

@@ -6,7 +6,7 @@ JPH_NAMESPACE_BEGIN
 
 UVec8::UVec8(UVec4Arg inLo, UVec4Arg inHi) :
 	mValue(_mm256_insertf128_si256(_mm256_castsi128_si256(inLo.mValue), inHi.mValue, 1))
-{		
+{
 }
 
 bool UVec8::operator == (UVec8Arg inV2) const

+ 2 - 2
Jolt/Math/Vec3.cpp

@@ -29,12 +29,12 @@ static void sCreateVertices(std::unordered_set<Vec3> &ioVertices, Vec3Arg inDir1
 	}
 }
 
-const std::vector<Vec3> Vec3::sUnitSphere = []() { 
+const std::vector<Vec3> Vec3::sUnitSphere = []() {
 
 	const int level = 3;
 
 	std::unordered_set<Vec3> verts;
-	
+
 	// Add unit axis
 	verts.insert(Vec3::sAxisX());
 	verts.insert(-Vec3::sAxisX());

+ 4 - 4
Jolt/Math/Vec3.h

@@ -10,7 +10,7 @@
 
 JPH_NAMESPACE_BEGIN
 
-/// 3 component vector (stored as 4 vectors). 
+/// 3 component vector (stored as 4 vectors).
 /// Note that we keep the 4th component the same as the 3rd component to avoid divisions by zero when JPH_FLOATING_POINT_EXCEPTIONS_ENABLED defined
 class [[nodiscard]] alignas(JPH_VECTOR_ALIGNMENT) Vec3
 {
@@ -55,7 +55,7 @@ public:
 
 	/// Replicate inV across all components
 	static JPH_INLINE Vec3		sReplicate(float inV);
-		
+
 	/// Load 3 floats from memory (reads 32 bits extra which it doesn't use)
 	static JPH_INLINE Vec3		sLoadFloat3Unsafe(const Float3 &inV);
 
@@ -124,7 +124,7 @@ public:
 	JPH_INLINE float			GetY() const									{ return mF32[1]; }
 	JPH_INLINE float			GetZ() const									{ return mF32[2]; }
 #endif
-	
+
 	/// Set individual components
 	JPH_INLINE void				SetX(float inX)									{ mF32[0] = inX; }
 	JPH_INLINE void				SetY(float inY)									{ mF32[1] = inY; }
@@ -273,7 +273,7 @@ public:
 
 	/// Internal helper function that checks that W is equal to Z, so e.g. dividing by it should not generate div by 0
 	JPH_INLINE void				CheckW() const;
-	
+
 	/// Internal helper function that ensures that the Z component is replicated to the W component to prevent divisions by zero
 	static JPH_INLINE Type		sFixW(Type inValue);
 

+ 34 - 34
Jolt/Math/Vec3.inl

@@ -16,18 +16,18 @@ JPH_MAKE_HASHABLE(JPH::Vec3, t.GetX(), t.GetY(), t.GetZ())
 JPH_NAMESPACE_BEGIN
 
 void Vec3::CheckW() const
-{ 
+{
 #ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
 	// Avoid asserts when both components are NaN
-	JPH_ASSERT(reinterpret_cast<const uint32 *>(mF32)[2] == reinterpret_cast<const uint32 *>(mF32)[3]); 
+	JPH_ASSERT(reinterpret_cast<const uint32 *>(mF32)[2] == reinterpret_cast<const uint32 *>(mF32)[3]);
 #endif // JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
-} 
-	
+}
+
 JPH_INLINE Vec3::Type Vec3::sFixW(Type inValue)
-{ 
+{
 #ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
 	#if defined(JPH_USE_SSE)
-		return _mm_shuffle_ps(inValue, inValue, _MM_SHUFFLE(2, 2, 1, 0)); 
+		return _mm_shuffle_ps(inValue, inValue, _MM_SHUFFLE(2, 2, 1, 0));
 	#elif defined(JPH_USE_NEON)
 		return JPH_NEON_SHUFFLE_F32x4(inValue, inValue, 0, 1, 2, 2);
 	#else
@@ -43,9 +43,9 @@ JPH_INLINE Vec3::Type Vec3::sFixW(Type inValue)
 #endif // JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
 }
 
-Vec3::Vec3(Vec4Arg inRHS) : 
+Vec3::Vec3(Vec4Arg inRHS) :
 	mValue(sFixW(inRHS.mValue))
-{ 
+{
 }
 
 Vec3::Vec3(const Float3 &inV)
@@ -150,8 +150,8 @@ Vec3 Vec3::sMin(Vec3Arg inV1, Vec3Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vminq_f32(inV1.mValue, inV2.mValue);
 #else
-	return Vec3(min(inV1.mF32[0], inV2.mF32[0]), 
-				min(inV1.mF32[1], inV2.mF32[1]), 
+	return Vec3(min(inV1.mF32[0], inV2.mF32[0]),
+				min(inV1.mF32[1], inV2.mF32[1]),
 				min(inV1.mF32[2], inV2.mF32[2]));
 #endif
 }
@@ -163,8 +163,8 @@ Vec3 Vec3::sMax(Vec3Arg inV1, Vec3Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vmaxq_f32(inV1.mValue, inV2.mValue);
 #else
-	return Vec3(max(inV1.mF32[0], inV2.mF32[0]), 
-				max(inV1.mF32[1], inV2.mF32[1]), 
+	return Vec3(max(inV1.mF32[0], inV2.mF32[0]),
+				max(inV1.mF32[1], inV2.mF32[1]),
 				max(inV1.mF32[2], inV2.mF32[2]));
 #endif
 }
@@ -182,9 +182,9 @@ UVec4 Vec3::sEquals(Vec3Arg inV1, Vec3Arg inV2)
 	return vceqq_f32(inV1.mValue, inV2.mValue);
 #else
 	uint32 z = inV1.mF32[2] == inV2.mF32[2]? 0xffffffffu : 0;
-	return UVec4(inV1.mF32[0] == inV2.mF32[0]? 0xffffffffu : 0, 
-				 inV1.mF32[1] == inV2.mF32[1]? 0xffffffffu : 0, 
-				 z, 
+	return UVec4(inV1.mF32[0] == inV2.mF32[0]? 0xffffffffu : 0,
+				 inV1.mF32[1] == inV2.mF32[1]? 0xffffffffu : 0,
+				 z,
 				 z);
 #endif
 }
@@ -197,9 +197,9 @@ UVec4 Vec3::sLess(Vec3Arg inV1, Vec3Arg inV2)
 	return vcltq_f32(inV1.mValue, inV2.mValue);
 #else
 	uint32 z = inV1.mF32[2] < inV2.mF32[2]? 0xffffffffu : 0;
-	return UVec4(inV1.mF32[0] < inV2.mF32[0]? 0xffffffffu : 0, 
-				 inV1.mF32[1] < inV2.mF32[1]? 0xffffffffu : 0, 
-				 z, 
+	return UVec4(inV1.mF32[0] < inV2.mF32[0]? 0xffffffffu : 0,
+				 inV1.mF32[1] < inV2.mF32[1]? 0xffffffffu : 0,
+				 z,
 				 z);
 #endif
 }
@@ -212,9 +212,9 @@ UVec4 Vec3::sLessOrEqual(Vec3Arg inV1, Vec3Arg inV2)
 	return vcleq_f32(inV1.mValue, inV2.mValue);
 #else
 	uint32 z = inV1.mF32[2] <= inV2.mF32[2]? 0xffffffffu : 0;
-	return UVec4(inV1.mF32[0] <= inV2.mF32[0]? 0xffffffffu : 0, 
-				 inV1.mF32[1] <= inV2.mF32[1]? 0xffffffffu : 0, 
-				 z, 
+	return UVec4(inV1.mF32[0] <= inV2.mF32[0]? 0xffffffffu : 0,
+				 inV1.mF32[1] <= inV2.mF32[1]? 0xffffffffu : 0,
+				 z,
 				 z);
 #endif
 }
@@ -227,9 +227,9 @@ UVec4 Vec3::sGreater(Vec3Arg inV1, Vec3Arg inV2)
 	return vcgtq_f32(inV1.mValue, inV2.mValue);
 #else
 	uint32 z = inV1.mF32[2] > inV2.mF32[2]? 0xffffffffu : 0;
-	return UVec4(inV1.mF32[0] > inV2.mF32[0]? 0xffffffffu : 0, 
-				 inV1.mF32[1] > inV2.mF32[1]? 0xffffffffu : 0, 
-				 z, 
+	return UVec4(inV1.mF32[0] > inV2.mF32[0]? 0xffffffffu : 0,
+				 inV1.mF32[1] > inV2.mF32[1]? 0xffffffffu : 0,
+				 z,
 				 z);
 #endif
 }
@@ -242,9 +242,9 @@ UVec4 Vec3::sGreaterOrEqual(Vec3Arg inV1, Vec3Arg inV2)
 	return vcgeq_f32(inV1.mValue, inV2.mValue);
 #else
 	uint32 z = inV1.mF32[2] >= inV2.mF32[2]? 0xffffffffu : 0;
-	return UVec4(inV1.mF32[0] >= inV2.mF32[0]? 0xffffffffu : 0, 
-				 inV1.mF32[1] >= inV2.mF32[1]? 0xffffffffu : 0, 
-				 z, 
+	return UVec4(inV1.mF32[0] >= inV2.mF32[0]? 0xffffffffu : 0,
+				 inV1.mF32[1] >= inV2.mF32[1]? 0xffffffffu : 0,
+				 z,
 				 z);
 #endif
 }
@@ -334,8 +334,8 @@ Vec3 Vec3::sRandom(Random &inRandom)
 	return sUnitSpherical(theta, phi);
 }
 
-bool Vec3::operator == (Vec3Arg inV2) const 
-{ 
+bool Vec3::operator == (Vec3Arg inV2) const
+{
 	return sEquals(*this, inV2).TestAllXYZTrue();
 }
 
@@ -734,9 +734,9 @@ Vec3 Vec3::NormalizedOr(Vec3Arg inZeroValue) const
 #endif
 }
 
-bool Vec3::IsNormalized(float inTolerance) const 
-{ 
-	return abs(LengthSq() - 1.0f) <= inTolerance; 
+bool Vec3::IsNormalized(float inTolerance) const
+{
+	return abs(LengthSq() - 1.0f) <= inTolerance;
 }
 
 bool Vec3::IsNaN() const
@@ -836,8 +836,8 @@ Vec3 Vec3::GetSign() const
 	Type one = vdupq_n_f32(1.0f);
 	return vorrq_s32(vandq_s32(mValue, minus_one), one);
 #else
-	return Vec3(signbit(mF32[0])? -1.0f : 1.0f, 
-				signbit(mF32[1])? -1.0f : 1.0f, 
+	return Vec3(signbit(mF32[0])? -1.0f : 1.0f,
+				signbit(mF32[1])? -1.0f : 1.0f,
 				signbit(mF32[2])? -1.0f : 1.0f);
 #endif
 }

+ 3 - 3
Jolt/Math/Vec4.h

@@ -89,7 +89,7 @@ public:
 
 	/// Logical and (component wise)
 	static JPH_INLINE Vec4		sAnd(Vec4Arg inV1, Vec4Arg inV2);
-	
+
 	/// Sort the four elements of ioValue and sort ioIndex at the same time.
 	/// Based on a sorting network: http://en.wikipedia.org/wiki/Sorting_network
 	static JPH_INLINE void		sSort4(Vec4 &ioValue, UVec4 &ioIndex);
@@ -199,10 +199,10 @@ public:
 
 	/// Reciprocal vector (1 / value) for each of the components
 	JPH_INLINE Vec4				Reciprocal() const;
-	
+
 	/// Dot product, returns the dot product in X, Y and Z components
 	JPH_INLINE Vec4				DotV(Vec4Arg inV2) const;
-	
+
 	/// Dot product
 	JPH_INLINE float			Dot(Vec4Arg inV2) const;
 

+ 51 - 51
Jolt/Math/Vec4.inl

@@ -9,9 +9,9 @@
 JPH_NAMESPACE_BEGIN
 
 // Constructor
-Vec4::Vec4(Vec3Arg inRHS) : 
-	mValue(inRHS.mValue) 
-{ 
+Vec4::Vec4(Vec3Arg inRHS) :
+	mValue(inRHS.mValue)
+{
 }
 
 Vec4::Vec4(Vec3Arg inRHS, float inW)
@@ -142,9 +142,9 @@ Vec4 Vec4::sMin(Vec4Arg inV1, Vec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vminq_f32(inV1.mValue, inV2.mValue);
 #else
-	return Vec4(min(inV1.mF32[0], inV2.mF32[0]), 
-				min(inV1.mF32[1], inV2.mF32[1]), 
-				min(inV1.mF32[2], inV2.mF32[2]), 
+	return Vec4(min(inV1.mF32[0], inV2.mF32[0]),
+				min(inV1.mF32[1], inV2.mF32[1]),
+				min(inV1.mF32[2], inV2.mF32[2]),
 				min(inV1.mF32[3], inV2.mF32[3]));
 #endif
 }
@@ -156,9 +156,9 @@ Vec4 Vec4::sMax(Vec4Arg inV1, Vec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vmaxq_f32(inV1.mValue, inV2.mValue);
 #else
-	return Vec4(max(inV1.mF32[0], inV2.mF32[0]), 
-				max(inV1.mF32[1], inV2.mF32[1]), 
-				max(inV1.mF32[2], inV2.mF32[2]), 
+	return Vec4(max(inV1.mF32[0], inV2.mF32[0]),
+				max(inV1.mF32[1], inV2.mF32[1]),
+				max(inV1.mF32[2], inV2.mF32[2]),
 				max(inV1.mF32[3], inV2.mF32[3]));
 #endif
 }
@@ -170,9 +170,9 @@ UVec4 Vec4::sEquals(Vec4Arg inV1, Vec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vceqq_f32(inV1.mValue, inV2.mValue);
 #else
-	return UVec4(inV1.mF32[0] == inV2.mF32[0]? 0xffffffffu : 0, 
-				 inV1.mF32[1] == inV2.mF32[1]? 0xffffffffu : 0, 
-				 inV1.mF32[2] == inV2.mF32[2]? 0xffffffffu : 0, 
+	return UVec4(inV1.mF32[0] == inV2.mF32[0]? 0xffffffffu : 0,
+				 inV1.mF32[1] == inV2.mF32[1]? 0xffffffffu : 0,
+				 inV1.mF32[2] == inV2.mF32[2]? 0xffffffffu : 0,
 				 inV1.mF32[3] == inV2.mF32[3]? 0xffffffffu : 0);
 #endif
 }
@@ -184,9 +184,9 @@ UVec4 Vec4::sLess(Vec4Arg inV1, Vec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vcltq_f32(inV1.mValue, inV2.mValue);
 #else
-	return UVec4(inV1.mF32[0] < inV2.mF32[0]? 0xffffffffu : 0, 
-				 inV1.mF32[1] < inV2.mF32[1]? 0xffffffffu : 0, 
-				 inV1.mF32[2] < inV2.mF32[2]? 0xffffffffu : 0, 
+	return UVec4(inV1.mF32[0] < inV2.mF32[0]? 0xffffffffu : 0,
+				 inV1.mF32[1] < inV2.mF32[1]? 0xffffffffu : 0,
+				 inV1.mF32[2] < inV2.mF32[2]? 0xffffffffu : 0,
 				 inV1.mF32[3] < inV2.mF32[3]? 0xffffffffu : 0);
 #endif
 }
@@ -198,9 +198,9 @@ UVec4 Vec4::sLessOrEqual(Vec4Arg inV1, Vec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vcleq_f32(inV1.mValue, inV2.mValue);
 #else
-	return UVec4(inV1.mF32[0] <= inV2.mF32[0]? 0xffffffffu : 0, 
-				 inV1.mF32[1] <= inV2.mF32[1]? 0xffffffffu : 0, 
-				 inV1.mF32[2] <= inV2.mF32[2]? 0xffffffffu : 0, 
+	return UVec4(inV1.mF32[0] <= inV2.mF32[0]? 0xffffffffu : 0,
+				 inV1.mF32[1] <= inV2.mF32[1]? 0xffffffffu : 0,
+				 inV1.mF32[2] <= inV2.mF32[2]? 0xffffffffu : 0,
 				 inV1.mF32[3] <= inV2.mF32[3]? 0xffffffffu : 0);
 #endif
 }
@@ -212,9 +212,9 @@ UVec4 Vec4::sGreater(Vec4Arg inV1, Vec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vcgtq_f32(inV1.mValue, inV2.mValue);
 #else
-	return UVec4(inV1.mF32[0] > inV2.mF32[0]? 0xffffffffu : 0, 
-				 inV1.mF32[1] > inV2.mF32[1]? 0xffffffffu : 0, 
-				 inV1.mF32[2] > inV2.mF32[2]? 0xffffffffu : 0, 
+	return UVec4(inV1.mF32[0] > inV2.mF32[0]? 0xffffffffu : 0,
+				 inV1.mF32[1] > inV2.mF32[1]? 0xffffffffu : 0,
+				 inV1.mF32[2] > inV2.mF32[2]? 0xffffffffu : 0,
 				 inV1.mF32[3] > inV2.mF32[3]? 0xffffffffu : 0);
 #endif
 }
@@ -226,9 +226,9 @@ UVec4 Vec4::sGreaterOrEqual(Vec4Arg inV1, Vec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vcgeq_f32(inV1.mValue, inV2.mValue);
 #else
-	return UVec4(inV1.mF32[0] >= inV2.mF32[0]? 0xffffffffu : 0, 
-				 inV1.mF32[1] >= inV2.mF32[1]? 0xffffffffu : 0, 
-				 inV1.mF32[2] >= inV2.mF32[2]? 0xffffffffu : 0, 
+	return UVec4(inV1.mF32[0] >= inV2.mF32[0]? 0xffffffffu : 0,
+				 inV1.mF32[1] >= inV2.mF32[1]? 0xffffffffu : 0,
+				 inV1.mF32[2] >= inV2.mF32[2]? 0xffffffffu : 0,
 				 inV1.mF32[3] >= inV2.mF32[3]? 0xffffffffu : 0);
 #endif
 }
@@ -346,8 +346,8 @@ void Vec4::sSort4Reverse(Vec4 &ioValue, UVec4 &ioIndex)
 	ioIndex = UVec4::sSelect(ioIndex, i3, c3);
 }
 
-bool Vec4::operator == (Vec4Arg inV2) const 
-{ 
+bool Vec4::operator == (Vec4Arg inV2) const
+{
 	return sEquals(*this, inV2).TestAllTrue();
 }
 
@@ -356,9 +356,9 @@ bool Vec4::IsClose(Vec4Arg inV2, float inMaxDistSq) const
 	return (inV2 - *this).LengthSq() <= inMaxDistSq;
 }
 
-bool Vec4::IsNormalized(float inTolerance) const 
-{ 
-	return abs(LengthSq() - 1.0f) <= inTolerance; 
+bool Vec4::IsNormalized(float inTolerance) const
+{
+	return abs(LengthSq() - 1.0f) <= inTolerance;
 }
 
 bool Vec4::IsNaN() const
@@ -382,9 +382,9 @@ Vec4 Vec4::operator * (Vec4Arg inV2) const
 #elif defined(JPH_USE_NEON)
 	return vmulq_f32(mValue, inV2.mValue);
 #else
-	return Vec4(mF32[0] * inV2.mF32[0], 
-				mF32[1] * inV2.mF32[1], 
-				mF32[2] * inV2.mF32[2], 
+	return Vec4(mF32[0] * inV2.mF32[0],
+				mF32[1] * inV2.mF32[1],
+				mF32[2] * inV2.mF32[2],
 				mF32[3] * inV2.mF32[3]);
 #endif
 }
@@ -408,9 +408,9 @@ Vec4 operator * (float inV1, Vec4Arg inV2)
 #elif defined(JPH_USE_NEON)
 	return vmulq_n_f32(inV2.mValue, inV1);
 #else
-	return Vec4(inV1 * inV2.mF32[0], 
-				inV1 * inV2.mF32[1], 
-				inV1 * inV2.mF32[2], 
+	return Vec4(inV1 * inV2.mF32[0],
+				inV1 * inV2.mF32[1],
+				inV1 * inV2.mF32[2],
 				inV1 * inV2.mF32[3]);
 #endif
 }
@@ -472,9 +472,9 @@ Vec4 Vec4::operator + (Vec4Arg inV2) const
 #elif defined(JPH_USE_NEON)
 	return vaddq_f32(mValue, inV2.mValue);
 #else
-	return Vec4(mF32[0] + inV2.mF32[0], 
-				mF32[1] + inV2.mF32[1], 
-				mF32[2] + inV2.mF32[2], 
+	return Vec4(mF32[0] + inV2.mF32[0],
+				mF32[1] + inV2.mF32[1],
+				mF32[2] + inV2.mF32[2],
 				mF32[3] + inV2.mF32[3]);
 #endif
 }
@@ -510,9 +510,9 @@ Vec4 Vec4::operator - (Vec4Arg inV2) const
 #elif defined(JPH_USE_NEON)
 	return vsubq_f32(mValue, inV2.mValue);
 #else
-	return Vec4(mF32[0] - inV2.mF32[0], 
-				mF32[1] - inV2.mF32[1], 
-				mF32[2] - inV2.mF32[2], 
+	return Vec4(mF32[0] - inV2.mF32[0],
+				mF32[1] - inV2.mF32[1],
+				mF32[2] - inV2.mF32[2],
 				mF32[3] - inV2.mF32[3]);
 #endif
 }
@@ -537,9 +537,9 @@ Vec4 Vec4::operator / (Vec4Arg inV2) const
 #elif defined(JPH_USE_NEON)
 	return vdivq_f32(mValue, inV2.mValue);
 #else
-	return Vec4(mF32[0] / inV2.mF32[0], 
-				mF32[1] / inV2.mF32[1], 
-				mF32[2] / inV2.mF32[2], 
+	return Vec4(mF32[0] / inV2.mF32[0],
+				mF32[1] / inV2.mF32[1],
+				mF32[2] / inV2.mF32[2],
 				mF32[3] / inV2.mF32[3]);
 #endif
 }
@@ -684,9 +684,9 @@ Vec4 Vec4::GetSign() const
 	Type one = vdupq_n_f32(1.0f);
 	return vorrq_s32(vandq_s32(mValue, minus_one), one);
 #else
-	return Vec4(signbit(mF32[0])? -1.0f : 1.0f, 
-				signbit(mF32[1])? -1.0f : 1.0f, 
-				signbit(mF32[2])? -1.0f : 1.0f, 
+	return Vec4(signbit(mF32[0])? -1.0f : 1.0f,
+				signbit(mF32[1])? -1.0f : 1.0f,
+				signbit(mF32[2])? -1.0f : 1.0f,
 				signbit(mF32[3])? -1.0f : 1.0f);
 #endif
 }
@@ -802,7 +802,7 @@ void Vec4::SinCos(Vec4 &outSin, Vec4 &outCos) const
 	// Let x be the original input value and x' our value that has been mapped to the range [-PI / 4, PI / 4].
 	// since cos(x) = sin(x - PI / 2) and since we want to use the Taylor expansion as close as possible to 0,
 	// we can alternate between using the Taylor expansion for sin and cos according to the following table:
-	// 
+	//
 	// quadrant	 sin(x)		 cos(x)
 	// XXX00b	 sin(x')	 cos(x')
 	// XXX01b	 cos(x')	-sin(x')
@@ -842,7 +842,7 @@ Vec4 Vec4::Tan() const
 	Vec4 float_quadrant = quadrant.ToFloat();
 	x = ((x - float_quadrant * 1.5703125f) - float_quadrant * 0.0004837512969970703125f) - float_quadrant * 7.549789948768648e-8f;
 
-	// Calculate x2 = x^2	
+	// Calculate x2 = x^2
 	Vec4 x2 = x * x;
 
 	// Roughly equivalent to the Taylor expansion:
@@ -911,11 +911,11 @@ Vec4 Vec4::ATan() const
 	Vec4 y = Vec4::sZero();
 
 	// If x > Tan(PI / 8)
-	UVec4 greater1 = Vec4::sGreater(x, Vec4::sReplicate(0.4142135623730950f)); 
+	UVec4 greater1 = Vec4::sGreater(x, Vec4::sReplicate(0.4142135623730950f));
 	Vec4 x1 = (x - Vec4::sReplicate(1.0f)) / (x + Vec4::sReplicate(1.0f));
 
 	// If x > Tan(3 * PI / 8)
-	UVec4 greater2 = Vec4::sGreater(x, Vec4::sReplicate(2.414213562373095f)); 
+	UVec4 greater2 = Vec4::sGreater(x, Vec4::sReplicate(2.414213562373095f));
 	Vec4 x2 = Vec4::sReplicate(-1.0f) / (x JPH_IF_FLOATING_POINT_EXCEPTIONS_ENABLED(+ Vec4::sReplicate(FLT_MIN))); // Add small epsilon to prevent div by zero, works because x is always positive
 
 	// Apply first if

+ 4 - 4
Jolt/Math/Vec8.h

@@ -20,7 +20,7 @@ public:
 
 	/// Set 256 bit vector from 2 128 bit vectors
 	JPH_INLINE					Vec8(Vec4Arg inLo, Vec4Arg inHi);
-	
+
 	/// Vector with all zeros
 	static JPH_INLINE Vec8		sZero();
 
@@ -53,7 +53,7 @@ public:
 
 	/// Greater than
 	static JPH_INLINE UVec8		sGreater(Vec8Arg inV1, Vec8Arg inV2);
-	
+
 	/// Load from memory
 	static JPH_INLINE Vec8		sLoadFloat8(const float *inV);
 
@@ -63,7 +63,7 @@ public:
 	/// Get float component by index
 	JPH_INLINE float			operator [] (uint inCoordinate) const			{ JPH_ASSERT(inCoordinate < 8); return mF32[inCoordinate]; }
 	JPH_INLINE float &			operator [] (uint inCoordinate)					{ JPH_ASSERT(inCoordinate < 8); return mF32[inCoordinate]; }
-	
+
 	/// Multiply two float vectors
 	JPH_INLINE Vec8				operator * (Vec8Arg inV2) const;
 
@@ -88,7 +88,7 @@ public:
 
 	/// Get absolute value of all components
 	JPH_INLINE Vec8				Abs() const;
-	
+
 	/// Fetch the lower 128 bit from a 256 bit variable
 	JPH_INLINE Vec4				LowerVec4() const;
 

+ 3 - 3
Jolt/Math/Vec8.inl

@@ -8,9 +8,9 @@ JPH_NAMESPACE_BEGIN
 
 Vec8::Vec8(Vec4Arg inLo, Vec4Arg inHi) :
 	mValue(_mm256_insertf128_ps(_mm256_castps128_ps256(inLo.mValue), inHi.mValue, 1))
-{		
+{
 }
-	
+
 Vec8 Vec8::sZero()
 {
 	return _mm256_setzero_ps();
@@ -129,7 +129,7 @@ Vec8 Vec8::Abs() const
 	return _mm256_max_ps(_mm256_sub_ps(_mm256_setzero_ps(), mValue), mValue);
 #endif
 }
-	
+
 Vec4 Vec8::LowerVec4() const
 {
 	return _mm256_castps256_ps128(mValue);

+ 10 - 10
Jolt/Math/Vector.h

@@ -36,16 +36,16 @@ public:
 		}
 
 	/// Get float component by index
-	inline float				operator [] (uint inCoordinate) const			
-	{ 
-		JPH_ASSERT(inCoordinate < Rows); 
-		return mF32[inCoordinate]; 
+	inline float				operator [] (uint inCoordinate) const
+	{
+		JPH_ASSERT(inCoordinate < Rows);
+		return mF32[inCoordinate];
 	}
-	
+
 	inline float &				operator [] (uint inCoordinate)
-	{ 
-		JPH_ASSERT(inCoordinate < Rows); 
-		return mF32[inCoordinate]; 
+	{
+		JPH_ASSERT(inCoordinate < Rows);
+		return mF32[inCoordinate];
 	}
 
 	/// Comparison
@@ -97,7 +97,7 @@ public:
 		return v;
 	}
 
-	inline Vector &				operator *= (const float inV2) 
+	inline Vector &				operator *= (const float inV2)
 	{
 		for (uint r = 0; r < Rows; ++r)
 			mF32[r] *= inV2;
@@ -153,7 +153,7 @@ public:
 		return v;
 	}
 
-	inline Vector &				operator -= (const Vector &inV2) 
+	inline Vector &				operator -= (const Vector &inV2)
 	{
 		for (uint r = 0; r < Rows; ++r)
 			mF32[r] -= inV2.mF32[r];

+ 14 - 14
Jolt/ObjectStream/GetPrimitiveTypeOfType.h

@@ -9,45 +9,45 @@
 JPH_NAMESPACE_BEGIN
 
 /// Helper functions to get the underlying RTTI type of a type (so e.g. Array<sometype> will return sometype)
-template <class T>				
+template <class T>
 const RTTI *GetPrimitiveTypeOfType(T *)
-{ 
+{
 	return GetRTTIOfType((T *)nullptr);
 }
 
-template <class T>				
+template <class T>
 const RTTI *GetPrimitiveTypeOfType(T **)
-{ 
+{
 	return GetRTTIOfType((T *)nullptr);
 }
 
-template <class T>				
+template <class T>
 const RTTI *GetPrimitiveTypeOfType(Ref<T> *)
-{ 
+{
 	return GetRTTIOfType((T *)nullptr);
 }
 
-template <class T>				
+template <class T>
 const RTTI *GetPrimitiveTypeOfType(RefConst<T> *)
-{ 
+{
 	return GetRTTIOfType((T *)nullptr);
 }
 
-template <class T>				
+template <class T>
 const RTTI *GetPrimitiveTypeOfType(Array<T> *)
-{ 
+{
 	return GetPrimitiveTypeOfType((T *)nullptr);
 }
 
-template <class T, uint N>				
+template <class T, uint N>
 const RTTI *GetPrimitiveTypeOfType(StaticArray<T, N> *)
-{ 
+{
 	return GetPrimitiveTypeOfType((T *)nullptr);
 }
 
-template <class T, uint N>				
+template <class T, uint N>
 const RTTI *GetPrimitiveTypeOfType(T (*)[N])
-{ 
+{
 	return GetPrimitiveTypeOfType((T *)nullptr);
 }
 

+ 1 - 1
Jolt/ObjectStream/ObjectStreamBinaryIn.cpp

@@ -135,7 +135,7 @@ bool ObjectStreamBinaryIn::ReadPrimitiveData(String &outPrimitive)
 	if (len & 0x80000000)
 	{
 		StringTable::iterator i = mStringTable.find(len);
-		if (i == mStringTable.end()) 
+		if (i == mStringTable.end())
 			return false;
 		outPrimitive = i->second;
 		return true;

+ 1 - 1
Jolt/ObjectStream/ObjectStreamBinaryOut.h

@@ -22,7 +22,7 @@ public:
 	virtual void				WriteName(const char *inName) override;
 	virtual void				WriteIdentifier(Identifier inIdentifier) override;
 	virtual void				WriteCount(uint32 inCount) override;
-								
+
 	virtual void				WritePrimitiveData(const uint8 &inPrimitive) override;
 	virtual void				WritePrimitiveData(const uint16 &inPrimitive) override;
 	virtual void				WritePrimitiveData(const int &inPrimitive) override;

+ 99 - 99
Jolt/ObjectStream/ObjectStreamIn.cpp

@@ -26,10 +26,10 @@ bool ObjectStreamIn::GetInfo(istream &inStream, EStreamType &outType, int &outVe
 	inStream.read(header, 8);
 	if ((header[0] == 'B' || header[0] == 'T') && header[1] == 'O' && header[2] == 'S'
 		&& (header[3] == ' ' || isdigit(header[3])) && isdigit(header[4])
-		&& header[5] == '.' && isdigit(header[6]) && isdigit(header[7])) 
+		&& header[5] == '.' && isdigit(header[6]) && isdigit(header[7]))
 	{
 		// Check if this is a binary or text objectfile
-		switch (header[0]) 
+		switch (header[0])
 		{
 		case 'T':	outType = ObjectStream::EStreamType::Text;		break;
 		case 'B':	outType = ObjectStream::EStreamType::Binary;	break;
@@ -42,7 +42,7 @@ bool ObjectStreamIn::GetInfo(istream &inStream, EStreamType &outType, int &outVe
 		outRevision = atoi(&header[6]);
 
 		return true;
-	} 
+	}
 
 	Trace("ObjectStreamIn: Not a valid object stream.");
 	return false;
@@ -54,19 +54,19 @@ ObjectStreamIn *ObjectStreamIn::Open(istream &inStream)
 	EStreamType	type;
 	int version;
 	int revision;
-	if (GetInfo(inStream, type, version, revision)) 
+	if (GetInfo(inStream, type, version, revision))
 	{
-		if (version == sVersion && revision == sRevision) 
+		if (version == sVersion && revision == sRevision)
 		{
 			// Create an input stream of the correct type
-			switch (type) 
+			switch (type)
 			{
 			case EStreamType::Text:		return new ObjectStreamTextIn(inStream);
 			case EStreamType::Binary:	return new ObjectStreamBinaryIn(inStream);
 			default:					JPH_ASSERT(false);
 			}
-		} 
-		else 
+		}
+		else
 		{
 			Trace("ObjectStreamIn: Different version stream (%d.%02d, expected %d.%02d).", version, revision, sVersion, sRevision);
 		}
@@ -86,13 +86,13 @@ void *ObjectStreamIn::Read(const RTTI *inRTTI)
 	{
 		// Get type of next operation
 		EOSDataType data_type;
-		if (!ReadDataType(data_type)) 
+		if (!ReadDataType(data_type))
 			break;
 
 		if (data_type == EOSDataType::Declare)
-		{	
+		{
 			// Read type declaration
-			if (!ReadRTTI()) 
+			if (!ReadRTTI())
 			{
 				Trace("ObjectStreamIn: Fatal error while reading class description for class %s.", inRTTI->GetName());
 				continue_reading = false;
@@ -100,13 +100,13 @@ void *ObjectStreamIn::Read(const RTTI *inRTTI)
 			}
 		}
 		else if (data_type == EOSDataType::Object)
-		{	
+		{
 			const RTTI *rtti;
 			void *object = ReadObject(rtti);
-			if (!main_object && object) 
+			if (!main_object && object)
 			{
 				// This is the first and thus main object of the file.
-				if (rtti->IsKindOf(inRTTI)) 
+				if (rtti->IsKindOf(inRTTI))
 				{
 					// Object is of correct type
 					main_object = object;
@@ -120,7 +120,7 @@ void *ObjectStreamIn::Read(const RTTI *inRTTI)
 			}
 		}
 		else
-		{	
+		{
 			// Invalid or out of place token found
 			Trace("ObjectStreamIn: Invalid or out of place token found.");
 			continue_reading = false;
@@ -129,14 +129,14 @@ void *ObjectStreamIn::Read(const RTTI *inRTTI)
 	}
 
 	// Resolve links (pointer, references)
-	if (continue_reading) 
-	{		
+	if (continue_reading)
+	{
 		// Resolve links
 		ObjectSet referenced_objects;
-		for (Link &link : mUnresolvedLinks) 
+		for (Link &link : mUnresolvedLinks)
 		{
 			IdentifierMap::const_iterator j = mIdentifierMap.find(link.mIdentifier);
-			if (j != mIdentifierMap.end() && j->second.mRTTI->IsKindOf(link.mRTTI)) 
+			if (j != mIdentifierMap.end() && j->second.mRTTI->IsKindOf(link.mRTTI))
 			{
 				const ObjectInfo &obj_info = j->second;
 
@@ -144,14 +144,14 @@ void *ObjectStreamIn::Read(const RTTI *inRTTI)
 				*link.mPointer = obj_info.mInstance;
 
 				// Increment refcount if it was a referencing pointer
-				if (link.mRefCountOffset != -1) 
+				if (link.mRefCountOffset != -1)
 					++(*(uint32 *)(((uint8 *)obj_info.mInstance) + link.mRefCountOffset));
-				
+
 				// Add referenced object to the list
 				if (referenced_objects.find(obj_info.mInstance) == referenced_objects.end())
 					referenced_objects.insert(obj_info.mInstance);
-			} 
-			else 
+			}
+			else
 			{
 				// Referenced object not found, set pointer to nullptr
 				Trace("ObjectStreamIn: Setting incorrect pointer to class of type %s to nullptr.", link.mRTTI->GetName());
@@ -160,14 +160,14 @@ void *ObjectStreamIn::Read(const RTTI *inRTTI)
 		}
 
 		// Release unreferenced objects except the main object
-		for (const IdentifierMap::value_type &j : mIdentifierMap) 
+		for (const IdentifierMap::value_type &j : mIdentifierMap)
 		{
 			const ObjectInfo &obj_info = j.second;
 
-			if (obj_info.mInstance != main_object) 
+			if (obj_info.mInstance != main_object)
 			{
 				ObjectSet::const_iterator k = referenced_objects.find(obj_info.mInstance);
-				if (k == referenced_objects.end()) 
+				if (k == referenced_objects.end())
 				{
 					Trace("ObjectStreamIn: Releasing unreferenced object of type %s.", obj_info.mRTTI->GetName());
 					obj_info.mRTTI->DestructObject(obj_info.mInstance);
@@ -180,7 +180,7 @@ void *ObjectStreamIn::Read(const RTTI *inRTTI)
 	else
 	{
 		// Release all objects if a fatal error occurred
-		for (const IdentifierMap::value_type &i : mIdentifierMap) 
+		for (const IdentifierMap::value_type &i : mIdentifierMap)
 		{
 			const ObjectInfo &obj_info = i.second;
 			obj_info.mRTTI->DestructObject(obj_info.mInstance);
@@ -195,41 +195,41 @@ void *ObjectStreamIn::ReadObject(const RTTI *& outRTTI)
 	// Read the object class
 	void *object = nullptr;
 	String class_name;
-	if (ReadName(class_name)) 
+	if (ReadName(class_name))
 	{
 		// Get class description
 		ClassDescriptionMap::iterator i = mClassDescriptionMap.find(class_name);
-		if (i != mClassDescriptionMap.end()) 
+		if (i != mClassDescriptionMap.end())
 		{
 			const ClassDescription &class_desc = i->second;
 
 			// Read object identifier
 			Identifier identifier;
-			if (ReadIdentifier(identifier)) 
+			if (ReadIdentifier(identifier))
 			{
 				// Check if this object can be read or must be skipped
-				if (identifier != sNullIdentifier 
+				if (identifier != sNullIdentifier
 					&& class_desc.mRTTI
-					&& !class_desc.mRTTI->IsAbstract()) 
+					&& !class_desc.mRTTI->IsAbstract())
 				{
 					// Create object instance
 					outRTTI = class_desc.mRTTI;
 					object = outRTTI->CreateObject();
 
 					// Read object attributes
-					if (ReadClassData(class_desc, object)) 
+					if (ReadClassData(class_desc, object))
 					{
 						// Add object to identifier map
 						mIdentifierMap.try_emplace(identifier, object, outRTTI);
-					} 
-					else 
+					}
+					else
 					{
 						// Fatal error while reading attributes, release object
 						outRTTI->DestructObject(object);
 						object = nullptr;
 					}
-				} 
-				else 
+				}
+				else
 				{
 					// Skip this object
 					// TODO: This operation can fail, but there is no check yet
@@ -237,8 +237,8 @@ void *ObjectStreamIn::ReadObject(const RTTI *& outRTTI)
 					ReadClassData(class_desc, nullptr);
 				}
 			}
-		} 
-		else 
+		}
+		else
 		{
 			// TODO: This is a fatal error, but this function has no way of indicating this
 			Trace("ObjectStreamIn: Found object of unknown class %s.", class_name.c_str());
@@ -252,10 +252,10 @@ bool ObjectStreamIn::ReadRTTI()
 {
 	// Read class name and find it's attribute info
 	String class_name;
-	if (!ReadName(class_name)) 
+	if (!ReadName(class_name))
 		return false;
 
-	// Find class 
+	// Find class
 	const RTTI *rtti = Factory::sInstance->Find(class_name.c_str());
 	if (rtti == nullptr)
 		Trace("ObjectStreamIn: Unknown class: \"%s\".", class_name.c_str());
@@ -265,44 +265,44 @@ bool ObjectStreamIn::ReadRTTI()
 
 	// Read the number of entries in the description
 	uint32 count;
-	if (!ReadCount(count)) 
+	if (!ReadCount(count))
 		return false;
 
 	// Read the entries
-	for (uint32 i = 0; i < count; ++i) 
+	for (uint32 i = 0; i < count; ++i)
 	{
 		AttributeDescription attribute;
-		
+
 		// Read name
 		String attribute_name;
-		if (!ReadName(attribute_name)) 
+		if (!ReadName(attribute_name))
 			return false;
-		
+
 		// Read type
-		if (!ReadDataType(attribute.mSourceType)) 
+		if (!ReadDataType(attribute.mSourceType))
 			return false;
 
 		// Read array depth
-		while (attribute.mSourceType == EOSDataType::Array) 
+		while (attribute.mSourceType == EOSDataType::Array)
 		{
 			++attribute.mArrayDepth;
-			if (!ReadDataType(attribute.mSourceType)) 
+			if (!ReadDataType(attribute.mSourceType))
 				return false;
 		}
 
 		// Read instance/pointer class name
-		if ((attribute.mSourceType == EOSDataType::Instance || attribute.mSourceType == EOSDataType::Pointer) 
-			&& !ReadName(attribute.mClassName)) 
+		if ((attribute.mSourceType == EOSDataType::Instance || attribute.mSourceType == EOSDataType::Pointer)
+			&& !ReadName(attribute.mClassName))
 			return false;
 
 		// Find attribute in rtti
-		if (rtti) 
+		if (rtti)
 		{
 			// Find attribute index
 			for (int idx = 0; idx < rtti->GetAttributeCount(); ++idx)
 			{
 				const SerializableAttribute &attr = rtti->GetAttribute(idx);
-				if (strcmp(attr.GetName(), attribute_name.c_str()) == 0) 
+				if (strcmp(attr.GetName(), attribute_name.c_str()) == 0)
 				{
 					attribute.mIndex = idx;
 					break;
@@ -334,7 +334,7 @@ bool ObjectStreamIn::ReadRTTI()
 					attribute.mIndex = -1;
 				}
 			}
-		} 
+		}
 
 		// Add attribute to the class description
 		class_desc.mAttributes.push_back(attribute);
@@ -357,7 +357,7 @@ bool ObjectStreamIn::ReadClassData(const ClassDescription &inClassDesc, void *in
 {
 	// Read data for this class
 	bool continue_reading = true;
-	
+
 	for (const AttributeDescription &attr_desc : inClassDesc.mAttributes)
 	{
 		// Read or skip the attribute data
@@ -403,14 +403,14 @@ bool ObjectStreamIn::ReadClassData(const ClassDescription &inClassDesc, void *in
 bool ObjectStreamIn::ReadPointerData(const RTTI *inRTTI, void **inPointer, int inRefCountOffset)
 {
 	Identifier identifier;
-	if (ReadIdentifier(identifier)) 
+	if (ReadIdentifier(identifier))
 	{
-		if (identifier == sNullIdentifier) 
+		if (identifier == sNullIdentifier)
 		{
 			// Set nullptr pointer
 			inPointer = nullptr;
-		} 
-		else 
+		}
+		else
 		{
 			// Put pointer on the list to be resolved later on
 			mUnresolvedLinks.emplace_back();
@@ -432,15 +432,15 @@ bool ObjectStreamIn::SkipAttributeData(int inArrayDepth, EOSDataType inDataType,
 
 	// Get number of items to read
 	uint32 count = 1;
-	for (; inArrayDepth > 0; --inArrayDepth) 
+	for (; inArrayDepth > 0; --inArrayDepth)
 	{
 		uint32 temporary;
-		if (ReadCount(temporary)) 
+		if (ReadCount(temporary))
 		{
 			// Multiply for multi dimensional arrays
 			count *= temporary;
-		} 
-		else 
+		}
+		else
 		{
 			// Fatal error while reading array size
 			continue_reading = false;
@@ -449,150 +449,150 @@ bool ObjectStreamIn::SkipAttributeData(int inArrayDepth, EOSDataType inDataType,
 	}
 
 	// Read data for all items
-	if (continue_reading) 
+	if (continue_reading)
 	{
-		if (inDataType == EOSDataType::Instance) 
+		if (inDataType == EOSDataType::Instance)
 		{
 			// Get the class description
 			ClassDescriptionMap::iterator i = mClassDescriptionMap.find(inClassName);
-			if (i != mClassDescriptionMap.end()) 
-			{			
+			if (i != mClassDescriptionMap.end())
+			{
 				for (; count > 0 && continue_reading; --count)
 					continue_reading = ReadClassData(i->second, nullptr);
-			} 
-			else 
+			}
+			else
 			{
 				continue_reading = false;
 				Trace("ObjectStreamIn: Found instance of unknown class %s.", inClassName);
 			}
-		} 
-		else 
+		}
+		else
 		{
-			for (; count > 0 && continue_reading; --count) 
+			for (; count > 0 && continue_reading; --count)
 			{
-				switch (inDataType) 
+				switch (inDataType)
 				{
 				case EOSDataType::Pointer:
-					{	
+					{
 						Identifier temporary;
 						continue_reading = ReadIdentifier(temporary);
 						break;
 					}
 
 				case EOSDataType::T_uint8:
-					{	
+					{
 						uint8 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
-				
+
 				case EOSDataType::T_uint16:
-					{	
+					{
 						uint16 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
-				
+
 				case EOSDataType::T_int:
-					{	
+					{
 						int temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
-				
+
 				case EOSDataType::T_uint32:
-					{	
+					{
 						uint32 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
-				
+
 				case EOSDataType::T_uint64:
-					{	
+					{
 						uint64 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
-				
+
 				case EOSDataType::T_float:
-					{	
+					{
 						float temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
-				
+
 				case EOSDataType::T_double:
-					{	
+					{
 						double temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
-				
+
 				case EOSDataType::T_bool:
-					{	
+					{
 						bool temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
-				
+
 				case EOSDataType::T_String:
-					{	
+					{
 						String temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
 
 				case EOSDataType::T_Float3:
-					{	
+					{
 						Float3 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
 
 				case EOSDataType::T_Double3:
-					{	
+					{
 						Double3 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
 
 				case EOSDataType::T_Vec3:
-					{	
+					{
 						Vec3 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
 
 				case EOSDataType::T_DVec3:
-					{	
+					{
 						DVec3 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
 
 				case EOSDataType::T_Vec4:
-					{	
+					{
 						Vec4 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
 
 				case EOSDataType::T_Quat:
-					{	
+					{
 						Quat temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
 
 				case EOSDataType::T_Mat44:
-					{	
+					{
 						Mat44 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;
 					}
 
 				case EOSDataType::T_DMat44:
-					{	
+					{
 						DMat44 temporary;
 						continue_reading = ReadPrimitiveData(temporary);
 						break;

+ 6 - 6
Jolt/ObjectStream/ObjectStreamIn.h

@@ -24,13 +24,13 @@ private:
 
 public:
 	/// Main function to read an object from a stream
-	template <class T> 
+	template <class T>
 	static bool sReadObject(istream &inStream, T *&outObject)
 	{
 		// Create the input stream
 		bool result = false;
 		ObjectStreamIn *stream = ObjectStreamIn::Open(inStream);
-		if (stream) 
+		if (stream)
 		{
 			// Read the object
 			outObject = (T *)stream->Read(JPH_RTTI(T));
@@ -41,7 +41,7 @@ public:
 	}
 
 	/// Main function to read an object from a stream (reference counting pointer version)
-	template <class T> 
+	template <class T>
 	static bool sReadObject(istream &inStream, Ref<T> &outObject)
 	{
 		T *object = nullptr;
@@ -56,7 +56,7 @@ public:
 	{
 		std::ifstream stream;
 		stream.open(inFileName, std::ifstream::in | std::ifstream::binary);
-		if (!stream.is_open()) 
+		if (!stream.is_open())
 			return false;
 		return sReadObject(stream, outObject);
 	}
@@ -115,7 +115,7 @@ private:
 		const RTTI *			mRTTI = nullptr;
 		Array<AttributeDescription>	mAttributes;
 	};
-	
+
 	struct ObjectInfo
 	{
 								ObjectInfo() = default;
@@ -132,7 +132,7 @@ private:
 		Identifier				mIdentifier;
 		const RTTI *			mRTTI;
 	};
-	
+
 	using IdentifierMap = UnorderedMap<Identifier, ObjectInfo>;
 	using ClassDescriptionMap = UnorderedMap<String, ClassDescription>;
 

+ 12 - 12
Jolt/ObjectStream/ObjectStreamOut.cpp

@@ -21,7 +21,7 @@ ObjectStreamOut::ObjectStreamOut(ostream &inStream) :
 
 ObjectStreamOut *ObjectStreamOut::Open(EStreamType inType, ostream &inStream)
 {
-	switch (inType) 
+	switch (inType)
 	{
 	case EStreamType::Text:		return new ObjectStreamTextOut(inStream);
 	case EStreamType::Binary:	return new ObjectStreamBinaryOut(inStream);
@@ -38,7 +38,7 @@ bool ObjectStreamOut::Write(const void *inObject, const RTTI *inRTTI)
 	WriteObject(inObject);
 
 	// Write all linked objects
-	while (!mObjectQueue.empty() && !mStream.fail()) 
+	while (!mObjectQueue.empty() && !mStream.fail())
 	{
 		const void *linked_object = mObjectQueue.front();
 		WriteObject(linked_object);
@@ -55,7 +55,7 @@ void ObjectStreamOut::WriteObject(const void *inObject)
 
 	// Write class description and associated descriptions
 	QueueRTTI(i->second.mRTTI);
-	while (!mClassQueue.empty() && !mStream.fail()) 
+	while (!mClassQueue.empty() && !mStream.fail())
 	{
 		WriteRTTI(mClassQueue.front());
 		mClassQueue.pop();
@@ -76,7 +76,7 @@ void ObjectStreamOut::WriteObject(const void *inObject)
 void ObjectStreamOut::QueueRTTI(const RTTI *inRTTI)
 {
 	ClassSet::const_iterator i = mClassSet.find(inRTTI);
-	if (i == mClassSet.end()) 
+	if (i == mClassSet.end())
 	{
 		mClassSet.insert(inRTTI);
 		mClassQueue.push(inRTTI);
@@ -95,7 +95,7 @@ void ObjectStreamOut::WriteRTTI(const RTTI *inRTTI)
 
 	// Write class attribute info
 	HintIndentUp();
-	for (int attr_index = 0; attr_index < inRTTI->GetAttributeCount(); ++attr_index) 
+	for (int attr_index = 0; attr_index < inRTTI->GetAttributeCount(); ++attr_index)
 	{
 		// Get attribute
 		const SerializableAttribute &attr = inRTTI->GetAttribute(attr_index);
@@ -120,7 +120,7 @@ void ObjectStreamOut::WriteClassData(const RTTI *inRTTI, const void *inInstance)
 
 	// Write attributes
 	HintIndentUp();
-	for (int attr_index = 0; attr_index < inRTTI->GetAttributeCount(); ++attr_index) 
+	for (int attr_index = 0; attr_index < inRTTI->GetAttributeCount(); ++attr_index)
 	{
 		// Get attribute
 		const SerializableAttribute &attr = inRTTI->GetAttribute(attr_index);
@@ -133,24 +133,24 @@ void ObjectStreamOut::WritePointerData(const RTTI *inRTTI, const void *inPointer
 {
 	Identifier identifier;
 
-	if (inPointer) 
+	if (inPointer)
 	{
 		// Check if this object has an identifier
 		IdentifierMap::iterator i = mIdentifierMap.find(inPointer);
-		if (i != mIdentifierMap.end()) 
+		if (i != mIdentifierMap.end())
 		{
 			// Object already has an identifier
 			identifier = i->second.mIdentifier;
-		} 
-		else 
+		}
+		else
 		{
 			// Assign a new identifier to this object and queue it for serialization
 			identifier = mNextIdentifier++;
 			mIdentifierMap.try_emplace(inPointer, identifier, inRTTI);
 			mObjectQueue.push(inPointer);
 		}
-	} 
-	else 
+	}
+	else
 	{
 		// Write nullptr pointer
 		identifier = sNullIdentifier;

+ 6 - 6
Jolt/ObjectStream/ObjectStreamOut.h

@@ -18,7 +18,7 @@ JPH_NAMESPACE_BEGIN
 
 template <class T> using Queue = std::queue<T, std::deque<T, STLAllocator<T>>>;
 
-/// ObjectStreamOut contains all logic for writing an object to disk. It is the base 
+/// ObjectStreamOut contains all logic for writing an object to disk. It is the base
 /// class for the text and binary output streams (ObjectStreamTextOut and ObjectStreamBinaryOut).
 class JPH_EXPORT ObjectStreamOut : public IObjectStreamOut
 {
@@ -27,20 +27,20 @@ private:
 
 public:
 	/// Main function to write an object to a stream
-	template <class T> 
+	template <class T>
 	static bool	sWriteObject(ostream &inStream, ObjectStream::EStreamType inType, const T &inObject)
 	{
 		// Create the output stream
 		bool result = false;
 		ObjectStreamOut *stream = ObjectStreamOut::Open(inType, inStream);
-		if (stream) 
+		if (stream)
 		{
 			// Write the object to the stream
 			result = stream->Write((void *)&inObject, GetRTTI(&inObject));
 			delete stream;
 		}
 
-		return result;		
+		return result;
 	}
 
 	/// Main function to write an object to a file
@@ -49,7 +49,7 @@ public:
 	{
 		std::ofstream stream;
 		stream.open(inFileName, std::ofstream::out | std::ofstream::trunc | std::ofstream::binary);
-		if (!stream.is_open()) 
+		if (!stream.is_open())
 			return false;
 		return sWriteObject(stream, inType, inObject);
 	}
@@ -95,6 +95,6 @@ private:
 	ObjectQueue					mObjectQueue;												///< Queue of objects to be written
 	ClassSet					mClassSet;													///< List of classes already written
 	ClassQueue					mClassQueue;												///< List of classes waiting to be written
-};	
+};
 
 JPH_NAMESPACE_END

+ 20 - 20
Jolt/ObjectStream/ObjectStreamTextIn.cpp

@@ -16,13 +16,13 @@ ObjectStreamTextIn::ObjectStreamTextIn(istream &inStream) :
 bool ObjectStreamTextIn::ReadDataType(EOSDataType &outType)
 {
 	String token;
-	if (ReadWord(token)) 
+	if (ReadWord(token))
 	{
 		transform(token.begin(), token.end(), token.begin(), [](char inValue) { return (char)tolower(inValue); });
 		if (token == "declare")
 			outType = EOSDataType::Declare;
 		else if (token == "object")
-			outType = EOSDataType::Object;		
+			outType = EOSDataType::Object;
 		else if (token == "instance")
 			outType = EOSDataType::Instance;
 		else if (token == "pointer")
@@ -109,7 +109,7 @@ bool ObjectStreamTextIn::ReadPrimitiveData(uint8 &outPrimitive)
 	{
 		outPrimitive = (uint8)temporary;
 		return true;
-	}	
+	}
 	return false;
 }
 
@@ -125,7 +125,7 @@ bool ObjectStreamTextIn::ReadPrimitiveData(uint16 &outPrimitive)
 	{
 		outPrimitive = (uint16)temporary;
 		return true;
-	}	
+	}
 	return false;
 }
 
@@ -212,54 +212,54 @@ bool ObjectStreamTextIn::ReadPrimitiveData(String &outPrimitive)
 	// Read string and interpret special characters
 	String result;
 	bool escaped = false;
-	for (;;) 
+	for (;;)
 	{
 		if (!ReadChar(c))
 			break;
 
-		switch (c) 
+		switch (c)
 		{
 		case '\n':
 		case '\t':
 			break;
 
 		case '\\':
-			if (escaped) 
+			if (escaped)
 			{
 				result += '\\';
 				escaped = false;
-			} 
-			else 
+			}
+			else
 				escaped = true;
 			break;
 
 		case 'n':
-			if (escaped) 
+			if (escaped)
 			{
 				result += '\n';
 				escaped = false;
-			} 
-			else 
+			}
+			else
 				result += 'n';
 			break;
 
 		case 't':
-			if (escaped) 
+			if (escaped)
 			{
 				result += '\t';
 				escaped = false;
-			} 
-			else 
+			}
+			else
 				result += 't';
 			break;
 
 		case '\"':
-			if (escaped) 
+			if (escaped)
 			{
 				result += '\"';
 				escaped = false;
-			} 
-			else 
+			}
+			else
 			{
 				// Found closing double quote
 				outPrimitive = result;
@@ -268,9 +268,9 @@ bool ObjectStreamTextIn::ReadPrimitiveData(String &outPrimitive)
 			break;
 
 		default:
-			if (escaped) 
+			if (escaped)
 				escaped = false;
-			else 
+			else
 				result += c;
 			break;
 		}

+ 1 - 1
Jolt/ObjectStream/ObjectStreamTextOut.cpp

@@ -17,7 +17,7 @@ ObjectStreamTextOut::ObjectStreamTextOut(ostream &inStream) :
 
 void ObjectStreamTextOut::WriteDataType(EOSDataType inType)
 {
-	switch (inType) 
+	switch (inType)
 	{
 	case EOSDataType::Declare:		WriteWord("declare ");		break;
 	case EOSDataType::Object:		WriteWord("object ");		break;

+ 1 - 1
Jolt/ObjectStream/ObjectStreamTextOut.h

@@ -22,7 +22,7 @@ public:
 	virtual void				WriteName(const char *inName) override;
 	virtual void				WriteIdentifier(Identifier inIdentifier) override;
 	virtual void				WriteCount(uint32 inCount) override;
-								
+
 	virtual void				WritePrimitiveData(const uint8 &inPrimitive) override;
 	virtual void				WritePrimitiveData(const uint16 &inPrimitive) override;
 	virtual void				WritePrimitiveData(const int &inPrimitive) override;

+ 1 - 1
Jolt/ObjectStream/SerializableAttribute.h

@@ -19,7 +19,7 @@ enum class EOSDataType
 	Instance,																		///< Used in attribute declaration, indicates that an object is an instanced attribute (no pointer)
 	Pointer,																		///< Used in attribute declaration, indicates that an object is a pointer attribute
 	Array,																			///< Used in attribute declaration, indicates that this is an array of objects
-		
+
 	// Basic types (primitives)
 	#define JPH_DECLARE_PRIMITIVE(name)	T_##name,
 

+ 2 - 2
Jolt/ObjectStream/SerializableAttributeEnum.h

@@ -18,7 +18,7 @@ inline void AddSerializableAttributeEnum(RTTI &inRTTI, uint inOffset, const char
 {
 	inRTTI.AddAttribute(SerializableAttribute(inName, inOffset,
 		[]() -> const RTTI *
-		{ 
+		{
 			return nullptr;
 		},
 		[](int inArrayDepth, EOSDataType inDataType, [[maybe_unused]] const char *inClassName)
@@ -28,7 +28,7 @@ inline void AddSerializableAttributeEnum(RTTI &inRTTI, uint inOffset, const char
 		[](IObjectStreamIn &ioStream, void *inObject)
 		{
 			uint32 temporary;
-			if (OSReadData(ioStream, temporary)) 
+			if (OSReadData(ioStream, temporary))
 			{
 				*reinterpret_cast<MemberType *>(inObject) = static_cast<MemberType>(temporary);
 				return true;

+ 1 - 1
Jolt/ObjectStream/SerializableAttributeTyped.h

@@ -19,7 +19,7 @@ inline void AddSerializableAttributeTyped(RTTI &inRTTI, uint inOffset, const cha
 {
 	inRTTI.AddAttribute(SerializableAttribute(inName, inOffset,
 		[]()
-		{ 
+		{
 			return GetPrimitiveTypeOfType((MemberType *)nullptr);
 		},
 		[](int inArrayDepth, EOSDataType inDataType, const char *inClassName)

+ 2 - 2
Jolt/ObjectStream/TypeDeclarations.cpp

@@ -26,8 +26,8 @@ JPH_IMPLEMENT_RTTI_OUTSIDE_CLASS(Quat)			{ }
 JPH_IMPLEMENT_RTTI_OUTSIDE_CLASS(Mat44)			{ }
 JPH_IMPLEMENT_RTTI_OUTSIDE_CLASS(DMat44)		{ }
 
-JPH_IMPLEMENT_SERIALIZABLE_OUTSIDE_CLASS(Color)			
-{ 
+JPH_IMPLEMENT_SERIALIZABLE_OUTSIDE_CLASS(Color)
+{
 	JPH_ADD_ATTRIBUTE(Color, r)
 	JPH_ADD_ATTRIBUTE(Color, g)
 	JPH_ADD_ATTRIBUTE(Color, b)

+ 3 - 3
Jolt/Physics/Body/BodyFilter.h

@@ -36,7 +36,7 @@ class IgnoreSingleBodyFilter : public BodyFilter
 {
 public:
 	/// Constructor, pass the body you want to ignore
-	explicit				IgnoreSingleBodyFilter(const BodyID &inBodyID) : 
+	explicit				IgnoreSingleBodyFilter(const BodyID &inBodyID) :
 		mBodyID(inBodyID)
 	{
 	}
@@ -46,7 +46,7 @@ public:
 	{
 		return mBodyID != inBodyID;
 	}
-		
+
 private:
 	BodyID					mBodyID;
 };
@@ -72,7 +72,7 @@ public:
 	{
 		mBodyIDs.push_back(inBodyID);
 	}
-		
+
 	/// Filter function. Returns true if we should collide with inBodyID
 	virtual bool			ShouldCollide(const BodyID &inBodyID) const override
 	{

+ 6 - 6
Jolt/Physics/Body/BodyID.h

@@ -26,16 +26,16 @@ public:
 	}
 
 	/// Construct from index and sequence number combined in a single uint32 (use with care!)
-	explicit				BodyID(uint32 inID) : 
-		mID(inID) 
-	{ 
+	explicit				BodyID(uint32 inID) :
+		mID(inID)
+	{
 		JPH_ASSERT((inID & cBroadPhaseBit) == 0 || inID == cInvalidBodyID); // Check bit used by broadphase
 	}
 
 	/// Construct from index and sequence number
-	explicit				BodyID(uint32 inID, uint8 inSequenceNumber) : 
-		mID((uint32(inSequenceNumber) << 24) | inID) 
-	{ 
+	explicit				BodyID(uint32 inID, uint8 inSequenceNumber) :
+		mID((uint32(inSequenceNumber) << 24) | inID)
+	{
 		JPH_ASSERT(inID < cMaxBodyIndex); // Should not use bit pattern for invalid ID and should not use the broadphase bit
 	}
 

+ 4 - 4
Jolt/Physics/Body/BodyLock.h

@@ -80,19 +80,19 @@ private:
 };
 
 /// A body lock takes a body ID and locks the underlying body so that other threads cannot access its members
-/// 
+///
 /// The common usage pattern is:
-/// 
+///
 ///		BodyLockInterface lock_interface = physics_system.GetBodyLockInterface(); // Or non-locking interface if the lock is already taken
 ///		BodyID body_id = ...; // Obtain ID to body
-///		
+///
 ///		// Scoped lock
 ///		{
 ///			BodyLockRead lock(lock_interface, body_id);
 ///			if (lock.Succeeded()) // body_id may no longer be valid
 ///			{
 ///				const Body &body = lock.GetBody();
-///		
+///
 ///				// Do something with body
 ///				...
 ///			}

+ 4 - 4
Jolt/Physics/Body/BodyLockInterface.h

@@ -45,7 +45,7 @@ public:
 	virtual void				LockWrite(MutexMask inMutexMask) const = 0;
 	virtual void				UnlockWrite(MutexMask inMutexMask) const = 0;
 	///@}
-		
+
 	/// Convert body ID to body
 	inline Body *				TryGetBody(const BodyID &inBodyID) const			{ return mBodyManager.TryGetBody(inBodyID); }
 
@@ -91,7 +91,7 @@ public:
 	{
 		PhysicsLock::sUnlockShared(*inMutex JPH_IF_ENABLE_ASSERTS(, &mBodyManager, EPhysicsLockTypes::PerBody));
 	}
-	
+
 	virtual SharedMutex *		LockWrite(const BodyID &inBodyID) const override
 	{
 		SharedMutex &mutex = mBodyManager.GetMutexForBody(inBodyID);
@@ -105,8 +105,8 @@ public:
 	}
 
 	///@name Batch locking functions
-	virtual MutexMask			GetMutexMask(const BodyID *inBodies, int inNumber) const override	
-	{ 
+	virtual MutexMask			GetMutexMask(const BodyID *inBodies, int inNumber) const override
+	{
 		return mBodyManager.GetMutexMask(inBodies, inNumber);
 	}
 

+ 5 - 5
Jolt/Physics/Body/BodyLockMulti.h

@@ -26,7 +26,7 @@ public:
 		if (mMutexMask != 0)
 		{
 			// Get mutex
-			if (Write) 
+			if (Write)
 				inBodyLockInterface.LockWrite(mMutexMask);
 			else
 				inBodyLockInterface.LockRead(mMutexMask);
@@ -68,13 +68,13 @@ private:
 };
 
 /// A multi body lock takes a number of body IDs and locks the underlying bodies so that other threads cannot access its members
-/// 
+///
 /// The common usage pattern is:
-/// 
+///
 ///		BodyLockInterface lock_interface = physics_system.GetBodyLockInterface(); // Or non-locking interface if the lock is already taken
 ///		const BodyID *body_id = ...; // Obtain IDs to bodies
 ///		int num_body_ids = ...;
-///		
+///
 ///		// Scoped lock
 ///		{
 ///			BodyLockMultiRead lock(lock_interface, body_ids, num_body_ids);
@@ -84,7 +84,7 @@ private:
 ///				if (body != nullptr)
 ///				{
 ///					const Body &body = lock.Body();
-///		
+///
 ///					// Do something with body
 ///					...
 ///				}

+ 2 - 2
Jolt/Physics/Body/MassProperties.cpp

@@ -35,7 +35,7 @@ bool MassProperties::DecomposePrincipalMomentsOfInertia(Mat44 &outRotation, Vec3
 	// Sort so that the biggest value goes first
 	int indices[] = { 0, 1, 2 };
 	InsertionSort(indices, indices + 3, [&eigen_val](int inLeft, int inRight) { return eigen_val[inLeft] > eigen_val[inRight]; });
-		
+
 	// Convert to a regular Mat44 and Vec3
 	outRotation = Mat44::sIdentity();
 	for (int i = 0; i < 3; ++i)
@@ -146,7 +146,7 @@ void MassProperties::Scale(Vec3Arg inScale)
 	// Mass scales linear with volume (note that the scaling can be negative and we don't want the mass to become negative)
 	float mass_scale = abs(inScale.GetX() * inScale.GetY() * inScale.GetZ());
 	mMass *= mass_scale;
-	
+
 	// Inertia scales linear with mass. This updates the m_k terms above.
 	mInertia *= mass_scale;
 

+ 1 - 1
Jolt/Physics/Body/MassProperties.h

@@ -21,7 +21,7 @@ public:
 	/// @see https://en.wikipedia.org/wiki/Moment_of_inertia section 'Principal axes'
 	/// @param outRotation The rotation matrix R
 	/// @param outDiagonal The diagonal of the diagonal matrix D
-	/// @return True if successful, false if failed 
+	/// @return True if successful, false if failed
 	bool					DecomposePrincipalMomentsOfInertia(Mat44 &outRotation, Vec3 &outDiagonal) const;
 
 	/// Set the mass and inertia of a box with edge size inBoxSize and density inDensity

+ 2 - 2
Jolt/Physics/Body/MotionQuality.h

@@ -20,9 +20,9 @@ enum class EMotionQuality : uint8
 	/// and will not bounce off the surface until the next integration step). This will make the body appear
 	/// to go slower when it collides with high velocity. In order to not get stuck, the body is always
 	/// allowed to move by a fraction of it's inner radius, which may eventually lead it to pass through geometry.
-	/// 
+	///
 	/// Note that if you're using a collision listener, you can receive contact added/persisted notifications of contacts
-	/// that may in the end not happen. This happens between bodies that are using casting: If bodies A and B collide at t1 
+	/// that may in the end not happen. This happens between bodies that are using casting: If bodies A and B collide at t1
 	/// and B and C collide at t2 where t2 < t1 and A and C don't collide. In this case you may receive an incorrect contact
 	/// point added callback between A and B (which will be removed the next frame).
 	LinearCast,

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov