Panda3D
collisionLevelState.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file collisionLevelState.h
10  * @author drose
11  * @date 2002-03-16
12  */
13 
14 #ifndef COLLISIONLEVELSTATE_H
15 #define COLLISIONLEVELSTATE_H
16 
17 #include "pandabase.h"
18 
20 #include "collisionNode.h"
21 #include "bitMask.h"
22 #include "doubleBitMask.h"
23 
24 /**
25  * This is the state information the CollisionTraverser retains for each level
26  * during traversal.
27  *
28  * This is the template class that specifies the CurrentMask type: the type of
29  * bitmask that is used to keep track of the set of active colliders for each
30  * node.
31  */
32 template<class MaskType>
34 public:
35  // By hiding this template from interrogate, we improve compile-time speed
36  // and memory utilization.
37 #ifndef CPPPARSER
38  INLINE CollisionLevelState(const NodePath &node_path);
40  PandaNode *child);
42  INLINE void operator = (const CollisionLevelState<MaskType> &copy);
43 
44  INLINE void clear();
45  INLINE void prepare_collider(const ColliderDef &def, const NodePath &root);
46 
47  bool any_in_bounds();
48  bool apply_transform();
49 
50  INLINE static bool has_max_colliders();
51  INLINE static int get_max_colliders();
52 
53  INLINE bool has_collider(int n) const;
54  INLINE bool has_any_collider() const;
55 
56  INLINE void omit_collider(int n);
57 
58 private:
59  // CurrentMask here is a locally-defined value that simply serves to keep
60  // track of the colliders that are still interested in the current node.
61  // Don't confuse it with CollideMask, which is a set of user-defined bits
62  // that specify which CollisionSolids may possibly intersect with each
63  // other.
64  typedef MaskType CurrentMask;
65  CurrentMask _current;
66 
67  friend class CollisionTraverser;
68 #endif // CPPPARSER
69 };
70 
71 #include "collisionLevelState.I"
72 
73 // Now instantiate a handful of implementations of CollisionLevelState: one
74 // that uses a word-at-a-time bitmask to track the active colliders, and a
75 // couple that use more words at a time.
76 
80 
81 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
This is the state information the CollisionTraverser retains for each level during traversal.
bool has_collider(int n) const
Returns true if the nth collider in the LevelState is still part of the level.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool any_in_bounds()
Checks the bounding volume of the current node against each of our colliders.
void prepare_collider(const ColliderDef &def, const NodePath &root)
Adds the indicated Collider to the set of Colliders in the current level state.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static bool has_max_colliders()
Returns true if there is any the maximum number of colliders that may be added to the CollisionLevelS...
This class manages the traversal through the scene graph to detect collisions.
This is the state information the CollisionTraverser retains for each level during traversal.
bool apply_transform()
Applies the inverse transform from the current node, if any, onto all the colliders in the level stat...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static int get_max_colliders()
Returns the maximum number of colliders that may be added to the CollisionLevelStateBase at any one t...