ivaria/collider.h
Go to the documentation of this file.00001 /* 00002 Crystal Space 3D engine 00003 Copyright (C) 2000 by Jorrit Tyberghein 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 00020 #ifndef __CS_IVARIA_COLLIDER_H__ 00021 #define __CS_IVARIA_COLLIDER_H__ 00022 00027 #include "csutil/scf_interface.h" 00028 #include "csgeom/vector3.h" 00029 #include "csutil/array.h" 00030 #include "csutil/ref.h" 00031 #include "iutil/strset.h" 00032 00033 struct iPolygonMesh; 00034 struct iTriangleMesh; 00035 struct iTerraFormer; 00036 struct iMeshObject; 00037 class csReversibleTransform; 00038 struct iTerrainSystem; 00039 00044 struct csCollisionPair 00045 { 00047 00048 csVector3 a1, b1, c1; 00050 00051 // Second triangle 00052 csVector3 a2, b2, c2; 00054 00056 bool operator==(const csCollisionPair& p) const 00057 { 00058 return (a1 == p.a1 && b1 == p.b1 && c1 == p.c1 && 00059 a2 == p.a2 && b2 == p.b2 && c2 == p.c2); 00060 } 00061 }; 00062 00066 struct csIntersectingTriangle 00067 { 00068 csVector3 a, b, c; 00069 }; 00070 00071 00072 00073 enum csColliderType 00074 { 00075 CS_MESH_COLLIDER = 0, 00076 CS_TERRAFORMER_COLLIDER, 00077 CS_TERRAIN_COLLIDER 00078 }; 00079 00092 struct iCollider : public virtual iBase 00093 { 00094 SCF_INTERFACE (iCollider, 0, 2, 0); 00095 virtual csColliderType GetColliderType () = 0; 00096 }; 00097 00098 // for iPolygonMesh 00099 #include "csutil/win32/msvc_deprecated_warn_off.h" 00100 00117 struct iCollideSystem : public virtual iBase 00118 { 00119 SCF_INTERFACE (iCollideSystem, 2, 1, 1); 00120 00127 virtual csStringID GetTriangleDataID () = 0; 00128 00135 virtual csStringID GetBaseDataID () = 0; 00136 00147 CS_DEPRECATED_METHOD_MSG("Use CreateCollider(iTriangleMesh*) instead.") 00148 virtual csPtr<iCollider> CreateCollider (iPolygonMesh* mesh) = 0; 00149 00161 virtual csPtr<iCollider> CreateCollider (iTriangleMesh* mesh) = 0; 00162 00168 virtual csPtr<iCollider> CreateCollider (iTerraFormer* mesh) = 0; 00169 00173 virtual csPtr<iCollider> CreateCollider (iTerrainSystem* mesh) = 0; 00174 00196 virtual bool Collide ( 00197 iCollider* collider1, const csReversibleTransform* trans1, 00198 iCollider* collider2, const csReversibleTransform* trans2) = 0; 00199 00208 virtual csCollisionPair* GetCollisionPairs () = 0; 00209 00214 virtual size_t GetCollisionPairCount () = 0; 00215 00221 virtual void ResetCollisionPairs () = 0; 00222 00234 virtual bool CollideRay ( 00235 iCollider* collider, const csReversibleTransform* trans, 00236 const csVector3& start, const csVector3& end) = 0; 00237 00250 virtual bool CollideSegment ( 00251 iCollider* collider, const csReversibleTransform* trans, 00252 const csVector3& start, const csVector3& end) = 0; 00253 00259 virtual const csArray<csIntersectingTriangle>& GetIntersectingTriangles () 00260 const = 0; 00261 00270 virtual void SetOneHitOnly (bool o) = 0; 00271 00280 virtual bool GetOneHitOnly () = 0; 00281 }; 00282 00283 // for iPolygonMesh 00284 #include "csutil/win32/msvc_deprecated_warn_on.h" 00285 00286 #endif // __CS_IVARIA_COLLIDER_H__ 00287
Generated for Crystal Space 1.2 by doxygen 1.4.7