[216] | 1 | //Benoit CHAPEROT 2003-2004 www.jstarlab.com |
---|
| 2 | #ifndef _ODE_COLLISION_STD_INTERNAL_H_ |
---|
| 3 | #define _ODE_COLLISION_STD_INTERNAL_H_ |
---|
| 4 | |
---|
| 5 | #include <ode/common.h> |
---|
| 6 | #include "collision_kernel.h" |
---|
| 7 | |
---|
| 8 | struct dxSphere : public dxGeom { |
---|
| 9 | dReal radius; // sphere radius |
---|
| 10 | dxSphere (dSpaceID space, dReal _radius); |
---|
| 11 | void computeAABB(); |
---|
| 12 | }; |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | struct dxBox : public dxGeom { |
---|
| 16 | dVector3 side; // side lengths (x,y,z) |
---|
| 17 | dxBox (dSpaceID space, dReal lx, dReal ly, dReal lz); |
---|
| 18 | void computeAABB(); |
---|
| 19 | }; |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | struct dxCCylinder : public dxGeom { |
---|
| 23 | dReal radius,lz; // radius, length along z axis |
---|
| 24 | dxCCylinder (dSpaceID space, dReal _radius, dReal _length); |
---|
| 25 | void computeAABB(); |
---|
| 26 | }; |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | struct dxPlane : public dxGeom { |
---|
| 30 | dReal p[4]; |
---|
| 31 | dxPlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d); |
---|
| 32 | void computeAABB(); |
---|
| 33 | }; |
---|
| 34 | |
---|
| 35 | struct dxCylinder : public dxGeom { |
---|
| 36 | dReal radius,lz; // radius, length along z axis |
---|
| 37 | dxCylinder (dSpaceID space, dReal _radius, dReal _length); |
---|
| 38 | void computeAABB(); |
---|
| 39 | }; |
---|
| 40 | |
---|
| 41 | struct dxCone : public dxGeom { |
---|
| 42 | dReal radius,lz; |
---|
| 43 | dxCone(dSpaceID space, dReal _radius,dReal _length); |
---|
| 44 | ~dxCone(); |
---|
| 45 | void computeAABB(); |
---|
| 46 | }; |
---|
| 47 | |
---|
| 48 | struct dxRay : public dxGeom { |
---|
| 49 | dReal length; |
---|
| 50 | dxRay (dSpaceID space, dReal _length); |
---|
| 51 | void computeAABB(); |
---|
| 52 | }; |
---|
| 53 | |
---|
| 54 | struct dxTerrainY : public dxGeom { |
---|
| 55 | dReal m_vLength; |
---|
| 56 | dReal *m_pHeights; |
---|
| 57 | dReal m_vMinHeight; |
---|
| 58 | dReal m_vMaxHeight; |
---|
| 59 | dReal m_vNodeLength; |
---|
| 60 | int m_nNumNodesPerSide; |
---|
| 61 | int m_nNumNodesPerSideShift; |
---|
| 62 | int m_nNumNodesPerSideMask; |
---|
| 63 | int m_bFinite; |
---|
| 64 | dxTerrainY(dSpaceID space, dReal *pHeights,dReal vLength,int nNumNodesPerSide, int bFinite, int bPlaceable); |
---|
| 65 | ~dxTerrainY(); |
---|
| 66 | void computeAABB(); |
---|
| 67 | dReal GetHeight(dReal x,dReal z); |
---|
| 68 | dReal GetHeight(int x,int z); |
---|
| 69 | int dCollideTerrainUnit(int x,int z,dxGeom *o2,int numMaxContacts,int flags,dContactGeom *contact, int skip); |
---|
| 70 | bool IsOnTerrain(int nx,int nz,int w,dReal *pos); |
---|
| 71 | }; |
---|
| 72 | |
---|
| 73 | struct dxTerrainZ : public dxGeom { |
---|
| 74 | dReal m_vLength; |
---|
| 75 | dReal *m_pHeights; |
---|
| 76 | dReal m_vMinHeight; |
---|
| 77 | dReal m_vMaxHeight; |
---|
| 78 | dReal m_vNodeLength; |
---|
| 79 | int m_nNumNodesPerSide; |
---|
| 80 | int m_nNumNodesPerSideShift; |
---|
| 81 | int m_nNumNodesPerSideMask; |
---|
| 82 | int m_bFinite; |
---|
| 83 | dxTerrainZ(dSpaceID space, dReal *pHeights,dReal vLength,int nNumNodesPerSide, int bFinite, int bPlaceable); |
---|
| 84 | ~dxTerrainZ(); |
---|
| 85 | void computeAABB(); |
---|
| 86 | dReal GetHeight(dReal x,dReal y); |
---|
| 87 | dReal GetHeight(int x,int y); |
---|
| 88 | int dCollideTerrainUnit(int x,int y,dxGeom *o2,int numMaxContacts,int flags,dContactGeom *contact, int skip); |
---|
| 89 | bool IsOnTerrain(int nx,int ny,int w,dReal *pos); |
---|
| 90 | }; |
---|
| 91 | |
---|
| 92 | #ifndef MIN |
---|
| 93 | #define MIN(a,b) ((a<b)?a:b) |
---|
| 94 | #endif |
---|
| 95 | |
---|
| 96 | #ifndef MAX |
---|
| 97 | #define MAX(a,b) ((a>b)?a:b) |
---|
| 98 | #endif |
---|
| 99 | |
---|
| 100 | #endif //_ODE_COLLISION_STD_INTERNAL_H_ |
---|