Panda3D
|
00001 // Filename: collisionRecorder.h 00002 // Created by: drose (16Apr03) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef COLLISIONRECORDER_H 00016 #define COLLISIONRECORDER_H 00017 00018 #include "pandabase.h" 00019 #include "typeHandle.h" 00020 #include "typedObject.h" 00021 00022 class CollisionTraverser; 00023 class CollisionEntry; 00024 00025 #ifdef DO_COLLISION_RECORDING 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : CollisionRecorder 00029 // Description : This class is used to help debug the work the 00030 // collisions system is doing. It is a virtual base 00031 // class that just provides an interface for recording 00032 // collisions tested and detected each frame. 00033 //////////////////////////////////////////////////////////////////// 00034 class EXPCL_PANDA_COLLIDE CollisionRecorder : public TypedObject { 00035 protected: 00036 CollisionRecorder(); 00037 public: 00038 virtual ~CollisionRecorder(); 00039 00040 PUBLISHED: 00041 void output(ostream &out) const; 00042 00043 public: 00044 virtual void begin_traversal(); 00045 virtual void collision_tested(const CollisionEntry &entry, bool detected); 00046 virtual void end_traversal(); 00047 00048 private: 00049 int _num_missed; 00050 int _num_detected; 00051 CollisionTraverser *_trav; 00052 00053 public: 00054 static TypeHandle get_class_type() { 00055 return _type_handle; 00056 } 00057 static void init_type() { 00058 TypedObject::init_type(); 00059 register_type(_type_handle, "CollisionRecorder", 00060 TypedObject::get_class_type()); 00061 } 00062 virtual TypeHandle get_type() const { 00063 return get_class_type(); 00064 } 00065 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00066 00067 private: 00068 static TypeHandle _type_handle; 00069 00070 friend class CollisionTraverser; 00071 }; 00072 00073 #include "collisionRecorder.I" 00074 00075 #endif // DO_COLLISION_RECORDING 00076 00077 00078 #endif 00079