14#ifndef COLLISIONTRAVERSER_H
15#define COLLISIONTRAVERSER_H
30class CollisionRecorder;
31class CollisionVisualizer;
46class EXPCL_PANDA_COLLIDE CollisionTraverser :
public Namable {
48 explicit CollisionTraverser(
const std::string &name =
"ctrav");
49 ~CollisionTraverser();
70#if defined(DO_COLLISION_RECORDING) || !defined(CPPPARSER)
72 INLINE
bool has_recorder()
const;
73 INLINE CollisionRecorder *get_recorder()
const;
74 INLINE
void clear_recorder();
75 MAKE_PROPERTY2(recorder, has_recorder, get_recorder,
82 void output(std::ostream &out)
const;
83 void write(std::ostream &out,
int indent_level)
const;
85 EXTENSION(PyObject *__getstate__()
const);
86 EXTENSION(
void __setstate__(PyObject *state));
89 typedef pvector<CollisionLevelStateSingle> LevelStatesSingle;
90 void prepare_colliders_single(LevelStatesSingle &level_states,
const NodePath &root);
91 void r_traverse_single(CollisionLevelStateSingle &level_state,
size_t pass);
93 typedef pvector<CollisionLevelStateDouble> LevelStatesDouble;
94 void prepare_colliders_double(LevelStatesDouble &level_states,
const NodePath &root);
95 void r_traverse_double(CollisionLevelStateDouble &level_state,
size_t pass);
97 typedef pvector<CollisionLevelStateQuad> LevelStatesQuad;
98 void prepare_colliders_quad(LevelStatesQuad &level_states,
const NodePath &root);
99 void r_traverse_quad(CollisionLevelStateQuad &level_state,
size_t pass);
121 class OrderedColliderDef {
128 Colliders _colliders;
129 typedef pvector<OrderedColliderDef> OrderedColliders;
130 OrderedColliders _ordered_colliders;
135 Handlers::iterator remove_handler(Handlers::iterator hi);
137 bool _respect_prev_transform;
138#ifdef DO_COLLISION_RECORDING
139 CollisionRecorder *_recorder;
142 CollisionRecorder *_recorder_disabled =
nullptr;
143 NodePath _collision_visualizer_np_disabled;
154 typedef pvector<PStatCollector> PassCollectors;
155 PassCollectors _pass_collectors;
158 typedef pvector<PStatCollector> SolidCollideCollectors;
159 SolidCollideCollectors _solid_collide_collectors;
165 static void init_type() {
170 static TypeHandle _type_handle;
172 friend class SortByColliderSort;
Defines a single collision event.
The abstract interface to a number of classes that decide what to do when a collision is detected.
A node in the scene graph that can hold any number of CollisionSolids.
This class manages the traversal through the scene graph to detect collisions.
CollisionHandler * get_handler(const NodePath &collider) const
Returns the handler that is currently assigned to serve the indicated collision node,...
get_collider
Returns the nth CollisionNode that has been added to the traverser via add_collider().
bool remove_collider(const NodePath &collider)
Removes the collider (and its associated handler) from the set of CollisionNodes that will be tested ...
bool has_collider(const NodePath &collider) const
Returns true if the indicated node is current in the set of nodes that will be tested each frame for ...
set_respect_prev_transform
Sets the flag that indicates whether the prev_transform stored on a node (as updated via set_fluid_po...
set_recorder
Uses the indicated CollisionRecorder object to start recording the intersection tests made by each su...
get_respect_prev_transform
Returns the flag that indicates whether the prev_transform stored on a node is respected to calculate...
void clear_colliders()
Completely empties the set of collision nodes and their associated handlers.
CollisionVisualizer * show_collisions(const NodePath &root)
This is a high-level function to create a CollisionVisualizer object to render the collision tests pe...
void add_collider(const NodePath &collider, CollisionHandler *handler)
Adds a new CollisionNode, representing an object that will be tested for collisions into other object...
get_num_colliders
Returns the number of CollisionNodes that have been added to the traverser via add_collider().
void hide_collisions()
Undoes the effect of a previous call to show_collisions().
void traverse(const NodePath &root)
Perform the traversal.
A container for geometry primitives.
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
void output(std::ostream &out) const
Outputs the Namable.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
A lightweight class that represents a single element that may be timed and/or counted via stats.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...