Browse Source

sonar fixes (#15)

jrouwe 3 years ago
parent
commit
4f87ec71da
48 changed files with 93 additions and 92 deletions
  1. 1 1
      Jolt/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h
  2. 1 1
      Jolt/Core/AlignedAllocator.h
  3. 2 2
      Jolt/Core/JobSystem.h
  4. 1 1
      Jolt/Core/JobSystemThreadPool.cpp
  5. 4 4
      Jolt/Core/Profiler.cpp
  6. 1 1
      Jolt/Core/RTTI.h
  7. 1 1
      Jolt/Core/Result.h
  8. 4 4
      Jolt/Core/StatCollector.cpp
  9. 4 4
      Jolt/Core/StatCollector.h
  10. 1 1
      Jolt/Core/StaticArray.h
  11. 1 1
      Jolt/Core/TempAllocator.h
  12. 1 1
      Jolt/Geometry/ConvexHullBuilder.h
  13. 2 2
      Jolt/Geometry/ConvexHullBuilder2D.h
  14. 1 1
      Jolt/Geometry/ConvexSupport.h
  15. 1 1
      Jolt/Geometry/EPAConvexHullBuilder.h
  16. 2 2
      Jolt/Geometry/Plane.h
  17. 1 1
      Jolt/Geometry/RayAABox.h
  18. 1 1
      Jolt/ObjectStream/ObjectStreamBinaryIn.h
  19. 1 1
      Jolt/ObjectStream/ObjectStreamBinaryOut.h
  20. 2 2
      Jolt/ObjectStream/ObjectStreamIn.h
  21. 1 1
      Jolt/ObjectStream/ObjectStreamOut.h
  22. 1 1
      Jolt/ObjectStream/ObjectStreamTextIn.h
  23. 1 1
      Jolt/ObjectStream/ObjectStreamTextOut.h
  24. 1 1
      Jolt/ObjectStream/SerializableAttribute.h
  25. 1 1
      Jolt/Physics/Body/Body.h
  26. 7 5
      Jolt/Physics/Body/BodyAccess.cpp
  27. 4 4
      Jolt/Physics/Body/BodyAccess.h
  28. 1 1
      Jolt/Physics/Body/BodyFilter.h
  29. 1 1
      Jolt/Physics/Body/BodyLockInterface.h
  30. 2 2
      Jolt/Physics/Character/Character.cpp
  31. 1 1
      Jolt/Physics/Collision/BroadPhase/BroadPhaseLayer.h
  32. 3 3
      Jolt/Physics/Collision/BroadPhase/QuadTree.cpp
  33. 3 3
      Jolt/Physics/Collision/BroadPhase/QuadTree.h
  34. 1 1
      Jolt/Physics/Collision/GroupFilterTable.h
  35. 1 1
      Jolt/Physics/Collision/ObjectLayer.h
  36. 2 2
      Jolt/Physics/Collision/Shape/ConvexHullShape.cpp
  37. 10 10
      Jolt/Physics/Collision/Shape/MeshShape.cpp
  38. 2 2
      Jolt/Physics/Collision/Shape/SphereShape.cpp
  39. 1 1
      Jolt/Physics/Collision/Shape/SubShapeID.h
  40. 1 1
      Jolt/Physics/Constraints/Constraint.h
  41. 1 1
      Jolt/Physics/Constraints/ContactConstraintManager.h
  42. 4 4
      Jolt/Physics/PhysicsLock.cpp
  43. 4 4
      Jolt/Physics/PhysicsLock.h
  44. 1 1
      Jolt/Physics/Ragdoll/Ragdoll.h
  45. 1 1
      Jolt/Physics/Vehicle/TrackedVehicleController.h
  46. 1 1
      Jolt/Physics/Vehicle/VehicleController.h
  47. 2 3
      Jolt/Physics/Vehicle/Wheel.cpp
  48. 1 1
      Jolt/Physics/Vehicle/WheeledVehicleController.h

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

@@ -207,7 +207,7 @@ public:
 		}
 
 		/// Constructor
-		inline						DecodingContext(const Header *inHeader) :
+		inline explicit				DecodingContext(const Header *inHeader) :
 			mRootBoundsMin(Vec3::sLoadFloat3Unsafe(inHeader->mRootBoundsMin)),
 			mRootBoundsMax(Vec3::sLoadFloat3Unsafe(inHeader->mRootBoundsMax))
 		{

+ 1 - 1
Jolt/Core/AlignedAllocator.h

@@ -31,7 +31,7 @@ public:
 
 	/// Constructor from other allocator
 	template <typename T2>
-	inline					AlignedAllocator(const AlignedAllocator<T2, N> &) { }
+	inline explicit			AlignedAllocator(const AlignedAllocator<T2, N> &) { }
 
 	/// Allocate memory
 	inline pointer			allocate(size_type n)

+ 2 - 2
Jolt/Core/JobSystem.h

@@ -55,7 +55,7 @@ public:
 		inline				JobHandle(JobHandle &&inHandle) noexcept	: Ref<Job>(move(inHandle)) { }
 
 		/// Constructor, only to be used by JobSystem
-		inline				JobHandle(Job *inJob)						: Ref<Job>(inJob) { }
+		inline explicit		JobHandle(Job *inJob)						: Ref<Job>(inJob) { }
 
 		/// Assignment
 		inline JobHandle &	operator = (const JobHandle &inHandle)		{ Ref<Job>::operator = (inHandle); return *this; }
@@ -139,7 +139,7 @@ protected:
 	{
 	public:
 		/// Constructor
-							Job(const char *inJobName, 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), 

+ 1 - 1
Jolt/Core/JobSystemThreadPool.cpp

@@ -515,7 +515,7 @@ static void SetThreadName(const char *inName)
 
 #endif
 
-void JobSystemThreadPool::ThreadMain(const string &inName, int inThreadIndex)
+void JobSystemThreadPool::ThreadMain([[maybe_unused]] const string &inName, int inThreadIndex)
 {
 #ifdef JPH_PLATFORM_WINDOWS
 	SetThreadName(inName.c_str());

+ 4 - 4
Jolt/Core/Profiler.cpp

@@ -8,10 +8,10 @@
 #include <Core/StringTools.h>
 #include <fstream>
 
-namespace JPH {
-
 #ifdef JPH_PROFILE_ENABLED
 
+namespace JPH {
+
 //////////////////////////////////////////////////////////////////////////////////////////
 // Profiler
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -379,6 +379,6 @@ void Profiler::DumpChart(int inNumber, const Threads &inThreads, const KeyToAggr
 </tbody></table></body></html>)";
 }
 
-#endif // JPH_PROFILE_ENABLED
-
 } // JPH
+
+#endif // JPH_PROFILE_ENABLED

+ 1 - 1
Jolt/Core/RTTI.h

@@ -447,7 +447,7 @@ class RTTIAttribute : public RefTarget<RTTIAttribute>
 public:
 	/// Constructor
 								RTTIAttribute()												: mName("") { }
-								RTTIAttribute(const char *inName)							: mName(inName) { }
+	explicit					RTTIAttribute(const char *inName)							: mName(inName) { }
 	virtual						~RTTIAttribute() = default;
 
 	/// Name of the attribute

+ 1 - 1
Jolt/Core/Result.h

@@ -59,7 +59,7 @@ public:
 						~Result()									{ Clear(); }
 
 	/// Copy assignment
-	Result<Type> &		operator = (const Result<Type> &inRHS)
+	Result<Type> &		operator = (const Result<Type> &inRHS) noexcept
 	{
 		Clear();
 

+ 4 - 4
Jolt/Core/StatCollector.cpp

@@ -8,10 +8,10 @@
 #include <Core/StringTools.h>
 #include <fstream>
 
-namespace JPH {
-
 #ifdef JPH_STAT_COLLECTOR
 
+namespace JPH {
+
 StatCollector StatCollector::sInstance;
 
 string StatCollector::Variant::ToString() const
@@ -364,6 +364,6 @@ void StatCollector::StopCapture(const char *inFileName)
 	ResetInternal();
 }
 
-#endif // JPH_STAT_COLLECTOR
+} // JPH
 
-} // JPH
+#endif // JPH_STAT_COLLECTOR

+ 4 - 4
Jolt/Core/StatCollector.h

@@ -7,10 +7,10 @@
 #include <Core/NonCopyable.h>
 #include <map>
 
-namespace JPH {
-
 #ifdef JPH_STAT_COLLECTOR
 
+namespace JPH {
+
 /// Singleton class for collacting simple stat values
 ///
 /// Usage:
@@ -109,6 +109,8 @@ private:
 #define JPH_STAT_COLLECTOR_IS_CAPTURING()			StatCollector::sInstance.IsCapturing()
 #define JPH_STAT_COLLECTOR_RESET()					StatCollector::sInstance.Reset()
 
+} // JPH
+
 #else
 
 #define JPH_IF_STAT_COLLECTOR(...)
@@ -120,5 +122,3 @@ private:
 #define JPH_STAT_COLLECTOR_RESET()
 
 #endif
-
-} // JPH

+ 1 - 1
Jolt/Core/StaticArray.h

@@ -20,7 +20,7 @@ public:
 	}
 
 	/// Constructor from initializer list
-						StaticArray(initializer_list<T> inList)
+	explicit			StaticArray(initializer_list<T> inList)
 	{
 		JPH_ASSERT(inList.size() <= N);
 		for (typename initializer_list<T>::iterator i = inList.begin(); i != inList.end(); ++i)

+ 1 - 1
Jolt/Core/TempAllocator.h

@@ -27,7 +27,7 @@ class TempAllocatorImpl final : public TempAllocator
 {
 public:
 	/// Constructs the allocator with a maximum allocatable size of inSize
-									TempAllocatorImpl(uint inSize) :
+	explicit						TempAllocatorImpl(uint inSize) :
 		mBase(static_cast<uint8 *>(malloc(inSize))),
 		mSize(inSize)
 	{

+ 1 - 1
Jolt/Geometry/ConvexHullBuilder.h

@@ -82,7 +82,7 @@ public:
 	using Faces = vector<Face *>;
 
 	/// Constructor
-						ConvexHullBuilder(const Positions &inPositions);
+	explicit			ConvexHullBuilder(const Positions &inPositions);
 
 	/// Destructor
 						~ConvexHullBuilder()				{ FreeFaces(); }

+ 2 - 2
Jolt/Geometry/ConvexHullBuilder2D.h

@@ -18,7 +18,7 @@ public:
 
 	/// Constructor
 	/// @param inPositions Positions used to make the hull. Uses X and Y component of Vec3 only!
-						ConvexHullBuilder2D(const Positions &inPositions); 
+	explicit			ConvexHullBuilder2D(const Positions &inPositions); 
 
 	/// Destructor
 						~ConvexHullBuilder2D();
@@ -72,7 +72,7 @@ private:
 	{
 	public:
 		/// Constructor
-						Edge(int inStartIdx)						: mStartIdx(inStartIdx) { }
+		explicit		Edge(int inStartIdx)						: mStartIdx(inStartIdx) { }
 
 		/// Calculate the center of the edge and the edge normal
 		void			CalculateNormalAndCenter(const Vec3 *inPositions);

+ 1 - 1
Jolt/Geometry/ConvexSupport.h

@@ -148,7 +148,7 @@ template <class VERTEX_ARRAY>
 struct PolygonConvexSupport
 {
 	/// Constructor
-							PolygonConvexSupport(const VERTEX_ARRAY &inVertices) :
+	explicit				PolygonConvexSupport(const VERTEX_ARRAY &inVertices) :
 		mVertices(inVertices)
 	{
 	}

+ 1 - 1
Jolt/Geometry/EPAConvexHullBuilder.h

@@ -219,7 +219,7 @@ public:
 	};
 
 	/// Constructor
-						EPAConvexHullBuilder(const Points &inPositions) :
+	explicit			EPAConvexHullBuilder(const Points &inPositions) :
 		mPositions(inPositions)
 	{
 #ifdef JPH_EPA_CONVEX_BUILDER_DRAW

+ 2 - 2
Jolt/Geometry/Plane.h

@@ -11,7 +11,7 @@ class [[nodiscard]] Plane
 public:
 	/// Constructor
 					Plane() = default;
-					Plane(Vec4Arg inNormalAndConstant)										: mNormalAndConstant(inNormalAndConstant) { }
+	explicit		Plane(Vec4Arg inNormalAndConstant)										: mNormalAndConstant(inNormalAndConstant) { }
 					Plane(Vec3Arg inNormal, float inConstant)								: mNormalAndConstant(inNormal, inConstant) { }
 
 	/// Create from point and normal
@@ -27,7 +27,7 @@ public:
 	void			SetConstant(float inConstant)											{ mNormalAndConstant.SetW(inConstant); }
 
 	/// Offset the plane (positive value means move it in the direction of the plane normal)
-	Plane			Offset(float inDistance) const											{ return mNormalAndConstant - Vec4(Vec3::sZero(), inDistance); }
+	Plane			Offset(float inDistance) const											{ return Plane(mNormalAndConstant - Vec4(Vec3::sZero(), inDistance)); }
 
 	/// Distance point to plane
 	float			SignedDistance(Vec3Arg inPoint) const									{ return inPoint.Dot(GetNormal()) + GetConstant(); }

+ 1 - 1
Jolt/Geometry/RayAABox.h

@@ -11,7 +11,7 @@ class RayInvDirection
 public:
 	/// Constructors
 	inline			RayInvDirection() = default;
-	inline			RayInvDirection(Vec3Arg inDirection) { Set(inDirection); }
+	inline explicit	RayInvDirection(Vec3Arg inDirection) { Set(inDirection); }
 
 	/// Set reciprocal from ray direction
 	inline void		Set(Vec3Arg inDirection)

+ 1 - 1
Jolt/ObjectStream/ObjectStreamBinaryIn.h

@@ -12,7 +12,7 @@ class ObjectStreamBinaryIn : public ObjectStreamIn
 {
 public:
 	/// Constructor
-								ObjectStreamBinaryIn(istream &inStream);
+	explicit 					ObjectStreamBinaryIn(istream &inStream);
 
 	///@name Input type specific operations
 	virtual bool				ReadDataType(EDataType &outType) override;

+ 1 - 1
Jolt/ObjectStream/ObjectStreamBinaryOut.h

@@ -12,7 +12,7 @@ class ObjectStreamBinaryOut : public ObjectStreamOut
 {
 public:
 	/// Constructor and destructor
-								ObjectStreamBinaryOut(ostream &inStream);
+	explicit 					ObjectStreamBinaryOut(ostream &inStream);
 
 	///@name Output type specific operations
 	virtual void				WriteDataType(EDataType inType) override;

+ 2 - 2
Jolt/ObjectStream/ObjectStreamIn.h

@@ -102,7 +102,7 @@ public:
 
 protected:
 	/// Constructor
-								ObjectStreamIn(istream &inStream);
+	explicit 					ObjectStreamIn(istream &inStream);
 
 	/// Determine the type and version of an object stream
 	static bool					GetInfo(istream &inStream, EStreamType &outType, int &outVersion, int &outRevision);
@@ -127,7 +127,7 @@ private:
 	struct ClassDescription
 	{
 								ClassDescription()										: mRTTI(nullptr) { }
-								ClassDescription(const RTTI *inRTTI)					: mRTTI(inRTTI) { }
+		explicit 				ClassDescription(const RTTI *inRTTI)					: mRTTI(inRTTI) { }
 
 		const RTTI *			mRTTI;
 		vector<AttributeDescription>	mAttributes;

+ 1 - 1
Jolt/ObjectStream/ObjectStreamOut.h

@@ -90,7 +90,7 @@ protected:
 	static ObjectStreamOut *	Open(EStreamType inType, ostream &inStream);
 
 	/// Constructor
-								ObjectStreamOut(ostream &inStream);
+	explicit 					ObjectStreamOut(ostream &inStream);
 
 	ostream &					mStream;
 

+ 1 - 1
Jolt/ObjectStream/ObjectStreamTextIn.h

@@ -12,7 +12,7 @@ class ObjectStreamTextIn : public ObjectStreamIn
 {
 public:
 	/// Constructor
-								ObjectStreamTextIn(istream &inStream);
+	explicit					ObjectStreamTextIn(istream &inStream);
 
 	///@name Input type specific operations
 	virtual bool				ReadDataType(EDataType &outType) override;

+ 1 - 1
Jolt/ObjectStream/ObjectStreamTextOut.h

@@ -12,7 +12,7 @@ class ObjectStreamTextOut : public ObjectStreamOut
 {
 public:
 	/// Constructor and destructor
-								ObjectStreamTextOut(ostream &inStream);
+	explicit					ObjectStreamTextOut(ostream &inStream);
 
 	///@name Output type specific operations
 	virtual void				WriteDataType(EDataType inType) override;

+ 1 - 1
Jolt/ObjectStream/SerializableAttribute.h

@@ -16,7 +16,7 @@ class SerializableAttribute : public RTTIAttribute
 {
 public:
 	/// Constructor
-								SerializableAttribute(const char *inName)							: RTTIAttribute(inName) { }
+	explicit					SerializableAttribute(const char *inName)							: RTTIAttribute(inName) { }
 
 	///@name Serialization operations
 	virtual bool				IsType(int inArrayDepth, ObjectStream::EDataType inDataType, const char *inClassName) const = 0;

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

@@ -258,7 +258,7 @@ public:
 private:
 	friend class BodyManager;
 
-							Body(bool);														///< Alternative constructor that initializes all members
+	explicit				Body(bool);														///< Alternative constructor that initializes all members
 
 	void					GetSleepTestPoints(Vec3 *outPoints) const;						///< Determine points to test for checking if body is sleeping: COM, COM + largest bounding box axis, COM + second largest bounding box axis
 	void					ResetSleepTestSpheres();										///< Reset spheres to current position as returned by GetSleepTestPoints

+ 7 - 5
Jolt/Physics/Body/BodyAccess.cpp

@@ -5,11 +5,13 @@
 
 #include <Physics/Body/BodyAccess.h>
 
+#ifdef JPH_ENABLE_ASSERTS
+
 namespace JPH {
 
-#ifdef JPH_ENABLE_ASSERTS
-	thread_local BodyAccess::EAccess	BodyAccess::sVelocityAccess = BodyAccess::EAccess::ReadWrite;
-	thread_local BodyAccess::EAccess	BodyAccess::sPositionAccess = BodyAccess::EAccess::ReadWrite;
-#endif
+thread_local BodyAccess::EAccess	BodyAccess::sVelocityAccess = BodyAccess::EAccess::ReadWrite;
+thread_local BodyAccess::EAccess	BodyAccess::sPositionAccess = BodyAccess::EAccess::ReadWrite;
+
+} // JPH
 
-} // JPH
+#endif

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

@@ -3,10 +3,10 @@
 
 #pragma once
 
-namespace JPH {
-
 #ifdef JPH_ENABLE_ASSERTS
 
+namespace JPH {
+
 class BodyAccess
 {
 public:
@@ -46,6 +46,6 @@ public:
 	static thread_local EAccess			sPositionAccess;
 };
 
-#endif // JPH_ENABLE_ASSERTS
+} // JPH
 
-} // JPH
+#endif // JPH_ENABLE_ASSERTS

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

@@ -35,7 +35,7 @@ class IgnoreSingleBodyFilter : public BodyFilter
 {
 public:
 	/// Constructor, pass the body you want to ignore
-							IgnoreSingleBodyFilter(const BodyID &inBodyID) : 
+	explicit				IgnoreSingleBodyFilter(const BodyID &inBodyID) : 
 		mBodyID(inBodyID)
 	{
 	}

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

@@ -19,7 +19,7 @@ public:
 	using MutexMask = BodyManager::MutexMask;
 
 	/// Constructor
-								BodyLockInterface(BodyManager &inBodyManager)		: mBodyManager(inBodyManager) { }
+	explicit					BodyLockInterface(BodyManager &inBodyManager)		: mBodyManager(inBodyManager) { }
 	virtual						~BodyLockInterface() = default;
 
 	///@name Locking functions

+ 2 - 2
Jolt/Physics/Character/Character.cpp

@@ -103,7 +103,7 @@ void Character::PostSimulation(float inMaxSeparationDistance, bool inLockBodies)
 	{
 	public:
 		// Constructor
-							MyCollector(Vec3Arg inGravity) : mGravity(inGravity) { }
+		explicit			MyCollector(Vec3Arg inGravity) : mGravity(inGravity) { }
 
 		// See: CollectorType::AddHit
 		virtual void		AddHit(const CollideShapeResult &inResult) override
@@ -217,7 +217,7 @@ bool Character::SetShape(const Shape *inShape, float inMaxPenetrationDepth, bool
 		{
 		public:
 			// Constructor
-								MyCollector(float inMaxPenetrationDepth) : mMaxPenetrationDepth(inMaxPenetrationDepth) { }
+			explicit			MyCollector(float inMaxPenetrationDepth) : mMaxPenetrationDepth(inMaxPenetrationDepth) { }
 
 			// See: CollectorType::AddHit
 			virtual void		AddHit(const CollideShapeResult &inResult) override

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

@@ -114,7 +114,7 @@ class SpecifiedBroadPhaseLayerFilter : public BroadPhaseLayerFilter
 {
 public:
 	/// Constructor
-									SpecifiedBroadPhaseLayerFilter(BroadPhaseLayer inLayer) :
+	explicit						SpecifiedBroadPhaseLayerFilter(BroadPhaseLayer inLayer) :
 		mLayer(inLayer)
 	{
 	}

+ 3 - 3
Jolt/Physics/Collision/BroadPhase/QuadTree.cpp

@@ -117,7 +117,7 @@ void QuadTree::GetBodyLocation(const TrackingVector &inTracking, BodyID inBodyID
 	JPH_ASSERT(mAllocator->Get(outNodeIdx).mChildNodeID[outChildIdx] == inBodyID, "Make sure that the body is in the node where it should be");
 }
 
-void QuadTree::SetBodyLocation(TrackingVector &ioTracking, BodyID inBodyID, uint32 inNodeIdx, uint32 inChildIdx)
+void QuadTree::SetBodyLocation(TrackingVector &ioTracking, BodyID inBodyID, uint32 inNodeIdx, uint32 inChildIdx) const
 { 
 	JPH_ASSERT(inNodeIdx <= 0x3fffffff);
 	JPH_ASSERT(inChildIdx < 4); 
@@ -350,7 +350,7 @@ void QuadTree::UpdatePrepare(const BodyVector &inBodies, TrackingVector &ioTrack
 	outUpdateState.mRootNodeID = root_node_id;
 }
 
-void QuadTree::UpdateFinalize(const BodyVector &inBodies, TrackingVector &ioTracking, UpdateState &inUpdateState)
+void QuadTree::UpdateFinalize([[maybe_unused]] const BodyVector &inBodies, [[maybe_unused]] TrackingVector &ioTracking, UpdateState &inUpdateState)
 {
 	// Tree building is complete, now we switch the old with the new tree
 	uint32 new_root_idx = mRootNodeIndex ^ 1;
@@ -863,7 +863,7 @@ void QuadTree::AddBodiesAbort(TrackingVector &ioTracking, const AddState &inStat
 	mAllocator->DestructObjectBatch(free_batch);
 }
 
-void QuadTree::RemoveBodies(const BodyVector &inBodies, TrackingVector &ioTracking, BodyID *ioBodyIDs, int inNumber)
+void QuadTree::RemoveBodies([[maybe_unused]] const BodyVector &inBodies, TrackingVector &ioTracking, BodyID *ioBodyIDs, int inNumber)
 {
 	// Assert sane input
 	JPH_ASSERT(ioBodyIDs != nullptr);

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

@@ -67,7 +67,7 @@ private:
 	public:
 		/// Constructor
 								AtomicNodeID() = default;
-								AtomicNodeID(const NodeID &inRHS)			: mID(inRHS.mID) { }
+		explicit				AtomicNodeID(const NodeID &inRHS)			: mID(inRHS.mID) { }
 
 		/// Assignment
 		inline void				operator = (const NodeID &inRHS)			{ mID = inRHS.mID; }
@@ -94,7 +94,7 @@ private:
 	{
 	public:
 		/// Construct node
-								Node(bool inLocked);
+		explicit				Node(bool inLocked);
 
 		/// Get bounding box encapsulating all children
 		void					GetNodeBounds(AABox &outBounds) const;
@@ -269,7 +269,7 @@ private:
 
 	/// Caches location of body inBodyID in the tracker, body can be found in mNodes[inNodeIdx].mChildNodeID[inChildIdx]
 	void						GetBodyLocation(const TrackingVector &inTracking, BodyID inBodyID, uint32 &outNodeIdx, uint32 &outChildIdx) const;
-	void						SetBodyLocation(TrackingVector &ioTracking, BodyID inBodyID, uint32 inNodeIdx, uint32 inChildIdx);
+	void						SetBodyLocation(TrackingVector &ioTracking, BodyID inBodyID, uint32 inNodeIdx, uint32 inChildIdx) const;
 	void						InvalidateBodyLocation(TrackingVector &ioTracking, BodyID inBodyID);
 
 	/// Get the current root of the tree

+ 1 - 1
Jolt/Physics/Collision/GroupFilterTable.h

@@ -58,7 +58,7 @@ private:
 
 public:
 	/// Constructs the table with inNumSubGroups subgroups, initially all collision pairs are enabled except when the sub group ID is the same
-							GroupFilterTable(uint inNumSubGroups = 0) :
+	explicit				GroupFilterTable(uint inNumSubGroups = 0) :
 		mNumSubGroups(inNumSubGroups)
 	{
 		// By default everything collides

+ 1 - 1
Jolt/Physics/Collision/ObjectLayer.h

@@ -72,7 +72,7 @@ class SpecifiedObjectLayerFilter : public ObjectLayerFilter
 {
 public:
 	/// Constructor
-							SpecifiedObjectLayerFilter(ObjectLayer inLayer) :
+	explicit				SpecifiedObjectLayerFilter(ObjectLayer inLayer) :
 		mLayer(inLayer)
 	{
 	}

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

@@ -397,7 +397,7 @@ Vec3 ConvexHullShape::GetSurfaceNormal(const SubShapeID &inSubShapeID, Vec3Arg i
 class ConvexHullShape::HullNoConvex final : public Support
 {
 public:
-							HullNoConvex(float inConvexRadius) : 
+	explicit				HullNoConvex(float inConvexRadius) : 
 		mConvexRadius(inConvexRadius)
 	{ 
 		static_assert(sizeof(HullNoConvex) <= sizeof(SupportBuffer), "Buffer size too small"); 
@@ -449,7 +449,7 @@ private:
 class ConvexHullShape::HullWithConvex final : public Support
 {
 public:
-							HullWithConvex(const ConvexHullShape *inShape) : 
+	explicit				HullWithConvex(const ConvexHullShape *inShape) : 
 		mShape(inShape)
 	{ 
 		static_assert(sizeof(HullWithConvex) <= sizeof(SupportBuffer), "Buffer size too small"); 

+ 10 - 10
Jolt/Physics/Collision/Shape/MeshShape.cpp

@@ -523,22 +523,22 @@ bool MeshShape::CastRay(const RayCast &inRay, const SubShapeIDCreator &inSubShap
 
 	struct Visitor
 	{
-				Visitor(RayCastResult &ioHit) : 
+		explicit	Visitor(RayCastResult &ioHit) : 
 			mHit(ioHit)
 		{
 		}
 
-		bool	ShouldAbort() const
+		bool		ShouldAbort() const
 		{
 			return mHit.mFraction <= 0.0f;
 		}
 
-		bool	ShouldVisitNode(int inStackTop) const
+		bool		ShouldVisitNode(int inStackTop) const
 		{
 			return mDistanceStack[inStackTop] < mHit.mFraction;
 		}
 
-		int		VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop) 
+		int			VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop) 
 		{
 			// Test bounds of 4 children
 			Vec4 distance = RayAABox4(mRayOrigin, mRayInvDirection, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
@@ -558,7 +558,7 @@ bool MeshShape::CastRay(const RayCast &inRay, const SubShapeIDCreator &inSubShap
 			return num_results;
 		}
 
-		void	VisitTriangles(const TriangleCodec::DecodingContext &ioContext, Vec3Arg inRootBoundsMin, Vec3Arg inRootBoundsMax, const void *inTriangles, int inNumTriangles, uint32 inTriangleBlockID) 
+		void		VisitTriangles(const TriangleCodec::DecodingContext &ioContext, Vec3Arg inRootBoundsMin, Vec3Arg inRootBoundsMax, const void *inTriangles, int inNumTriangles, uint32 inTriangleBlockID) 
 		{
 			// Test against triangles
 			uint32 triangle_idx;
@@ -600,22 +600,22 @@ void MeshShape::CastRay(const RayCast &inRay, const RayCastSettings &inRayCastSe
 
 	struct Visitor
 	{
-				Visitor(CastRayCollector &ioCollector) : 
+		explicit	Visitor(CastRayCollector &ioCollector) : 
 			mCollector(ioCollector)
 		{
 		}
 
-		bool	ShouldAbort() const
+		bool		ShouldAbort() const
 		{
 			return mCollector.ShouldEarlyOut();
 		}
 
-		bool	ShouldVisitNode(int inStackTop) const
+		bool		ShouldVisitNode(int inStackTop) const
 		{
 			return mDistanceStack[inStackTop] < mCollector.GetEarlyOutFraction();
 		}
 
-		int		VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop) 
+		int			VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop) 
 		{
 			// Test bounds of 4 children
 			Vec4 distance = RayAABox4(mRayOrigin, mRayInvDirection, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
@@ -635,7 +635,7 @@ void MeshShape::CastRay(const RayCast &inRay, const RayCastSettings &inRayCastSe
 			return num_results;
 		}
 
-		void	VisitTriangles(const TriangleCodec::DecodingContext &ioContext, Vec3Arg inRootBoundsMin, Vec3Arg inRootBoundsMax, const void *inTriangles, int inNumTriangles, uint32 inTriangleBlockID) 
+		void		VisitTriangles(const TriangleCodec::DecodingContext &ioContext, Vec3Arg inRootBoundsMin, Vec3Arg inRootBoundsMax, const void *inTriangles, int inNumTriangles, uint32 inTriangleBlockID) 
 		{
 			// Create ID for triangle block
 			SubShapeIDCreator block_sub_shape_id = mSubShapeIDCreator.PushID(inTriangleBlockID, mTriangleBlockIDBits);

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

@@ -74,7 +74,7 @@ AABox SphereShape::GetWorldSpaceBounds(Mat44Arg inCenterOfMassTransform, Vec3Arg
 class SphereShape::SphereNoConvex final : public Support
 {
 public:
-					SphereNoConvex(float inRadius) :
+	explicit		SphereNoConvex(float inRadius) :
 		mRadius(inRadius)
 	{ 
 		static_assert(sizeof(SphereNoConvex) <= sizeof(SupportBuffer), "Buffer size too small"); 
@@ -98,7 +98,7 @@ private:
 class SphereShape::SphereWithConvex final : public Support
 {
 public:
-					SphereWithConvex(float inRadius) :
+	explicit		SphereWithConvex(float inRadius) :
 		mRadius(inRadius)
 	{ 
 		static_assert(sizeof(SphereWithConvex) <= sizeof(SupportBuffer), "Buffer size too small"); 

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

@@ -59,7 +59,7 @@ private:
 	static constexpr Type cEmpty = ~Type(0);
 
 	/// Constructor
-						SubShapeID(const Type &inValue) : mValue(inValue) { }
+	explicit			SubShapeID(const Type &inValue) : mValue(inValue) { }
 
 	/// Adds an id at a particular position in the chain
 	/// (this should really only be called by the SubShapeIDCreator)

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

@@ -66,7 +66,7 @@ class Constraint : public RefTarget<Constraint>
 {
 public:
 	/// Constructor
-								Constraint(const ConstraintSettings &inSettings)
+	explicit					Constraint([[maybe_unused]] const ConstraintSettings &inSettings)
 #ifdef JPH_DEBUG_RENDERER
 									: mDrawConstraintSize(inSettings.mDrawConstraintSize)
 #endif // JPH_DEBUG_RENDERER

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

@@ -22,7 +22,7 @@ class ContactConstraintManager : public NonCopyable
 {
 public:
 	/// Constructor
-								ContactConstraintManager(const PhysicsSettings &inPhysicsSettings);
+	explicit					ContactConstraintManager(const PhysicsSettings &inPhysicsSettings);
 								~ContactConstraintManager();
 
 	/// Initialize the system.

+ 4 - 4
Jolt/Physics/PhysicsLock.cpp

@@ -5,12 +5,12 @@
 
 #include <Physics/PhysicsLock.h>
 
-namespace JPH {
-
 #ifdef JPH_ENABLE_ASSERTS
 
+namespace JPH {
+
 thread_local uint32 PhysicsLock::sLockedMutexes = 0;
 
-#endif
+} // JPH
 
-} // JPH
+#endif

+ 4 - 4
Jolt/Physics/PhysicsLock.h

@@ -40,28 +40,28 @@ public:
 #endif // !JPH_ENABLE_ASSERTS
 
 	template <class LockType>
-	static inline void			sLock(LockType &inMutex, EPhysicsLockTypes inType)
+	static inline void			sLock(LockType &inMutex, [[maybe_unused]] EPhysicsLockTypes inType)
 	{
 		JPH_IF_ENABLE_ASSERTS(sCheckLock(inType);)
 		inMutex.lock();
 	}
 
 	template <class LockType>
-	static inline void			sUnlock(LockType &inMutex, EPhysicsLockTypes inType)
+	static inline void			sUnlock(LockType &inMutex, [[maybe_unused]] EPhysicsLockTypes inType)
 	{
 		JPH_IF_ENABLE_ASSERTS(sCheckUnlock(inType);)
 		inMutex.unlock();
 	}
 
 	template <class LockType>
-	static inline void			sLockShared(LockType &inMutex, EPhysicsLockTypes inType)
+	static inline void			sLockShared(LockType &inMutex, [[maybe_unused]] EPhysicsLockTypes inType)
 	{
 		JPH_IF_ENABLE_ASSERTS(sCheckLock(inType);)
 		inMutex.lock_shared();
 	}
 
 	template <class LockType>
-	static inline void			sUnlockShared(LockType &inMutex, EPhysicsLockTypes inType)
+	static inline void			sUnlockShared(LockType &inMutex, [[maybe_unused]] EPhysicsLockTypes inType)
 	{
 		JPH_IF_ENABLE_ASSERTS(sCheckUnlock(inType);)
 		inMutex.unlock_shared();

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

@@ -96,7 +96,7 @@ class Ragdoll : public RefTarget<Ragdoll>
 {
 public:
 	/// Constructor
-										Ragdoll(PhysicsSystem *inSystem) : mSystem(inSystem) { }
+	explicit							Ragdoll(PhysicsSystem *inSystem) : mSystem(inSystem) { }
 
 	/// Destructor
 										~Ragdoll();

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

@@ -32,7 +32,7 @@ class WheelTV : public Wheel
 {
 public:
 	/// Constructor
-								WheelTV(const WheelSettingsTV &inWheel);
+	explicit					WheelTV(const WheelSettingsTV &inWheel);
 
 	/// Override GetSettings and cast to the correct class
 	const WheelSettingsTV *		GetSettings() const							{ return static_cast<const WheelSettingsTV *>(mSettings.GetPtr()); }

+ 1 - 1
Jolt/Physics/Vehicle/VehicleController.h

@@ -33,7 +33,7 @@ class VehicleController : public RefTarget<VehicleController>
 {
 public:
 	/// Constructor / destructor
-								VehicleController(VehicleConstraint &inConstraint) : mConstraint(inConstraint) { }
+	explicit					VehicleController(VehicleConstraint &inConstraint) : mConstraint(inConstraint) { }
 	virtual						~VehicleController() = default;
 
 protected:

+ 2 - 3
Jolt/Physics/Vehicle/Wheel.cpp

@@ -49,7 +49,8 @@ void WheelSettings::RestoreBinaryState(StreamIn &inStream)
 }
 
 Wheel::Wheel(const WheelSettings &inSettings) :
-	mSettings(&inSettings)
+	mSettings(&inSettings),
+	mContactLength(inSettings.mSuspensionMaxLength + inSettings.mRadius)
 {
 	JPH_ASSERT(inSettings.mDirection.IsNormalized());
 	JPH_ASSERT(inSettings.mSuspensionMinLength >= 0.0f);
@@ -59,8 +60,6 @@ Wheel::Wheel(const WheelSettings &inSettings) :
 	JPH_ASSERT(inSettings.mSuspensionDamping >= 0.0f);
 	JPH_ASSERT(inSettings.mRadius > 0.0f);
 	JPH_ASSERT(inSettings.mWidth >= 0.0f);
-
-	mContactLength = inSettings.mSuspensionMaxLength + inSettings.mRadius;
 }
 
 bool Wheel::SolveLongitudinalConstraintPart(const VehicleConstraint &inConstraint, float inMinImpulse, float inMaxImpulse) 

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

@@ -41,7 +41,7 @@ class WheelWV : public Wheel
 {
 public:
 	/// Constructor
-								WheelWV(const WheelSettingsWV &inWheel);
+	explicit					WheelWV(const WheelSettingsWV &inWheel);
 
 	/// Override GetSettings and cast to the correct class
 	const WheelSettingsWV *		GetSettings() const							{ return static_cast<const WheelSettingsWV *>(mSettings.GetPtr()); }