cstool/collider.h
00001 /* 00002 Copyright (C) 1998-2003 by Jorrit Tyberghein 00003 Written by Alex Pfaffe. 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 #ifndef __CS_COLLIDER_H__ 00020 #define __CS_COLLIDER_H__ 00021 00022 #include "csextern.h" 00023 00024 #include "csutil/csobject.h" 00025 #include "csgeom/math3d.h" 00026 #include "csgeom/matrix3.h" 00027 #include "csgeom/vector3.h" 00028 00029 class csReversibleTransform; 00030 struct iPolygonMesh; 00031 struct iCollideSystem; 00032 struct iCollider; 00033 struct iObject; 00034 struct iEngine; 00035 struct iRegion; 00036 struct iMeshWrapper; 00037 00038 SCF_VERSION (csColliderWrapper, 0, 0, 3); 00039 00053 class CS_CSTOOL_EXPORT csColliderWrapper : public csObject 00054 { 00055 private: 00056 csRef<iCollideSystem> collide_system; 00057 csRef<iCollider> collider; 00058 00059 public: 00061 csColliderWrapper (csObject& parent, iCollideSystem* collide_system, 00062 iPolygonMesh* mesh); 00063 00065 csColliderWrapper (iObject* parent, iCollideSystem* collide_system, 00066 iPolygonMesh* mesh); 00067 00073 csColliderWrapper (iObject* parent, iCollideSystem* collide_system, 00074 iCollider* collider); 00075 00077 virtual ~csColliderWrapper (); 00078 00080 iCollider* GetCollider () { return collider; } 00081 00083 iCollideSystem* GetCollideSystem () { return collide_system; } 00084 00092 bool Collide (csColliderWrapper& pOtherCollider, 00093 csReversibleTransform* pThisTransform = 0, 00094 csReversibleTransform* pOtherTransform = 0); 00099 bool Collide (csObject& otherObject, 00100 csReversibleTransform* pThisTransform = 0, 00101 csReversibleTransform* pOtherTransform = 0); 00106 bool Collide (iObject* otherObject, 00107 csReversibleTransform* pThisTransform = 0, 00108 csReversibleTransform* pOtherTransform = 0); 00109 00114 static csColliderWrapper* GetColliderWrapper (csObject& object); 00115 00120 static csColliderWrapper* GetColliderWrapper (iObject* object); 00121 00122 SCF_DECLARE_IBASE_EXT (csObject); 00123 }; 00124 00129 class CS_CSTOOL_EXPORT csColliderHelper 00130 { 00131 public: 00142 static void InitializeCollisionWrapper (iCollideSystem* colsys, 00143 iMeshWrapper* mesh); 00144 00150 static void InitializeCollisionWrappers (iCollideSystem* colsys, 00151 iEngine* engine, iRegion* region = 0); 00152 00171 static bool CollideArray ( 00172 iCollideSystem* colsys, 00173 iCollider* collider, const csReversibleTransform* trans, 00174 int num_colliders, 00175 iCollider** colliders, 00176 csReversibleTransform **transforms); 00177 00215 static int CollidePath ( 00216 iCollideSystem* colsys, 00217 iCollider* collider, const csReversibleTransform* trans, 00218 float stepsize, 00219 csVector3& newpos, 00220 int num_colliders, 00221 iCollider** colliders, 00222 csReversibleTransform** transforms); 00223 }; 00224 00225 #endif // __CS_COLLIDER_H__
Generated for Crystal Space by doxygen 1.2.18