Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
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 "csutil/leakguard.h" 00026 #include "csgeom/math3d.h" 00027 #include "csgeom/matrix3.h" 00028 #include "csgeom/vector3.h" 00029 00030 class csReversibleTransform; 00031 struct csIntersectingTriangle; 00032 struct iPolygonMesh; 00033 struct iCollideSystem; 00034 struct iCollider; 00035 struct iObject; 00036 struct iEngine; 00037 struct iRegion; 00038 struct iMeshWrapper; 00039 struct iSector; 00040 00041 SCF_VERSION (csColliderWrapper, 0, 0, 3); 00042 00056 class CS_CSTOOL_EXPORT csColliderWrapper : public csObject 00057 { 00058 private: 00059 csRef<iCollideSystem> collide_system; 00060 csRef<iCollider> collider; 00061 00062 public: 00063 CS_LEAKGUARD_DECLARE (csColliderWrapper); 00064 00066 csColliderWrapper (csObject& parent, iCollideSystem* collide_system, 00067 iPolygonMesh* mesh); 00068 00070 csColliderWrapper (iObject* parent, iCollideSystem* collide_system, 00071 iPolygonMesh* mesh); 00072 00078 csColliderWrapper (iObject* parent, iCollideSystem* collide_system, 00079 iCollider* collider); 00080 00082 virtual ~csColliderWrapper (); 00083 00085 iCollider* GetCollider () { return collider; } 00086 00088 iCollideSystem* GetCollideSystem () { return collide_system; } 00089 00097 bool Collide (csColliderWrapper& pOtherCollider, 00098 csReversibleTransform* pThisTransform = 0, 00099 csReversibleTransform* pOtherTransform = 0); 00104 bool Collide (csObject& otherObject, 00105 csReversibleTransform* pThisTransform = 0, 00106 csReversibleTransform* pOtherTransform = 0); 00111 bool Collide (iObject* otherObject, 00112 csReversibleTransform* pThisTransform = 0, 00113 csReversibleTransform* pOtherTransform = 0); 00114 00119 static csColliderWrapper* GetColliderWrapper (csObject& object); 00120 00125 static csColliderWrapper* GetColliderWrapper (iObject* object); 00126 00127 SCF_DECLARE_IBASE_EXT (csObject); 00128 }; 00129 00134 class CS_CSTOOL_EXPORT csColliderHelper 00135 { 00136 public: 00147 static void InitializeCollisionWrapper (iCollideSystem* colsys, 00148 iMeshWrapper* mesh); 00149 00155 static void InitializeCollisionWrappers (iCollideSystem* colsys, 00156 iEngine* engine, iRegion* region = 0); 00157 00175 static bool CollideArray ( 00176 iCollideSystem* colsys, 00177 iCollider* collider, 00178 const csReversibleTransform* trans, 00179 int num_colliders, 00180 iCollider** colliders, 00181 csReversibleTransform **transforms); 00182 00220 static int CollidePath ( 00221 iCollideSystem* colsys, 00222 iCollider* collider, const csReversibleTransform* trans, 00223 float nbrsteps, 00224 csVector3& newpos, 00225 int num_colliders, 00226 iCollider** colliders, 00227 csReversibleTransform** transforms); 00228 00229 00251 static float TraceBeam (iCollideSystem* cdsys, iSector* sector, 00252 const csVector3& start, const csVector3& end, 00253 bool traverse_portals, 00254 csIntersectingTriangle& closest_tri, 00255 csVector3& closest_isect, 00256 iMeshWrapper** closest_mesh = 0); 00257 }; 00258 00259 #endif // __CS_COLLIDER_H__
Generated for Crystal Space by doxygen 1.3.9.1