Browse Source

Sonar fixes (#125)

Jorrit Rouwe 3 years ago
parent
commit
c9796f6071
75 changed files with 144 additions and 150 deletions
  1. 2 3
      Jolt/AABBTree/AABBTreeToBuffer.h
  2. 3 3
      Jolt/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h
  3. 3 3
      Jolt/Core/Factory.cpp
  4. 1 1
      Jolt/Core/Factory.h
  5. 1 1
      Jolt/Core/IssueReporting.cpp
  6. 1 2
      Jolt/Core/JobSystem.h
  7. 1 1
      Jolt/Core/JobSystem.inl
  8. 4 6
      Jolt/Core/JobSystemThreadPool.cpp
  9. 3 2
      Jolt/Core/LockFreeHashMap.inl
  10. 4 4
      Jolt/Core/Reference.h
  11. 3 1
      Jolt/Core/TempAllocator.h
  12. 1 1
      Jolt/Geometry/ConvexHullBuilder.cpp
  13. 1 1
      Jolt/Geometry/ConvexHullBuilder.h
  14. 7 7
      Jolt/Geometry/EPAConvexHullBuilder.h
  15. 1 1
      Jolt/Geometry/EPAPenetrationDepth.h
  16. 2 2
      Jolt/Geometry/GJKClosestPoint.h
  17. 1 1
      Jolt/Geometry/Plane.h
  18. 2 2
      Jolt/Geometry/Sphere.h
  19. 1 1
      Jolt/Math/Matrix.h
  20. 1 2
      Jolt/ObjectStream/ObjectStreamBinaryIn.cpp
  21. 1 1
      Jolt/ObjectStream/ObjectStreamBinaryIn.h
  22. 1 2
      Jolt/ObjectStream/ObjectStreamBinaryOut.cpp
  23. 1 1
      Jolt/ObjectStream/ObjectStreamBinaryOut.h
  24. 1 2
      Jolt/ObjectStream/ObjectStreamOut.cpp
  25. 1 1
      Jolt/ObjectStream/ObjectStreamOut.h
  26. 2 2
      Jolt/ObjectStream/ObjectStreamTextIn.cpp
  27. 1 2
      Jolt/ObjectStream/ObjectStreamTextOut.cpp
  28. 1 1
      Jolt/ObjectStream/ObjectStreamTextOut.h
  29. 2 1
      Jolt/ObjectStream/SerializableAttributeEnum.h
  30. 1 1
      Jolt/ObjectStream/SerializableObject.h
  31. 1 1
      Jolt/Physics/Body/BodyLockMulti.h
  32. 1 1
      Jolt/Physics/Body/BodyManager.cpp
  33. 1 1
      Jolt/Physics/Body/MassProperties.cpp
  34. 1 1
      Jolt/Physics/Collision/BroadPhase/QuadTree.h
  35. 3 3
      Jolt/Physics/Collision/ContactListener.h
  36. 1 0
      Jolt/Physics/Collision/GroupFilter.cpp
  37. 1 0
      Jolt/Physics/Collision/PhysicsMaterial.cpp
  38. 2 2
      Jolt/Physics/Collision/Shape/CylinderShape.cpp
  39. 1 1
      Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h
  40. 2 2
      Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h
  41. 1 1
      Jolt/Physics/Collision/Shape/Shape.cpp
  42. 6 5
      Jolt/Physics/Collision/Shape/Shape.h
  43. 3 3
      Jolt/Physics/Collision/TransformedShape.h
  44. 2 2
      Jolt/Physics/Constraints/Constraint.h
  45. 2 2
      Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h
  46. 1 1
      Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h
  47. 3 3
      Jolt/Physics/Constraints/ConstraintPart/DualAxisConstraintPart.h
  48. 2 2
      Jolt/Physics/Constraints/ConstraintPart/HingeRotationConstraintPart.h
  49. 2 2
      Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h
  50. 2 2
      Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h
  51. 2 2
      Jolt/Physics/Constraints/ConstraintPart/RotationQuatConstraintPart.h
  52. 1 1
      Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h
  53. 3 3
      Jolt/Physics/Constraints/SliderConstraint.cpp
  54. 1 1
      Jolt/Physics/Constraints/SliderConstraint.h
  55. 1 1
      Jolt/Physics/IslandBuilder.cpp
  56. 2 2
      Jolt/Physics/IslandBuilder.h
  57. 2 2
      Jolt/Physics/PhysicsLock.h
  58. 3 3
      Jolt/Physics/PhysicsSystem.cpp
  59. 2 2
      Jolt/Physics/PhysicsSystem.h
  60. 1 1
      Jolt/Physics/Ragdoll/Ragdoll.cpp
  61. 2 2
      Jolt/Physics/Ragdoll/Ragdoll.h
  62. 1 1
      Jolt/Physics/Vehicle/TrackedVehicleController.cpp
  63. 1 1
      Jolt/Physics/Vehicle/VehicleConstraint.cpp
  64. 1 1
      Jolt/Physics/Vehicle/WheeledVehicleController.cpp
  65. 0 5
      Jolt/Skeleton/SkeletalAnimation.cpp
  66. 1 1
      Jolt/Skeleton/SkeletalAnimation.h
  67. 1 1
      Jolt/Skeleton/SkeletonPose.cpp
  68. 2 2
      Jolt/TriangleGrouper/TriangleGrouperClosestCentroid.cpp
  69. 1 1
      Jolt/TriangleGrouper/TriangleGrouperMorton.cpp
  70. 1 1
      Jolt/TriangleSplitter/TriangleSplitterBinning.cpp
  71. 1 1
      Jolt/TriangleSplitter/TriangleSplitterFixedLeafSize.cpp
  72. 1 1
      Jolt/TriangleSplitter/TriangleSplitterMorton.cpp
  73. 7 7
      Samples/Tests/ConvexCollision/RandomRayTest.cpp
  74. 1 1
      Samples/Tests/Rig/PoweredRigTest.cpp
  75. 12 12
      UnitTests/Geometry/GJKTests.cpp

+ 2 - 3
Jolt/AABBTree/AABBTreeToBuffer.h

@@ -77,8 +77,7 @@ public:
 		// Estimate the amount of memory required
 		uint tri_count = inRoot->GetTriangleCountInTree();
 		uint node_count = inRoot->GetNodeCount();
-		uint leaf_node_count = inRoot->GetLeafNodeCount();
-		uint nodes_size = node_ctx.GetPessimisticMemoryEstimate(node_count, leaf_node_count);
+		uint nodes_size = node_ctx.GetPessimisticMemoryEstimate(node_count);
 		uint total_size = HeaderSize + TriangleHeaderSize + nodes_size + tri_ctx.GetPessimisticMemoryEstimate(tri_count);
 		mTree.reserve(total_size);
 
@@ -242,7 +241,7 @@ public:
 		
 		// Finalize all nodes
 		for (NodeData &n : node_list)
-			if (!node_ctx.NodeFinalize(n.mNode, n.mNodeStart, n.mTriangleStart, n.mNumChildren, n.mChildNodeStart, n.mChildTrianglesStart, mTree, outError))
+			if (!node_ctx.NodeFinalize(n.mNode, n.mNodeStart, n.mNumChildren, n.mChildNodeStart, n.mChildTrianglesStart, mTree, outError))
 				return false;
 		
 		// Finalize the triangles

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

@@ -60,8 +60,8 @@ public:
 	class EncodingContext
 	{
 	public:
-		/// Get an upper bound on the amount of bytes needed for a node tree with inNodeCount nodes and inLeafNodeCount leaf nodes (those that contain the triangles)
-		uint							GetPessimisticMemoryEstimate(uint inNodeCount, uint inLeafNodeCount) const
+		/// Get an upper bound on the amount of bytes needed for a node tree with inNodeCount nodes
+		uint							GetPessimisticMemoryEstimate(uint inNodeCount) const
 		{
 			return inNodeCount * (sizeof(Node) + Alignment - 1);
 		}
@@ -132,7 +132,7 @@ public:
 		}
 
 		/// Once all nodes have been added, this call finalizes all nodes by patching in the offsets of the child nodes (that were added after the node itself was added)
-		bool						NodeFinalize(const AABBTreeBuilder::Node *inNode, uint inNodeStart, uint inTrianglesStart, uint inNumChildren, const uint *inChildrenNodeStart, const uint *inChildrenTrianglesStart, ByteBuffer &ioBuffer, string &outError) const
+		bool						NodeFinalize(const AABBTreeBuilder::Node *inNode, uint inNodeStart, uint inNumChildren, const uint *inChildrenNodeStart, const uint *inChildrenTrianglesStart, ByteBuffer &ioBuffer, string &outError) const
 		{
 			if (!inNode->HasChildren())
 				return true;

+ 3 - 3
Jolt/Core/Factory.cpp

@@ -60,12 +60,12 @@ bool Factory::Register(const RTTI *inRTTI)
 	return true;
 }
 
-vector<const RTTI *> Factory::GetAllClasses()
+vector<const RTTI *> Factory::GetAllClasses() const
 {
 	vector<const RTTI *> all_classes;
 	all_classes.reserve(mClassNameMap.size());
-	for (ClassNameMap::iterator c = mClassNameMap.begin(); c != mClassNameMap.end(); ++c)
-		all_classes.push_back(c->second);
+	for (const ClassNameMap::value_type &c : mClassNameMap)
+		all_classes.push_back(c.second);
 	return all_classes;
 }
 

+ 1 - 1
Jolt/Core/Factory.h

@@ -28,7 +28,7 @@ public:
 	bool						Register(const RTTI *inRTTI);
 
 	/// Get all registered classes
-	vector<const RTTI *>		GetAllClasses();
+	vector<const RTTI *>		GetAllClasses() const;
 
 	/// Singleton factory instance
 	static Factory 				sInstance;

+ 1 - 1
Jolt/Core/IssueReporting.cpp

@@ -9,7 +9,7 @@ JPH_SUPPRESS_WARNINGS_STD_END
 
 JPH_NAMESPACE_BEGIN
 
-static void DummyTrace(const char *inFMT, ...) 
+static void DummyTrace([[maybe_unused]] const char *inFMT, ...) 
 { 
 	JPH_ASSERT(false); 
 };

+ 1 - 2
Jolt/Core/JobSystem.h

@@ -149,7 +149,6 @@ protected:
 		#endif // defined(JPH_EXTERNAL_PROFILE) || defined(JPH_PROFILE_ENABLED)
 			mJobSystem(inJobSystem), 
 			mJobFunction(inJobFunction), 
-			mReferenceCount(0), 
 			mNumDependencies(inNumDependencies) 
 		{ 
 		}
@@ -237,7 +236,7 @@ private:
 		JobSystem *			mJobSystem;									///< The job system we belong to
 		atomic<intptr_t>	mBarrier = 0;								///< Barrier that this job is associated with (is a Barrier pointer)
 		JobFunction			mJobFunction;								///< Main job function
-		atomic<uint32>		mReferenceCount;							///< Amount of JobHandles pointing to this job
+		atomic<uint32>		mReferenceCount = 0;						///< Amount of JobHandles pointing to this job
 		atomic<uint32>		mNumDependencies;							///< Amount of jobs that need to complete before this job can run
 	};
 

+ 1 - 1
Jolt/Core/JobSystem.inl

@@ -38,7 +38,7 @@ void JobSystem::JobHandle::sRemoveDependencies(JobHandle *inHandles, uint inNumH
 	Job **next_job = jobs_to_queue;
 
 	// Remove the dependencies on all jobs
-	for (JobHandle *handle = inHandles, *handle_end = inHandles + inNumHandles; handle < handle_end; ++handle)
+	for (const JobHandle *handle = inHandles, *handle_end = inHandles + inNumHandles; handle < handle_end; ++handle)
 	{
 		Job *job = handle->GetPtr();
 		JPH_ASSERT(job->GetJobSystem() == job_system); // All jobs should belong to the same job system

+ 4 - 6
Jolt/Core/JobSystemThreadPool.cpp

@@ -196,7 +196,7 @@ void JobSystemThreadPool::BarrierImpl::Wait()
 				// Loop through the jobs and execute the first executable job
 				for (uint index = mJobReadIndex; index < mJobWriteIndex; ++index)
 				{
-					atomic<Job *> &job = mJobs[index & (cMaxJobs - 1)];
+					const atomic<Job *> &job = mJobs[index & (cMaxJobs - 1)];
 					Job *job_ptr = job.load();
 					if (job_ptr != nullptr && job_ptr->CanBeExecuted())
 					{
@@ -228,15 +228,13 @@ void JobSystemThreadPool::BarrierImpl::Wait()
 	}
 }
 
-JobSystemThreadPool::JobSystemThreadPool(uint inMaxJobs, uint inMaxBarriers, int inNumThreads)	
+JobSystemThreadPool::JobSystemThreadPool(uint inMaxJobs, uint inMaxBarriers, int inNumThreads) :
+	mMaxBarriers(inMaxBarriers),
+	mBarriers(new BarrierImpl [inMaxBarriers]) // Init freelist of barriers
 {
 	// Init freelist of jobs
 	mJobs.Init(inMaxJobs, inMaxJobs);
 
-	// Init freelist of barriers
-	mMaxBarriers = inMaxBarriers;
-	mBarriers = new BarrierImpl [inMaxBarriers];
-
 	// Init queue
 	for (atomic<Job *> &j : mQueue)
 		j = nullptr;

+ 3 - 2
Jolt/Core/LockFreeHashMap.inl

@@ -128,7 +128,8 @@ void LockFreeHashMap<Key, Value>::Clear()
 	// Reset buckets 4 at a time
 	static_assert(sizeof(atomic<uint32>) == sizeof(uint32));
 	UVec4 invalid_handle = UVec4::sReplicate(cInvalidHandle);
-	uint32 *start = reinterpret_cast<uint32 *>(mBuckets), *end = start + mNumBuckets;
+	uint32 *start = reinterpret_cast<uint32 *>(mBuckets);
+	const uint32 *end = start + mNumBuckets;
 	JPH_ASSERT(IsAligned(start, 16));
 	while (start < end)
 	{
@@ -224,7 +225,7 @@ inline const typename LockFreeHashMap<Key, Value>::KeyValue *LockFreeHashMap<Key
 template <class Key, class Value>
 inline void LockFreeHashMap<Key, Value>::GetAllKeyValues(vector<const KeyValue *> &outAll) const
 {
-	for (atomic<uint32> *bucket = mBuckets; bucket < mBuckets + mNumBuckets; ++bucket)
+	for (const atomic<uint32> *bucket = mBuckets; bucket < mBuckets + mNumBuckets; ++bucket)
 	{
 		uint32 offset = *bucket;
 		while (offset != cInvalidHandle)

+ 4 - 4
Jolt/Core/Reference.h

@@ -36,8 +36,8 @@ class RefTarget
 {	
 public:
 	/// Constructor
-	inline					RefTarget()										: mRefCount(0) { }
-	inline					RefTarget(const RefTarget &)					: mRefCount(0) { }
+	inline					RefTarget() = default;
+	inline					RefTarget(const RefTarget &)					{ /* Do not copy refcount */ }
 	inline					~RefTarget()									{ JPH_ASSERT(mRefCount == 0 || mRefCount == cEmbedded); } ///< assert no one is referencing us
 
 	/// Mark this class as embedded, this means the type can be used in a compound or constructed on the stack.
@@ -46,7 +46,7 @@ public:
 	inline void				SetEmbedded()									{ JPH_ASSERT(mRefCount < cEmbedded); mRefCount += cEmbedded; }
 
 	/// Assignment operator
-	inline RefTarget &		operator = (const RefTarget &inRHS)				{ return *this; }
+	inline RefTarget &		operator = (const RefTarget &)					{ /* Don't copy refcount */ return *this; }
 
 	/// Get current refcount of this object
 	uint32					GetRefCount() const								{ return mRefCount; }
@@ -64,7 +64,7 @@ public:
 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;										///< Current reference count
+	mutable atomic<uint32>	mRefCount = 0;									///< Current reference count
 };							
 
 /// Pure virtual version of RefTarget

+ 3 - 1
Jolt/Core/TempAllocator.h

@@ -3,13 +3,15 @@
 
 #pragma once
 
+#include <Jolt/Core/NonCopyable.h>
+
 JPH_NAMESPACE_BEGIN
 
 /// 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.
-class TempAllocator
+class TempAllocator : public NonCopyable
 {
 public:
 	/// Destructor

+ 1 - 1
Jolt/Geometry/ConvexHullBuilder.cpp

@@ -657,7 +657,7 @@ void ConvexHullBuilder::sUnlinkFace(Face *inFace)
 	} while (e != inFace->mFirstEdge);
 }
 
-void ConvexHullBuilder::FindEdge(Face *inFacingFace, Vec3Arg inVertex, FullEdges &outEdges)
+void ConvexHullBuilder::FindEdge(Face *inFacingFace, Vec3Arg inVertex, FullEdges &outEdges) const
 {
 	// Assert that we were given an empty array
 	JPH_ASSERT(outEdges.empty());

+ 1 - 1
Jolt/Geometry/ConvexHullBuilder.h

@@ -175,7 +175,7 @@ private:
 
 	/// Given one face that faces inVertex, find the edges of the faces that are not facing inVertex.
 	/// Will flag all those faces for removal.
-	void				FindEdge(Face *inFacingFace, Vec3Arg inVertex, FullEdges &outEdges);
+	void				FindEdge(Face *inFacingFace, Vec3Arg inVertex, FullEdges &outEdges) const;
 
 	/// Merges the two faces that share inEdge into the face inEdge->mFace
 	void				MergeFaces(Edge *inEdge);

+ 7 - 7
Jolt/Geometry/EPAConvexHullBuilder.h

@@ -239,9 +239,9 @@ public:
 		Triangle *t2 = CreateTriangle(inIdx1, inIdx3, inIdx2);
 
 		// Link triangles edges
-		LinkTriangle(t1, 0, t2, 2);
-		LinkTriangle(t1, 1, t2, 1);
-		LinkTriangle(t1, 2, t2, 0);
+		sLinkTriangle(t1, 0, t2, 2);
+		sLinkTriangle(t1, 1, t2, 1);
+		sLinkTriangle(t1, 2, t2, 0);
 
 		// Always add both triangles to the priority queue
 		mTriangleQueue.push_back(t1);
@@ -257,7 +257,7 @@ public:
 	}
 
 	/// Check if there's another triangle to process from the queue
-	bool				HasNextTriangle()
+	bool				HasNextTriangle() const
 	{
 		return !mTriangleQueue.empty();
 	}
@@ -340,8 +340,8 @@ public:
 		// Link edges
 		for (int i = 0; i < num_edges; ++i)
 		{
-			LinkTriangle(outTriangles[i], 0, edges[i].mNeighbourTriangle, edges[i].mNeighbourEdge);
-			LinkTriangle(outTriangles[i], 1, outTriangles[(i + 1) % num_edges], 2);
+			sLinkTriangle(outTriangles[i], 0, edges[i].mNeighbourTriangle, edges[i].mNeighbourEdge);
+			sLinkTriangle(outTriangles[i], 1, outTriangles[(i + 1) % num_edges], 2);
 		}
 
 #ifdef JPH_EPA_CONVEX_BUILDER_VALIDATE
@@ -403,7 +403,7 @@ private:
 	}
 
 	/// Link triangle edge to other triangle edge
-	void				LinkTriangle(Triangle *inT1, int inEdge1, Triangle *inT2, int inEdge2)
+	static void			sLinkTriangle(Triangle *inT1, int inEdge1, Triangle *inT2, int inEdge2)
 	{
 		JPH_ASSERT(inEdge1 >= 0 && inEdge1 < 3);
 		JPH_ASSERT(inEdge2 >= 0 && inEdge2 < 3);

+ 1 - 1
Jolt/Geometry/EPAPenetrationDepth.h

@@ -332,7 +332,7 @@ public:
 
 			// If the hull is starting to form defects then we're reaching numerical precision and we have to stop
 			bool has_defect = false;
-			for (Triangle *nt : new_triangles)
+			for (const Triangle *nt : new_triangles)
 				if (nt->IsFacingOrigin())
 				{
 					has_defect = true;

+ 2 - 2
Jolt/Geometry/GJKClosestPoint.h

@@ -154,7 +154,7 @@ private:
 	}
 
 	// Calculate closest points on A and B
-	void		CalculatePointAAndB(Vec3 &outPointA, Vec3 &outPointB)
+	void		CalculatePointAAndB(Vec3 &outPointA, Vec3 &outPointB) const
 	{
 		switch (mNumPoints)		
 		{
@@ -489,7 +489,7 @@ public:
 
 	/// Get the resulting simplex after the GetClosestPoints algorithm finishes.
 	/// If it returned a squared distance of 0, the origin will be contained in the simplex.
-	void		GetClosestPointsSimplex(Vec3 *outY, Vec3 *outP, Vec3 *outQ, uint &outNumPoints)
+	void		GetClosestPointsSimplex(Vec3 *outY, Vec3 *outP, Vec3 *outQ, uint &outNumPoints) const
 	{
 		uint size = sizeof(Vec3) * mNumPoints;
 		memcpy(outY, mY, size);

+ 1 - 1
Jolt/Geometry/Plane.h

@@ -21,7 +21,7 @@ public:
 	static Plane	sFromPointsCCW(Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3)				{ return sFromPointAndNormal(inV1, (inV2 - inV1).Cross(inV3 - inV1).Normalized()); }
 
 	// Properties
-	const Vec3		GetNormal() const														{ return Vec3(mNormalAndConstant); }
+	Vec3			GetNormal() const														{ return Vec3(mNormalAndConstant); }
 	void			SetNormal(Vec3Arg inNormal)												{ mNormalAndConstant = Vec4(inNormal, mNormalAndConstant.GetW()); }
 	float			GetConstant() const														{ return mNormalAndConstant.GetW(); }
 	void			SetConstant(float inConstant)											{ mNormalAndConstant.SetW(inConstant); }

+ 2 - 2
Jolt/Geometry/Sphere.h

@@ -16,14 +16,14 @@ public:
 	inline				Sphere(Vec3Arg inCenter, float inRadius)				: mRadius(inRadius) { inCenter.StoreFloat3(&mCenter); }
 
 	/// Calculate the support vector for this convex shape.
-	inline const Vec3	GetSupport(Vec3Arg inDirection) const
+	inline Vec3			GetSupport(Vec3Arg inDirection) const
 	{
 		float length = inDirection.Length();
 		return length > 0.0f ? Vec3::sLoadFloat3Unsafe(mCenter) + (mRadius/ length) * inDirection : Vec3::sLoadFloat3Unsafe(mCenter);
 	}
 
 	// Properties
-	inline const Vec3 	GetCenter() const										{ return Vec3::sLoadFloat3Unsafe(mCenter); }
+	inline Vec3 		GetCenter() const										{ return Vec3::sLoadFloat3Unsafe(mCenter); }
 	inline float		GetRadius() const										{ return mRadius; }
 
 	/// Test if two spheres overlap

+ 1 - 1
Jolt/Math/Matrix.h

@@ -140,7 +140,7 @@ public:
 	}
 
 	/// Multiply vector by matrix
-	inline const Vector<Rows>				operator * (const Vector<Cols> &inV) const
+	inline Vector<Rows>						operator * (const Vector<Cols> &inV) const
 	{
 		Vector<Rows> v;
 		for (uint r = 0; r < Rows; ++r)

+ 1 - 2
Jolt/ObjectStream/ObjectStreamBinaryIn.cpp

@@ -8,8 +8,7 @@
 JPH_NAMESPACE_BEGIN
 
 ObjectStreamBinaryIn::ObjectStreamBinaryIn(istream &inStream) :
-	ObjectStreamIn(inStream),
-	mNextStringID(0x80000000)
+	ObjectStreamIn(inStream)
 {
 }
 

+ 1 - 1
Jolt/ObjectStream/ObjectStreamBinaryIn.h

@@ -38,7 +38,7 @@ private:
 	using StringTable = unordered_map<uint32, string>;
 
 	StringTable					mStringTable;
-	uint32						mNextStringID;
+	uint32						mNextStringID = 0x80000000;
 };
 
 JPH_NAMESPACE_END

+ 1 - 2
Jolt/ObjectStream/ObjectStreamBinaryOut.cpp

@@ -9,8 +9,7 @@
 JPH_NAMESPACE_BEGIN
 
 ObjectStreamBinaryOut::ObjectStreamBinaryOut(ostream &inStream) :
-	ObjectStreamOut(inStream),
-	mNextStringID(0x80000000)
+	ObjectStreamOut(inStream)
 {
 	string header;
 	header = StringFormat("BOS%2d.%02d", ObjectStream::sVersion, ObjectStream::sRevision);

+ 1 - 1
Jolt/ObjectStream/ObjectStreamBinaryOut.h

@@ -38,7 +38,7 @@ private:
 	using StringTable = unordered_map<string, uint32>;
 
 	StringTable					mStringTable;
-	uint32						mNextStringID;
+	uint32						mNextStringID = 0x80000000;
 };
 
 JPH_NAMESPACE_END

+ 1 - 2
Jolt/ObjectStream/ObjectStreamOut.cpp

@@ -12,8 +12,7 @@
 JPH_NAMESPACE_BEGIN
 
 ObjectStreamOut::ObjectStreamOut(ostream &inStream) :
-	mStream(inStream),
-	mNextIdentifier(sNullIdentifier + 1)
+	mStream(inStream)
 {
 // Add all primitives to the class set
 #define JPH_DECLARE_PRIMITIVE(name)	mClassSet.insert(JPH_RTTI(name));

+ 1 - 1
Jolt/ObjectStream/ObjectStreamOut.h

@@ -112,7 +112,7 @@ private:
 	using ObjectQueue = queue<const void *>;
 	using ClassQueue = queue<const RTTI *>;
 
-	Identifier					mNextIdentifier;											///< Next free identifier for this stream
+	Identifier					mNextIdentifier = sNullIdentifier + 1;						///< Next free identifier for this stream
 	IdentifierMap				mIdentifierMap;												///< Links object pointer to an identifier
 	ObjectQueue					mObjectQueue;												///< Queue of objects to be written
 	ClassSet					mClassSet;													///< List of classes already written

+ 2 - 2
Jolt/ObjectStream/ObjectStreamTextIn.cpp

@@ -17,7 +17,7 @@ bool ObjectStreamTextIn::ReadDataType(EDataType &outType)
 	string token;
 	if (ReadWord(token)) 
 	{
-		transform(token.begin(), token.end(), token.begin(), [](char inValue) -> char { return (char)tolower(inValue); });
+		transform(token.begin(), token.end(), token.begin(), [](char inValue) { return (char)tolower(inValue); });
 		if (token == "declare")
 			outType = EDataType::Declare;
 		else if (token == "object")
@@ -165,7 +165,7 @@ bool ObjectStreamTextIn::ReadPrimitiveData(bool &outPrimitive)
 	string token;
 	if (!ReadWord(token))
 		return false;
-	transform(token.begin(), token.end(), token.begin(), [](char inValue) -> char { return (char)tolower(inValue); });
+	transform(token.begin(), token.end(), token.begin(), [](char inValue) { return (char)tolower(inValue); });
 	outPrimitive = token == "true";
 	return outPrimitive || token == "false";
 }

+ 1 - 2
Jolt/ObjectStream/ObjectStreamTextOut.cpp

@@ -9,8 +9,7 @@
 JPH_NAMESPACE_BEGIN
 
 ObjectStreamTextOut::ObjectStreamTextOut(ostream &inStream) :
-	ObjectStreamOut(inStream),
-	mIndentation(0)
+	ObjectStreamOut(inStream)
 {
 	WriteWord(StringFormat("TOS%2d.%02d", ObjectStream::sVersion, ObjectStream::sRevision));
 }

+ 1 - 1
Jolt/ObjectStream/ObjectStreamTextOut.h

@@ -43,7 +43,7 @@ private:
 	void						WriteChar(char inChar);
 	void						WriteWord(const string &inWord);
 
-	int							mIndentation;
+	int							mIndentation = 0;
 };
 
 JPH_NAMESPACE_END

+ 2 - 1
Jolt/ObjectStream/SerializableAttributeEnum.h

@@ -51,7 +51,8 @@ public:
 	}
 
 	virtual void				VisitCompounds(const void *inObject, const CompoundVisitor &inVisitor) const override
-	{		
+	{
+		// An enum is not a compound, do nothing
 	}
 
 private:

+ 1 - 1
Jolt/ObjectStream/SerializableObject.h

@@ -215,7 +215,7 @@ public:
 
 	/// Callback given when object has been loaded from an object stream
 	/// This is called when all links have been resolved. Objects that this object point to have already received their OnLoaded callback.
-	virtual void				OnLoaded()																			{ }
+	virtual void				OnLoaded()																			{ /* Do nothing */ }
 };
 
 JPH_NAMESPACE_END

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

@@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN
 
 /// Base class for locking multiple bodies for the duration of the scope of this class (do not use directly)
 template <bool Write, class BodyType>
-class BodyLockMultiBase
+class BodyLockMultiBase : public NonCopyable
 {
 public:
 	/// Redefine MutexMask

+ 1 - 1
Jolt/Physics/Body/BodyManager.cpp

@@ -533,7 +533,7 @@ bool BodyManager::RestoreState(StateRecorder &inStream)
 		UniqueLock lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
 
 		// Mark current active bodies as deactivated
-		for (BodyID *id = mActiveBodies, *id_end = mActiveBodies + mNumActiveBodies; id < id_end; ++id)
+		for (const BodyID *id = mActiveBodies, *id_end = mActiveBodies + mNumActiveBodies; id < id_end; ++id)
 			mBodies[id->GetIndex()]->mMotionProperties->mIndexInActiveBodies = Body::cInactiveIndex;
 
 		sort(mActiveBodies, mActiveBodies + mNumActiveBodies); // Sort for validation

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

@@ -32,7 +32,7 @@ bool MassProperties::DecomposePrincipalMomentsOfInertia(Mat44 &outRotation, Vec3
 
 	// Sort so that the biggest value goes first
 	int indices[] = { 0, 1, 2 };
-	sort(indices, indices + 3, [&eigen_val](int inLeft, int inRight) -> bool { return eigen_val[inLeft] > eigen_val[inRight]; });
+	sort(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();

+ 1 - 1
Jolt/Physics/Collision/BroadPhase/QuadTree.h

@@ -75,7 +75,7 @@ private:
 		inline void				operator = (const NodeID &inRHS)			{ mID = inRHS.mID; }
 
 		/// Getting the value
-		inline					operator const NodeID () const				{ return NodeID(mID); }
+		inline					operator NodeID () const					{ return NodeID(mID); }
 
 		/// Check if the ID is valid
 		inline bool				IsValid() const								{ return mID != cInvalidNodeIndex; }

+ 3 - 3
Jolt/Physics/Collision/ContactListener.h

@@ -69,18 +69,18 @@ public:
 	/// Called whenever a new contact point is detected.
 	/// Note that this callback is called when all bodies are locked, so don't use any locking functions!
 	/// Body 1 and 2 will be sorted such that body 1 ID < body 2 ID, so body 1 may not be dynamic
-	virtual void			OnContactAdded(const Body &inBody1, const Body &inBody2, const ContactManifold &inManifold, ContactSettings &ioSettings) { }
+	virtual void			OnContactAdded(const Body &inBody1, const Body &inBody2, const ContactManifold &inManifold, ContactSettings &ioSettings) { /* Do nothing */ }
 
 	/// Called whenever a contact is detected that was also detected last update.
 	/// Note that this callback is called when all bodies are locked, so don't use any locking functions!
 	/// Body 1 and 2 will be sorted such that body 1 ID < body 2 ID, so body 1 may not be dynamic
-	virtual void			OnContactPersisted(const Body &inBody1, const Body &inBody2, const ContactManifold &inManifold, ContactSettings &ioSettings) { }
+	virtual void			OnContactPersisted(const Body &inBody1, const Body &inBody2, const ContactManifold &inManifold, ContactSettings &ioSettings) { /* Do nothing */ }
 
 	/// Called whenever a contact was detected last update but is not detected anymore.
 	/// Note that this callback is called when all bodies are locked, so don't use any locking functions!
 	/// Note that we're using BodyID's since the bodies may have been removed at the time of callback.
 	/// Body 1 and 2 will be sorted such that body 1 ID < body 2 ID, so body 1 may not be dynamic
-	virtual void			OnContactRemoved(const SubShapeIDPair &inSubShapePair) { }
+	virtual void			OnContactRemoved(const SubShapeIDPair &inSubShapePair) { /* Do nothing */ }
 };
 
 JPH_NAMESPACE_END

+ 1 - 0
Jolt/Physics/Collision/GroupFilter.cpp

@@ -22,6 +22,7 @@ void GroupFilter::SaveBinaryState(StreamOut &inStream) const
 
 void GroupFilter::RestoreBinaryState(StreamIn &inStream)
 {
+	// RTTI hash is read in sRestoreFromBinaryState
 }
 
 GroupFilter::GroupFilterResult GroupFilter::sRestoreFromBinaryState(StreamIn &inStream)

+ 1 - 0
Jolt/Physics/Collision/PhysicsMaterial.cpp

@@ -25,6 +25,7 @@ void PhysicsMaterial::SaveBinaryState(StreamOut &inStream) const
 
 void PhysicsMaterial::RestoreBinaryState(StreamIn &inStream)
 {
+	// RTTI hash is read in sRestoreFromBinaryState
 }
 
 PhysicsMaterial::PhysicsMaterialResult PhysicsMaterial::sRestoreFromBinaryState(StreamIn &inStream)

+ 2 - 2
Jolt/Physics/Collision/Shape/CylinderShape.cpp

@@ -213,8 +213,8 @@ void CylinderShape::GetSupportingFace(Vec3Arg inDirection, Vec3Arg inScale, Supp
 	{
 		// Hitting top or bottom
 		Vec3 multiplier = y < 0.0f? Vec3(scaled_radius, scaled_half_height, scaled_radius) : Vec3(-scaled_radius, -scaled_half_height, scaled_radius);
-		for (int i = 0; i < 8; ++i)
-			outVertices.push_back(multiplier * cTopFace[i]);
+		for (const Vec3 &v : cTopFace)
+			outVertices.push_back(multiplier * v);
 	}
 }
 

+ 1 - 1
Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h

@@ -39,7 +39,7 @@ public:
 									OffsetCenterOfMassShape(const OffsetCenterOfMassShapeSettings &inSettings, ShapeResult &outResult);
 
 	/// Access the offset that is applied to the center of mass
-	const Vec3						GetOffset() const										{ return mOffset; }
+	Vec3							GetOffset() const										{ return mOffset; }
 
 	// See Shape::GetCenterOfMass
 	virtual Vec3					GetCenterOfMass() const override						{ return mInnerShape->GetCenterOfMass() + mOffset; }

+ 2 - 2
Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h

@@ -42,10 +42,10 @@ public:
 									RotatedTranslatedShape(const RotatedTranslatedShapeSettings &inSettings, ShapeResult &outResult);
 
 	/// Access the rotation that is applied to the inner shape
-	const Quat						GetRotation() const										{ return mRotation; }
+	Quat							GetRotation() const										{ return mRotation; }
 
 	/// Access the translation that has been applied to the inner shape
-	const Vec3						GetPosition() const										{ return mCenterOfMass - mRotation.InverseRotate(mInnerShape->GetCenterOfMass()); }
+	Vec3							GetPosition() const										{ return mCenterOfMass - mRotation.InverseRotate(mInnerShape->GetCenterOfMass()); }
 
 	// See Shape::GetCenterOfMass
 	virtual Vec3					GetCenterOfMass() const override						{ return mCenterOfMass; }

+ 1 - 1
Jolt/Physics/Collision/Shape/Shape.cpp

@@ -306,7 +306,7 @@ Shape::ShapeResult Shape::ScaleShape(Vec3Arg inScale) const
 	// Construct a compound shape
 	StaticCompoundShapeSettings compound;
 	compound.mSubShapes.reserve(collector.mShapes.size());
-	for (TransformedShape &ts : collector.mShapes)
+	for (const TransformedShape &ts : collector.mShapes)
 	{
 		const Shape *shape = ts.mShape;
 

+ 6 - 5
Jolt/Physics/Collision/Shape/Shape.h

@@ -10,6 +10,7 @@
 #include <Jolt/Core/Reference.h>
 #include <Jolt/Core/Color.h>
 #include <Jolt/Core/Result.h>
+#include <Jolt/Core/NonCopyable.h>
 #include <Jolt/ObjectStream/SerializableObject.h>
 
 JPH_NAMESPACE_BEGIN
@@ -152,7 +153,7 @@ private:
 };
 
 /// Base class for all shapes (collision volume of a body). Defines a virtual interface for collision detection.
-class Shape : public RefTarget<Shape>
+class Shape : public RefTarget<Shape>, public NonCopyable
 {
 public:
 	using ShapeResult = ShapeSettings::ShapeResult;
@@ -229,10 +230,10 @@ public:
 	virtual void					Draw(DebugRenderer *inRenderer, Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, ColorArg inColor, bool inUseMaterialColors, bool inDrawWireframe) const = 0;
 
 	/// Draw the results of the GetSupportFunction with the convex radius added back on to show any errors introduced by this process (only relevant for convex shapes)
-	virtual void					DrawGetSupportFunction(DebugRenderer *inRenderer, Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, ColorArg inColor, bool inDrawSupportDirection) const { }
+	virtual void					DrawGetSupportFunction(DebugRenderer *inRenderer, Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, ColorArg inColor, bool inDrawSupportDirection) const { /* Only implemented for convex shapes */ }
 
 	/// Draw the results of the GetSupportingFace function to show any errors introduced by this process (only relevant for convex shapes)
-	virtual void					DrawGetSupportingFace(DebugRenderer *inRenderer, Mat44Arg inCenterOfMassTransform, Vec3Arg inScale) const { }
+	virtual void					DrawGetSupportingFace(DebugRenderer *inRenderer, Mat44Arg inCenterOfMassTransform, Vec3Arg inScale) const { /* Only implemented for convex shapes */ }
 #endif // JPH_DEBUG_RENDERER
 
 	/// Cast a ray against this shape, returns true if it finds a hit closer than ioHit.mFraction and updates that fraction. Otherwise ioHit is left untouched and the function returns false.
@@ -301,13 +302,13 @@ public:
 	static ShapeResult				sRestoreFromBinaryState(StreamIn &inStream);
 
 	/// Outputs the material references that this shape has to outMaterials.
-	virtual void					SaveMaterialState(PhysicsMaterialList &outMaterials) const			{ }
+	virtual void					SaveMaterialState(PhysicsMaterialList &outMaterials) const			{ /* By default do nothing */ }
 
 	/// Restore the material references after calling sRestoreFromBinaryState. Note that the exact same materials need to be provided in the same order as returned by SaveMaterialState.
 	virtual void					RestoreMaterialState(const PhysicsMaterialRefC *inMaterials, uint inNumMaterials) { JPH_ASSERT(inNumMaterials == 0); }
 
 	/// Outputs the shape references that this shape has to outSubShapes.
-	virtual void					SaveSubShapeState(ShapeList &outSubShapes) const					{ }
+	virtual void					SaveSubShapeState(ShapeList &outSubShapes) const					{ /* By default do nothing */ }
 
 	/// Restore the shape references after calling sRestoreFromBinaryState. Note that the exact same shapes need to be provided in the same order as returned by SaveSubShapeState.
 	virtual void					RestoreSubShapeState(const ShapeRefC *inSubShapes, uint inNumShapes) { JPH_ASSERT(inNumShapes == 0); }

+ 3 - 3
Jolt/Physics/Collision/TransformedShape.h

@@ -73,10 +73,10 @@ public:
 	inline void					SetShapeScale(Vec3Arg inScale)				{ inScale.StoreFloat3(&mShapeScale); }
 
 	/// Calculates the transform for this shapes's center of mass (excluding scale)
-	inline const Mat44			GetCenterOfMassTransform() const			{ return Mat44::sRotationTranslation(mShapeRotation, mShapePositionCOM); }
+	inline Mat44				GetCenterOfMassTransform() const			{ return Mat44::sRotationTranslation(mShapeRotation, mShapePositionCOM); }
 
 	/// Calculates the inverse of the transform for this shape's center of mass (excluding scale)
-	inline const Mat44			GetInverseCenterOfMassTransform() const		{ return Mat44::sInverseRotationTranslation(mShapeRotation, mShapePositionCOM); }
+	inline Mat44				GetInverseCenterOfMassTransform() const		{ return Mat44::sInverseRotationTranslation(mShapeRotation, mShapePositionCOM); }
 
 	/// Sets the world transform (including scale) of this transformed shape (not from the center of mass but in the space the shape was created)
 	inline void					SetWorldTransform(Vec3Arg inPosition, QuatArg inRotation, Vec3Arg inScale)
@@ -95,7 +95,7 @@ public:
 	}
 
 	/// Calculates the world transform including scale of this shape (not from the center of mass but in the space the shape was created)
-	inline const Mat44			GetWorldTransform() const					
+	inline Mat44				GetWorldTransform() const					
 	{	
 		Mat44 transform = Mat44::sRotation(mShapeRotation) * Mat44::sScale(GetShapeScale());
 		transform.SetTranslation(mShapePositionCOM - transform.Multiply3x3(mShape->GetCenterOfMass()));

+ 2 - 2
Jolt/Physics/Constraints/Constraint.h

@@ -48,7 +48,7 @@ enum class EConstraintSpace
 };
 
 /// Class used to store the configuration of a constraint. Allows run-time creation of constraints.
-class ConstraintSettings : public SerializableObject, public RefTarget<ConstraintSettings>, public NonCopyable
+class ConstraintSettings : public SerializableObject, public RefTarget<ConstraintSettings>
 {
 public:
 	JPH_DECLARE_SERIALIZABLE_VIRTUAL(ConstraintSettings)
@@ -70,7 +70,7 @@ protected:
 };
 
 /// Base class for all physics constraints. A constraint removes one or more degrees of freedom for a rigid body.
-class Constraint : public RefTarget<Constraint>
+class Constraint : public RefTarget<Constraint>, public NonCopyable
 {
 public:
 	/// Constructor

+ 2 - 2
Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h

@@ -35,7 +35,7 @@ JPH_NAMESPACE_BEGIN
 class AngleConstraintPart
 {
 	/// Internal helper function to update velocities of bodies after Lagrange multiplier is calculated
-	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, float inLambda)
+	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, float inLambda) const
 	{
 		// Apply impulse if delta is not zero
 		if (inLambda != 0.0f)
@@ -136,7 +136,7 @@ public:
 	/// @param ioBody2 The second body that this constraint is attached to
 	/// @param inC Value of the constraint equation (C)
 	/// @param inBaumgarte Baumgarte constant (fraction of the error to correct)
-	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inC, float inBaumgarte)
+	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inC, float inBaumgarte) const
 	{
 		// Only apply position constraint when the constraint is hard, otherwise the velocity bias will fix the constraint
 		if (inC != 0.0f && !mSpringPart.IsActive())

+ 1 - 1
Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h

@@ -324,7 +324,7 @@ public:
 	/// @param inWorldSpaceAxis Axis along which the constraint acts (normalized)
 	/// @param inC Value of the constraint equation (C)
 	/// @param inBaumgarte Baumgarte constant (fraction of the error to correct)
-	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inC, float inBaumgarte)
+	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inC, float inBaumgarte) const
 	{
 		// Only apply position constraint when the constraint is hard, otherwise the velocity bias will fix the constraint
 		if (inC != 0.0f && !mSpringPart.IsActive())

+ 3 - 3
Jolt/Physics/Constraints/ConstraintPart/DualAxisConstraintPart.h

@@ -50,7 +50,7 @@ public:
 
 private:
 	/// Internal helper function to update velocities of bodies after Lagrange multiplier is calculated
-	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, Vec3Arg inN1, Vec3Arg inN2, const Vec2 &inLambda)
+	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, Vec3Arg inN1, Vec3Arg inN2, const Vec2 &inLambda) const
 	{
 		// Apply impulse if delta is not zero
 		if (!inLambda.IsZero())
@@ -82,7 +82,7 @@ private:
 	}
 	
 	/// Internal helper function to calculate the lagrange multiplier
-	inline void					CalculateLagrangeMultiplier(const Body &inBody1, const Body &inBody2, Vec3Arg inN1, Vec3Arg inN2, Vec2 &outLambda)
+	inline void					CalculateLagrangeMultiplier(const Body &inBody1, const Body &inBody2, Vec3Arg inN1, Vec3Arg inN2, Vec2 &outLambda) const
 	{
 		// Calculate lagrange multiplier:
 		//
@@ -191,7 +191,7 @@ public:
 	
 	/// Iteratively update the position constraint. Makes sure C(...) = 0.
 	/// All input vectors are in world space
-	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, Vec3Arg inU, Vec3Arg inN1, Vec3Arg inN2, float inBaumgarte)
+	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, Vec3Arg inU, Vec3Arg inN1, Vec3Arg inN2, float inBaumgarte) const
 	{
 		Vec2 c;
 		c[0] = inU.Dot(inN1);

+ 2 - 2
Jolt/Physics/Constraints/ConstraintPart/HingeRotationConstraintPart.h

@@ -46,7 +46,7 @@ public:
 
 private:
 	/// Internal helper function to update velocities of bodies after Lagrange multiplier is calculated
-	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, const Vec2 &inLambda)
+	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, const Vec2 &inLambda) const
 	{
 		// Apply impulse if delta is not zero
 		if (!inLambda.IsZero())
@@ -149,7 +149,7 @@ public:
 	}
 
 	/// Iteratively update the position constraint. Makes sure C(...) = 0.
-	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inBaumgarte)
+	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inBaumgarte) const
 	{
 		// Constraint needs Axis of body 1 perpendicular to both B and C from body 2 (which are both perpendicular to the Axis of body 2)
 		Vec2 c;

+ 2 - 2
Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h

@@ -39,7 +39,7 @@ JPH_NAMESPACE_BEGIN
 /// E = identity matrix.
 class PointConstraintPart
 {
-	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, Vec3Arg inLambda)
+	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, Vec3Arg inLambda) const
 	{
 		// Apply impulse if delta is not zero
 		if (inLambda != Vec3::sZero())
@@ -151,7 +151,7 @@ public:
 	/// @param ioBody1 The first body that this constraint is attached to
 	/// @param ioBody2 The second body that this constraint is attached to
 	/// @param inBaumgarte Baumgarte constant (fraction of the error to correct)
-	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inBaumgarte)
+	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inBaumgarte) const
 	{
 		Vec3 separation = (ioBody2.GetCenterOfMassPosition() + mR2 - ioBody1.GetCenterOfMassPosition() - mR1);
 		if (separation != Vec3::sZero())

+ 2 - 2
Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h

@@ -36,7 +36,7 @@ class RotationEulerConstraintPart
 {
 private:
 	/// Internal helper function to update velocities of bodies after Lagrange multiplier is calculated
-	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, Vec3Arg inLambda)
+	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, Vec3Arg inLambda) const
 	{
 		// Apply impulse if delta is not zero
 		if (inLambda != Vec3::sZero())
@@ -117,7 +117,7 @@ public:
 	}
 	
 	/// Iteratively update the position constraint. Makes sure C(...) = 0.
-	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, QuatArg inInvInitialOrientation, float inBaumgarte)
+	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, QuatArg inInvInitialOrientation, float inBaumgarte) const
 	{
 		// Calculate difference in rotation
 		//

+ 2 - 2
Jolt/Physics/Constraints/ConstraintPart/RotationQuatConstraintPart.h

@@ -87,7 +87,7 @@ class RotationQuatConstraintPart
 {
 private:
 	/// Internal helper function to update velocities of bodies after Lagrange multiplier is calculated
-	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, Vec3Arg inLambda)
+	JPH_INLINE bool				ApplyVelocityStep(Body &ioBody1, Body &ioBody2, Vec3Arg inLambda) const
 	{
 		// Apply impulse if delta is not zero
 		if (inLambda != Vec3::sZero())
@@ -163,7 +163,7 @@ public:
 	}
 
 	/// Iteratively update the position constraint. Makes sure C(...) = 0.
-	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, QuatArg inInvInitialOrientation, float inBaumgarte)
+	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, QuatArg inInvInitialOrientation, float inBaumgarte) const
 	{
 		// Calculate constraint equation
 		Vec3 c = (ioBody1.GetRotation().Conjugated() * ioBody2.GetRotation() * inInvInitialOrientation).GetXYZ();

+ 1 - 1
Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h

@@ -367,7 +367,7 @@ public:
 	/// @param inConstraintRotation The current rotation of the constraint in constraint space
 	/// @param inConstraintToBody1 , inConstraintToBody2 Rotates from constraint space to body 1/2 space
 	/// @param inBaumgarte Baumgarte constant (fraction of the error to correct)
-	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, QuatArg inConstraintRotation, QuatArg inConstraintToBody1, QuatArg inConstraintToBody2, float inBaumgarte)
+	inline bool					SolvePositionConstraint(Body &ioBody1, Body &ioBody2, QuatArg inConstraintRotation, QuatArg inConstraintToBody1, QuatArg inConstraintToBody2, float inBaumgarte) const
 	{
 		Quat q_swing, q_twist;
 		inConstraintRotation.GetSwingTwist(q_swing, q_twist);

+ 3 - 3
Jolt/Physics/Constraints/SliderConstraint.cpp

@@ -199,7 +199,7 @@ void SliderConstraint::CalculateSlidingAxisAndPosition(Mat44Arg inRotation1)
 	}
 }
 
-void SliderConstraint::CalculatePositionLimitsConstraintProperties(float inDeltaTime, Mat44Arg inRotation1)
+void SliderConstraint::CalculatePositionLimitsConstraintProperties(float inDeltaTime)
 {
 	// Check if distance is within limits
 	if (mHasLimits && (mD <= mLimitsMin || mD >= mLimitsMax))
@@ -238,7 +238,7 @@ void SliderConstraint::SetupVelocityConstraint(float inDeltaTime)
 	CalculatePositionConstraintProperties(rotation1, rotation2);
 	mRotationConstraintPart.CalculateConstraintProperties(*mBody1, rotation1, *mBody2, rotation2);
 	CalculateSlidingAxisAndPosition(rotation1);
-	CalculatePositionLimitsConstraintProperties(inDeltaTime, rotation1);
+	CalculatePositionLimitsConstraintProperties(inDeltaTime);
 	CalculateMotorConstraintProperties(inDeltaTime);
 }
 
@@ -318,7 +318,7 @@ bool SliderConstraint::SolvePositionConstraint(float inDeltaTime, float inBaumga
 		rotation2 = Mat44::sRotation(mBody2->GetRotation());
 		CalculateR1R2U(rotation1, rotation2);
 		CalculateSlidingAxisAndPosition(rotation1);
-		CalculatePositionLimitsConstraintProperties(inDeltaTime, rotation1);
+		CalculatePositionLimitsConstraintProperties(inDeltaTime);
 		if (mPositionLimitsConstraintPart.IsActive())
 		{
 			if (mD <= mLimitsMin)

+ 1 - 1
Jolt/Physics/Constraints/SliderConstraint.h

@@ -115,7 +115,7 @@ private:
 	void						CalculateR1R2U(Mat44Arg inRotation1, Mat44Arg inRotation2);
 	void						CalculateSlidingAxisAndPosition(Mat44Arg inRotation1);
 	void						CalculatePositionConstraintProperties(Mat44Arg inRotation1, Mat44Arg inRotation2);
-	void						CalculatePositionLimitsConstraintProperties(float inDeltaTime, Mat44Arg inRotation1);
+	void						CalculatePositionLimitsConstraintProperties(float inDeltaTime);
 	void						CalculateMotorConstraintProperties(float inDeltaTime);
 
 	// CONFIGURATION PROPERTIES FOLLOW

+ 1 - 1
Jolt/Physics/IslandBuilder.cpp

@@ -278,7 +278,7 @@ void IslandBuilder::BuildBodyIslands(const BodyID *inActiveBodies, uint32 inNumA
 	mBodyIslandEnds = body_island_starts;
 }
 
-void IslandBuilder::BuildConstraintIslands(uint32 *inConstraintToBody, uint32 inNumConstraints, uint32 *&outConstraints, uint32 *&outConstraintsEnd, TempAllocator *inTempAllocator)
+void IslandBuilder::BuildConstraintIslands(uint32 *inConstraintToBody, uint32 inNumConstraints, uint32 *&outConstraints, uint32 *&outConstraintsEnd, TempAllocator *inTempAllocator) const
 {
 	JPH_PROFILE_FUNCTION();
 

+ 2 - 2
Jolt/Physics/IslandBuilder.h

@@ -45,7 +45,7 @@ public:
 	void					Finalize(const BodyID *inActiveBodies, uint32 inNumActiveBodies, uint32 inNumContacts, TempAllocator *inTempAllocator);
 
 	/// Get the amount of islands formed
-	uint32					GetNumIslands()									{ return mNumIslands; }
+	uint32					GetNumIslands() const							{ return mNumIslands; }
 
 	/// Get iterator for a particular island, return false if there are no constraints
 	void					GetBodiesInIsland(uint32 inIslandIndex, BodyID *&outBodiesBegin, BodyID *&outBodiesEnd) const;
@@ -66,7 +66,7 @@ private:
 
 	// Helper functions to build various islands
 	void					BuildBodyIslands(const BodyID *inActiveBodies, uint32 inNumActiveBodies, TempAllocator *inTempAllocator);
-	void					BuildConstraintIslands(uint32 *inConstraintToBody, uint32 inNumConstraints, uint32 *&outConstraints, uint32 *&outConstraintsEnd, TempAllocator *inTempAllocator);
+	void					BuildConstraintIslands(uint32 *inConstraintToBody, uint32 inNumConstraints, uint32 *&outConstraints, uint32 *&outConstraintsEnd, TempAllocator *inTempAllocator) const;
 
 	/// Sorts the islands so that the islands with most constraints go first
 	void					SortIslands(TempAllocator *inTempAllocator);

+ 2 - 2
Jolt/Physics/PhysicsLock.h

@@ -75,7 +75,7 @@ private:
 
 /// Helper class that is similar to std::unique_lock
 template <class LockType>
-class UniqueLock
+class UniqueLock : public NonCopyable
 {
 public:
 								UniqueLock(LockType &inLock, EPhysicsLockTypes inType)		: mLock(inLock), mType(inType) { PhysicsLock::sLock(mLock, mType); }
@@ -88,7 +88,7 @@ private:
 
 /// Helper class that is similar to std::shared_lock
 template <class LockType>
-class SharedLock
+class SharedLock : public NonCopyable
 {
 public:
 								SharedLock(LockType &inLock, EPhysicsLockTypes inType)		: mLock(inLock), mType(inType) { PhysicsLock::sLockShared(mLock, mType); }

+ 3 - 3
Jolt/Physics/PhysicsSystem.cpp

@@ -352,7 +352,7 @@ void PhysicsSystem::Update(float inDeltaTime, int inCollisionSteps, int inIntegr
 			// It will also delete any bodies that have been destroyed in the last frame
 			step.mBodySetIslandIndex = inJobSystem->CreateJob("BodySetIslandIndex", cColorBodySetIslandIndex, [&context, &step]() 
 				{ 
-					context.mPhysicsSystem->JobBodySetIslandIndex(&context); 
+					context.mPhysicsSystem->JobBodySetIslandIndex(); 
 
 					if (step.mStartNextStep.IsValid())
 						step.mStartNextStep.RemoveDependency();
@@ -706,7 +706,7 @@ void PhysicsSystem::JobApplyGravity(const PhysicsUpdateContext *ioContext, Physi
 	}
 }
 
-void PhysicsSystem::JobSetupVelocityConstraints(float inDeltaTime, PhysicsUpdateContext::Step *ioStep)
+void PhysicsSystem::JobSetupVelocityConstraints(float inDeltaTime, PhysicsUpdateContext::Step *ioStep) const
 {
 #ifdef JPH_ENABLE_ASSERTS
 	// We only read positions
@@ -1222,7 +1222,7 @@ void PhysicsSystem::JobFinalizeIslands(PhysicsUpdateContext *ioContext)
 	mIslandBuilder.Finalize(mBodyManager.GetActiveBodiesUnsafe(), mBodyManager.GetNumActiveBodies(), mContactManager.GetNumConstraints(), ioContext->mTempAllocator);
 }
 
-void PhysicsSystem::JobBodySetIslandIndex(PhysicsUpdateContext *ioContext)
+void PhysicsSystem::JobBodySetIslandIndex()
 {
 #ifdef JPH_ENABLE_ASSERTS
 	// We only touch island data

+ 2 - 2
Jolt/Physics/PhysicsSystem.h

@@ -171,11 +171,11 @@ private:
 	void						JobStepListeners(PhysicsUpdateContext::Step *ioStep);
 	void						JobDetermineActiveConstraints(PhysicsUpdateContext::Step *ioStep) const;
 	void						JobApplyGravity(const PhysicsUpdateContext *ioContext, PhysicsUpdateContext::Step *ioStep);	
-	void						JobSetupVelocityConstraints(float inDeltaTime, PhysicsUpdateContext::Step *ioStep);
+	void						JobSetupVelocityConstraints(float inDeltaTime, PhysicsUpdateContext::Step *ioStep) const;
 	void						JobBuildIslandsFromConstraints(PhysicsUpdateContext *ioContext, PhysicsUpdateContext::Step *ioStep);
 	void						JobFindCollisions(PhysicsUpdateContext::Step *ioStep, int inJobIndex);
 	void						JobFinalizeIslands(PhysicsUpdateContext *ioContext);
-	void						JobBodySetIslandIndex(PhysicsUpdateContext *ioContext);
+	void						JobBodySetIslandIndex();
 	void						JobSolveVelocityConstraints(PhysicsUpdateContext *ioContext, PhysicsUpdateContext::SubStep *ioSubStep);
 	void						JobPreIntegrateVelocity(PhysicsUpdateContext *ioContext, PhysicsUpdateContext::SubStep *ioSubStep) const;
 	void						JobIntegrateVelocity(const PhysicsUpdateContext *ioContext, PhysicsUpdateContext::SubStep *ioSubStep);

+ 1 - 1
Jolt/Physics/Ragdoll/Ragdoll.cpp

@@ -574,7 +574,7 @@ void Ragdoll::GetRootTransform(Vec3 &outPosition, Quat &outRotation, bool inLock
 	}
 }
 
-const AABox Ragdoll::GetWorldSpaceBounds(bool inLockBodies) const
+AABox Ragdoll::GetWorldSpaceBounds(bool inLockBodies) const
 {
 	// Lock the bodies
 	int body_count = (int)mBodyIDs.size();

+ 2 - 2
Jolt/Physics/Ragdoll/Ragdoll.h

@@ -106,7 +106,7 @@ private:
 };
 
 /// Runtime ragdoll information
-class Ragdoll : public RefTarget<Ragdoll>
+class Ragdoll : public RefTarget<Ragdoll>, public NonCopyable
 {
 public:
 	/// Constructor
@@ -176,7 +176,7 @@ public:
 	const TwoBodyConstraint *			GetConstraint(int inConstraintIndex) const				{ return mConstraints[inConstraintIndex]; }
 
 	/// Get world space bounding box for all bodies of the ragdoll
-	const AABox 						GetWorldSpaceBounds(bool inLockBodies = true) const;
+	AABox 								GetWorldSpaceBounds(bool inLockBodies = true) const;
 
 	/// Get the settings object that created this ragdoll
 	const RagdollSettings *				GetRagdollSettings() const								{ return mRagdollSettings; }

+ 1 - 1
Jolt/Physics/Vehicle/TrackedVehicleController.cpp

@@ -293,7 +293,7 @@ void TrackedVehicleController::PostCollide(float inDeltaTime, PhysicsSystem &inP
 			float total_radius = 0.0f;
 			for (uint wheel_index : t.mWheels)
 			{
-				WheelTV *w = static_cast<WheelTV *>(wheels[wheel_index]);
+				const WheelTV *w = static_cast<WheelTV *>(wheels[wheel_index]);
 
 				if (w->HasContact())
 					total_radius += w->GetSettings()->mRadius;

+ 1 - 1
Jolt/Physics/Vehicle/VehicleConstraint.cpp

@@ -213,7 +213,7 @@ void VehicleConstraint::OnStep(float inDeltaTime, PhysicsSystem &inPhysicsSystem
 
 	// If the wheels are rotating, we don't want to go to sleep yet
 	bool allow_sleep = true;
-	for (Wheel *w : mWheels)
+	for (const Wheel *w : mWheels)
 		if (abs(w->mAngularVelocity) > DegreesToRadians(10.0f))
 			allow_sleep = false;
 	if (mBody->GetAllowSleeping() != allow_sleep)

+ 1 - 1
Jolt/Physics/Vehicle/WheeledVehicleController.cpp

@@ -91,7 +91,7 @@ void WheelWV::Update(float inDeltaTime, const VehicleConstraint &inConstraint)
 
 	if (mContactBody != nullptr)
 	{
-		Body *body = inConstraint.GetVehicleBody();
+		const Body *body = inConstraint.GetVehicleBody();
 
 		// Calculate relative velocity between wheel contact point and floor
 		Vec3 relative_velocity = body->GetPointVelocity(mContactPosition) - mContactPointVelocity;

+ 0 - 5
Jolt/Skeleton/SkeletalAnimation.cpp

@@ -41,11 +41,6 @@ void SkeletalAnimation::JointState::FromMatrix(Mat44Arg inMatrix)
 	mTranslation = inMatrix.GetTranslation();
 }
 
-void SkeletalAnimation::JointState::ToMatrix(Mat44 &outMatrix)
-{
-	outMatrix = Mat44::sRotationTranslation(mRotation, mTranslation);
-}
-
 float SkeletalAnimation::GetDuration() const
 {
 	if (!mAnimatedJoints.empty() && !mAnimatedJoints[0].mKeyframes.empty())

+ 1 - 1
Jolt/Skeleton/SkeletalAnimation.h

@@ -26,7 +26,7 @@ public:
 		void							FromMatrix(Mat44Arg inMatrix);
 		
 		/// Convert to matrix representation
-		void							ToMatrix(Mat44 &outMatrix);
+		inline Mat44					ToMatrix() const									{ return Mat44::sRotationTranslation(mRotation, mTranslation); }
 
 		Quat							mRotation = Quat::sIdentity();						///< Local space rotation of the joint
 		Vec3							mTranslation = Vec3::sZero();						///< Local space translation of the joint

+ 1 - 1
Jolt/Skeleton/SkeletonPose.cpp

@@ -22,7 +22,7 @@ void SkeletonPose::CalculateJointMatrices()
 {
 	for (int i = 0; i < (int)mJoints.size(); ++i)
 	{
-		mJoints[i].ToMatrix(mJointMatrices[i]);
+		mJointMatrices[i] = mJoints[i].ToMatrix();
 
 		int parent = mSkeleton->GetJoint(i).mParentJointIndex;
 		if (parent >= 0)

+ 2 - 2
Jolt/TriangleGrouper/TriangleGrouperClosestCentroid.cpp

@@ -57,7 +57,7 @@ void TriangleGrouperClosestCentroid::Group(const VertexList &inVertices, const I
 
 		// Sort remaining triangles in batch on distance to first triangle
 		sort(batch_begin_plus_1, batch_end, 
-			[&first_centroid, &centroids](uint inLHS, uint inRHS) -> bool 
+			[&first_centroid, &centroids](uint inLHS, uint inRHS)
 			{ 
 				return (centroids[inLHS] - first_centroid).LengthSq() < (centroids[inRHS] - first_centroid).LengthSq(); 
 			});
@@ -76,7 +76,7 @@ void TriangleGrouperClosestCentroid::Group(const VertexList &inVertices, const I
 
 				// Find first element that is bigger than this one and insert the current item before it
 				vector<uint>::iterator upper = upper_bound(batch_begin_plus_1, batch_end, dist, 
-					[&first_centroid, &centroids](float inLHS, uint inRHS) -> bool 
+					[&first_centroid, &centroids](float inLHS, uint inRHS)
 					{
 						return inLHS < (centroids[inRHS] - first_centroid).LengthSq(); 
 					});

+ 1 - 1
Jolt/TriangleGrouper/TriangleGrouperMorton.cpp

@@ -41,7 +41,7 @@ void TriangleGrouperMorton::Group(const VertexList &inVertices, const IndexedTri
 		morton_codes[t] = MortonCode::sGetMortonCode(centroids[t], centroid_bounds);
 
 	// Sort triangles based on morton code
-	sort(outGroupedTriangleIndices.begin(), outGroupedTriangleIndices.end(), [&morton_codes](uint inLHS, uint inRHS) -> bool { return morton_codes[inLHS] < morton_codes[inRHS]; });
+	sort(outGroupedTriangleIndices.begin(), outGroupedTriangleIndices.end(), [&morton_codes](uint inLHS, uint inRHS) { return morton_codes[inLHS] < morton_codes[inRHS]; });
 }
 
 JPH_NAMESPACE_END

+ 1 - 1
Jolt/TriangleSplitter/TriangleSplitterBinning.cpp

@@ -90,7 +90,7 @@ bool TriangleSplitterBinning::Split(const Range &inTriangles, Range &outLeft, Ra
 		for (uint b = 1; b < num_bins; ++b) // Start at 1 since selecting bin 0 would result in everything ending up on the right side
 		{
 			// Calculate surface area heuristic and see if it is better than the current best
-			Bin &bin = bins[b];
+			const Bin &bin = bins[b];
 			float cp = bin.mBoundsAccumulatedLeft.GetSurfaceArea() * bin.mNumTrianglesAccumulatedLeft + bin.mBoundsAccumulatedRight.GetSurfaceArea() * bin.mNumTrianglesAccumulatedRight;
 			if (cp < best_cp)
 			{

+ 1 - 1
Jolt/TriangleSplitter/TriangleSplitterFixedLeafSize.cpp

@@ -117,7 +117,7 @@ bool TriangleSplitterFixedLeafSize::Split(const Range &inTriangles, Range &outLe
 		for (uint b = 1; b < num_bins; ++b) // Start at 1 since selecting bin 0 would result in everything ending up on the right side
 		{
 			// Calculate surface area heuristic and see if it is better than the current best
-			Bin &bin = bins[b];
+			const Bin &bin = bins[b];
 			float cp = bin.mBoundsAccumulatedLeft.GetSurfaceArea() * bin.mNumTrianglesAccumulatedLeft + bin.mBoundsAccumulatedRight.GetSurfaceArea() * bin.mNumTrianglesAccumulatedRight;
 			if (cp < best_cp)
 			{

+ 1 - 1
Jolt/TriangleSplitter/TriangleSplitterMorton.cpp

@@ -26,7 +26,7 @@ TriangleSplitterMorton::TriangleSplitterMorton(const VertexList &inVertices, con
 
 	// Sort triangles on morton code
 	const vector<uint32> &morton_codes = mMortonCodes;
-	sort(mSortedTriangleIdx.begin(), mSortedTriangleIdx.end(), [&morton_codes](uint inLHS, uint inRHS) -> bool { return morton_codes[inLHS] < morton_codes[inRHS]; });
+	sort(mSortedTriangleIdx.begin(), mSortedTriangleIdx.end(), [&morton_codes](uint inLHS, uint inRHS) { return morton_codes[inLHS] < morton_codes[inRHS]; });
 }
 
 bool TriangleSplitterMorton::Split(const Range &inTriangles, Range &outLeft, Range &outRight)

+ 7 - 7
Samples/Tests/ConvexCollision/RandomRayTest.cpp

@@ -128,7 +128,7 @@ void RandomRayTest::PrePhysicsUpdate(const PreUpdateParams &inParams)
 		Vec3 render_offset(0, 0, 0);
 		Sphere sphere(Vec3(0.1f, 0.2f, 0.3f), 1.1f);
 		mDebugRenderer->DrawSphere(render_offset + sphere.GetCenter(), sphere.GetRadius(), Color::sYellow);
-		TestRay<Sphere, Sphere>("Sphere", render_offset, sphere, sphere, [](const Sphere &inSphere, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<Sphere, Sphere>("Sphere", render_offset, sphere, sphere, [](const Sphere &inSphere, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			return RaySphere(inRayOrigin, inRayDirection, inSphere.GetCenter(), inSphere.GetRadius()); 
 		});
 	}
@@ -141,7 +141,7 @@ void RandomRayTest::PrePhysicsUpdate(const PreUpdateParams &inParams)
 	#endif // JPH_DEBUG_RENDERER
 		ConvexShape::SupportBuffer buffer;
 		const ConvexShape::Support *support = sphere_shape.GetSupportFunction(ConvexShape::ESupportMode::IncludeConvexRadius, buffer, Vec3::sReplicate(1.0f));
-		TestRay<ConvexShape::Support, SphereShape>("Sphere Shape", render_offset, *support, sphere_shape, [](const SphereShape &inSphere, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<ConvexShape::Support, SphereShape>("Sphere Shape", render_offset, *support, sphere_shape, [](const SphereShape &inSphere, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			return RaySphere(inRayOrigin, inRayDirection, Vec3::sZero(), inSphere.GetRadius()); 
 		});
 	}
@@ -150,7 +150,7 @@ void RandomRayTest::PrePhysicsUpdate(const PreUpdateParams &inParams)
 		Vec3 render_offset(10, 0, 0);
 		AABox box(Vec3(-0.9f, -1.0f, -1.1f), Vec3(0.8f, 0.9f, 1.0f));
 		mDebugRenderer->DrawBox(box.Transformed(Mat44::sTranslation(render_offset)), Color::sYellow);
-		TestRay<AABox, AABox>("Box", render_offset, box, box, [](const AABox &inBox, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<AABox, AABox>("Box", render_offset, box, box, [](const AABox &inBox, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			float fraction = RayAABox(inRayOrigin, RayInvDirection(inRayDirection), inBox.mMin, inBox.mMax); 
 			return max(fraction, 0.0f);
 		});
@@ -164,7 +164,7 @@ void RandomRayTest::PrePhysicsUpdate(const PreUpdateParams &inParams)
 	#endif // JPH_DEBUG_RENDERER
 		ConvexShape::SupportBuffer buffer;
 		const ConvexShape::Support *support = box_shape.GetSupportFunction(ConvexShape::ESupportMode::IncludeConvexRadius, buffer, Vec3::sReplicate(1.0f));
-		TestRay<ConvexShape::Support, BoxShape>("Box Shape", render_offset, *support, box_shape, [](const BoxShape &inBox, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<ConvexShape::Support, BoxShape>("Box Shape", render_offset, *support, box_shape, [](const BoxShape &inBox, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			float fraction = RayAABox(inRayOrigin, RayInvDirection(inRayDirection), -inBox.GetHalfExtent(), inBox.GetHalfExtent()); 
 			return max(fraction, 0.0f);
 		});
@@ -178,7 +178,7 @@ void RandomRayTest::PrePhysicsUpdate(const PreUpdateParams &inParams)
 	#endif // JPH_DEBUG_RENDERER
 		ConvexShape::SupportBuffer buffer;
 		const ConvexShape::Support *support = capsule_shape.GetSupportFunction(ConvexShape::ESupportMode::IncludeConvexRadius, buffer, Vec3::sReplicate(1.0f));
-		TestRay<ConvexShape::Support, CapsuleShape>("Capsule Shape", render_offset, *support, capsule_shape, [](const CapsuleShape &inCapsule, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<ConvexShape::Support, CapsuleShape>("Capsule Shape", render_offset, *support, capsule_shape, [](const CapsuleShape &inCapsule, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			return RayCapsule(inRayOrigin, inRayDirection, inCapsule.GetHalfHeightOfCylinder(), inCapsule.GetRadius()); 
 		});
 	}
@@ -191,7 +191,7 @@ void RandomRayTest::PrePhysicsUpdate(const PreUpdateParams &inParams)
 	#endif // JPH_DEBUG_RENDERER
 		ConvexShape::SupportBuffer buffer;
 		const ConvexShape::Support *support = cylinder_shape.GetSupportFunction(ConvexShape::ESupportMode::IncludeConvexRadius, buffer, Vec3::sReplicate(1.0f));
-		TestRay<ConvexShape::Support, CylinderShape>("Cylinder Shape", render_offset, *support, cylinder_shape, [](const CylinderShape &inCylinder, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<ConvexShape::Support, CylinderShape>("Cylinder Shape", render_offset, *support, cylinder_shape, [](const CylinderShape &inCylinder, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			return RayCylinder(inRayOrigin, inRayDirection, inCylinder.GetHalfHeight(), inCylinder.GetRadius()); 
 		});
 	}
@@ -200,7 +200,7 @@ void RandomRayTest::PrePhysicsUpdate(const PreUpdateParams &inParams)
 		Vec3 render_offset(30, 0, 0);
 		TriangleConvexSupport triangle(Vec3(0.1f, 0.9f, 0.3f), Vec3(-0.9f, -0.5f, 0.2f), Vec3(0.7f, -0.3f, -0.1f));
 		mDebugRenderer->DrawTriangle(render_offset + triangle.mV1, render_offset + triangle.mV2, render_offset + triangle.mV3, Color::sYellow);
-		TestRay<TriangleConvexSupport, TriangleConvexSupport>("Triangle", render_offset, triangle, triangle, [](const TriangleConvexSupport &inTriangle, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<TriangleConvexSupport, TriangleConvexSupport>("Triangle", render_offset, triangle, triangle, [](const TriangleConvexSupport &inTriangle, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			return RayTriangle(inRayOrigin, inRayDirection, inTriangle.mV1, inTriangle.mV2, inTriangle.mV3);
 		});
 	}

+ 1 - 1
Samples/Tests/Rig/PoweredRigTest.cpp

@@ -25,7 +25,7 @@ const char *PoweredRigTest::sAnimations[] =
 	"Dead_Pose4"
 };
 
-const char *PoweredRigTest::sAnimationName = "Dead_Pose1";
+const char *PoweredRigTest::sAnimationName = "Sprint";
 
 PoweredRigTest::~PoweredRigTest()
 {

+ 12 - 12
UnitTests/Geometry/GJKTests.cpp

@@ -105,7 +105,7 @@ TEST_SUITE("GJKTests")
 
 	TEST_CASE("TestGJKSphereVsSphereIntersect")
 	{
-		auto sphere_creator = [](UnitTestRandom &inRandom) -> Sphere {
+		auto sphere_creator = [](UnitTestRandom &inRandom) {
 				uniform_real_distribution<float> pos(-2.0f, 2.0f);
 				uniform_real_distribution<float> rad(0.5f, 2.0f);
 				return Sphere(Vec3(pos(inRandom), pos(inRandom), pos(inRandom)), rad(inRandom));
@@ -114,7 +114,7 @@ TEST_SUITE("GJKTests")
 		TestIntersect<Sphere, Sphere>(
 			sphere_creator, 
 			sphere_creator, 
-			[](const Sphere &inSphereA, const Sphere &inSphereB, bool inIsIntersecting, float inTolerance) -> bool { 
+			[](const Sphere &inSphereA, const Sphere &inSphereB, bool inIsIntersecting, float inTolerance) {
 
 				// Test without and with tolerance if the results are equal
 				return inSphereA.Overlaps(inSphereB) == inIsIntersecting
@@ -124,13 +124,13 @@ TEST_SUITE("GJKTests")
 
 	TEST_CASE("TestGJKSphereVsBoxIntersect")
 	{
-		auto sphere_creator = [](UnitTestRandom &inRandom) -> Sphere {
+		auto sphere_creator = [](UnitTestRandom &inRandom) {
 				uniform_real_distribution<float> pos(-2.0f, 2.0f);
 				uniform_real_distribution<float> rad(0.5f, 2.0f);
 				return Sphere(Vec3(pos(inRandom), pos(inRandom), pos(inRandom)), rad(inRandom));
 			};
 
-		auto box_creator = [](UnitTestRandom &inRandom) -> AABox {
+		auto box_creator = [](UnitTestRandom &inRandom) {
 				uniform_real_distribution<float> pos(-2.0f, 2.0f);
 				Vec3 p1 = Vec3(pos(inRandom), pos(inRandom), pos(inRandom));
 				Vec3 p2 = Vec3(pos(inRandom), pos(inRandom), pos(inRandom));
@@ -140,7 +140,7 @@ TEST_SUITE("GJKTests")
 		TestIntersect<Sphere, AABox>(
 			sphere_creator, 
 			box_creator, 
-			[](const Sphere &inSphereA, const AABox &inBoxB, bool inIsIntersecting, float inTolerance) -> bool { 
+			[](const Sphere &inSphereA, const AABox &inBoxB, bool inIsIntersecting, float inTolerance) {
 				
 				// Test without and with tolerance if the results are equal
 				return inSphereA.Overlaps(inBoxB) == inIsIntersecting
@@ -182,7 +182,7 @@ TEST_SUITE("GJKTests")
 	TEST_CASE("TestGJKRaySphere")
 	{
 		Sphere sphere(Vec3(0.1f, 0.2f, 0.3f), 1.1f);
-		TestRay<Sphere, Sphere>(sphere, sphere, [](const Sphere &inSphere, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<Sphere, Sphere>(sphere, sphere, [](const Sphere &inSphere, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			return RaySphere(inRayOrigin, inRayDirection, inSphere.GetCenter(), inSphere.GetRadius()); 
 		});
 	}
@@ -192,7 +192,7 @@ TEST_SUITE("GJKTests")
 		SphereShape sphere_shape(1.1f);
 		ConvexShape::SupportBuffer buffer;
 		const ConvexShape::Support *support = sphere_shape.GetSupportFunction(ConvexShape::ESupportMode::IncludeConvexRadius, buffer, Vec3::sReplicate(1.0f));
-		TestRay<ConvexShape::Support, SphereShape>(*support, sphere_shape, [](const SphereShape &inSphere, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<ConvexShape::Support, SphereShape>(*support, sphere_shape, [](const SphereShape &inSphere, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			return RaySphere(inRayOrigin, inRayDirection, Vec3::sZero(), inSphere.GetRadius()); 
 		});
 	}
@@ -200,7 +200,7 @@ TEST_SUITE("GJKTests")
 	TEST_CASE("TestGJKRayBox")
 	{
 		AABox box(Vec3(-0.9f, -1.0f, -1.1f), Vec3(0.8f, 0.9f, 1.0f));
-		TestRay<AABox, AABox>(box, box, [](const AABox &inBox, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<AABox, AABox>(box, box, [](const AABox &inBox, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			float fraction = RayAABox(inRayOrigin, RayInvDirection(inRayDirection), inBox.mMin, inBox.mMax); 
 			return max(fraction, 0.0f);
 		});
@@ -211,7 +211,7 @@ TEST_SUITE("GJKTests")
 		BoxShape box_shape(Vec3(0.9f, 1.0f, 1.1f), 0.0f);
 		ConvexShape::SupportBuffer buffer;
 		const ConvexShape::Support *support = box_shape.GetSupportFunction(ConvexShape::ESupportMode::IncludeConvexRadius, buffer, Vec3::sReplicate(1.0f));
-		TestRay<ConvexShape::Support, BoxShape>(*support, box_shape, [](const BoxShape &inBox, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<ConvexShape::Support, BoxShape>(*support, box_shape, [](const BoxShape &inBox, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			float fraction = RayAABox(inRayOrigin, RayInvDirection(inRayDirection), -inBox.GetHalfExtent(), inBox.GetHalfExtent()); 
 			return max(fraction, 0.0f);
 		});
@@ -222,7 +222,7 @@ TEST_SUITE("GJKTests")
 		CapsuleShape capsule_shape(1.1f, 0.6f);
 		ConvexShape::SupportBuffer buffer;
 		const ConvexShape::Support *support = capsule_shape.GetSupportFunction(ConvexShape::ESupportMode::IncludeConvexRadius, buffer, Vec3::sReplicate(1.0f));
-		TestRay<ConvexShape::Support, CapsuleShape>(*support, capsule_shape, [](const CapsuleShape &inCapsule, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<ConvexShape::Support, CapsuleShape>(*support, capsule_shape, [](const CapsuleShape &inCapsule, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			return RayCapsule(inRayOrigin, inRayDirection, inCapsule.GetHalfHeightOfCylinder(), inCapsule.GetRadius()); 
 		});
 	}
@@ -232,7 +232,7 @@ TEST_SUITE("GJKTests")
 		CylinderShape cylinder_shape(1.5f, 0.6f, 0.0f);
 		ConvexShape::SupportBuffer buffer;
 		const ConvexShape::Support *support = cylinder_shape.GetSupportFunction(ConvexShape::ESupportMode::IncludeConvexRadius, buffer, Vec3::sReplicate(1.0f));
-		TestRay<ConvexShape::Support, CylinderShape>(*support, cylinder_shape, [](const CylinderShape &inCylinder, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<ConvexShape::Support, CylinderShape>(*support, cylinder_shape, [](const CylinderShape &inCylinder, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			return RayCylinder(inRayOrigin, inRayDirection, inCylinder.GetHalfHeight(), inCylinder.GetRadius()); 
 		});
 	}
@@ -240,7 +240,7 @@ TEST_SUITE("GJKTests")
 	TEST_CASE("TestGJKRayTriangle")
 	{			
 		TriangleConvexSupport triangle(Vec3(0.1f, 0.9f, 0.3f), Vec3(-0.9f, -0.5f, 0.2f), Vec3(0.7f, -0.3f, -0.1f));
-		TestRay<TriangleConvexSupport, TriangleConvexSupport>(triangle, triangle, [](const TriangleConvexSupport &inTriangle, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) -> float { 
+		TestRay<TriangleConvexSupport, TriangleConvexSupport>(triangle, triangle, [](const TriangleConvexSupport &inTriangle, Vec3Arg inRayOrigin, Vec3Arg inRayDirection) { 
 			return RayTriangle(inRayOrigin, inRayDirection, inTriangle.mV1, inTriangle.mV2, inTriangle.mV3);
 		});
 	}