Panda3D
|
This is the state information the CollisionTraverser retains for each level during traversal. More...
#include "collisionLevelState.h"
Public Member Functions | |
CollisionLevelState (const NodePath &node_path) | |
CollisionLevelState (const CollisionLevelState< MaskType > &parent, PandaNode *child) | |
This constructor goes to the next child node in the traversal. | |
CollisionLevelState (const CollisionLevelState< MaskType > ©) | |
bool | any_in_bounds () |
Checks the bounding volume of the current node against each of our colliders. | |
bool | apply_transform () |
Applies the inverse transform from the current node, if any, onto all the colliders in the level state. | |
void | clear () |
const CollisionSolid * | get_collider (int n) const |
CollisionNode * | get_collider_node (int n) const |
NodePath | get_collider_node_path (int n) const |
CollideMask | get_include_mask () const |
Returns the mask that is applied to the into CollideMask of nodes in the scene graph before testing for bits in common with the from CollideMask of colliders. | |
const GeometricBoundingVolume * | get_local_bound (int n) const |
Returns the bounding volume of the indicated collider, transformed into the current node's transform space. | |
NodePath | get_node_path () const |
Returns the NodePath representing the node instance we have traversed to. | |
int | get_num_colliders () const |
const GeometricBoundingVolume * | get_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. | |
bool | has_any_collider () const |
bool | has_collider (int n) const |
Returns true if the nth collider in the LevelState is still part of the level. | |
PandaNode * | node () const |
Returns the PandaNode pointer of the node we have traversed to. | |
void | omit_collider (int n) |
void | operator= (const CollisionLevelState< MaskType > ©) |
void | prepare_collider (const ColliderDef &def, const NodePath &root) |
Adds the indicated Collider to the set of Colliders in the current level state. | |
void | reserve (int num_colliders) |
Indicates an intention to add the indicated number of colliders to the level state. | |
void | set_include_mask (CollideMask include_mask) |
Specifies the mask that is applied to the into CollideMask of nodes in the scene graph before testing for bits in common with the from CollideMask of colliders. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static int | get_max_colliders () |
Returns the maximum number of colliders that may be added to the CollisionLevelStateBase at any one time. | |
static bool | has_max_colliders () |
Returns true if there is any the maximum number of colliders that may be added to the CollisionLevelStateBase at any one time. | |
static void | init_type () |
Protected Member Functions | |
typedef | PTA (ColliderDef) Colliders |
typedef | PTA (CPT(GeometricBoundingVolume)) BoundingVolumes |
Protected Attributes | |
Colliders | _colliders |
CollideMask | _include_mask |
BoundingVolumes | _local_bounds |
WorkingNodePath | _node_path |
BoundingVolumes | _parent_bounds |
Static Protected Attributes | |
static PStatCollector | _node_volume_pcollector |
Friends | |
class | CollisionTraverser |
This is the state information the CollisionTraverser retains for each level during traversal.
This is the template class that specifies the CurrentMask type: the type of bitmask that is used to keep track of the set of active colliders for each node.
Definition at line 37 of file collisionLevelState.h.
CollisionLevelState< MaskType >::CollisionLevelState | ( | const CollisionLevelState< MaskType > & | parent, |
PandaNode * | child | ||
) | [inline] |
This constructor goes to the next child node in the traversal.
Definition at line 39 of file collisionLevelState.I.
bool CollisionLevelState< MaskType >::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 121 of file collisionLevelState.I.
References GeometricBoundingVolume::contains(), CollisionNode::get_from_collide_mask(), CollisionTraverser::get_num_colliders(), and CollisionTraverser::has_collider().
bool CollisionLevelState< MaskType >::apply_transform | ( | ) |
Applies the inverse transform from the current node, if any, onto all the colliders in the level state.
Returns true if the inverse transform is valid, or false if it is not valid (e.g. the transform has a scale to zero). If the inverse transform is not valid, the caller should not visit this node.
Definition at line 240 of file collisionLevelState.I.
References CollisionTraverser::get_num_colliders(), CollisionTraverser::has_collider(), and TransformState::is_identity().
CollideMask CollisionLevelStateBase::get_include_mask | ( | ) | const [inline, inherited] |
Returns the mask that is applied to the into CollideMask of nodes in the scene graph before testing for bits in common with the from CollideMask of colliders.
See set_include_mask().
Definition at line 210 of file collisionLevelStateBase.I.
const GeometricBoundingVolume * CollisionLevelStateBase::get_local_bound | ( | int | n | ) | const [inline, inherited] |
Returns the bounding volume of the indicated collider, transformed into the current node's transform space.
Definition at line 149 of file collisionLevelStateBase.I.
int CollisionLevelState< MaskType >::get_max_colliders | ( | ) | [inline, static] |
Returns the maximum number of colliders that may be added to the CollisionLevelStateBase at any one time.
Definition at line 325 of file collisionLevelState.I.
NodePath CollisionLevelStateBase::get_node_path | ( | ) | const [inline, inherited] |
Returns the NodePath representing the node instance we have traversed to.
Definition at line 80 of file collisionLevelStateBase.I.
References WorkingNodePath::get_node_path().
const GeometricBoundingVolume * CollisionLevelStateBase::get_parent_bound | ( | int | n | ) | const [inline, inherited] |
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 173 of file collisionLevelStateBase.I.
bool CollisionLevelState< MaskType >::has_collider | ( | int | n | ) | const [inline] |
Returns true if the nth collider in the LevelState is still part of the level.
Definition at line 339 of file collisionLevelState.I.
bool CollisionLevelState< MaskType >::has_max_colliders | ( | ) | [inline, static] |
Returns true if there is any the maximum number of colliders that may be added to the CollisionLevelStateBase at any one time.
Definition at line 311 of file collisionLevelState.I.
PandaNode * CollisionLevelStateBase::node | ( | ) | const [inline, inherited] |
Returns the PandaNode pointer of the node we have traversed to.
Definition at line 91 of file collisionLevelStateBase.I.
References WorkingNodePath::node().
void CollisionLevelState< MaskType >::prepare_collider | ( | const ColliderDef & | def, |
const NodePath & | root | ||
) | [inline] |
Adds the indicated Collider to the set of Colliders in the current level state.
Reimplemented from CollisionLevelStateBase.
Definition at line 98 of file collisionLevelState.I.
References CollisionLevelStateBase::prepare_collider().
void CollisionLevelStateBase::reserve | ( | int | num_colliders | ) | [inherited] |
Indicates an intention to add the indicated number of colliders to the level state.
Definition at line 44 of file collisionLevelStateBase.cxx.
void CollisionLevelStateBase::set_include_mask | ( | CollideMask | include_mask | ) | [inline, inherited] |
Specifies the mask that is applied to the into CollideMask of nodes in the scene graph before testing for bits in common with the from CollideMask of colliders.
This is normally all bits on, but you may set it to some other mask to restrict certain bits from consideration.
This is used by the CollisionTraverser to restrict collision with geometry except under the lowest level of LOD.
Definition at line 196 of file collisionLevelStateBase.I.