source: GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/collision.h @ 1092

Revision 1092, 7.7 KB checked in by gumbau, 18 years ago (diff)

LodStrips? and LODTrees demos

Line 
1/*************************************************************************
2 *                                                                       *
3 * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith.       *
4 * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
5 *                                                                       *
6 * This library is free software; you can redistribute it and/or         *
7 * modify it under the terms of EITHER:                                  *
8 *   (1) The GNU Lesser General Public License as published by the Free  *
9 *       Software Foundation; either version 2.1 of the License, or (at  *
10 *       your option) any later version. The text of the GNU Lesser      *
11 *       General Public License is included with this library in the     *
12 *       file LICENSE.TXT.                                               *
13 *   (2) The BSD-style license that is included with this library in     *
14 *       the file LICENSE-BSD.TXT.                                       *
15 *                                                                       *
16 * This library is distributed in the hope that it will be useful,       *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
20 *                                                                       *
21 *************************************************************************/
22
23#ifndef _ODE_COLLISION_H_
24#define _ODE_COLLISION_H_
25
26#include <ode/common.h>
27#include <ode/collision_space.h>
28#include <ode/contact.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* ************************************************************************ */
35/* general functions */
36
37void dGeomDestroy (dGeomID);
38void dGeomSetData (dGeomID, void *);
39void *dGeomGetData (dGeomID);
40void dGeomSetBody (dGeomID, dBodyID);
41dBodyID dGeomGetBody (dGeomID);
42void dGeomSetPosition (dGeomID, dReal x, dReal y, dReal z);
43void dGeomSetRotation (dGeomID, const dMatrix3 R);
44void dGeomSetQuaternion (dGeomID, const dQuaternion);
45const dReal * dGeomGetPosition (dGeomID);
46const dReal * dGeomGetRotation (dGeomID);
47void dGeomGetQuaternion (dGeomID, dQuaternion result);
48void dGeomGetAABB (dGeomID, dReal aabb[6]);
49int dGeomIsSpace (dGeomID);
50dSpaceID dGeomGetSpace (dGeomID);
51int dGeomGetClass (dGeomID);
52void dGeomSetCategoryBits (dGeomID, unsigned long bits);
53void dGeomSetCollideBits (dGeomID, unsigned long bits);
54unsigned long dGeomGetCategoryBits (dGeomID);
55unsigned long dGeomGetCollideBits (dGeomID);
56void dGeomEnable (dGeomID);
57void dGeomDisable (dGeomID);
58int dGeomIsEnabled (dGeomID);
59
60/* ************************************************************************ */
61/* collision detection */
62
63int dCollide (dGeomID o1, dGeomID o2, int flags, dContactGeom *contact,
64              int skip);
65void dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback);
66void dSpaceCollide2 (dGeomID o1, dGeomID o2, void *data,
67                     dNearCallback *callback);
68
69/* ************************************************************************ */
70/* standard classes */
71
72/* the maximum number of user classes that are supported */
73enum {
74  dMaxUserClasses = 4
75};
76
77/* class numbers - each geometry object needs a unique number */
78enum {
79  dSphereClass = 0,
80  dBoxClass,
81  dCCylinderClass,
82  dCylinderClass,
83  dPlaneClass,
84  dRayClass,
85  dGeomTransformClass,
86  dTriMeshClass,
87  // Terrain callback mod
88  dTerrainCallbackClass,
89 
90  dFirstSpaceClass,
91  dSimpleSpaceClass = dFirstSpaceClass,
92  dHashSpaceClass,
93  dQuadTreeSpaceClass,
94  dLastSpaceClass = dQuadTreeSpaceClass,
95
96  dFirstUserClass,
97  dLastUserClass = dFirstUserClass + dMaxUserClasses - 1,
98  dGeomNumClasses
99};
100
101// Terrain Callback mod (start)
102typedef dReal dTerrainHeightCallback(void* data,dReal x,dReal z);
103
104dGeomID dCreateTerrainCallback (dSpaceID space, dReal *pHeights,dReal vHeight,dReal vLength,int nNumNodesPerSide, int bFinite, int bPlaceable);
105dReal dGeomTerrainCallbackPointDepth (dGeomID g, dReal x, dReal y, dReal z);
106void dGeomTerrainCallbackSetHeightCallback(dGeomID g,dTerrainHeightCallback* callback);
107// Terrain Callback mod (end)
108
109dGeomID dCreateSphere (dSpaceID space, dReal radius);
110void dGeomSphereSetRadius (dGeomID sphere, dReal radius);
111dReal dGeomSphereGetRadius (dGeomID sphere);
112dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z);
113
114dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz);
115void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz);
116void dGeomBoxGetLengths (dGeomID box, dVector3 result);
117dReal dGeomBoxPointDepth (dGeomID box, dReal x, dReal y, dReal z);
118
119dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d);
120void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d);
121void dGeomPlaneGetParams (dGeomID plane, dVector4 result);
122dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal z);
123
124dGeomID dCreateCCylinder (dSpaceID space, dReal radius, dReal length);
125void dGeomCCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length);
126void dGeomCCylinderGetParams (dGeomID ccylinder, dReal *radius, dReal *length);
127dReal dGeomCCylinderPointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z);
128
129dGeomID dCreateRay (dSpaceID space, dReal length);
130void dGeomRaySetLength (dGeomID ray, dReal length);
131dReal dGeomRayGetLength (dGeomID ray);
132void dGeomRaySet (dGeomID ray, dReal px, dReal py, dReal pz,
133                  dReal dx, dReal dy, dReal dz);
134void dGeomRayGet (dGeomID ray, dVector3 start, dVector3 dir);
135
136/*
137 * Set/get ray flags that influence ray collision detection.
138 * These flags are currently only noticed by the trimesh collider, because
139 * they can make a major differences there.
140 */
141void dGeomRaySetParams (dGeomID g, int FirstContact, int BackfaceCull);
142void dGeomRayGetParams (dGeomID g, int *FirstContact, int *BackfaceCull);
143void dGeomRaySetClosestHit (dGeomID g, int closestHit);
144int dGeomRayGetClosestHit (dGeomID g);
145
146#include "collision_trimesh.h"
147
148dGeomID dCreateGeomTransform (dSpaceID space);
149void dGeomTransformSetGeom (dGeomID g, dGeomID obj);
150dGeomID dGeomTransformGetGeom (dGeomID g);
151void dGeomTransformSetCleanup (dGeomID g, int mode);
152int dGeomTransformGetCleanup (dGeomID g);
153void dGeomTransformSetInfo (dGeomID g, int mode);
154int dGeomTransformGetInfo (dGeomID g);
155
156/* ************************************************************************ */
157/* utility functions */
158
159void dClosestLineSegmentPoints (const dVector3 a1, const dVector3 a2,
160                                const dVector3 b1, const dVector3 b2,
161                                dVector3 cp1, dVector3 cp2);
162
163int dBoxTouchesBox (const dVector3 _p1, const dMatrix3 R1,
164                    const dVector3 side1, const dVector3 _p2,
165                    const dMatrix3 R2, const dVector3 side2);
166
167void dInfiniteAABB (dGeomID geom, dReal aabb[6]);
168void dCloseODE();
169
170/* ************************************************************************ */
171/* custom classes */
172
173typedef void dGetAABBFn (dGeomID, dReal aabb[6]);
174typedef int dColliderFn (dGeomID o1, dGeomID o2,
175                         int flags, dContactGeom *contact, int skip);
176typedef dColliderFn * dGetColliderFnFn (int num);
177typedef void dGeomDtorFn (dGeomID o);
178typedef int dAABBTestFn (dGeomID o1, dGeomID o2, dReal aabb[6]);
179
180typedef struct dGeomClass {
181  int bytes;
182  dGetColliderFnFn *collider;
183  dGetAABBFn *aabb;
184  dAABBTestFn *aabb_test;
185  dGeomDtorFn *dtor;
186} dGeomClass;
187
188int dCreateGeomClass (const dGeomClass *classptr);
189void * dGeomGetClassData (dGeomID);
190dGeomID dCreateGeom (int classnum);
191
192/* ************************************************************************ */
193
194#ifdef __cplusplus
195}
196#endif
197
198#endif
Note: See TracBrowser for help on using the repository browser.