Add documentation
This commit is contained in:
parent
29e5f2b7b4
commit
fcac6457a7
|
@ -115,7 +115,6 @@ inline bool PairManager::isDifferentPair(const BroadPhasePair& pair1, bodyindex
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the next power of two of a 32bits integer using a SWAR algorithm
|
// Return the next power of two of a 32bits integer using a SWAR algorithm
|
||||||
// TODO : Add documentation
|
|
||||||
inline luint PairManager::computeNextPowerOfTwo(luint number) const {
|
inline luint PairManager::computeNextPowerOfTwo(luint number) const {
|
||||||
number |= (number >> 1);
|
number |= (number >> 1);
|
||||||
number |= (number >> 2);
|
number |= (number >> 2);
|
||||||
|
@ -149,7 +148,8 @@ inline void PairManager::sortIDs(bodyindex &id1, bodyindex &id2) const {
|
||||||
|
|
||||||
// This method returns an hash value for a 32 bits key
|
// This method returns an hash value for a 32 bits key
|
||||||
// using Thomas Wang's hash technique.
|
// using Thomas Wang's hash technique.
|
||||||
// TODO : Add documentation here
|
// This hash function can be found at :
|
||||||
|
// http://www.concentric.net/~ttwang/tech/inthash.htm
|
||||||
inline int PairManager::computeHash32Bits(int key) const {
|
inline int PairManager::computeHash32Bits(int key) const {
|
||||||
key += ~(key << 15);
|
key += ~(key << 15);
|
||||||
key ^= (key >> 10);
|
key ^= (key >> 10);
|
||||||
|
|
|
@ -112,8 +112,12 @@ class SweepAndPruneAlgorithm : public BroadPhaseAlgorithm {
|
||||||
virtual void updateObject(Body* body, const AABB& aabb); // Notify the broad-phase that the AABB of an object has changed
|
virtual void updateObject(Body* body, const AABB& aabb); // Notify the broad-phase that the AABB of an object has changed
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO : ADD Documentation for this method
|
// Encode a floating value into a integer value in order to
|
||||||
// Encode a floating value into a integer value
|
// work with integer comparison in the Sweep-And-Prune algorithm
|
||||||
|
// because it is faster. The main issue when encoding floating
|
||||||
|
// number into integer is to keep to sorting order. This is a
|
||||||
|
// problem for negative float number. This article describes
|
||||||
|
// how to solve this issue : http://www.stereopsis.com/radix.html
|
||||||
inline uint encodeFloatIntoInteger(float number) {
|
inline uint encodeFloatIntoInteger(float number) {
|
||||||
uint intNumber = (uint&) number;
|
uint intNumber = (uint&) number;
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,9 @@ RigidBody* PhysicsWorld::createRigidBody(const Transform& transform, decimal mas
|
||||||
currentBodyID++;
|
currentBodyID++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Largest index cannot be used (it is used for invalid index)
|
||||||
|
assert(bodyID < std::numeric_limits<reactphysics3d::bodyindex>::max());
|
||||||
|
|
||||||
// Create the rigid body
|
// Create the rigid body
|
||||||
RigidBody* rigidBody = new (memoryPoolRigidBodies.allocateObject()) RigidBody(transform, mass, inertiaTensorLocal, collisionShape, bodyID);
|
RigidBody* rigidBody = new (memoryPoolRigidBodies.allocateObject()) RigidBody(transform, mass, inertiaTensorLocal, collisionShape, bodyID);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user