Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/collide/collisionRecorder.h

Go to the documentation of this file.
00001 // Filename: collisionRecorder.h
00002 // Created by:  drose (16Apr03)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef COLLISIONRECORDER_H
00020 #define COLLISIONRECORDER_H
00021 
00022 #include "pandabase.h"
00023 #include "typeHandle.h"
00024 
00025 class CollisionTraverser;
00026 
00027 #ifdef DO_COLLISION_RECORDING
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : CollisionRecorder
00031 // Description : This class is used to help debug the work the
00032 //               collisions system is doing.  It is a virtual base
00033 //               class that just provides an interface for recording
00034 //               collisions tested and detected each frame.
00035 ////////////////////////////////////////////////////////////////////
00036 class EXPCL_PANDA CollisionRecorder {
00037 protected:
00038   CollisionRecorder();
00039 public:
00040   virtual ~CollisionRecorder();
00041 
00042 PUBLISHED:
00043   void output(ostream &out) const;
00044 
00045 public:
00046   virtual void begin_traversal();
00047   virtual void collision_tested(const CollisionEntry &entry, bool detected);
00048   virtual void end_traversal();
00049 
00050 private:
00051   int _num_missed;
00052   int _num_detected;
00053   CollisionTraverser *_trav;
00054 
00055 public:
00056   static TypeHandle get_class_type() {
00057     return _type_handle;
00058   }
00059 
00060   static void init_type() {
00061     register_type(_type_handle, "CollisionRecorder");
00062   }
00063 
00064 PUBLISHED:
00065   // We have to publish this explicitly because the CollisionRecorder
00066   // object does not inherit from TypedObject.
00067   virtual TypeHandle get_type() const {
00068     return get_class_type();
00069   }
00070   INLINE int get_type_index() const;
00071 
00072 private:
00073   static TypeHandle _type_handle;
00074 
00075   friend class CollisionTraverser;
00076 };
00077 
00078 #include "collisionRecorder.I"
00079 
00080 #endif  // DO_COLLISION_RECORDING
00081 
00082 
00083 #endif
00084 

Generated on Fri May 2 00:35:42 2003 for Panda by doxygen1.3