Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | List of all members
om::physics::collision::CollisionNarrowphase Class Reference

A class that sorts pairs of potentially colliding shapes to the associated collision algorithms. More...

#include <omPhysicsCollisionNarrowphase.h>

Public Member Functions

 CollisionNarrowphase ()
 Create a default narrowphase with no algorithms. More...
 
 CollisionNarrowphase (const CollisionNarrowphase &other)
 Create a copy of an narrowphase. More...
 
 ~CollisionNarrowphase ()
 Destroy this narrowphase and all of the algorithms it contains. More...
 
CollisionNarrowphaseoperator= (const CollisionNarrowphase &other)
 Assign the algorithms of one narrowphase to another. More...
 
void addPair (const CollisionPair &pair)
 Add a collision pair to this narrowphase that should be tested for collisions. More...
 
void testPair (const CollisionPair &pair, const CollisionRequest &request, CollisionResultSet &resultSet) const
 Test for collisions between the specified pair of shapes. More...
 
void testPairs (const CollisionRequest &request, CollisionResultSet &resultSet)
 Test all buffered pairs for collisions and place the results in the output result set. More...
 
Size getAlgorithmCount () const
 Return the number of collision algorithms that this narrowphase has. More...
 
CollisionAlgorithmgetAlgorithm (Index algorithmIndex) const
 Return a pointer to the algorithm at the specified index. More...
 
CollisionAlgorithmgetAlgorithm (const ShapeType &shapeType1, const ShapeType &shapeType2) const
 Return a pointer to the algorithm for the specified shape types. More...
 
template<typename ShapeType1 , typename ShapeType2 >
CollisionAlgorithmgetAlgorithm () const
 Return a pointer to the algorithm for the specified template shape types. More...
 
Bool addAlgorithm (CollisionAlgorithm *newAlgorithm)
 Add the specified CollisionAlgorithm to this narrowphase. More...
 
Bool removeAlgorithm (const ShapeType &shapeType1, const ShapeType &shapeType2)
 Remove an algorithm with the specified shape types from this narrowphase. More...
 
template<typename ShapeType1 , typename ShapeType2 >
Bool removeAlgorithm ()
 Remove an algorithm with the specified templated shape types from this narrowphase. More...
 
void clearAlgorithms ()
 Remove all algorithms from this CollisionNarrowphase. More...
 

Detailed Description

A class that sorts pairs of potentially colliding shapes to the associated collision algorithms.

Constructor & Destructor Documentation

om::physics::collision::CollisionNarrowphase::CollisionNarrowphase ( )

Create a default narrowphase with no algorithms.

om::physics::collision::CollisionNarrowphase::CollisionNarrowphase ( const CollisionNarrowphase other)

Create a copy of an narrowphase.

om::physics::collision::CollisionNarrowphase::~CollisionNarrowphase ( )

Destroy this narrowphase and all of the algorithms it contains.

Member Function Documentation

CollisionNarrowphase& om::physics::collision::CollisionNarrowphase::operator= ( const CollisionNarrowphase other)

Assign the algorithms of one narrowphase to another.

void om::physics::collision::CollisionNarrowphase::addPair ( const CollisionPair pair)
inline

Add a collision pair to this narrowphase that should be tested for collisions.

The pair is stored but no collisions are found until the testPairs() method is called. For immediate collision detection, call testPair() instead.

void om::physics::collision::CollisionNarrowphase::testPair ( const CollisionPair pair,
const CollisionRequest request,
CollisionResultSet resultSet 
) const
inline

Test for collisions between the specified pair of shapes.

The collision results are placed in the output result set if there are any collisions.

void om::physics::collision::CollisionNarrowphase::testPairs ( const CollisionRequest request,
CollisionResultSet resultSet 
)

Test all buffered pairs for collisions and place the results in the output result set.

The buffered pairs are then cleared so that the narrowphase is ready for the next set of collision pairs.

Size om::physics::collision::CollisionNarrowphase::getAlgorithmCount ( ) const
inline

Return the number of collision algorithms that this narrowphase has.

CollisionAlgorithm* om::physics::collision::CollisionNarrowphase::getAlgorithm ( Index  algorithmIndex) const
inline

Return a pointer to the algorithm at the specified index.

CollisionAlgorithm* om::physics::collision::CollisionNarrowphase::getAlgorithm ( const ShapeType shapeType1,
const ShapeType shapeType2 
) const
inline

Return a pointer to the algorithm for the specified shape types.

If such an algorithm exists in this narrowphase, a pointer to it is returned. Otherwise, NULL is returned.

template<typename ShapeType1 , typename ShapeType2 >
CollisionAlgorithm* om::physics::collision::CollisionNarrowphase::getAlgorithm ( ) const
inline

Return a pointer to the algorithm for the specified template shape types.

If such an algorithm exists in this narrowphase, a pointer to it is returned. Otherwise, NULL is returned.

Bool om::physics::collision::CollisionNarrowphase::addAlgorithm ( CollisionAlgorithm newAlgorithm)

Add the specified CollisionAlgorithm to this narrowphase.

If there already exists an algorithm for the specified algorithm's shape types, the old algorithm is replaced.

Bool om::physics::collision::CollisionNarrowphase::removeAlgorithm ( const ShapeType shapeType1,
const ShapeType shapeType2 
)

Remove an algorithm with the specified shape types from this narrowphase.

If such an algorithm exists in this narrowphase, it is removed and TRUE is returned. Otherwise, FALSE is returned and the narrowphase is unchanged.

template<typename ShapeType1 , typename ShapeType2 >
Bool om::physics::collision::CollisionNarrowphase::removeAlgorithm ( )
inline

Remove an algorithm with the specified templated shape types from this narrowphase.

If such an algorithm exists in this narrowphase, it is removed and TRUE is returned. Otherwise, FALSE is returned and the narrowphase is unchanged.

void om::physics::collision::CollisionNarrowphase::clearAlgorithms ( )

Remove all algorithms from this CollisionNarrowphase.


The documentation for this class was generated from the following file: