Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

CollisionLevelState Class Reference

This is the state information the CollisionTraverser retains for each level during traversal. More...

#include <collisionLevelState.h>

List of all members.

Public Member Functions

 CollisionLevelState (const NodePath &node_path)
 CollisionLevelState (const CollisionLevelState &parent, PandaNode *child)
 This constructor goes to the next child node in the traversal.

void clear ()
void reserve (int max_colliders)
void prepare_collider (const ColliderDef &def)
 Adds the indicated Collider to the set of Colliders in the current level state.

bool any_in_bounds ()
 Checks the bounding volume of the current node against each of our colliders.

void apply_transform ()
 Applies the inverse transform from the current node, if any, onto all the colliders in the level state.

NodePath get_node_path () const
 Returns the NodePath representing the node instance we have traversed to.

PandaNodenode () const
 Returns the PandaNode pointer of the node we have traversed to.

int get_num_colliders () const
bool has_collider (int n) const
 Returns true if the nth collider in the LevelState is still part of the level.

bool has_collider_with_geom (int n) const
 Returns true if the nth collider in the LevelState is still part of the level, and it has the "collide_geom" flag set.

bool has_any_collider () const
bool has_any_collide_geom () const
 Returns true if any Collider in the level state has the "collide_geom" flag set, false otherwise.

void reached_collision_node ()
 Called by the traverser when we reach a CollisionNode in the traversal.

CollisionSolidget_collider (int n) const
CollisionNodeget_node (int n) const
const LMatrix4f & get_space (int n) const
const LMatrix4f & get_inv_space (int n) const
const GeometricBoundingVolumeget_local_bound (int n) const
 Returns the bounding volume of the indicated collider, transformed into the current node's transform space.

const GeometricBoundingVolumeget_parent_bound (int n) const
 Returns the bounding volume of the indicated collider, transformed into the previous node's transform space, but not transformed by the current node's transform.

void omit_collider (int n)

Private Types

typedef int ColliderMask
typedef PointerToArray< ColliderDefColliders
typedef PointerToArray< ConstPointerTo<
GeometricBoundingVolume > > 
BoundingVolumes

Private Member Functions

ColliderMask get_mask (int n) const
 Returns a single bit associated with the nth collider.


Private Attributes

WorkingNodePath _node_path
Colliders _colliders
ColliderMask _current
ColliderMask _colliders_with_geom
BoundingVolumes _local_bounds
BoundingVolumes _parent_bounds


Detailed Description

This is the state information the CollisionTraverser retains for each level during traversal.

Definition at line 49 of file collisionLevelState.h.


Member Typedef Documentation

typedef PointerToArray< ConstPointerTo< GeometricBoundingVolume > > CollisionLevelState::BoundingVolumes [private]
 

Definition at line 107 of file collisionLevelState.h.

typedef int CollisionLevelState::ColliderMask [private]
 

Definition at line 96 of file collisionLevelState.h.

typedef PointerToArray< ColliderDef > CollisionLevelState::Colliders [private]
 

Definition at line 102 of file collisionLevelState.h.


Constructor & Destructor Documentation

CollisionLevelState::CollisionLevelState const NodePath node_path  )  [inline]
 

Definition at line 31 of file collisionLevelState.I.

References INLINE.

CollisionLevelState::CollisionLevelState const CollisionLevelState &  parent,
PandaNode child
[inline]
 

This constructor goes to the next child node in the traversal.

Definition at line 47 of file collisionLevelState.I.

References _node_path, WorkingNodePath::get_node_path(), and INLINE.


Member Function Documentation

bool CollisionLevelState::any_in_bounds  ) 
 

Checks the bounding volume of the current node against each of our colliders.

Eliminates from the current collider list any that are outside of the bounding volume. Returns true if any colliders remain, false if all of them fall outside this node's bounding volume.

Definition at line 122 of file collisionLevelState.cxx.

References NULL.

void CollisionLevelState::apply_transform  ) 
 

Applies the inverse transform from the current node, if any, onto all the colliders in the level state.

Definition at line 207 of file collisionLevelState.cxx.

void CollisionLevelState::clear  ) 
 

Definition at line 34 of file collisionLevelState.cxx.

CollisionSolid * CollisionLevelState::get_collider int  n  )  const [inline]
 

Definition at line 188 of file collisionLevelState.I.

References _colliders.

const LMatrix4f & CollisionLevelState::get_inv_space int  n  )  const [inline]
 

Definition at line 233 of file collisionLevelState.I.

References _colliders, _current, get_mask(), has_collider(), INLINE, and nassertv.

const GeometricBoundingVolume * CollisionLevelState::get_local_bound int  n  )  const [inline]
 

Returns the bounding volume of the indicated collider, transformed into the current node's transform space.

Definition at line 253 of file collisionLevelState.I.

CollisionLevelState::ColliderMask CollisionLevelState::get_mask int  n  )  const [inline, private]
 

Returns a single bit associated with the nth collider.

Definition at line 322 of file collisionLevelState.I.

Referenced by get_inv_space(), get_num_colliders(), and node().

CollisionNode * CollisionLevelState::get_node int  n  )  const [inline]
 

Definition at line 203 of file collisionLevelState.I.

References _local_bounds.

NodePath CollisionLevelState::get_node_path  )  const [inline]
 

Returns the NodePath representing the node instance we have traversed to.

Definition at line 67 of file collisionLevelState.I.

int CollisionLevelState::get_num_colliders  )  const [inline]
 

Definition at line 94 of file collisionLevelState.I.

References _colliders, _colliders_with_geom, _current, get_mask(), INLINE, and nassertr.

const GeometricBoundingVolume * CollisionLevelState::get_parent_bound int  n  )  const [inline]
 

Returns the bounding volume of the indicated collider, transformed into the previous node's transform space, but not transformed by the current node's transform.

This is appropriate for testing against the bounding volume of the current node (which does not have its own transform applied to it).

Definition at line 287 of file collisionLevelState.I.

const LMatrix4f & CollisionLevelState::get_space int  n  )  const [inline]
 

Definition at line 218 of file collisionLevelState.I.

References _colliders, _parent_bounds, has_collider(), INLINE, nassertr, NULL, and PointerToArray< ConstPointerTo< GeometricBoundingVolume > >::size().

bool CollisionLevelState::has_any_collide_geom  )  const [inline]
 

Returns true if any Collider in the level state has the "collide_geom" flag set, false otherwise.

Definition at line 155 of file collisionLevelState.I.

References _colliders, has_collider(), INLINE, nassertr, and NULL.

bool CollisionLevelState::has_any_collider  )  const [inline]
 

Definition at line 140 of file collisionLevelState.I.

References _colliders, has_collider(), INLINE, nassertr, and NULL.

bool CollisionLevelState::has_collider int  n  )  const [inline]
 

Returns true if the nth collider in the LevelState is still part of the level.

Definition at line 109 of file collisionLevelState.I.

References _current, and INLINE.

Referenced by get_inv_space(), get_space(), has_any_collide_geom(), and has_any_collider().

bool CollisionLevelState::has_collider_with_geom int  n  )  const [inline]
 

Returns true if the nth collider in the LevelState is still part of the level, and it has the "collide_geom" flag set.

Definition at line 127 of file collisionLevelState.I.

References _colliders_with_geom, and INLINE.

PandaNode * CollisionLevelState::node  )  const [inline]
 

Returns the PandaNode pointer of the node we have traversed to.

Definition at line 82 of file collisionLevelState.I.

References _colliders, _current, get_mask(), INLINE, and nassertr.

void CollisionLevelState::omit_collider int  n  )  [inline]
 

Definition at line 304 of file collisionLevelState.I.

void CollisionLevelState::prepare_collider const ColliderDef def  ) 
 

Adds the indicated Collider to the set of Colliders in the current level state.

Definition at line 66 of file collisionLevelState.cxx.

References CollisionLevelState::ColliderDef::_node, GeometricBoundingVolume::extend_by(), and CollisionNode::get_velocity().

void CollisionLevelState::reached_collision_node  )  [inline]
 

Called by the traverser when we reach a CollisionNode in the traversal.

At this point, we zero out our set of colliders with the "collide_geom" flag set, because no colliders will test against geometry parented beneath a CollisionNode.

Definition at line 176 of file collisionLevelState.I.

void CollisionLevelState::reserve int  max_colliders  ) 
 

Definition at line 50 of file collisionLevelState.cxx.

References CollisionLevelState::ColliderDef::_collider, _colliders, _local_bounds, DCAST_INTO_V, BoundedObject::get_bound(), GeometricBoundingVolume::get_class_type(), TypedObject::is_of_type(), BoundingVolume::make_copy(), NULL, and PointerToArray< ConstPointerTo< GeometricBoundingVolume > >::push_back().


Member Data Documentation

Colliders CollisionLevelState::_colliders [private]
 

Definition at line 103 of file collisionLevelState.h.

Referenced by get_collider(), get_inv_space(), get_num_colliders(), get_space(), has_any_collide_geom(), has_any_collider(), node(), and reserve().

ColliderMask CollisionLevelState::_colliders_with_geom [private]
 

Definition at line 105 of file collisionLevelState.h.

Referenced by get_num_colliders(), and has_collider_with_geom().

ColliderMask CollisionLevelState::_current [private]
 

Definition at line 104 of file collisionLevelState.h.

Referenced by get_inv_space(), get_num_colliders(), has_collider(), and node().

BoundingVolumes CollisionLevelState::_local_bounds [private]
 

Definition at line 108 of file collisionLevelState.h.

Referenced by get_node(), and reserve().

WorkingNodePath CollisionLevelState::_node_path [private]
 

Definition at line 100 of file collisionLevelState.h.

Referenced by CollisionLevelState().

BoundingVolumes CollisionLevelState::_parent_bounds [private]
 

Definition at line 109 of file collisionLevelState.h.

Referenced by get_space().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:48:30 2003 for Panda by doxygen1.3