CrystalSpace

Public API Reference

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.h"
00028 #include "csgeom/vector3.h"
00029 #include "csutil/array.h"
00030 
00031 struct iPolygonMesh;
00032 struct iMeshObject;
00033 class csReversibleTransform;
00034 
00039 struct csCollisionPair
00040 {
00042 
00043   csVector3 a1, b1, c1; 
00045 
00046   // Second triangle
00047   csVector3 a2, b2, c2; 
00049 };
00050 
00054 struct csIntersectingTriangle
00055 {
00056   csVector3 a, b, c;
00057 };
00058 
00059 SCF_VERSION (iCollider, 0, 2, 0);
00060 
00073 struct iCollider : public iBase
00074 {
00075 };
00076 
00077 SCF_VERSION (iCollideSystem, 0, 0, 4);
00078 
00095 struct iCollideSystem : public iBase
00096 {
00106   virtual csPtr<iCollider> CreateCollider (iPolygonMesh* mesh) = 0;
00107   
00129   virtual bool Collide (
00130         iCollider* collider1, const csReversibleTransform* trans1,
00131         iCollider* collider2, const csReversibleTransform* trans2) = 0;
00132 
00141   virtual csCollisionPair* GetCollisionPairs () = 0;
00142 
00147   virtual size_t GetCollisionPairCount () = 0;
00148 
00154   virtual void ResetCollisionPairs () = 0;
00155 
00167   virtual bool CollideRay (
00168         iCollider* collider, const csReversibleTransform* trans,
00169         const csVector3& start, const csVector3& end) = 0;
00170 
00183   virtual bool CollideSegment (
00184         iCollider* collider, const csReversibleTransform* trans,
00185         const csVector3& start, const csVector3& end) = 0;
00186 
00192   virtual const csArray<csIntersectingTriangle>& GetIntersectingTriangles ()
00193         const = 0;
00194 
00203   virtual void SetOneHitOnly (bool o) = 0;
00204 
00213   virtual bool GetOneHitOnly () = 0;
00214 };
00215 
00216 #endif // __CS_IVARIA_COLLIDER_H__
00217 

Generated for Crystal Space by doxygen 1.4.6