Collaboration diagram for col::Callback:
Public Member Functions | |
virtual void | operator() (const Data *data)=0 throw () |
The raison d'etre; this will be executed by the coll. det. module. | |
Callback (osg::NodePtr obj1, osg::NodePtr obj2, bool always=false, bool all_polygons_in=false, LevelOfDetectionE level_of_detection=LEVEL_EXACT) | |
Create a collision callback functor. | |
Public Attributes | |
osg::NodePtr | obj1 |
The two objects participating in the collision (or non-collision). | |
osg::NodePtr | obj2 |
bool | collision |
Tells whether or not obj1/2 have collided. | |
bool | all_polygons |
Tells whether or not the application is interested in all pairs of intersecting polygons. | |
LevelOfDetectionE | level |
Level of detection. |
Clients of the collision detection module need to derive from this abstract class and overload the () operator.
A callback can be a collision callback or a cycle callback. Collision callbacks are invoked in case of collision, cycle callbacks are invoked at the end of a completed collision cycle. Collision callbacks are only called if one or both of the objects have moved. Cycle callbacks are only called if there has been at least one object which has moved since the last cycle. Collision callbacks get some collision data (see struct Data), cycle callbacks don't.
col::Callback::Callback | ( | osg::NodePtr | inobj1, | |
osg::NodePtr | inobj2, | |||
bool | always = false , |
|||
bool | all_polygons_in = false , |
|||
LevelOfDetectionE | level_of_detection = LEVEL_EXACT | |||
) |
Create a collision callback functor.
inobj1/inobj2 | callback for this pair of objs is created (both should be NullNode, if cycle callback) | |
all_polygons_in,always | flags (see below) | |
level_of_detection | the maximum level of detection (box, convex hull, or exact) wanted for this particular callback; the cell will later perform the max of all levels. |
If always = true, then the col.det. module will call the callback once every collision cycle, whether the objects are colliding or not.
If the callback will be registered as a cycle callback, then both obj1 and obj2 should be a NullNode. Otherwise, both obj1 and obj2 must not be a NullNode; however, this will be checked only when the callback is actually saved in the collision matrix!
Level of detection.
The coll. det. module might choose to check with a finer level (for instance, if another callback for the same pair requests it).
If all_polygons are requested, then the finest level is assumed automatically.