Panda3D

Loading...
Searching...
No Matches
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
19#include "collisionLevelStateBase.h"
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>
33 class CollisionLevelState : public CollisionLevelStateBase {
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);
39 INLINE CollisionLevelState(const CollisionLevelState<MaskType> &parent,
40 PandaNode *child);
41 INLINE CollisionLevelState(const CollisionLevelState<MaskType> &copy);
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
77 typedef CollisionLevelState<BitMaskNative> CollisionLevelStateSingle;
78 typedef CollisionLevelState<DoubleBitMaskNative> CollisionLevelStateDouble;
79 typedef CollisionLevelState<QuadBitMaskNative> CollisionLevelStateQuad;
80
81#endif
bitMask.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CollisionLevelStateBase::ColliderDef
Definition collisionLevelStateBase.h:45
CollisionLevelState
This is the state information the CollisionTraverser retains for each level during traversal.
Definition collisionLevelState.h:33
CollisionLevelState::any_in_bounds
bool any_in_bounds()
Checks the bounding volume of the current node against each of our colliders.
Definition collisionLevelState.I:103
CollisionLevelState::has_collider
bool has_collider(int n) const
Returns true if the nth collider in the LevelState is still part of the level.
Definition collisionLevelState.I:310
CollisionLevelState::prepare_collider
void prepare_collider(const ColliderDef &def, const NodePath &root)
Adds the indicated Collider to the set of Colliders in the current level state.
Definition collisionLevelState.I:84
CollisionLevelState::apply_transform
bool apply_transform()
Applies the inverse transform from the current node, if any, onto all the colliders in the level stat...
Definition collisionLevelState.I:220
CollisionLevelState::has_max_colliders
static bool has_max_colliders()
Returns true if there is any the maximum number of colliders that may be added to the CollisionLevelS...
Definition collisionLevelState.I:286
CollisionLevelState::get_max_colliders
static int get_max_colliders()
Returns the maximum number of colliders that may be added to the CollisionLevelStateBase at any one t...
Definition collisionLevelState.I:298
CollisionLevelState::CollisionLevelState
CollisionLevelState(const CollisionLevelState< MaskType > &parent, PandaNode *child)
This constructor goes to the next child node in the traversal.
Definition collisionLevelState.I:33
NodePath
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
PandaNode
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
collisionLevelStateBase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
collisionLevelState.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
collisionNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
doubleBitMask.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.