UGDK
|
00001 #ifndef PYRAMIDWORKS_COLLISION_COLLISIONMASK_H_ 00002 #define PYRAMIDWORKS_COLLISION_COLLISIONMASK_H_ 00003 00004 #include <string> 00005 #include <list> 00006 #include <set> 00007 #include <ugdk/util.h> 00008 #include <pyramidworks/collision.h> 00009 00010 namespace pyramidworks { 00011 namespace collision { 00012 00014 class CollisionClass { 00015 typedef ugdk::ikdtree::IntervalKDTree<const CollisionObject*, 2> ObjectTree; 00016 public: 00017 ~CollisionClass(); 00018 const CollisionClass* parent() const { return parent_; } 00019 void set_parent(CollisionClass* parent) { parent_ = parent; } 00020 00021 const CollisionObjectList FindCollidingObjects(const CollisionObject *target) const; 00022 00023 void AddObject(const CollisionObject *obj); 00024 void RemoveObject(const CollisionObject *obj); 00025 void RefreshObject(const CollisionObject *obj); 00026 00027 #ifdef DEBUG 00028 void set_name(const std::string &name) { name_ = name; } 00029 #endif 00030 private: 00031 friend class CollisionManager; 00032 CollisionClass(const ugdk::ikdtree::Box<2>& tree_bounding_box); 00033 00034 #ifdef DEBUG 00035 // Unnecessary, used for debugging purposes. 00036 std::string name_; 00037 #endif 00038 CollisionClass* parent_; 00039 ObjectTree* objects_tree_; 00040 }; 00041 00042 } // namespace collision 00043 } // namespace pyramidworks 00044 00045 #endif /* PYRAMIDWORKS_COLLISION_COLLISIONMASK_H_ */