Panda3D
 All Classes Functions Variables Enumerations
collisionRecorder.h
1 // Filename: collisionRecorder.h
2 // Created by: drose (16Apr03)
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 COLLISIONRECORDER_H
16 #define COLLISIONRECORDER_H
17 
18 #include "pandabase.h"
19 #include "typeHandle.h"
20 #include "typedObject.h"
21 
22 class CollisionTraverser;
23 class CollisionEntry;
24 
25 #ifdef DO_COLLISION_RECORDING
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : CollisionRecorder
29 // Description : This class is used to help debug the work the
30 // collisions system is doing. It is a virtual base
31 // class that just provides an interface for recording
32 // collisions tested and detected each frame.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_COLLIDE CollisionRecorder : public TypedObject {
35 protected:
36  CollisionRecorder();
37 public:
38  virtual ~CollisionRecorder();
39 
40 PUBLISHED:
41  void output(ostream &out) const;
42 
43 public:
44  virtual void begin_traversal();
45  virtual void collision_tested(const CollisionEntry &entry, bool detected);
46  virtual void end_traversal();
47 
48 private:
49  int _num_missed;
50  int _num_detected;
51  CollisionTraverser *_trav;
52 
53 public:
54  static TypeHandle get_class_type() {
55  return _type_handle;
56  }
57  static void init_type() {
59  register_type(_type_handle, "CollisionRecorder",
60  TypedObject::get_class_type());
61  }
62  virtual TypeHandle get_type() const {
63  return get_class_type();
64  }
65  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
66 
67 private:
68  static TypeHandle _type_handle;
69 
70  friend class CollisionTraverser;
71 };
72 
73 #include "collisionRecorder.I"
74 
75 #endif // DO_COLLISION_RECORDING
76 
77 
78 #endif
79 
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Definition: typedObject.cxx:52
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition: typedObject.h:98
Defines a single collision event.
This class manages the traversal through the scene graph to detect collisions.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85