00001 /*========================================================================= 00002 UberSim Source Code Release 00003 ------------------------------------------------------------------------- 00004 Copyright (C) 2002 Manuela Veloso, Brett Browning, Mike Bowling, 00005 James Bruce; {mmv, brettb, mhb, jbruce}@cs.cmu.edu 00006 Erick Tryzelaar {erickt}@andrew.cmu.edu 00007 School of Computer Science, Carnegie Mellon University 00008 ------------------------------------------------------------------------- 00009 This software is distributed under the GNU General Public License, 00010 version 2. If you do not have a copy of this licence, visit 00011 www.gnu.org, or write: Free Software Foundation, 59 Temple Place, 00012 Suite 330 Boston, MA 02111-1307 USA. This program is distributed 00013 in the hope that it will be useful, but WITHOUT ANY WARRANTY, 00014 including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 -------------------------------------------------------------------------*/ 00016 00017 #ifndef __COLLISIONGROUP_H__ 00018 #define __COLLISIONGROUP_H__ 00019 00020 #include "nommgr.h" 00021 #include <vector> 00022 #include "mmgr.h" 00028 class CollisionManager; 00029 class Node; 00030 class Spatial; 00031 00032 class CollisionGroup 00033 { 00034 public: 00035 CollisionGroup (); 00036 virtual ~CollisionGroup (); 00037 00038 public: 00039 void addCollider (Spatial* collider); 00040 void addCollidee (Spatial* collidee); 00041 00042 void removeCollider (unsigned int i); 00043 void removeCollider (Spatial* spatial); 00044 00045 void removeCollidee (unsigned int i); 00046 void removeCollidee (Spatial* spatial); 00047 00048 public: 00049 void testForCollisions (CollisionManager* collisionManager); 00050 00051 protected: 00052 struct Collider 00053 { 00054 Spatial* spatial; 00055 Node* parent; 00056 00057 Collider (); 00058 Collider (Spatial* spatial); 00059 }; 00060 00061 protected: 00062 std::vector<Collider> colliders; 00063 std::vector<Spatial*> collidees; 00064 }; 00065 00066 #endif