Panda3D
collisionHandlerQueue.h
1 // Filename: collisionHandlerQueue.h
2 // Created by: drose (16Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef COLLISIONHANDLERQUEUE_H
16 #define COLLISIONHANDLERQUEUE_H
17 
18 #include "pandabase.h"
19 
20 #include "collisionHandler.h"
21 #include "collisionEntry.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : CollisionHandlerQueue
25 // Description : A special kind of CollisionHandler that does nothing
26 // except remember the CollisionEntries detected the
27 // last pass. This set of CollisionEntries may then be
28 // queried by the calling function. It's primarily
29 // useful when a simple intersection test is being made,
30 // e.g. for picking from the window.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDA_COLLIDE CollisionHandlerQueue : public CollisionHandler {
33 PUBLISHED:
35 
36 public:
37  virtual void begin_group();
38  virtual void add_entry(CollisionEntry *entry);
39 
40 PUBLISHED:
41  void sort_entries();
42  void clear_entries();
43 
44  int get_num_entries() const;
45  CollisionEntry *get_entry(int n) const;
46  MAKE_SEQ(get_entries, get_num_entries, get_entry);
47 
48  void output(ostream &out) const;
49  void write(ostream &out, int indent_level = 0) const;
50 
51 private:
53  Entries _entries;
54 
55 public:
56  static TypeHandle get_class_type() {
57  return _type_handle;
58  }
59  static void init_type() {
60  CollisionHandler::init_type();
61  register_type(_type_handle, "CollisionHandlerQueue",
62  CollisionHandler::get_class_type());
63  }
64  virtual TypeHandle get_type() const {
65  return get_class_type();
66  }
67  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
68 
69 private:
70  static TypeHandle _type_handle;
71 };
72 
73 INLINE ostream &operator << (ostream &out, const CollisionHandlerQueue &chq) {
74  chq.output(out);
75  return out;
76 }
77 
78 #endif
79 
80 
81 
The abstract interface to a number of classes that decide what to do when a collision is detected...
Defines a single collision event.
A special kind of CollisionHandler that does nothing except remember the CollisionEntries detected th...
virtual void begin_group()
Will be called by the CollisionTraverser before a new traversal is begun.
virtual void add_entry(CollisionEntry *entry)
Called between a begin_group() .
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85