#include <collisionTraverser.h>
Public Member Functions | |
CollisionTraverser () | |
~CollisionTraverser () | |
void | add_collider (CollisionNode *node, CollisionHandler *handler) |
Adds a new CollisionNode, representing an object that will be tested for collisions into other objects, along with the handler that will serve each detected collision. | |
bool | remove_collider (CollisionNode *node) |
Removes the collider (and its associated handler) from the set of CollisionNodes that will be tested each frame for collisions into other objects. | |
bool | has_collider (CollisionNode *node) const |
Returns true if the indicated node is current in the set of nodes that will be tested each frame for collisions into other objects. | |
int | get_num_colliders () const |
Returns the number of CollisionNodes that have been added to the traverser via add_collider(). | |
CollisionNode * | get_collider (int n) const |
Returns the nth CollisionNode that has been added to the traverser via add_collider(). | |
CollisionHandler * | get_handler (CollisionNode *node) const |
Returns the handler that is currently assigned to serve the indicated collision node, or NULL if the node is not on the traverser's set of active nodes. | |
void | clear_colliders () |
Completely empties the set of collision nodes and their associated handlers. | |
void | traverse (const NodePath &root) |
void | output (ostream &out) const |
void | write (ostream &out, int indent_level) const |
Private Types | |
typedef pmap< PointerTo< CollisionNode >, PointerTo< CollisionHandler > > | Colliders |
typedef pvector< CollisionNode * > | OrderedColliders |
typedef pmap< PointerTo< CollisionHandler >, int > | Handlers |
Private Member Functions | |
void | prepare_colliders (CollisionLevelState &state) |
void | r_traverse (CollisionLevelState &level_state) |
void | compare_collider_to_node (CollisionEntry &entry, const GeometricBoundingVolume *from_parent_gbv, const GeometricBoundingVolume *from_node_gbv, const GeometricBoundingVolume *into_node_gbv) |
void | compare_collider_to_geom_node (CollisionEntry &entry, const GeometricBoundingVolume *from_parent_gbv, const GeometricBoundingVolume *from_node_gbv, const GeometricBoundingVolume *into_node_gbv) |
void | compare_collider_to_solid (CollisionEntry &entry, const GeometricBoundingVolume *from_node_gbv, const GeometricBoundingVolume *solid_gbv) |
void | compare_collider_to_geom (CollisionEntry &entry, Geom *geom, const GeometricBoundingVolume *from_node_gbv, const GeometricBoundingVolume *solid_gbv) |
Private Attributes | |
PointerTo< CollisionHandler > | _default_handler |
TypeHandle | _graph_type |
Colliders | _colliders |
OrderedColliders | _ordered_colliders |
Handlers | _handlers |
Static Private Attributes | |
PStatCollector | _collisions_pcollector |
It holds ownership of a number of collider objects, each of which is a CollisionNode and an associated CollisionHandler.
When traverse() is called, it begins at the indicated root and detects all collisions with any of its collider objects against nodes at or below the indicated root, calling the appropriate CollisionHandler for each detected collision.
Definition at line 66 of file collisionTraverser.h.
|
Definition at line 115 of file collisionTraverser.h. |
|
Definition at line 120 of file collisionTraverser.h. |
|
Definition at line 117 of file collisionTraverser.h. |
|
Definition at line 48 of file collisionTraverser.cxx. |
|
Definition at line 62 of file collisionTraverser.cxx. References _colliders, _handlers, _ordered_colliders, nassertv, NULL, and PT. |
|
Adds a new CollisionNode, representing an object that will be tested for collisions into other objects, along with the handler that will serve each detected collision. Each CollisionNode may be served by only one handler at a time, but a given handler may serve many CollisionNodes. The handler that serves a particular node may be changed from time to time by calling add_collider() again on the same node. Definition at line 95 of file collisionTraverser.cxx. References _handlers. |
|
Completely empties the set of collision nodes and their associated handlers.
Definition at line 272 of file collisionTraverser.cxx. References _ordered_colliders. |
|
Definition at line 732 of file collisionTraverser.cxx. |
|
Definition at line 664 of file collisionTraverser.cxx. |
|
Definition at line 621 of file collisionTraverser.cxx. References _colliders, GeometricBoundingVolume::contains(), CollisionEntry::get_from_node(), nassertv, NULL, and CollisionEntry::test_intersection(). |
|
Definition at line 708 of file collisionTraverser.cxx. |
|
Returns the nth CollisionNode that has been added to the traverser via add_collider().
Definition at line 234 of file collisionTraverser.cxx. References _collisions_pcollector, _handlers, prepare_colliders(), and root. |
|
Returns the handler that is currently assigned to serve the indicated collision node, or NULL if the node is not on the traverser's set of active nodes.
Definition at line 253 of file collisionTraverser.cxx. References _handlers. |
|
Returns the number of CollisionNodes that have been added to the traverser via add_collider().
Definition at line 218 of file collisionTraverser.cxx. References _colliders, and _ordered_colliders. |
|
Returns true if the indicated node is current in the set of nodes that will be tested each frame for collisions into other objects.
Definition at line 202 of file collisionTraverser.cxx. References _colliders, and NULL. |
|
Definition at line 411 of file collisionTraverser.cxx. |
|
Definition at line 453 of file collisionTraverser.cxx. References CollisionEntry::_from_node, and CollisionEntry::set_from_velocity(). Referenced by get_collider(). |
|
Definition at line 498 of file collisionTraverser.cxx. References root. |
|
Removes the collider (and its associated handler) from the set of CollisionNodes that will be tested each frame for collisions into other objects. Returns true if the definition was found and removed, false if it wasn't present to begin with. Definition at line 158 of file collisionTraverser.cxx. References _colliders, and _ordered_colliders. |
|
Definition at line 286 of file collisionTraverser.cxx. |
|
Definition at line 424 of file collisionTraverser.cxx. References NULL. |
|
Definition at line 116 of file collisionTraverser.h. Referenced by compare_collider_to_node(), get_num_colliders(), has_collider(), remove_collider(), and ~CollisionTraverser(). |
|
Referenced by get_collider(). |
|
Definition at line 112 of file collisionTraverser.h. |
|
Definition at line 113 of file collisionTraverser.h. |
|
Definition at line 121 of file collisionTraverser.h. Referenced by add_collider(), get_collider(), get_handler(), and ~CollisionTraverser(). |
|
Definition at line 118 of file collisionTraverser.h. Referenced by clear_colliders(), get_num_colliders(), remove_collider(), and ~CollisionTraverser(). |