Browse Source

Documentation

See #951
Jorrit Rouwe 1 year ago
parent
commit
e6c8173612
3 changed files with 12 additions and 6 deletions
  1. 8 4
      HelloWorld/HelloWorld.cpp
  2. 1 1
      Jolt/Core/Factory.h
  3. 3 1
      Jolt/RegisterTypes.h

+ 8 - 4
HelloWorld/HelloWorld.cpp

@@ -210,17 +210,21 @@ public:
 // Program entry point
 // Program entry point
 int main(int argc, char** argv)
 int main(int argc, char** argv)
 {
 {
-	// Register allocation hook
+	// Register allocation hook. In this example we'll just let Jolt use malloc / free but you can override these if you want (see Memory.h).
+	// This needs to be done before any other Jolt function is called.
 	RegisterDefaultAllocator();
 	RegisterDefaultAllocator();
 
 
-	// Install callbacks
+	// Install trace and assert callbacks
 	Trace = TraceImpl;
 	Trace = TraceImpl;
 	JPH_IF_ENABLE_ASSERTS(AssertFailed = AssertFailedImpl;)
 	JPH_IF_ENABLE_ASSERTS(AssertFailed = AssertFailedImpl;)
 
 
-	// Create a factory
+	// Create a factory, this class is responsible for creating instances of classes based on their name or hash and is mainly used for deserialization of saved data.
+	// It is not directly used in this example but still required.
 	Factory::sInstance = new Factory();
 	Factory::sInstance = new Factory();
 
 
-	// Register all Jolt physics types
+	// Register all physics types with the factory and install their collision handlers with the CollisionDispatch class.
+	// If you have your own custom shape types you probably need to register their handlers with the CollisionDispatch before calling this function.
+	// If you implement your own default material (PhysicsMaterial::sDefault) make sure to initialize it before this function or else this function will create one for you.
 	RegisterTypes();
 	RegisterTypes();
 
 
 	// We need a temp allocator for temporary allocations during the physics update. We're
 	// We need a temp allocator for temporary allocations during the physics update. We're

+ 1 - 1
Jolt/Core/Factory.h

@@ -9,7 +9,7 @@
 
 
 JPH_NAMESPACE_BEGIN
 JPH_NAMESPACE_BEGIN
 
 
-/// Factory, to create RTTI objects
+/// This class is responsible for creating instances of classes based on their name or hash and is mainly used for deserialization of saved data.
 class JPH_EXPORT Factory
 class JPH_EXPORT Factory
 {
 {
 public:
 public:

+ 3 - 1
Jolt/RegisterTypes.h

@@ -18,7 +18,9 @@ JPH_INLINE bool VerifyJoltVersionID() { return VerifyJoltVersionIDInternal(JPH_V
 /// Internal helper function
 /// Internal helper function
 JPH_EXPORT extern void RegisterTypesInternal(uint64 inVersionID);
 JPH_EXPORT extern void RegisterTypesInternal(uint64 inVersionID);
 
 
-/// Register all physics types with the factory
+/// Register all physics types with the factory and install their collision handlers with the CollisionDispatch class.
+/// If you have your own custom shape types you probably need to register their handlers with the CollisionDispatch before calling this function.
+/// If you implement your own default material (PhysicsMaterial::sDefault) make sure to initialize it before this function or else this function will create one for you.
 JPH_INLINE void RegisterTypes() { RegisterTypesInternal(JPH_VERSION_ID); }
 JPH_INLINE void RegisterTypes() { RegisterTypesInternal(JPH_VERSION_ID); }
 
 
 /// Unregisters all types with the factory and cleans up the default material
 /// Unregisters all types with the factory and cleans up the default material