15 #include "collisionHandlerQueue.h"
16 #include "config_collide.h"
19 TypeHandle CollisionHandlerQueue::_type_handle;
28 entry->
get_from()->get_collision_origin();
32 return _dist2 < other._dist2;
44 CollisionHandlerQueue::
45 CollisionHandlerQueue() {
70 _entries.push_back(entry);
88 sorter.reserve(_entries.size());
90 Entries::const_iterator ei;
91 for (ei = _entries.begin(); ei != _entries.end(); ++ei) {
95 sort(sorter.begin(), sorter.end());
96 nassertv(sorter.size() == _entries.size());
102 sorted_entries.reserve(sorter.size());
103 Sorter::const_iterator si;
104 for (si = sorter.begin(); si != sorter.end(); ++si) {
105 sorted_entries.push_back((*si)._entry);
108 _entries.swap(sorted_entries);
129 return _entries.size();
139 nassertr(n >= 0 && n < (
int)_entries.size(), NULL);
148 void CollisionHandlerQueue::
149 output(ostream &out)
const {
150 out <<
"CollisionHandlerQueue, " << _entries.size() <<
" entries";
158 void CollisionHandlerQueue::
159 write(ostream &out,
int indent_level)
const {
160 indent(out, indent_level)
161 <<
"CollisionHandlerQueue, " << _entries.size() <<
" entries:\n";
163 Entries::const_iterator ei;
164 for (ei = _entries.begin(); ei != _entries.end(); ++ei) {
165 (*ei)->write(out, indent_level + 2);
int get_num_entries() const
Returns the number of CollisionEntries detected last pass.
float length_squared() const
Returns the square of the vector's length, cheap and easy.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
const CollisionSolid * get_from() const
Returns the CollisionSolid pointer for the particular solid that triggered this collision.
void sort_entries()
Sorts all the detected collisions front-to-back by from_intersection_point() so that those intersecti...
This is our own Panda specialization on the default STL vector.
virtual void add_entry(CollisionEntry *entry)
Called between a begin_group() .
LPoint3 get_surface_point(const NodePath &space) const
Returns the point, on the surface of the "into" object, at which a collision is detected.
Defines a single collision event.
NodePath get_from_node_path() const
Returns the NodePath that represents the CollisionNode that contains the CollisionSolid that triggere...
void clear_entries()
Removes all the entries from the queue.
TypeHandle is the identifier used to differentiate C++ class types.
CollisionEntry * get_entry(int n) const
Returns the nth CollisionEntry detected last pass.
virtual void begin_group()
Will be called by the CollisionTraverser before a new traversal is begun.