21 template<
class MaskType>
25 _current(CurrentMask::all_off())
37 template<
class MaskType>
41 _current(parent._current)
52 template<
class MaskType>
56 _current(copy._current)
67 template<
class MaskType>
70 CollisionLevelStateBase::operator = (copy);
71 _current = copy._current;
81 template<
class MaskType>
84 CollisionLevelStateBase::clear();
96 template<
class MaskType>
99 int index = (int)_colliders.size();
100 nassertv(!CurrentMask::has_max_num_bits() ||
101 index <= CurrentMask::get_max_num_bits());
104 _current.set_bit(index);
119 template<
class MaskType>
123 int indent_level = 0;
124 if (collide_cat.is_spam()) {
125 indent_level = _node_path.get_num_nodes() * 2;
127 indent(collide_cat.spam(
false), indent_level)
128 <<
"Considering " << _node_path.get_node_path() <<
"\n";
133 if (node_bv->is_of_type(GeometricBoundingVolume::get_class_type())) {
135 DCAST_INTO_R(node_gbv, node_bv,
false);
138 for (
int c = 0; c < num_colliders; c++) {
147 if (!(from_mask &
node()->get_net_collide_mask()).is_zero()) {
150 if (
node() == cnode) {
152 if (collide_cat.is_spam()) {
153 indent(collide_cat.spam(
false), indent_level)
154 <<
"Not comparing " << c <<
" to " << _node_path
168 is_in = (node_gbv->
contains(col_gbv) != 0);
169 _node_volume_pcollector.add_level(1);
172 if (collide_cat.is_spam()) {
173 indent(collide_cat.spam(
false), indent_level)
174 <<
"Comparing " << c <<
": " << *col_gbv
175 <<
" to " << *node_gbv <<
", is_in = " << is_in <<
"\n";
192 if (collide_cat.is_spam()) {
193 int num_active_colliders = 0;
195 for (
int c = 0; c < num_colliders; c++) {
197 num_active_colliders++;
202 indent(collide_cat.spam(
false), indent_level)
203 << _node_path.get_node_path() <<
" has " << num_active_colliders
204 <<
" interested colliders";
205 if (num_colliders != 0) {
206 collide_cat.spam(
false)
208 for (
int c = 0; c < num_colliders; c++) {
211 collide_cat.spam(
false)
212 <<
" " << c <<
". " << cnode->get_name();
215 collide_cat.spam(
false)
218 collide_cat.spam(
false)
222 return has_any_collider();
238 template<
class MaskType>
243 _parent_bounds = _local_bounds;
245 if (
node()->is_final()) {
250 BoundingVolumes new_bounds;
253 new_bounds.reserve(num_colliders);
254 for (
int c = 0; c < num_colliders; c++) {
258 _local_bounds = new_bounds;
264 const TransformState *node_transform =
node()->get_transform();
265 if (!node_transform->is_identity()) {
266 CPT(TransformState) inv_transform =
267 node_transform->invert_compose(TransformState::make_identity());
268 if (!inv_transform->has_mat()) {
273 const LMatrix4 &mat = inv_transform->get_mat();
276 BoundingVolumes new_bounds;
279 new_bounds.reserve(num_colliders);
280 for (
int c = 0; c < num_colliders; c++) {
288 new_bound->xform(mat);
289 new_bounds.push_back(new_bound);
293 _local_bounds = new_bounds;
309 template<
class MaskType>
312 return CurrentMask::has_max_num_bits();
323 template<
class MaskType>
326 return CurrentMask::get_max_num_bits();
337 template<
class MaskType>
340 nassertr(n >= 0 && n < (
int)_colliders.size(),
false);
341 return (_current.get_bit(n));
351 template<
class MaskType>
354 return !_current.is_zero();
364 template<
class MaskType>
367 nassertv(n >= 0 && n < (
int)_colliders.size());
370 _current.clear_bit(n);
A basic node of the scene graph or data graph.
int contains(const GeometricBoundingVolume *vol) const
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indi...
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.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
CollideMask get_from_collide_mask() const
Returns the current "from" CollideMask.
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
bool any_in_bounds()
Checks the bounding volume of the current node against each of our colliders.
This is a 4-by-4 transform matrix.
const GeometricBoundingVolume * get_local_bound(int n) const
Returns the bounding volume of the indicated collider, transformed into the current node's transform ...
void prepare_collider(const ColliderDef &def, const NodePath &root)
Adds the indicated Collider to the set of Colliders in the current level state.
int get_num_colliders() const
Returns the number of CollisionNodes that have been added to the traverser via add_collider().
static bool has_max_colliders()
Returns true if there is any the maximum number of colliders that may be added to the CollisionLevelS...
void prepare_collider(const ColliderDef &def, const NodePath &root)
Adds the indicated Collider to the set of Colliders in the current level state.
A node in the scene graph that can hold any number of CollisionSolids.
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...
PandaNode * node() const
Returns the PandaNode pointer of the node we have traversed to.
static int get_max_colliders()
Returns the maximum number of colliders that may be added to the CollisionLevelStateBase at any one t...