00001 /* 00002 * Collision sphere header 00003 * 00004 * This file is part of the "SoftPixel Engine" (Copyright (c) 2008 by Lukas Hermanns) 00005 * See "SoftPixelEngine.hpp" for license information. 00006 */ 00007 00008 #ifndef __SP_COLLISION_BOX_H__ 00009 #define __SP_COLLISION_BOX_H__ 00010 00011 00012 #include "Base/spStandard.hpp" 00013 #include "SceneGraph/Collision/spCollisionNode.hpp" 00014 00015 00016 namespace sp 00017 { 00018 namespace scene 00019 { 00020 00021 00027 class SP_EXPORT CollisionBox : public CollisionNode 00028 { 00029 00030 public: 00031 00032 CollisionBox(CollisionMaterial* Material, SceneNode* Node, const dim::aabbox3df &Box); 00033 ~CollisionBox(); 00034 00035 /* Functions */ 00036 00037 s32 getSupportFlags() const; 00038 f32 getMaxMovement() const; 00039 00040 bool checkIntersection(const dim::line3df &Line, SIntersectionContact &Contact) const; 00041 bool checkIntersection(const dim::line3df &Line, bool ExcludeCorners = false) const; 00042 00043 /* Inline functions */ 00044 00045 inline void setBox(const dim::aabbox3df &Box) 00046 { 00047 Box_ = Box; 00048 } 00049 inline dim::aabbox3df getBox() const 00050 { 00051 return Box_; 00052 } 00053 00054 private: 00055 00056 /* Functions */ 00057 00058 bool checkCollisionToPlane(const CollisionPlane* Rival, SCollisionContact &Contact) const; 00059 00060 void performCollisionResolvingToPlane(const CollisionPlane* Rival); 00061 00062 /* Members */ 00063 00064 dim::aabbox3df Box_; 00065 00066 }; 00067 00068 00069 } // /namespace scene 00070 00071 } // /namespace sp 00072 00073 00074 #endif 00075 00076 00077 00078 // ================================================================================