00001 // Filename: collisionHandlerQueue.h 00002 // Created by: drose (16Mar02) 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 COLLISIONHANDLERQUEUE_H 00020 #define COLLISIONHANDLERQUEUE_H 00021 00022 #include <pandabase.h> 00023 00024 #include "collisionHandler.h" 00025 #include "collisionEntry.h" 00026 00027 /////////////////////////////////////////////////////////////////// 00028 // Class : CollisionHandlerQueue 00029 // Description : A special kind of CollisionHandler that does nothing 00030 // except remember the CollisionEntries detected the 00031 // last pass. This set of CollisionEntries may then be 00032 // queried by the calling function. It's primarily 00033 // useful when a simple intersection test is being made, 00034 // e.g. for picking from the window. 00035 //////////////////////////////////////////////////////////////////// 00036 class EXPCL_PANDA CollisionHandlerQueue : public CollisionHandler { 00037 PUBLISHED: 00038 CollisionHandlerQueue(); 00039 00040 public: 00041 virtual void begin_group(); 00042 virtual void add_entry(CollisionEntry *entry); 00043 00044 PUBLISHED: 00045 void sort_entries(); 00046 void clear_entries(); 00047 00048 int get_num_entries() const; 00049 CollisionEntry *get_entry(int n) const; 00050 00051 private: 00052 typedef pvector< PT(CollisionEntry) > Entries; 00053 Entries _entries; 00054 00055 public: 00056 static TypeHandle get_class_type() { 00057 return _type_handle; 00058 } 00059 static void init_type() { 00060 CollisionHandler::init_type(); 00061 register_type(_type_handle, "CollisionHandlerQueue", 00062 CollisionHandler::get_class_type()); 00063 } 00064 virtual TypeHandle get_type() const { 00065 return get_class_type(); 00066 } 00067 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00068 00069 private: 00070 static TypeHandle _type_handle; 00071 }; 00072 00073 #endif 00074 00075 00076