-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathODEImport2.pas
1840 lines (1579 loc) · 99.9 KB
/
ODEImport2.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit ODEImport2;
{*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: [email protected] Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************}
{*************************************************************************
* *
* ODE Delphi Import unit : 0.8.14 *
* *
* Created by Mattias Fagerlund ( [email protected] ) and *
* Christophe ( [email protected] ) Hosten *
* *
* Special thanks to Eric Grange for his help *
* *
* All real work was of course performed by Russell L. Smith, *
* who created ODE. *
* *
* Convertion started 2002-09-16. *
* *
* There is no Delphi documentation for ODE, see the original ODE files *
* for information http://opende.sourceforge.net/ode-docs.html *
* *
*************************************************************************}
{CommentMarker}
{
Some notes;
Sometimes it's easier and faster to refer to the members of the objects
directly, like Body.Pos, Geom.Data or Body.Mass, instead of calling the built
in routines. Be very careful if you do this, because some of the built in
routines alter states when called.
Examples
Geom.Body := Body; // DON'T DO THIS
bGeomSetBody(Geom, Body); // This method must be used
Setting the mass of a body is another example. Typically, reading members is
fine, but before writing directly to member fields yourself, you should check
the c source and see what the function/procedure does. The source can be found
at http://www.q12.org/ode/
***********************************************************************
Change history
2004.05.19 - CH - New single and double dll. Added support for the new QuickStep solver
2004.04.25 - CH - New single and double dll. Trimesh now works in both mode.
2004.04.22 - MF - Fixes to make DelphiODE behave better when used as dynamic
2004.04.21 - CH - New single and double dll. Now handles Capped Cylinder vs Trimesh collision
Added dJointGetUniversalAngle and dJointGetUniversalAngleRate, ...
2004.04.08 - DL - Changed calling convention of dJointCreateContact and
dBodySetMass to require pointers. Again for compatability reasons.
2004.04.08 - DL - Minor compatibilit fixes (performed by MF)
2004.04.05 - CH - New single and double dll. Now handles trimesh/trimesh collision
2004.03.30 - DL - better crossplatform Module loading support using moduleloader.pas
2004.03.11 - CH - New single and double dll. Now handles auto-disable and new terrain geom
2004.03.08 - DL - Support for Delphi, Kylix, FreePascal, TMT Pascal and GnuPascal compilers
2004.02.25 - CH - New single and double dll. Now handles breakable joints
2004.02.18 - CH - New single and double dll
2003.09.08 - CH - New single and double dll. Now handles cones and terrain
2003.09.01 - EG - TriCollider bindings now dynamic to allow use of unit in Delphi5
(compatibility with other platforms unknow)
2003.07.23 - CH - New single dll, now handles Plane2D
2003.07.18 - CH - Added set and get UniversalParam, new dll deployed
2003.07.07 - MF - DelphiODE now defaults to Single precision, because TriMesh
only works with Single precision. We're hoping this will be corrected in the
future
2003.07.05 - CH - updated file to support new tri-collider code
2003.06.13 - CH - Created new DLL, adding dWorldStepFast and dJointTypePlane2D
2003.06.12 - MF - fixed Single support, which was slightly broken
2003.06.10 - MF - Removed GeomTransformGroup as they're not in the DLL.
2003.02.11 - JV - added syntax enforcement on some enumerated types
2003.02.01 - CH - removed dGeomGroup and all it's procedures / functions due to deprecation
2003.02.01 - MF - added a few new functions
2003.01.20 - CH - compiled a new DLL and added the new functions.
2002.10.31 - CH - compiled a new dll version, with some minor updates to friction among other things
2002.10.10 - MF - added the functions needed to support cylinder and GeomTransformGroup.
2002.10.10 - CH - compiled a new DLL with the new cylinder geom and the new GeomTransformGroup.
2002.09.25 - MF - I'm having issues with the single precision DLL, it seems less stable.
DelphiODE will still default to double precision. The goal is single
precision though, so the Tri-Collider can be used.
2002.09.24 - CH - New Single and Double precision DLLs created
2002.09.22 - DL - Preliminary Linux support
2002.09.16 - MF & CH - Conversion started
MF = Mattias Fagerlund
CH = Christophe Hosten (Chroma)
JV = John Villar
DL = Dominique Louis
EG = Eric Grange
}
{$I delphiode.inc}
interface
uses
{$IFDEF __GPC__}
system,
gpc,
{$ENDIF}
{$IFDEF UNIX}
{$IFDEF FPC}
{$IFDEF Ver1_0}
linux,
{$ELSE}
pthreads,
baseunix,
unix,
{$ENDIF}
x,
xlib,
{$ELSE}
Types,
Libc,
Xlib,
{$ENDIF}
{$ENDIF}
{$IFDEF __MACH__}
GPCMacOSAll,
{$ENDIF}
Classes;
const
{$IFDEF WIN32}
ODEDLL = 'ode.dll';
{$ENDIF}
{$IFDEF UNIX}
ODEDLL = 'libode.so';
{$ENDIF}
{$IFDEF MACOS}
ODEDLL = 'libode.dylib';
{$ENDIF}
{$IFDEF DARWIN} // MacOS X
ODEDLL = 'libode.dylib';
{$ENDIF}
type
// ********************************************************************
// ********************************************************************
//
// ODE precision:
//
// ODE can be run in Single or Double precision, Single is less precise,
// but requires less memory.
//
// If you choose to run in Single mode, you must deploy the single precision
// dll (this is default)
//
// If you choose to run in Double mode, you must deploy the double precision
// dll (named ode-Double.dll and located in the dll directory)
{$define cSINGLE} // Remove "$" from "$define" to make DelphiODE double based
{$ifdef cSINGLE}
TdReal = single;
{$else}
TdReal = double;
{$endif}
PdReal = ^TdReal;
{define cODEDebugEnabled} // Debug mode
// Pointers to internal ODE structures. These I haven't been able to reproduce
// in delphi, they're C++ classes.
TODEID = cardinal;
TdJointID = TODEID;
TdJointGroupID = TODEID;
TdRealArray = array[0..15] of TdReal;
PdRealArray = ^TdRealArray;
// typedef dReal dVector3[4];
// Q: Why isn't TdVector3 = array[0..2] of TdReal?
// A: Because of SIMD alignment.
TdVector3 = array[0..3] of TdReal;
PdVector3 = ^TdVector3;
// typedef dReal dVector4[4];
TdVector4 = array[0..3] of TdReal;
PdVector4 = ^TdVector4;
// typedef dReal dMatrix3[4*3];
TdMatrix3 = array[0..4*3-1] of TdReal;
PdMatrix3 = ^TdMatrix3;
TdMatrix3_As3x4 = array[0..2, 0..3] of TdReal;
PdMatrix3_As3x4 = ^TdMatrix3_As3x4;
// typedef dReal dMatrix4[4*4];
TdMatrix4 = array[0..4*4-1] of TdReal;
PdMatrix4 = ^TdMatrix4;
// typedef dReal dMatrix6[8*6];
TdMatrix6 = array[0..8*6-1] of TdReal;
PdMatrix6 = ^TdMatrix6;
// typedef dReal dQuaternion[4];
TdQuaternion = TdVector4;//array[0..3] of TdReal;
PdQuaternion = ^TdQuaternion;
// No typedef for AABB
TdAABB = array[0..5] of TdReal;
(*enum {
dxBodyFlagFiniteRotation = 1, // use finite rotations
dxBodyFlagFiniteRotationAxis = 2, // use finite rotations only along axis
dxBodyDisabled = 4 // body is disabled
};*)
// Delphi 5 can't handle enums like this :(
(* TBodyFlags =
(dxBodyFlagFiniteRotation = 1, // use finite rotations
dxBodyFlagFiniteRotationAxis = 2, // use finite rotations only along axis
dxBodyDisabled = 4, // body is disabled
dxBodyNoGravity = 8); // body is not influenced by gravity*)
(* Change: New Type added, syntax enforcement *)
TBodyFlags = Integer;
(* These consts now have defined types *)
const
dxBodyFlagFiniteRotation: TBodyFlags = 1; // use finite rotations
dxBodyFlagFiniteRotationAxis: TBodyFlags = 2; // use finite rotations only along axis
dxBodyDisabled: TBodyFlags = 4; // body is disabled
dxBodyNoGravity: TBodyFlags = 8; // body is not influenced by gravity
(*typedef struct dMass {
dReal mass; // total mass of the rigid body
dVector4 c; // center of gravity position in body frame (x,y,z)
dMatrix3 I; // 3x3 inertia tensor in body frame, about POR
} dMass;*)
type
TdMass = record
mass : TdReal; // total mass of the rigid body
c : TdVector4; // center of gravity position in body frame (x,y,z)
I : TdMatrix3; // 3x3 inertia tensor in body frame, about POR
end;
PdMass = ^TdMass;
(*struct dBase {
void *operator new (size_t size) { return dAlloc (size); }
void operator delete (void *ptr, size_t size) { dFree (ptr,size); }
void *operator new[] (size_t size) { return dAlloc (size); }
void operator delete[] (void *ptr, size_t size) { dFree (ptr,size); }
};
struct dObject : public dBase {
dxWorld *world; // world this object is in
dObject *next; // next object of this type in list
dObject **tome; // pointer to previous object's next ptr
void *userdata; // user settable data
int tag; // used by dynamics algorithms
};*)
PdxWorld = ^TdxWorld;
PdObject = ^TdObject;
PPdObject = ^PdObject;
TdObject = record
World : PdxWorld; // world this object is in
next : PdObject; // next object of this type in list
tome : PPdObject; // pointer to previous object's next ptr
userdata : pointer; // user settable data
tag : integer; // used by dynamics algorithms
end;
(*struct dxBody : public dObject {
dxJointNode *firstjoint; // list of attached joints
int flags; // some dxBodyFlagXXX flags
dMass mass; // mass parameters about POR
dMatrix3 invI; // inverse of mass.I
dReal invMass; // 1 / mass.mass
dVector3 pos; // position of POR (point of reference)
dQuaternion q; // orientation quaternion
dMatrix3 R; // rotation matrix, always corresponds to q
dVector3 lvel,avel; // linear and angular velocity of POR
dVector3 facc,tacc; // force and torque accululators
dVector3 finite_rot_axis; // finite rotation axis, unit length or 0=none
}; *)
PdxBody = ^TdxBody;
TdxBody = record
BaseObject : TdObject;
{$ifdef cSINGLE}
Padding : byte;
{$endif}
firstjoint : TdJointID; // list of attached joints
flags : integer; // some dxBodyFlagXXX flags
mass : TdMass; // mass parameters about POR
invI : TdMatrix3 ; // inverse of mass.I
invMass : TdReal; // 1 / mass.mass
pos : TdVector3; // position of POR (point of reference)
q : TdQuaternion; // orientation quaternion
R : TdMatrix3; // rotation matrix, always corresponds to q
lvel,avel : TdVector3; // linear and angular velocity of POR
facc,tacc : TdVector3 ; // force and torque accululators
finite_rot_axis : TdVector3 ; // finite rotation axis, unit length or 0=none
end;
TBodyList = class(TList)
private
function GetItems(i: integer): PdxBody;
procedure SetItems(i: integer; const Value: PdxBody);
public
property Items[i : integer] : PdxBody read GetItems write SetItems; default;
procedure DeleteAllBodies;
end;
(*struct dxWorld : public dBase {
dxBody *firstbody; // body linked list
dxJoint *firstjoint; // joint linked list
int nb,nj; // number of bodies and joints in lists
dVector3 gravity; // gravity vector (m/s/s)
dReal global_erp; // global error reduction parameter
dReal global_cfm; // global costraint force mixing parameter
};*)
TdxWorld = record //(TdBase)
firstbody : PdxBody; // body linked list
firstjoint : TdJointID; // joint linked list
nb,nj : integer; // number of bodies and joints in lists
gravity : TdVector3; // gravity vector (m/s/s)
global_erp : TdReal; // global error reduction parameter
global_cfm : TdReal; // global costraint force mixing parameter
end;
(* typedef struct dJointFeedback {
dVector3 f1; // force that joint applies to body 1
dVector3 t1; // torque that joint applies to body 1
dVector3 f2; // force that joint applies to body 2
dVector3 t2; // torque that joint applies to body 2
} dJointFeedback;)*)
TdJointFeedback = record
f1 : TdVector3; // force that joint applies to body 1
t1 : TdVector3; // torque that joint applies to body 1
f2 : TdVector3; // force that joint applies to body 2
t2 : TdVector3; // torque that joint applies to body 2
end;
PTdJointFeedback = ^TdJointFeedback;
(*enum {
d_ERR_UNKNOWN = 0, /* unknown error */
d_ERR_IASSERT, /* internal assertion failed */
d_ERR_UASSERT, /* user assertion failed */
d_ERR_LCP /* user assertion failed */
};*)
TdErrorType =
(d_ERR_UNKNOWN,
d_ERR_IASSERT,
d_ERR_UASSERT,
d_ERR_LCP { = 3//});
(*/* joint type numbers */
enum {
dJointTypeNone = 0, /* or "unknown" */
dJointTypeBall,
dJointTypeHinge,
dJointTypeSlider,
dJointTypeContact,
dJointTypeHinge2,
dJointTypeFixed,
dJointTypeNull,
dJointTypeAMotor
};*)
TdJointTypeNumbers =
(dJointTypeNone, // or "unknown"
dJointTypeBall,
dJointTypeHinge,
dJointTypeSlider,
dJointTypeContact,
dJointTypeHinge2,
dJointTypeFixed,
dJointTypeNull,
dJointTypeAMotor,
dJointTypePlane2D);
TdAngularMotorModeNumbers =
(dAMotorUser,
dAMotorEuler);
// joint flags
(*enum {
// if this flag is set, the joint was allocated in a joint group
dJOINT_INGROUP = 1,
// if this flag is set, the joint was attached with arguments (0,body).
// our convention is to treat all attaches as (body,0), i.e. so node[0].body
// is always nonzero, so this flag records the fact that the arguments were
// swapped.
dJOINT_REVERSE = 2,
// if this flag is set, the joint can not have just one body attached to it,
// it must have either zero or two bodies attached.
dJOINT_TWOBODIES = 4
};*)
//TJointFlag = (
(* Change: New Type added, syntax enforcement *)
type
TJointFlag = Integer;
(* These consts now have defined types *)
const
dJOINT_INGROUP: TJointFlag = 1;
dJOINT_REVERSE: TJointFlag = 2;
dJOINT_TWOBODIES: TJointFlag = 4;
// Space constants
const
TYPE_SIMPLE = $bad;
TYPE_HASH = $babe;
(*enum {
dContactMu2 = 0x001,
dContactFDir1 = 0x002,
dContactBounce = 0x004,
dContactSoftERP = 0x008,
dContactSoftCFM = 0x010,
dContactMotion1 = 0x020,
dContactMotion2 = 0x040,
dContactSlip1 = 0x080,
dContactSlip2 = 0x100,
dContactApprox0 = 0x0000,
dContactApprox1_1 = 0x1000,
dContactApprox1_2 = 0x2000,
dContactApprox1 = 0x3000
};*)
// TdContactType = (
(* Change: New Type added, syntax enforcement *)
type
TdContactType = Integer;
(* These consts now have defined types *)
const
dContactMu2: TdContactType = $0001;
dContactFDir1: TdContactType = $0002;
dContactBounce: TdContactType = $0004;
dContactSoftERP: TdContactType = $0008;
dContactSoftCFM: TdContactType = $0010;
dContactMotion1: TdContactType = $0020;
dContactMotion2: TdContactType = $0040;
dContactSlip1: TdContactType = $0080;
dContactSlip2: TdContactType = $0100;
dContactApprox0: TdContactType = $00000;
dContactApprox1_1: TdContactType = $1000;
dContactApprox1_2: TdContactType = $2000;
dContactApprox1: TdContactType = $3000;
(* typedef struct dSurfaceParameters {
/* must always be defined */
int mode;
dReal mu;
/* only defined if the corresponding flag is set in mode */
dReal mu2;
dReal bounce;
dReal bounce_vel;
dReal soft_erp;
dReal soft_cfm;
dReal motion1,motion2;
dReal slip1,slip2;
} dSurfaceParameters;*)
// enum { TRIMESH_FACE_NORMALS, TRIMESH_LAST_TRANSFORMATION };
const
TRIMESH_FACE_NORMALS = 0;
TRIMESH_LAST_TRANSFORMATION = 1;
type
TdSurfaceParameters = record
// must always be defined
mode : cardinal;
mu : TdReal;
// only defined if the corresponding flag is set in mode
mu2,
bounce,
bounce_vel,
soft_erp,
soft_cfm,
motion1,motion2,
slip1,slip2 : TdReal
end;
(*typedef struct dContactGeom {
dVector3 pos;
dVector3 normal;
dReal depth;
dGeomID g1,g2;
} dContactGeom;*)
PdxGeom = ^TdxGeom;
TdContactGeom = record
pos : TdVector3;
normal : TdVector3;
depth : TdReal;
g1,g2 : PdxGeom;
end;
PdContactGeom = ^TdContactGeom;
(*struct dContact {
dSurfaceParameters surface;
dContactGeom geom;
dVector3 fdir1;
};*)
TdContact = record
surface : TdSurfaceParameters;
geom : TdContactGeom;
fdir1 : TdVector3;
end;
PdContact = ^TdContact;
// Collission callback structure
TdNearCallback = procedure(data : pointer; o1, o2 : PdxGeom); cdecl;
TdColliderFn = function(o1, o2 : PdxGeom; flags : Integer;
contact : PdContactGeom; skip : Integer) : Integer; cdecl;
TdGetColliderFnFn = function(num : Integer) : TdColliderFn; cdecl;
TdGetAABBFn = procedure(g : PdxGeom; var aabb : TdAABB); cdecl;
TdGeomDtorFn = procedure(o : PdxGeom); cdecl;
TdAABBTestFn = function(o1, o2 : PdxGeom; const aabb2 : TdAABB) : Integer; cdecl;
(*typedef struct dGeomClass {
int bytes;
dGetColliderFnFn *collider;
dGetAABBFn *aabb;
dAABBTestFn *aabb_test;
dGeomDtorFn *dtor;
} dGeomClass;*)
TdGeomClass = record
bytes : integer; // extra storage size
collider : TdGetColliderFnFn; // collider function
aabb : TdGetAABBFn; // bounding box function
aabb_test : TdAABBTestFn; // aabb tester, can be 0 for none
dtor : TdGeomDtorFn; // destructor, can be 0 for none
end;
PdGeomClass = ^TdGeomClass;
(*struct dxGeomClass {
dGetColliderFnFn *collider;
dGetAABBFn *aabb;
dAABBTestFn *aabb_test;
dGeomDtorFn *dtor;
int num; // class number
int size; // total size of object, including extra data area
};*)
TdxGeomClass = record
collider : TdGetColliderFnFn; // collider function
aabb : TdGetAABBFn; // bounding box function
aabb_test : TdAABBTestFn; // aabb tester, can be 0 for none
dtor : TdGeomDtorFn; // destructor, can be 0 for none
num : integer; // class number
size : integer; // total size of object, including extra data area
end;
PdxGeomClass = ^TdxGeomClass;
(*// position vector and rotation matrix for geometry objects that are not
// connected to bodies.
struct dxPosR {
dVector3 pos;
dMatrix3 R;
};*)
TdxPosR = record
pos : TdVector3;
R : TdMatrix3;
end;
(*struct dxSpace : public dBase {
int type; // don't want to use RTTI
virtual void destroy()=0;
virtual void add (dGeomID)=0;
virtual void remove (dGeomID)=0;
virtual void collide (void *data, dNearCallback *callback)=0;
virtual int query (dGeomID)=0;
};*)
TdxSpace = record
_Garbage : integer;
// * Explaining _Garbage *
// That member first appears in the TdxSpace record. This is
// because the dxSpace struct declares its functions as virtual. Since the
// class (a struct in C++ is considered a public class) now contains virtual
// functions (functions in dxBase are not virtual), it needs a vtable to know
// what functions to call in what class. Visual C++ places the pointer to the
// vtable at offset 0, which is what your _Garbage field caters for.
//
// Steve 'Sly' Williams
SpaceType : integer;
end;
PdxSpace = ^TdxSpace;
TdRealHugeArray = array[0..65535] of TdReal;
PdRealHugeArray = ^TdRealHugeArray;
// Tri-list collider
TdIntegerArray = array[0..65535] of Integer;
PdIntegerArray = ^TdIntegerArray;
TdVector3Array = array[0..65535] of TdVector3;
PdVector3Array = ^TdVector3Array;
(*struct dxTriMeshData{
Model BVTree;
MeshInterface Mesh;
dxTriMeshData();
~dxTriMeshData();
void Build(const void* Vertices, int VertexStide, int VertexCount,
const void* Indices, int IndexCount, int TriStride,
const void* Normals,
bool Single);
/* aabb in model space */
dVector3 AABBCenter;
dVector3 AABBExtents;
/* data for use in collison resolution */
const void* Normals;
Matrix4x4 last_trans;
};*)
TdxTriMeshData = record
unknown : byte; //
end;
PdxTriMeshData = ^TdxTriMeshData;
(*//simple space - reports all n^2 object intersections
struct dxSimpleSpace : public dxSpace {
dGeomID first;
void destroy();
void add (dGeomID);
void remove (dGeomID);
void collide (void *data, dNearCallback *callback);
int query (dGeomID);
};*)
// Copies settings from TdxSpace, beacause pascal doeasn't do inheritance
// for records
TdxSimpleSpace = record
_Garbage : integer; // I don't know where this comes from!
SpaceType : integer;
First : PdxGeom;
end;
PdxSimpleSpace = ^TdxSimpleSpace;
(*//currently the space 'container' is just a list of the geoms in the space.
struct dxHashSpace : public dxSpace {
dxGeom *first;
int global_minlevel; // smallest hash table level to put AABBs in
int global_maxlevel; // objects that need a level larger than this will be
// put in a "big objects" list instead of a hash table
void destroy();
void add (dGeomID);
void remove (dGeomID);
void collide (void *data, dNearCallback *callback);
int query (dGeomID);
};*)
// Copies settings from TdxSpace, beacause pascal doeasn't do inheritance
// for records
TdxHashSpace = record
_Garbage : integer; // I don't know where this comes from!
SpaceType : integer;
First : PdxGeom;
global_minlevel : integer;
global_maxlevel : integer;
end;
PdxHashSpace = ^TdxHashSpace;
(*typedef struct dGeomSpaceData {
dGeomID next;
} dGeomSpaceData; *)
TdGeomSpaceData = record
next : PdxGeom;
end;
(*// common data for all geometry objects. the class-specific data area follows
// this structure. pos and R will either point to a separately allocated
// buffer (if body is 0 - pos points to the dxPosR object) or to the pos and
// R of the body (if body nonzero).
struct dxGeom { // a dGeomID is a pointer to this
dxGeomClass *_class; // class of this object
void *data; // user data pointer
dBodyID body; // dynamics body associated with this object (if any)
dReal *pos; // pointer to object's position vector
dReal *R; // pointer to object's rotation matrix
dSpaceID spaceid; // the space this object is in
dGeomSpaceData space; // reserved for use by space this object is in
dReal *space_aabb; // ptr to aabb array held by dSpaceCollide() fn
// class-specific data follows here, with proper alignment.
};*)
TdxGeom = record // a dGeomID is a pointer to this
_class : PdxGeomClass; // class of this object
{$ifdef cSINGLE}
Padding : array [0..4] of byte;
{$else}
Padding : array [0..2] of pointer;
{$endif}
data : pointer; // user data pointer
Body : PdxBody ; // dynamics body associated with this object (if any)
Pos : PdVector3; // pointer to object's position vector
R : PdMatrix3; // pointer to object's rotation matrix
spaceid : PdxSpace; // the space this object is in
space : TdGeomSpaceData ; // reserved for use by space this object is in
space_aabb : PdReal; // ptr to aabb array held by dSpaceCollide() fn
// class-specific data follows here, with proper alignment.
end;
TGeomList = class(TList)
private
function GetItems(i: integer): PdxGeom;
procedure SetItems(i: integer; const Value: PdxGeom);
public
property Items[i : integer] : PdxGeom read GetItems write SetItems; default;
procedure DeleteAllGeoms(DeleteDataAsObject : boolean=false);
end;
(*
/* standard joint parameter names. why are these here? - because we don't want
* to include all the joint function definitions in joint.cpp. hmmmm.
* MSVC complains if we call D_ALL_PARAM_NAMES_X with a blank second argument,
* which is why we have the D_ALL_PARAM_NAMES macro as well. please copy and
* paste between these two.
*/
#define D_ALL_PARAM_NAMES(start) \
/* parameters for limits and motors */ \
dParamLoStop = start, \
dParamHiStop, \
dParamVel, \
dParamFMax, \
dParamFudgeFactor, \
dParamBounce, \
dParamCFM, \
dParamStopERP, \
dParamStopCFM, \
/* parameters for suspension */ \
dParamSuspensionERP, \
dParamSuspensionCFM,
#define D_ALL_PARAM_NAMES_X(start,x) \
/* parameters for limits and motors */ \
dParamLoStop ## x = start, \
dParamHiStop ## x, \
dParamVel ## x, \
dParamFMax ## x, \
dParamFudgeFactor ## x, \
dParamBounce ## x, \
dParamCFM ## x, \
dParamStopERP ## x, \
dParamStopCFM ## x, \
/* parameters for suspension */ \
dParamSuspensionERP ## x, \
dParamSuspensionCFM ## x,
enum {
D_ALL_PARAM_NAMES(0)
D_ALL_PARAM_NAMES_X(0x100,2)
D_ALL_PARAM_NAMES_X(0x200,3)
/* add a multiple of this constant to the basic parameter numbers to get
* the parameters for the second, third etc axes.
*/
dParamGroup=0x100
};*)
// TJointParams = (
// parameters for limits and motors
(* Change: New Type added, sintax enforcement *)
type
TJointParams = Integer;
(* These consts now have defined types *)
const
_priv_dParamLoStop = 0;
_priv_dParamLoStop2 = $100;
_priv_dParamLoStop3 = $200;
const
dParamLoStop: TJointParams = _priv_dParamLoStop;
dParamHiStop: TJointParams = _priv_dParamLoStop + 1;
dParamVel: TJointParams = _priv_dParamLoStop + 2;
dParamFMax: TJointParams = _priv_dParamLoStop + 3;
dParamFudgeFactor: TJointParams = _priv_dParamLoStop + 4;
dParamBounce: TJointParams = _priv_dParamLoStop + 5;
dParamCFM: TJointParams = _priv_dParamLoStop + 6;
dParamStopERP: TJointParams = _priv_dParamLoStop + 7;
dParamStopCFM: TJointParams = _priv_dParamLoStop + 8;
// parameters for suspension
dParamSuspensionERP: TJointParams = _priv_dParamLoStop + 9;
dParamSuspensionCFM: TJointParams = _priv_dParamLoStop + 10;
// SECOND AXEL
// parameters for limits and motors
dParamLoStop2: TJointParams = _priv_dParamLoStop2;
dParamHiStop2: TJointParams = _priv_dParamLoStop2 + 1;
dParamVel2: TJointParams = _priv_dParamLoStop2 + 2;
dParamFMax2: TJointParams = _priv_dParamLoStop2 + 3;
dParamFudgeFactor2: TJointParams = _priv_dParamLoStop2 + 4;
dParamBounce2: TJointParams = _priv_dParamLoStop2 + 5;
dParamCFM2: TJointParams = _priv_dParamLoStop2 + 6;
dParamStopERP2: TJointParams = _priv_dParamLoStop2 + 7;
dParamStopCFM2: TJointParams = _priv_dParamLoStop2 + 8;
// parameters for suspension
dParamSuspensionERP2: TJointParams = _priv_dParamLoStop2 + 9;
dParamSuspensionCFM2: TJointParams = _priv_dParamLoStop2 + 10;
// THIRD AXEL
// parameters for limits and motors
dParamLoStop3: TJointParams = _priv_dParamLoStop3;
dParamHiStop3: TJointParams = _priv_dParamLoStop3 + 1;
dParamVel3: TJointParams = _priv_dParamLoStop3 + 2;
dParamFMax3: TJointParams = _priv_dParamLoStop3 + 3;
dParamFudgeFactor3: TJointParams = _priv_dParamLoStop3 + 4;
dParamBounce3: TJointParams = _priv_dParamLoStop3 + 5;
dParamCFM3: TJointParams = _priv_dParamLoStop3 + 6;
dParamStopERP3: TJointParams = _priv_dParamLoStop3 + 7;
dParamStopCFM3: TJointParams = _priv_dParamLoStop3 + 8;
// parameters for suspension
dParamSuspensionERP3: TJointParams = _priv_dParamLoStop3 + 9;
dParamSuspensionCFM3: TJointParams = _priv_dParamLoStop3 + 10;
// AGAIN!
// dParamGroup * 2 + dParamBounce = dParamBounce2
dParamGroup: TJointParams = $100;
{ TODO :
// How does one import integers?
dBoxClass
dCCylinderClass
dGeomTransformClass
dSphereClass
dPlaneClass
...
// Functions
dBoxBox
dDebug
dError
dMessage
dFactorCholesky
dFactorLDLT
dPlaneSpace
dInvertPDMatrix
dIsPositiveDefinite
dLDLTAddTL
dLDLTRemove
dRemoveRowCol
dSetDebugHandler
dSetErrorHandler
dSetMessageHandler
dSetZero
dSolveCholesky
dSolveLDLT}
// ***************************************************************************
// ***************************************************************************
// ***** WORLD
//----- dWorld -----
function dWorldCreate: PdxWorld; cdecl; external {$IFDEF __GPC__}name 'dWorldCreate'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldDestroy(const World: PdxWorld); cdecl; external {$IFDEF __GPC__}name 'dWorldDestroy'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dWorldGetCFM(const World: PdxWorld): TdReal; cdecl; external {$IFDEF __GPC__}name 'dWorldGetCFM'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dWorldGetERP(const World: PdxWorld): TdReal; cdecl; external {$IFDEF __GPC__}name 'dWorldGetERP'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldGetGravity(const World: PdxWorld; var gravity: TdVector3); cdecl; external {$IFDEF __GPC__}name 'dWorldGetGravity'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldImpulseToForce(const World: PdxWorld; const stepsize, ix, iy, iz: TdReal; var force: TdVector3); cdecl; external {$IFDEF __GPC__}name 'dWorldImpulseToForce'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldSetCFM(const World: PdxWorld; cfm: TdReal); cdecl; external {$IFDEF __GPC__}name 'dWorldSetCFM'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldSetERP(const World: PdxWorld; erp: TdReal); cdecl; external {$IFDEF __GPC__}name 'dWorldSetERP'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldSetGravity(const World: PdxWorld; const x, y, z: TdReal); cdecl; external {$IFDEF __GPC__}name 'dWorldSetGravity'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldSetContactMaxCorrectingVel(const World: PdxWorld; const vel: TdReal); cdecl; external {$IFDEF __GPC__}name 'WorldSetContactMaxCorrectingVel'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dWorldGetContactMaxCorrectingVel(const World: PdxWorld): TdReal; cdecl; external {$IFDEF __GPC__}name 'dWorldGetContactMaxCorrectingVel'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldSetContactSurfaceLayer(const World: PdxWorld; const depth: TdReal); cdecl; external {$IFDEF __GPC__}name 'dWorldSetContactSurfaceLayer'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dWorldGetContactSurfaceLayer(const World: PdxWorld): TdReal; cdecl; external {$IFDEF __GPC__}name 'dWorldGetContactSurfaceLayer'{$ELSE} ODEDLL{$ENDIF __GPC__};
// Step
procedure dWorldStep(const World: PdxWorld; const stepsize: TdReal); cdecl; external {$IFDEF __GPC__}name 'dWorldStep'{$ELSE} ODEDLL{$ENDIF __GPC__};
// QuickStep
procedure dWorldQuickStep(const World: PdxWorld; const stepsize: TdReal); cdecl; external {$IFDEF __GPC__}name 'dWorldQuickStep'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldSetQuickStepNumIterations(const World: PdxWorld; const num: integer); cdecl; external {$IFDEF __GPC__}name 'dWorldSetQuickStepNumIterations'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dWorldGetQuickStepNumIterations(const World: PdxWorld): integer; cdecl; external {$IFDEF __GPC__}name 'dWorldGetQuickStepNumIterations'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldSetQuickStepW(const World: PdxWorld; const param: TdReal); cdecl; external {$IFDEF __GPC__}name 'dWorldSetQuickStepW'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dWorldGetQuickStepW(const World: PdxWorld): TdReal; cdecl; external {$IFDEF __GPC__}name 'dWorldGetQuickStepW'{$ELSE} ODEDLL{$ENDIF __GPC__};
// Stepfast
procedure dWorldStepFast1(const World: PdxWorld; const stepsize: TdReal; const iterations: Integer); cdecl; external {$IFDEF __GPC__}name 'dWorldStepFast1'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dWorldSetAutoEnableDepthSF1(const World: PdxWorld; autodepth: Integer); cdecl; external {$IFDEF __GPC__}name 'dWorldSetAutoEnableDepthSF1'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dWorldGetAutoEnableDepthSF1(const World: PdxWorld): Integer; cdecl; external {$IFDEF __GPC__}name 'dWorldGetAutoEnableDepthSF1'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dCloseODE; cdecl; external {$IFDEF __GPC__}name 'dCloseODE'{$ELSE} ODEDLL{$ENDIF __GPC__};
//----- dBody -----
procedure dBodyAddForce(const Body: PdxBody; const fx, fy, fz: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodyAddForce'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyAddForceAtPos(const Body: PdxBody; const fx, fy, fz, px, py, pz: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodyAddForceAtPos'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyAddForceAtRelPos(const Body: PdxBody; const fx, fy, fz, px, py, pz: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodyAddForceAtRelPos'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyAddRelForce(const Body: PdxBody; const fx, fy, fz: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodyAddRelForce'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyAddRelForceAtPos(const Body: PdxBody; const fx, fy, fz, px, py, pz: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodyAddRelForceAtPos'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyAddRelForceAtRelPos(const Body: PdxBody; const fx, fy, fz, px, py, pz: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodyAddRelForceAtRelPos'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyAddRelTorque(const Body: PdxBody; const fx, fy, fz: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodyAddRelTorque'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyAddTorque(const Body: PdxBody; const fx, fy, fz: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodyAddTorque'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyCreate(const World: PdxWorld): PdxBody; cdecl; external {$IFDEF __GPC__}name 'dBodyCreate'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyDestroy(const Body: PdxBody); cdecl; external {$IFDEF __GPC__}name 'dBodyDestroy'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyDisable(const Body: PdxBody); cdecl; external {$IFDEF __GPC__}name 'dBodyDisable'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyEnable(const Body: PdxBody); cdecl; external {$IFDEF __GPC__}name 'dBodyEnable'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetAngularVel(const Body: PdxBody): PdVector3; cdecl; external {$IFDEF __GPC__}name 'dBodyGetAngularVel'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyGetFiniteRotationAxis(const Body: PdxBody; var result: TdVector3); cdecl; external {$IFDEF __GPC__}name 'dBodyGetFiniteRotationAxis'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetFiniteRotationMode(const Body: PdxBody): Integer; cdecl; external {$IFDEF __GPC__}name 'dBodyGetFiniteRotationMode'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetForce(const Body: PdxBody): PdVector3; cdecl; external {$IFDEF __GPC__}name 'dBodyGetForce'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetGravityMode(const Body: PdxBody): Integer; cdecl; external {$IFDEF __GPC__}name 'dBodyGetGravityMode'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetJoint(const Body: PdxBody; const index: Integer): TdJointID; cdecl; external {$IFDEF __GPC__}name 'dBodyGetJoint'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetLinearVel(const Body: PdxBody): PdVector3; cdecl; external {$IFDEF __GPC__}name 'dBodyGetLinearVel'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyGetMass(const Body: PdxBody; var mass: TdMass); cdecl; external {$IFDEF __GPC__}name 'dBodyGetMass'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetNumJoints(const Body: PdxBody): Integer; cdecl; external {$IFDEF __GPC__}name 'dBodyGetNumJoints'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyGetPointVel(const Body: PdxBody; const px, py, pz: TdReal; var result: TdVector3); cdecl; external {$IFDEF __GPC__}name 'dBodyGetPointVel'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyGetPosRelPoint(const Body: PdxBody; const px, py, pz: TdReal; var result: TdVector3); cdecl; external {$IFDEF __GPC__}name 'dBodyGetPosRelPoint'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetPosition(const Body: PdxBody): PdVector3; cdecl; external {$IFDEF __GPC__}name 'dBodyGetPosition'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetQuaternion(const Body: PdxBody): PdQuaternion; cdecl; external {$IFDEF __GPC__}name 'dBodyGetQuaternion'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyGetRelPointPos(const Body: PdxBody; const px, py, pz: TdReal; var result: TdVector3); cdecl; external {$IFDEF __GPC__}name 'dBodyGetRelPointPos'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyGetRelPointVel(const Body: PdxBody; const px, py, pz: TdReal; var result: TdVector3); cdecl; external {$IFDEF __GPC__}name 'dBodyGetRelPointVel'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetRotation(const Body: PdxBody): PdMatrix3; cdecl; external {$IFDEF __GPC__}name 'dBodyGetRotation'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetTorque(const Body: PdxBody): PdVector3; cdecl; external {$IFDEF __GPC__}name 'dBodyGetTorque'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyIsEnabled(const Body: PdxBody): Integer; cdecl; external {$IFDEF __GPC__}name 'dBodyIsEnabled'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetAngularVel(const Body: PdxBody; const x, y, z: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodySetAngularVel'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetFiniteRotationAxis(const Body: PdxBody; const x, y, z: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodySetFiniteRotationAxis'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetFiniteRotationMode(const Body: PdxBody; const mode: Integer); cdecl; external {$IFDEF __GPC__}name 'dBodySetFiniteRotationMode'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetForce(const Body: PdxBody; const x, y, z: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodySetForce'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetGravityMode(const Body: PdxBody; const mode: Integer); cdecl; external {$IFDEF __GPC__}name 'dBodySetGravityMode'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetLinearVel(const Body: PdxBody; const x, y, z: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodySetLinearVel'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetMass( const Body: PdxBody; const mass: PdMass); cdecl; external {$IFDEF __GPC__}name 'dBodySetMass'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetPosition(const Body: PdxBody; const x, y, z: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodySetPosition'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetQuaternion(const Body: PdxBody; const q: TdQuaternion); cdecl; external {$IFDEF __GPC__}name 'dBodySetQuaternion'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetRotation(const Body: PdxBody; const R: TdMatrix3); cdecl; external {$IFDEF __GPC__}name 'dBodySetRotation'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetTorque(const Body: PdxBody; const x, y, z: TdReal); cdecl; external {$IFDEF __GPC__}name 'dBodySetTorque'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyVectorFromWorld(const Body: PdxBody; const px, py, pz: TdReal; var result: TdVector3); cdecl; external {$IFDEF __GPC__}name 'dBodyVectorFromWorld'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodyVectorToWorld(const Body: PdxBody; const px, py, pz: TdReal; var result: TdVector3); cdecl; external {$IFDEF __GPC__}name 'dBodyVectorToWorld'{$ELSE} ODEDLL{$ENDIF __GPC__};
procedure dBodySetData (const Body: PdxBody; data : pointer); cdecl; external {$IFDEF __GPC__}name 'dBodySetData'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dBodyGetData (const Body: PdxBody) : pointer; cdecl; external {$IFDEF __GPC__}name 'dBodyGetData'{$ELSE} ODEDLL{$ENDIF __GPC__};
//----- dJoint -----
procedure dJointAttach(const dJointID : TdJointID; const body1, body2: PdxBody); cdecl; external {$IFDEF __GPC__}name 'dJointAttach'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dJointCreateAMotor(const World : PdxWorld; dJointGroupID : TdJointGroupID): TdJointID; cdecl; external {$IFDEF __GPC__}name 'dJointCreateAMotor'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dJointCreateBall(const World : PdxWorld; dJointGroupID : TdJointGroupID): TdJointID; cdecl; external {$IFDEF __GPC__}name 'dJointCreateBall'{$ELSE} ODEDLL{$ENDIF __GPC__};
function dJointCreateContact(const World : PdxWorld; dJointGroupID : TdJointGroupID; const dContact: PdContact): TdJointID; cdecl; external {$IFDEF __GPC__}name 'dJointCreateContact'{$ELSE} ODEDLL{$ENDIF __GPC__};