Panda3D
 All Classes Functions Variables Enumerations
collisionHandler.h
00001 // Filename: collisionHandler.h
00002 // Created by:  drose (16Mar02)
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 COLLISIONHANDLER_H
00016 #define COLLISIONHANDLER_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "typedReferenceCount.h"
00021 #include "nodePath.h"
00022 
00023 class CollisionEntry;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : CollisionHandler
00027 // Description : The abstract interface to a number of classes that
00028 //               decide what to do when a collision is detected.  One
00029 //               of these must be assigned to the CollisionTraverser
00030 //               that is processing collisions in order to specify how
00031 //               to dispatch detected collisions.
00032 ////////////////////////////////////////////////////////////////////
00033 class EXPCL_PANDA_COLLIDE CollisionHandler : public TypedReferenceCount {
00034 public:
00035   CollisionHandler();
00036 
00037   virtual void begin_group();
00038   virtual void add_entry(CollisionEntry *entry);
00039   virtual bool end_group();
00040 
00041   INLINE bool wants_all_potential_collidees() const;
00042   INLINE void set_root(const NodePath &root);
00043 
00044 PUBLISHED:
00045   static TypeHandle get_class_type() {
00046     return _type_handle;
00047   }
00048 
00049 public:
00050   static void init_type() {
00051     TypedReferenceCount::init_type();
00052     register_type(_type_handle, "CollisionHandler",
00053                   TypedReferenceCount::get_class_type());
00054   }
00055   virtual TypeHandle get_type() const {
00056     return get_class_type();
00057   }
00058   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00059 
00060 protected:
00061   bool _wants_all_potential_collidees;
00062   const NodePath *_root;
00063 
00064 private:
00065   static TypeHandle _type_handle;
00066 
00067   friend class CollisionTraverser;
00068 };
00069 
00070 #include "collisionHandler.I"
00071 
00072 #endif
00073 
00074 
00075 
 All Classes Functions Variables Enumerations