Browse Source

CharacterVirtual::GetID returns a const ref now

Some documentation update
Jorrit Rouwe 6 months ago
parent
commit
cf1302a124
3 changed files with 19 additions and 14 deletions
  1. 12 11
      Docs/ReleaseNotes.md
  2. 1 1
      Jolt/Physics/Character/CharacterVirtual.h
  3. 6 2
      Jolt/Physics/PhysicsSystem.h

+ 12 - 11
Docs/ReleaseNotes.md

@@ -6,11 +6,12 @@ For breaking API changes see [this document](https://github.com/jrouwe/JoltPhysi
 
 ### New functionality
 
+* Fixed a number of issues when creating very large `MeshShape`s. `MeshShape`s of up to 110M triangles are possible now, but the actual maximum is very dependent on how the triangles in the mesh are connected.
 * Optimized creation of `MeshShape`. Improves build speed by about 25% and reduces number of allocations by a factor of 1000. Allocations caused contention when building meshes from multiple threads.
+* Added `MeshShapeSettings::mBuildQuality` which allows selecting between faster mesh creation or faster run time performance.
 * Removed the use of `std::unordered_map` and `std::unordered_set` and replaced them with our own implementation: `UnorderedMap` and `UnorderedSet`.
 * Added `MotionProperties::ScaleToMass`. This lets you easily change the mass and inertia tensor of a body after creation.
 * Split up `Body::ApplyBuoyancyImpulse` into `Body::GetSubmergedVolume` and `Body::ApplyBuoyancyImpulse`. This allows you to use the calculated submerged volume for other purposes.
-* Fixed a number of issues when creating very large MeshShapes. MeshShapes of up to 110M triangles are possible now, but the actual maximum is very dependent on how the triangles in the mesh are connected.
 * Added `PhysicsSystem::SetSimShapeFilter`. This allows filtering out collisions between sub shapes within a body and can for example be used to have a single body that contains a low detail simulation shape an a high detail collision query shape.
 * Added an example of a body that's both a sensor and a rigid body in `ContactListenerTest`.
 * Added binary serialization to `SkeletalAnimation`.
@@ -19,14 +20,14 @@ For breaking API changes see [this document](https://github.com/jrouwe/JoltPhysi
 * Added the ability to add a sub shape at a specified index in a `MutableCompoundShape` rather than at the end.
 * The Samples and JoltViewer can run on Linux using Vulkan. Make sure to install the Vulkan SDK before compiling (see: `Build/ubuntu24_install_vulkan_sdk.sh`).
 * The Samples and JoltViewer can run on macOS using Metal.
-* Added `STLLocalAllocator` which is an allocator that can be used in e.g. the Array class. It keeps a fixed size buffer for N elements and only when it runs out of space falls back to the heap.
+* Added `STLLocalAllocator` which is an allocator that can be used in e.g. the `Array` class. It keeps a fixed size buffer for N elements and only when it runs out of space falls back to the heap.
 * Added support for `CharacterVirtual` to override the inner rigid body ID. This can be used to make the simulation deterministic in e.g. client/server setups.
 * Added `OnContactPersisted`, `OnContactRemoved`, `OnCharacterContactPersisted` and `OnCharacterContactRemoved` functions on `CharacterContactListener` to better match the interface of `ContactListener`.
 * Every `CharacterVirtual` now has a `CharacterID`. This ID can be used to identify the character after removal and is used to make the simulation deterministic in case a character collides with multiple other virtual characters.
 * Added overridable `CollisionCollector::OnBodyEnd` that is called after all hits for a body have been processed when collecting hits through `NarrowPhaseQuery`.
 * Added `ClosestHitPerBodyCollisionCollector` which will report the closest / deepest hit per body that the collision query collides with.
 * Added `PhysicsSystem::SetSimCollideBodyVsBody`. This allows overriding the collision detection between two bodies. It can be used to only store the 1st hit for sensor collisions. This makes sensors cheaper if you only need to know if there is an overlap or not. An example can be found in `SimCollideBodyVsBodyTest`.
-* Added the following constants on PhysicsSystem: cMaxBodiesLimit, cMaxBodyPairsLimit and cMaxContactConstraintsLimit. These constants are the max allowable values for PhysicsSystem::Init. Exceeding these will trigger an assert and the system will clamp the values.
+* Added the following constants on PhysicsSystem: `cMaxBodiesLimit`, `cMaxBodyPairsLimit` and `cMaxContactConstraintsLimit`. These constants are the max allowable values for `PhysicsSystem::Init`. Exceeding these will trigger an assert and the system will clamp the values. Note that on a 32 bit system, you'll run out of memory before you reach these values.
 
 ### Bug fixes
 
@@ -34,20 +35,20 @@ For breaking API changes see [this document](https://github.com/jrouwe/JoltPhysi
 * `std::push_heap`/`pop_heap` behave differently on macOS vs Windows/Linux when elements compare equal, this made the cross platform deterministic build not deterministic in some cases.
 * Added overloads for placement new in the `JPH_OVERRIDE_NEW_DELETE` macro, this means it is no longer needed to do `:: new (address) JPH::class_name(constructor_arguments)` but you can do `new (address) JPH::class_name(constructor_arguments)`.
 * Fixed a GCC warning `-Wshadow=global`.
-* BodyInterface::AddForce applied a force per soft body vertex rather than to the whole body, this resulted in a soft body accelerating much more compared to a rigid body of the same mass.
+* `BodyInterface::AddForce` applied a force per soft body vertex rather than to the whole body, this resulted in a soft body accelerating much more compared to a rigid body of the same mass.
 * Removing a sub shape from a `MutableCompoundShape` would not update the bounding box if the last shape was removed, which can result in a small performance loss.
 * VehicleConstraint would override `Body::SetAllowSleeping` every frame, making it impossible for client code to configure a vehicle that cannot go to sleep.
-* Fixed `CharacterVirtual::Contact::mIsSensorB` not being persisted in SaveState.
-* Fixed `CharacterVirtual::Contact::mHadContact` not being true for collisions with sensors. They will still be marked as mWasDiscarded to prevent any further interaction.
-* Fixed Character::SetShape failing to switch when standing inside a sensor / Character::PostSimulation finding a sensor as ground collision.
+* Fixed `CharacterVirtual::Contact::mIsSensorB` not being persisted in `SaveState`.
+* Fixed `CharacterVirtual::Contact::mHadContact` not being true for collisions with sensors. They will still be marked as `mWasDiscarded` to prevent any further interaction.
+* Fixed `Character::SetShape` failing to switch when standing inside a sensor / `Character::PostSimulation` finding a sensor as ground collision.
 * Fixed numerical inaccuracy in penetration depth calculation when `CollideShapeSettings::mMaxSeparationDistance` was set to a really high value (e.g. 1000).
 * Bugfix in `Semaphore::Acquire` for non-windows platform. The count was updated before waiting, meaning that the counter would become -(number of waiting threads) and the semaphore would not wake up until at least the same amount of releases was done. In practice this meant that the main thread had to do the last (number of threads) jobs, slowing down the simulation a bit.
 * An empty `MutableCompoundShape` now returns the same local bounding box as `EmptyShape` (a point at (0, 0, 0)). This prevents floating point overflow exceptions.
-* Fixed a bug in ManifoldBetweenTwoFaces that led to incorrect `ContactManifold::mRelativeContactPointsOn2` when the contact normal and the face normal were not roughly parallel. Also it led to possibly jitter in the simulation in that case.
-* Fixed InternalEdgeRemovingCollector not working when colliding with a very dense triangle grid because it ran out of internal space. Now falling back to memory allocations when this happens to avoid ghost collisions.
+* Fixed a bug in `ManifoldBetweenTwoFaces` that led to incorrect `ContactManifold::mRelativeContactPointsOn2` when the contact normal and the face normal were not roughly parallel. Also it led to possibly jitter in the simulation in that case.
+* Fixed `InternalEdgeRemovingCollector` not working when colliding with a very dense triangle grid because it ran out of internal space. Now falling back to memory allocations when this happens to avoid ghost collisions.
 * Fixed running out of stack space when simulating a really high number of active rigid bodies.
-* Moved the 'broad phase bit' to the highest bit in BodyID to avoid running out of NodeIDs in BroadPhaseQuadTree when calling PhysicsSystem::OptimizeBroadPhase on a tree with a very high body count.
-* TempAllocatorImpl uses 64 bit integers internally to allow for a higher max contact constraint count.
+* Moved the 'broad phase bit' to the highest bit in `BodyID` to avoid running out of `NodeID`s in `BroadPhaseQuadTree` when calling `PhysicsSystem::OptimizeBroadPhase` on a tree with a very high body count.
+* `TempAllocatorImpl` uses 64 bit integers internally to allow for a higher max contact constraint count.
 
 ## v5.2.0
 

+ 1 - 1
Jolt/Physics/Character/CharacterVirtual.h

@@ -215,7 +215,7 @@ public:
 	virtual								~CharacterVirtual() override;
 
 	/// The ID of this character
-	CharacterID							GetID() const											{ return mID; }
+	inline const CharacterID &			GetID() const											{ return mID; }
 
 	/// Set the contact listener
 	void								SetListener(CharacterContactListener *inListener)		{ mListener = inListener; }

+ 6 - 2
Jolt/Physics/PhysicsSystem.h

@@ -38,10 +38,14 @@ public:
 	/// The maximum value that can be passed to Init for inMaxBodies.
 	static constexpr uint		cMaxBodiesLimit = BodyID::cMaxBodyIndex + 1;
 
-	/// The maximum value that can be passed to Init for inMaxBodyPairs. Note you should really use a lower value, using this value will cost a lot of memory!
+	/// The maximum value that can be passed to Init for inMaxBodyPairs.
+	/// Note you should really use a lower value, using this value will cost a lot of memory!
+	/// On a 32 bit platform, you'll run out of memory way before you reach this limit.
 	static constexpr uint		cMaxBodyPairsLimit = ContactConstraintManager::cMaxBodyPairsLimit;
 
-	/// The maximum value that can be passed to Init for inMaxContactConstraints. Note you should really use a lower value, using this value will cost a lot of memory!
+	/// The maximum value that can be passed to Init for inMaxContactConstraints.
+	/// Note you should really use a lower value, using this value will cost a lot of memory!
+	/// On a 32 bit platform, you'll run out of memory way before you reach this limit.
 	static constexpr uint		cMaxContactConstraintsLimit = ContactConstraintManager::cMaxContactConstraintsLimit;
 
 	/// Initialize the system.