NGD.NewtonImport.pas 105 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266
  1. (* Copyright (c) <2003-2020> <Julio Jerez, Newton Game Dynamics>
  2. *
  3. * This software is provided 'as-is', without any express or implied
  4. * warranty. In no event will the authors be held liable for any damages
  5. * arising from the use of this software.
  6. *
  7. * Permission is granted to anyone to use this software for any purpose,
  8. * including commercial applications, and to alter it and redistribute it
  9. * freely, subject to the following restrictions:
  10. *
  11. * 1. The origin of this software must not be misrepresented; you must not
  12. * claim that you wrote the original software. If you use this software
  13. * in a product, an acknowledgment in the product documentation would be
  14. * appreciated but is not required.
  15. *
  16. * 2. Altered source versions must be plainly marked as such, and must not be
  17. * misrepresented as being the original software.
  18. *
  19. * 3. This notice may not be removed or altered from any source distribution.
  20. *)
  21. unit NGD.NewtonImport;
  22. // Define double to use newton in double precision
  23. {.$DEFINE USE_DOUBLE_PRECISION}
  24. interface
  25. const
  26. {$IFDEF WIN32}
  27. {$IFDEF USE_DOUBLE_PRECISION}
  28. NEWTON_API = 'newton32d.dll';
  29. {$ELSE}
  30. NEWTON_API = 'newton32s.dll';
  31. {$ENDIF}
  32. {$ENDIF}
  33. {$IFDEF WIN64}
  34. {$IFDEF USE_DOUBLE_PRECISION}
  35. NEWTON_API = 'newton64d.dll';
  36. {$ELSE}
  37. NEWTON_API = 'newton64s.dll';
  38. {$ENDIF}
  39. {$ENDIF}
  40. type
  41. {$IFDEF USE_DOUBLE_PRECISION}
  42. Float = Double;
  43. dFloat = Double;
  44. {$ELSE}
  45. Float = Single;
  46. dFloat = Single;
  47. {$ENDIF}
  48. PFloat = ^Float;
  49. PdFloat = ^dFloat;
  50. PInteger = ^Integer;
  51. Psmallint = ^smallint;
  52. PPointer = ^Pointer;
  53. dFloat64 = Double;
  54. PdFloat64 = ^dFloat64;
  55. dLong = Int64;
  56. PdLong = ^dLong;
  57. PNewtonMesh = ^Pointer;
  58. PNewtonBody = ^Pointer;
  59. PNewtonWorld = ^Pointer;
  60. PNewtonJoint = ^Pointer;
  61. PNewtonMaterial = ^Pointer;
  62. PNewtonCollision = ^Pointer;
  63. PNewtonSceneProxy = ^Pointer;
  64. PNewtonFracturedCompoundMeshPart = ^Pointer;
  65. PNewtonDeformableMeshSegment = ^Pointer;
  66. PNewtonAcyclicArticulation = ^Pointer;
  67. PNewtonInverseDynamics = ^Pointer;
  68. (*
  69. PNewtonSerializeHandle = ^Pointer;
  70. PNewtonMeshHandle = ^Pointer;
  71. PNewtonMeshVertex = ^Pointer;
  72. PNewtonMeshPoint = ^Pointer;
  73. PNewtonMeshEdge = ^Pointer;
  74. PNewtonMeshFace = ^Pointer;
  75. PNewtonListener = ^Pointer;
  76. *)
  77. TNewtonFuncLinkRecord = record
  78. function_name: widestring;
  79. function_ptr: pointer
  80. end;
  81. const
  82. NEWTON_MAJOR_VERSION = 3;
  83. NEWTON_MINOR_VERSION = 15;
  84. NEWTON_BROADPHASE_DEFAULT = 0;
  85. NEWTON_BROADPHASE_PERSINTENT = 1;
  86. NEWTON_DYNAMIC_BODY = 0;
  87. NEWTON_KINEMATIC_BODY = 1;
  88. NEWTON_DYNAMIC_ASYMETRIC_BODY = 2;
  89. // NEWTON_DEFORMABLE_BODY = 2;
  90. SERIALIZE_ID_SPHERE = 0;
  91. SERIALIZE_ID_CAPSULE = 1;
  92. SERIALIZE_ID_CYLINDER = 2;
  93. SERIALIZE_ID_CHAMFERCYLINDER = 3;
  94. SERIALIZE_ID_BOX = 4;
  95. SERIALIZE_ID_CONE = 5;
  96. SERIALIZE_ID_CONVEXHULL = 6;
  97. SERIALIZE_ID_NULL = 7;
  98. SERIALIZE_ID_COMPOUND = 8;
  99. SERIALIZE_ID_TREE = 9;
  100. SERIALIZE_ID_HEIGHTFIELD = 10;
  101. SERIALIZE_ID_CLOTH_PATCH = 11;
  102. SERIALIZE_ID_DEFORMABLE_SOLID = 12;
  103. SERIALIZE_ID_USERMESH = 13;
  104. SERIALIZE_ID_SCENE = 14;
  105. SERIALIZE_ID_FRACTURED_COMPOUND = 15;
  106. type
  107. TNewtonMaterialData = packed record
  108. case integer of
  109. 1: (
  110. m_ptr: Pointer;
  111. );
  112. 2: (
  113. m_int: dLong;
  114. );
  115. 3: (
  116. m_float: dFloat;
  117. );
  118. end;
  119. PNewtonMaterialData = ^TNewtonMaterialData;
  120. TNewtonCollisionMaterial = packed record
  121. m_userId: dLong;
  122. m_userData: TNewtonMaterialData;
  123. m_userParam: array[0..5] of TNewtonMaterialData;
  124. end;
  125. PNewtonCollisionMaterial = ^TNewtonCollisionMaterial;
  126. TNewtonBoxParam = packed record
  127. m_x: dFloat;
  128. m_y: dFloat;
  129. m_z: dFloat;
  130. end;
  131. PNewtonBoxParam = ^TNewtonBoxParam;
  132. TNewtonSphereParam = packed record
  133. m_radio: dFloat;
  134. end;
  135. PNewtonSphereParam = ^TNewtonSphereParam;
  136. TNewtonCapsuleParam = packed record
  137. m_radio0: dfloat;
  138. m_radio1: dfloat;
  139. m_height: dfloat;
  140. end;
  141. PNewtonCapsuleParam = ^TNewtonCapsuleParam;
  142. TNewtonCylinderParam = packed record
  143. m_radio0: dfloat;
  144. m_radio1: dfloat;
  145. m_height: dfloat;
  146. end;
  147. PNewtonCylinderParam = ^TNewtonCylinderParam;
  148. TNewtonConeParam = packed record
  149. m_radio: dfloat;
  150. m_height: dfloat;
  151. end;
  152. PNewtonConeParam = ^TNewtonConeParam;
  153. TNewtonTaperedCapsuleParam = packed record
  154. m_radio0,
  155. m_radio1,
  156. m_height: dFloat;
  157. end;
  158. PNewtonTaperedCapsuleParam = ^TNewtonTaperedCapsuleParam;
  159. TNewtonTaperedCylinderParam = packed record
  160. m_radio0,
  161. m_radio1,
  162. m_height: dFloat;
  163. end;
  164. PNewtonTaperedCylinderParam = ^TNewtonTaperedCylinderParam;
  165. TNewtonChamferCylinderParam = packed record
  166. m_radio: dFloat;
  167. m_height: dFloat;
  168. end;
  169. PNewtonChamferCylinderParam = ^TNewtonChamferCylinderParam;
  170. TNewtonConvexHullParam = packed record
  171. m_vertexCount: Integer;
  172. m_vertexStrideInBytes: Integer;
  173. m_faceCount: Integer;
  174. m_vertex: PdFloat;
  175. end;
  176. PNewtonConvexHullParam = ^TNewtonConvexHullParam;
  177. TNewtonCompoundCollisionParam = packed record
  178. m_chidrenCount: Integer;
  179. end;
  180. PNewtonCompoundCollisionParam = ^TNewtonCompoundCollisionParam;
  181. TNewtonCollisionTreeParam = packed record
  182. m_vertexCount: Integer;
  183. m_indexCount: Integer;
  184. end;
  185. PNewtonCollisionTreeParam = ^TNewtonCollisionTreeParam;
  186. TNewtonDeformableMeshParam = packed record
  187. m_vertexCount: Integer;
  188. m_triangleCount: Integer;
  189. m_vrtexStrideInBytes: Integer;
  190. m_indexList: PWord;
  191. m_vertexList: PdFloat;
  192. end;
  193. PNewtonDeformableMeshParam = ^TNewtonDeformableMeshParam;
  194. TNewtonHeightFieldCollisionParam = packed record
  195. m_width : Integer;
  196. m_height : Integer;
  197. m_gridsDiagonals : Integer;
  198. m_elevationDataType : Integer;// 0 = 32 bit floats, 1 = unsigned 16 bit integers
  199. m_verticalScale : dFloat;
  200. m_horizonalScale_x : dFloat;
  201. m_horizonalScale_z : dFloat;
  202. m_vertialElevation : Pointer;
  203. m_atributes : PShortInt;
  204. end;
  205. PNewtonHeightFieldCollisionParam = ^TNewtonHeightFieldCollisionParam;
  206. TNewtonSceneCollisionParam = packed record
  207. m_childrenProxyCount : Integer;
  208. end;
  209. PNewtonSceneCollisionParam = ^TNewtonSceneCollisionParam;
  210. TNewtonCollisionNullParam = packed record
  211. end;
  212. TNewtonCollisionInfoRecord = packed record
  213. m_offsetMatrix: array [0..3,0..3] of dFloat;
  214. m_collisionMaterial: TNewtonCollisionMaterial;
  215. m_collisionType, // tag id to identify the collision primitive
  216. m_collisionUserID: Integer;
  217. case Integer of
  218. SERIALIZE_ID_BOX: (shapedataBox: TNewtonBoxParam);
  219. SERIALIZE_ID_CONE: (shapedataCone: TNewtonConeParam);
  220. SERIALIZE_ID_SPHERE: (shapedataSphere: TNewtonSphereParam);
  221. SERIALIZE_ID_CAPSULE: (shapedataCapsule: TNewtonCapsuleParam);
  222. SERIALIZE_ID_CYLINDER: (shapedataCylinder: TNewtonCylinderParam);
  223. //SERIALIZE_ID_TAPEREDCAPSULE: (m_taperedCapsule: TNewtonTaperedCapsuleParam);
  224. //SERIALIZE_ID_TAPEREDCYLINDER: (m_taperedCylinder: TNewtonTaperedCylinderParam);
  225. // SERIALIZE_ID_NULL: (shapedataNull: TNewtonCollisionNullParam);
  226. SERIALIZE_ID_CHAMFERCYLINDER: (shapedataChamferCylinder: TNewtonChamferCylinderParam);
  227. SERIALIZE_ID_CONVEXHULL: (shapedataConvexHull: TNewtonConvexHullParam);
  228. SERIALIZE_ID_DEFORMABLE_SOLID: (m_deformableMesh: TNewtonDeformableMeshParam);
  229. SERIALIZE_ID_COMPOUND: (shapedataCompound: TNewtonCompoundCollisionParam);
  230. SERIALIZE_ID_TREE: (shapedataTree: TNewtonCollisionTreeParam);
  231. SERIALIZE_ID_HEIGHTFIELD: (shapedataHeightField: TNewtonHeightFieldCollisionParam);
  232. SERIALIZE_ID_SCENE: (shapedataSceneCollision: TNewtonSceneCollisionParam);
  233. SERIALIZE_ID_USERMESH: (m_paramArray: array[0..63] of float);
  234. end;
  235. PNewtonCollisionInfoRecord = ^TNewtonCollisionInfoRecord;
  236. TNewtonJointRecord = packed record
  237. m_attachmenMatrix_0: array[0..3, 0..3] of dfloat;
  238. m_attachmenMatrix_1: array[0..3, 0..3] of dfloat;
  239. m_minLinearDof: array[0..2] of dfloat;
  240. m_maxLinearDof: array[0..2] of dfloat;
  241. m_minAngularDof: array[0..2] of dfloat;
  242. m_maxAngularDof: array[0..2] of dfloat;
  243. m_attachBody_0: pNewtonBody;
  244. m_attachBody_1: pNewtonBody;
  245. m_extraParameters: array[0..63] of dfloat;
  246. m_bodiesCollisionOn: Integer;
  247. m_descriptionType: array[0..127] of AnsiChar;
  248. end;
  249. PNewtonJointRecord = ^TNewtonJointRecord;
  250. TNewtonUserMeshCollisionCollideDesc = packed record
  251. m_boxP0: array [0..3] of dFloat; // lower bounding box of intersection query in local space
  252. m_boxP1: array [0..3] of dFloat; // upper bounding box of intersection query in local space
  253. m_boxDistanceTravel: array [0..3] of dFloat; // max distance that box bpxP0 and boxP1 can travel on this timestep, used this for continue collision mode.
  254. m_threadNumber: Integer; // current thread executing this query
  255. m_faceCount: Integer; // the application should set here how many polygons intersect the query box
  256. m_vertexStrideInBytes: Integer; // the application should set here the size of each vertex
  257. m_skinThickness: dFloat; // this is the minimum skin separation specified by the material between these two colliding shapes
  258. m_userData: Pointer; // user data passed to the collision geometry at creation time
  259. m_objBody : PNewtonBody; // pointer to the colliding body
  260. m_polySoupBody : PNewtonBody; // pointer to the rigid body owner of this collision tree
  261. m_objCollision : PNewtonCollision; // collision shape of the colliding body, (no necessarily the collision of m_objBody)
  262. m_polySoupCollision : PNewtonCollision; // collision shape of teh collsion tree, (no necessarily the collision of m_polySoupBody)
  263. m_vertex : PdFloat; // the application should set here the pointer to the global vertex of the mesh.
  264. m_faceIndexCount : PInteger; // the application should set here the pointer to the vertex count of each face.
  265. m_faceVertexIndex : PInteger; // the application should set here the pointer index array for each vertex on a face.
  266. // the format of a face is I0, I1, I2, I3, ..., M, N, E0, E1, E2, ..., A
  267. // I0, I1, I2, .. are the indices to the vertex, relative to m_vertex pointer
  268. // M is the index to the material sub shape id
  269. // N in the index to the vertex normal relative to m_vertex pointer
  270. // E0, E1, E2, ... are the indices of the the face normal that is shared to that face edge, when the edge does not share a face normal then the edge index is set to index N, which the index to the face normal
  271. // A is and estimate of the largest diagonal of the face, this used internally as a hint to improve floating point accuracy and algorithm performance.
  272. end;
  273. PNewtonUserMeshCollisionCollideDesc = ^TNewtonUserMeshCollisionCollideDesc;
  274. TNewtonWorldConvexCastReturnInfo = Packed Record
  275. m_point: array [0..3] of dFloat; // collision point in global space
  276. m_normal: array [0..3] of dFloat; // surface normal at collision point in global space
  277. //m_normalOnHitPoint: array [0..3] of dFloat; // surface normal at the surface of the hit body,
  278. // is the same as the normal calculated by a ray cast hitting the body at the hit point
  279. m_contactID: Integer; // collision ID at contact point
  280. m_hitBody: PNewtonBody; // body hit at contact point
  281. m_penetration: dFloat; // contact penetration at collision point
  282. end;
  283. PNewtonWorldConvexCastReturnInfo = ^TNewtonWorldConvexCastReturnInfo;
  284. TNewtonUserMeshCollisionRayHitDesc = Packed Record
  285. m_p0 : array [0..3] of dFloat; // ray origin in collision local space
  286. m_p1 : array [0..3] of dFloat; // ray destination in collision local space
  287. m_normalOut : array [0..3] of dFloat; // copy here the normal at the ray intersection
  288. m_userIdOut : dLong; // copy here a user defined id for further feedback
  289. m_userData : Pointer; // user data passed to the collision geometry at creation time
  290. end;
  291. PNewtonUserMeshCollisionRayHitDesc = ^TNewtonUserMeshCollisionRayHitDesc;
  292. TNewtonHingeSliderUpdateDesc = Packed Record
  293. m_accel : dFloat;
  294. m_minFriction : dFloat;
  295. m_maxFriction : dFloat;
  296. m_timestep : dFloat;
  297. end;
  298. PNewtonHingeSliderUpdateDesc = ^TNewtonHingeSliderUpdateDesc;
  299. TNewtonUserContactPoint = packed record
  300. m_point : array [0..3] of dFloat;
  301. m_normal : array [0..3] of dFloat;
  302. m_shapeId0 : dLong;
  303. m_shapeId1 : dLong;
  304. m_penetration : dFloat;
  305. m_unused : array [0..2] of Integer;
  306. end;
  307. PNewtonUserContactPoint = ^TNewtonUserContactPoint;
  308. TNewtonImmediateModeConstraint = packed record
  309. m_jacobian01: array[0..7, 0..5] of dfloat;
  310. m_jacobian10: array[0..7, 0..5] of dfloat;
  311. m_minFriction: array[0..7] of dfloat;
  312. m_maxFriction: array[0..7] of dfloat;
  313. m_jointAccel: array[0..7] of dfloat;
  314. m_jointStiffness: array[0..7] of dfloat;
  315. end;
  316. PNewtonImmediateModeConstraint = ^TNewtonImmediateModeConstraint;
  317. // data structure for interfacing with NewtonMesh
  318. TNewtonMeshDoubleData = packed record
  319. m_data : Pdouble;
  320. m_indexList : PInteger;
  321. m_strideInBytes : Integer;
  322. end;
  323. PNewtonMeshDoubleData = ^TNewtonMeshDoubleData;
  324. TNewtonMeshFloatData = packed record
  325. m_data : PdFloat;
  326. m_indexList : PInteger;
  327. m_strideInBytes : Integer;
  328. end;
  329. PNewtonMeshFloatData = ^TNewtonMeshFloatData;
  330. TNewtonMeshVertexFormat = packed record
  331. m_faceCount : Integer;
  332. m_faceIndexCount: PInteger;
  333. m_faceMaterial: PInteger;
  334. m_vertex: TNewtonMeshDoubleData;
  335. m_normal: TNewtonMeshFloatData;
  336. m_binormal: TNewtonMeshFloatData;
  337. m_uv0: TNewtonMeshFloatData;
  338. m_uv1: TNewtonMeshFloatData;
  339. m_vertexColor: TNewtonMeshFloatData;
  340. end;
  341. PNewtonMeshVertexFormat = ^TNewtonMeshVertexFormat;
  342. // Newton callback functions
  343. NewtonAllocMemory = function(sizeInBytes: Integer): Pointer; cdecl;
  344. PNewtonAllocMemory = ^NewtonAllocMemory;
  345. NewtonFreeMemory = procedure(const ptr: Pointer; sizeInBytes: Integer); cdecl;
  346. PNewtonFreeMemory = ^NewtonFreeMemory;
  347. NewtonWorldDestructorCallback = procedure(const world: PNewtonWorld); cdecl;
  348. PNewtonWorldDestructorCallback = ^NewtonWorldDestructorCallback;
  349. NewtonPostUpdateCallback = procedure(const world: PNewtonWorld; timestep: dfloat); cdecl;
  350. PNewtonPostUpdateCallback = ^NewtonPostUpdateCallback;
  351. NewtonCreateContactCallback = procedure(const newtonWorld: PNewtonWorld; const contact: PNewtonJoint); cdecl;
  352. PNewtonCreateContactCallback = ^NewtonCreateContactCallback;
  353. NewtonDestroyContactCallback = procedure(const newtonWorld: PNewtonWorld; const contact: PNewtonJoint); cdecl;
  354. PNewtonDestroyContactCallback = ^NewtonDestroyContactCallback;
  355. NewtonWorldListenerDebugCallback = procedure(const world: PNewtonWorld; const listener: Pointer; const debugContext: Pointer); cdecl;
  356. PNewtonWorldListenerDebugCallback = ^NewtonWorldListenerDebugCallback;
  357. NewtonWorldListenerBodyDestroyCallback = procedure(const world: PNewtonWorld; const listenerUserData: Pointer; const body: pNewtonBody); cdecl;
  358. PNewtonWorldListenerBodyDestroyCallback = ^NewtonWorldListenerBodyDestroyCallback;
  359. NewtonWorldUpdateListenerCallback = procedure(const world: PNewtonWorld; const listenerUserData: Pointer; timestep: dfloat); cdecl;
  360. PNewtonWorldUpdateListenerCallback = ^NewtonWorldUpdateListenerCallback;
  361. NewtonWorldDestroyListenerCallback = procedure(const world: PNewtonWorld; const listenerUserData: Pointer); cdecl;
  362. PNewtonWorldDestroyListenerCallback = ^NewtonWorldDestroyListenerCallback;
  363. NewtonGetTimeInMicrosencondsCallback = function(): int64; cdecl;
  364. PNewtonGetTimeInMicrosencondsCallback = ^NewtonGetTimeInMicrosencondsCallback;
  365. NewtonSerializeCallback = procedure(const serializeHandle: Pointer; const buffer: Pointer; size: Integer); cdecl;
  366. PNewtonSerializeCallback = ^NewtonSerializeCallback;
  367. NewtonDeserializeCallback = procedure(const serializeHandle: Pointer; const buffer: Pointer; size: Integer); cdecl;
  368. PNewtonDeserializeCallback = ^NewtonDeserializeCallback;
  369. NewtonOnBodySerializationCallback = procedure(const body: pNewtonBody; const userData: Pointer; functionparam: PNewtonSerializeCallback; const serializeHandle: Pointer); cdecl;
  370. PNewtonOnBodySerializationCallback = ^NewtonOnBodySerializationCallback;
  371. NewtonOnBodyDeserializationCallback = procedure(const body: pNewtonBody; const userData: Pointer; functionparam: PNewtonDeserializeCallback; const serializeHandle: Pointer); cdecl;
  372. PNewtonOnBodyDeserializationCallback = ^NewtonOnBodyDeserializationCallback;
  373. NewtonOnJointSerializationCallback = procedure(const joint: PNewtonJoint; functionparam: PNewtonSerializeCallback; const serializeHandle: Pointer); cdecl;
  374. PNewtonOnJointSerializationCallback = ^NewtonOnJointSerializationCallback;
  375. NewtonOnJointDeserializationCallback = procedure(const body0: pNewtonBody; const body1: pNewtonBody; functionparam: PNewtonDeserializeCallback; const serializeHandle: Pointer); cdecl;
  376. PNewtonOnJointDeserializationCallback = ^NewtonOnJointDeserializationCallback;
  377. // user collision callbacks
  378. NewtonOnUserCollisionSerializationCallback = procedure(const userData: Pointer; functionparam: PNewtonSerializeCallback; const serializeHandle: Pointer); cdecl;
  379. PNewtonOnUserCollisionSerializationCallback = ^NewtonOnUserCollisionSerializationCallback;
  380. NewtonUserMeshCollisionDestroyCallback = procedure(const userData: Pointer); cdecl;
  381. PNewtonUserMeshCollisionDestroyCallback = ^NewtonUserMeshCollisionDestroyCallback;
  382. NewtonUserMeshCollisionRayHitCallback = function(const lineDescData: PNewtonUserMeshCollisionRayHitDesc): dfloat; cdecl;
  383. PNewtonUserMeshCollisionRayHitCallback = ^NewtonUserMeshCollisionRayHitCallback;
  384. NewtonUserMeshCollisionGetCollisionInfo = procedure(const userData: Pointer; const infoRecord: PNewtonCollisionInfoRecord); cdecl;
  385. PNewtonUserMeshCollisionGetCollisionInfo = ^NewtonUserMeshCollisionGetCollisionInfo;
  386. NewtonUserMeshCollisionAABBTest = function(const userData: Pointer; const boxP0: pfloat; const boxP1: pfloat): Integer; cdecl;
  387. PNewtonUserMeshCollisionAABBTest = ^NewtonUserMeshCollisionAABBTest;
  388. NewtonUserMeshCollisionGetFacesInAABB = function(const userData: Pointer; const p0: pfloat; const p1: pfloat; const vertexArray: Pfloat; const vertexCount: Pinteger; const vertexStrideInBytes: Pinteger; const indexList: Pinteger; maxIndexCount: Integer; const userDataList: Pinteger): Integer; cdecl;
  389. PNewtonUserMeshCollisionGetFacesInAABB = ^NewtonUserMeshCollisionGetFacesInAABB;
  390. NewtonUserMeshCollisionCollideCallback = procedure(const collideDescData: PNewtonUserMeshCollisionCollideDesc; const continueCollisionHandle: Pointer); cdecl;
  391. PNewtonUserMeshCollisionCollideCallback = ^NewtonUserMeshCollisionCollideCallback;
  392. NewtonTreeCollisionFaceCallback = function(const context: Pointer; const polygon: pfloat; strideInBytes: Integer; const indexArray: Pinteger; indexCount: Integer): Integer; cdecl;
  393. PNewtonTreeCollisionFaceCallback = ^NewtonTreeCollisionFaceCallback;
  394. NewtonCollisionTreeRayCastCallback = function(const body: pNewtonBody; const treeCollision: PNewtonCollision; intersection: dfloat; const normal: pfloat; faceId: Integer; const usedData: Pointer): dfloat; cdecl;
  395. PNewtonCollisionTreeRayCastCallback = ^NewtonCollisionTreeRayCastCallback;
  396. NewtonHeightFieldRayCastCallback = function(const body: pNewtonBody; const heightFieldCollision: PNewtonCollision; intersection: dfloat; row: Integer; col: Integer; const normal: pfloat; faceId: Integer; const usedData: Pointer): dfloat; cdecl;
  397. PNewtonHeightFieldRayCastCallback = ^NewtonHeightFieldRayCastCallback;
  398. NewtonCollisionCopyConstructionCallback = procedure(const newtonWorld: PNewtonWorld; const collision: PNewtonCollision; const sourceCollision: PNewtonCollision); cdecl;
  399. PNewtonCollisionCopyConstructionCallback = ^NewtonCollisionCopyConstructionCallback;
  400. NewtonCollisionDestructorCallback = procedure(const newtonWorld: PNewtonWorld; const collision: PNewtonCollision); cdecl;
  401. PNewtonCollisionDestructorCallback = ^NewtonCollisionDestructorCallback;
  402. NewtonTreeCollisionCallback = procedure(const bodyWithTreeCollision: pNewtonBody; const body: pNewtonBody; faceID: Integer; vertexCount: Integer; const vertex: pfloat; vertexStrideInBytes: Integer); cdecl;
  403. PNewtonTreeCollisionCallback = ^NewtonTreeCollisionCallback;
  404. NewtonBodyDestructor = procedure(const body: pNewtonBody); cdecl;
  405. PNewtonBodyDestructor = ^NewtonBodyDestructor;
  406. NewtonApplyForceAndTorque = procedure(const body: pNewtonBody; timestep: dfloat; threadIndex: Integer); cdecl;
  407. PNewtonApplyForceAndTorque = ^NewtonApplyForceAndTorque;
  408. NewtonSetTransform = procedure(const body: pNewtonBody; const matrix: pfloat; threadIndex: Integer); cdecl;
  409. PNewtonSetTransform = ^NewtonSetTransform;
  410. NewtonIslandUpdate = function(const newtonWorld: PNewtonWorld; const islandHandle: Pointer; bodyCount: Integer): Integer; cdecl;
  411. PNewtonIslandUpdate = ^NewtonIslandUpdate;
  412. NewtonFractureCompoundCollisionOnEmitCompoundFractured = procedure(const fracturedBody: pNewtonBody); cdecl;
  413. PNewtonFractureCompoundCollisionOnEmitCompoundFractured = ^NewtonFractureCompoundCollisionOnEmitCompoundFractured;
  414. NewtonFractureCompoundCollisionOnEmitChunk = procedure(const chunkBody: pNewtonBody; const fracturexChunkMesh: PNewtonFracturedCompoundMeshPart; const fracturedCompountCollision: PNewtonCollision); cdecl;
  415. PNewtonFractureCompoundCollisionOnEmitChunk = ^NewtonFractureCompoundCollisionOnEmitChunk;
  416. NewtonFractureCompoundCollisionReconstructMainMeshCallBack = procedure(const body: pNewtonBody; const mainMesh: PNewtonFracturedCompoundMeshPart; const fracturedCompountCollision: PNewtonCollision); cdecl;
  417. PNewtonFractureCompoundCollisionReconstructMainMeshCallBack = ^NewtonFractureCompoundCollisionReconstructMainMeshCallBack;
  418. NewtonWorldRayPrefilterCallback = function(const body: pNewtonBody; const collision: PNewtonCollision; const userData: Pointer): LongWord; cdecl;
  419. PNewtonWorldRayPrefilterCallback = ^NewtonWorldRayPrefilterCallback;
  420. NewtonWorldRayFilterCallback = function(const body: pNewtonBody; const shapeHit: PNewtonCollision; const hitContact: pfloat; const hitNormal: pfloat; collisionID: int64; const userData: Pointer; intersectParam: dfloat): dfloat; cdecl;
  421. PNewtonWorldRayFilterCallback = ^NewtonWorldRayFilterCallback;
  422. NewtonOnAABBOverlap = function(const contact: PNewtonJoint; timestep: dfloat; threadIndex: Integer): Integer; cdecl;
  423. PNewtonOnAABBOverlap = ^NewtonOnAABBOverlap;
  424. NewtonContactsProcess = procedure(const contact: PNewtonJoint; timestep: dfloat; threadIndex: Integer); cdecl;
  425. PNewtonContactsProcess = ^NewtonContactsProcess;
  426. NewtonOnCompoundSubCollisionAABBOverlap = function(const contact: PNewtonJoint; timestep: dfloat; const body0: pNewtonBody; const collisionNode0: Pointer; const body1: pNewtonBody; const collisionNode1: Pointer; threadIndex: Integer): Integer; cdecl;
  427. PNewtonOnCompoundSubCollisionAABBOverlap = ^NewtonOnCompoundSubCollisionAABBOverlap;
  428. NewtonOnContactGeneration = function(const material: PNewtonMaterial; const body0: pNewtonBody; const collision0: PNewtonCollision; const body1: pNewtonBody; const collision1: PNewtonCollision; const contactBuffer: PNewtonUserContactPoint; maxCount: Integer; threadIndex: Integer): Integer; cdecl;
  429. PNewtonOnContactGeneration = ^NewtonOnContactGeneration;
  430. NewtonBodyIterator = function(const body: pNewtonBody; const userData: Pointer): Integer; cdecl;
  431. PNewtonBodyIterator = ^NewtonBodyIterator;
  432. NewtonJointIterator = procedure(const joint: PNewtonJoint; const userData: Pointer); cdecl;
  433. PNewtonJointIterator = ^NewtonJointIterator;
  434. NewtonCollisionIterator = procedure(const userData: Pointer; vertexCount: Integer; const faceArray: pfloat; faceId: Integer); cdecl;
  435. PNewtonCollisionIterator = ^NewtonCollisionIterator;
  436. NewtonBallCallback = procedure(const ball: PNewtonJoint; timestep: dfloat); cdecl;
  437. PNewtonBallCallback = ^NewtonBallCallback;
  438. NewtonHingeCallback = function(const hinge: PNewtonJoint; const desc: PNewtonHingeSliderUpdateDesc): LongWord; cdecl;
  439. PNewtonHingeCallback = ^NewtonHingeCallback;
  440. NewtonSliderCallback = function(const slider: PNewtonJoint; const desc: PNewtonHingeSliderUpdateDesc): LongWord; cdecl;
  441. PNewtonSliderCallback = ^NewtonSliderCallback;
  442. NewtonUniversalCallback = function(const universal: PNewtonJoint; const desc: PNewtonHingeSliderUpdateDesc): LongWord; cdecl;
  443. PNewtonUniversalCallback = ^NewtonUniversalCallback;
  444. NewtonCorkscrewCallback = function(const corkscrew: PNewtonJoint; const desc: PNewtonHingeSliderUpdateDesc): LongWord; cdecl;
  445. PNewtonCorkscrewCallback = ^NewtonCorkscrewCallback;
  446. NewtonUserBilateralCallback = procedure(const userJoint: PNewtonJoint; timestep: dfloat; threadIndex: Integer); cdecl;
  447. PNewtonUserBilateralCallback = ^NewtonUserBilateralCallback;
  448. NewtonUserBilateralGetInfoCallback = procedure(const userJoint: PNewtonJoint; const info: PNewtonJointRecord); cdecl;
  449. PNewtonUserBilateralGetInfoCallback = ^NewtonUserBilateralGetInfoCallback;
  450. NewtonConstraintDestructor = procedure(const me: PNewtonJoint); cdecl;
  451. PNewtonConstraintDestructor = ^NewtonConstraintDestructor;
  452. NewtonJobTask = procedure(const world: PNewtonWorld; const userData: Pointer; threadIndex: Integer); cdecl;
  453. PNewtonJobTask = ^NewtonJobTask;
  454. NewtonReportProgress = function(normalizedProgressPercent: dfloat; const userData: Pointer): Integer; cdecl;
  455. PNewtonReportProgress = ^NewtonReportProgress;
  456. // **********************************************************************************************
  457. //
  458. // world control functions
  459. //
  460. // **********************************************************************************************
  461. function NewtonWorldGetVersion (): Integer; cdecl; external NEWTON_API;
  462. function NewtonWorldFloatSize (): Integer; cdecl; external NEWTON_API;
  463. function NewtonGetMemoryUsed (): Integer; cdecl; external NEWTON_API;
  464. procedure NewtonSetMemorySystem (malloc: NewtonAllocMemory; free: NewtonFreeMemory); cdecl; external NEWTON_API;
  465. function NewtonCreate (): PNewtonWorld; cdecl; external NEWTON_API;
  466. procedure NewtonDestroy (const newtonWorld: PNewtonWorld); cdecl; external NEWTON_API;
  467. procedure NewtonDestroyAllBodies (const newtonWorld: PNewtonWorld); cdecl; external NEWTON_API;
  468. function NewtonGetPostUpdateCallback (const newtonWorld: PNewtonWorld): PNewtonPostUpdateCallback; cdecl; external NEWTON_API;
  469. procedure NewtonSetPostUpdateCallback (const newtonWorld: PNewtonWorld; callback: NewtonPostUpdateCallback); cdecl; external NEWTON_API;
  470. function NewtonAlloc (sizeInBytes: Integer): Pointer; cdecl; external NEWTON_API;
  471. procedure NewtonFree (const ptr: Pointer); cdecl; external NEWTON_API;
  472. procedure NewtonLoadPlugins (const newtonWorld: PNewtonWorld; const plugInPath: pchar); cdecl; external NEWTON_API;
  473. procedure NewtonUnloadPlugins (const newtonWorld: PNewtonWorld); cdecl; external NEWTON_API;
  474. function NewtonCurrentPlugin (const newtonWorld: PNewtonWorld): Pointer; cdecl; external NEWTON_API;
  475. function NewtonGetFirstPlugin (const newtonWorld: PNewtonWorld): Pointer; cdecl; external NEWTON_API;
  476. function NewtonGetPreferedPlugin (const newtonWorld: PNewtonWorld): Pointer; cdecl; external NEWTON_API;
  477. function NewtonGetNextPlugin (const newtonWorld: PNewtonWorld; const plugin: Pointer): Pointer; cdecl; external NEWTON_API;
  478. function NewtonGetPluginString (const newtonWorld: PNewtonWorld; const plugin: Pointer): pchar; cdecl; external NEWTON_API;
  479. procedure NewtonSelectPlugin (const newtonWorld: PNewtonWorld; const plugin: Pointer); cdecl; external NEWTON_API;
  480. function NewtonGetContactMergeTolerance (const newtonWorld: PNewtonWorld): dfloat; cdecl; external NEWTON_API;
  481. procedure NewtonSetContactMergeTolerance (const newtonWorld: PNewtonWorld; tolerance: dfloat); cdecl; external NEWTON_API;
  482. procedure NewtonInvalidateCache (const newtonWorld: PNewtonWorld); cdecl; external NEWTON_API;
  483. procedure NewtonSetSolverIterations (const newtonWorld: PNewtonWorld; model: Integer); cdecl; external NEWTON_API;
  484. function NewtonGetSolverIterations (const newtonWorld: PNewtonWorld): Integer; cdecl; external NEWTON_API;
  485. procedure NewtonSetParallelSolverOnLargeIsland (const newtonWorld: PNewtonWorld; mode: Integer); cdecl; external NEWTON_API;
  486. function NewtonGetParallelSolverOnLargeIsland (const newtonWorld: PNewtonWorld): Integer; cdecl; external NEWTON_API;
  487. function NewtonGetBroadphaseAlgorithm (const newtonWorld: PNewtonWorld): Integer; cdecl; external NEWTON_API;
  488. procedure NewtonSelectBroadphaseAlgorithm (const newtonWorld: PNewtonWorld; algorithmType: Integer); cdecl; external NEWTON_API;
  489. procedure NewtonResetBroadphase (const newtonWorld: PNewtonWorld); cdecl; external NEWTON_API;
  490. procedure NewtonUpdate (const newtonWorld: PNewtonWorld; timestep: dfloat); cdecl; external NEWTON_API;
  491. procedure NewtonUpdateAsync (const newtonWorld: PNewtonWorld; timestep: dfloat); cdecl; external NEWTON_API;
  492. procedure NewtonWaitForUpdateToFinish (const newtonWorld: PNewtonWorld); cdecl; external NEWTON_API;
  493. function NewtonGetNumberOfSubsteps (const newtonWorld: PNewtonWorld): Integer; cdecl; external NEWTON_API;
  494. procedure NewtonSetNumberOfSubsteps (const newtonWorld: PNewtonWorld; subSteps: Integer); cdecl; external NEWTON_API;
  495. function NewtonGetLastUpdateTime (const newtonWorld: PNewtonWorld): dfloat; cdecl; external NEWTON_API;
  496. procedure NewtonSerializeToFile (const newtonWorld: PNewtonWorld; const filename: pchar; bodyCallback: NewtonOnBodySerializationCallback; const bodyUserData: Pointer); cdecl; external NEWTON_API;
  497. procedure NewtonDeserializeFromFile (const newtonWorld: PNewtonWorld; const filename: pchar; bodyCallback: NewtonOnBodyDeserializationCallback; const bodyUserData: Pointer); cdecl; external NEWTON_API;
  498. procedure NewtonSerializeScene (const newtonWorld: PNewtonWorld; bodyCallback: NewtonOnBodySerializationCallback; const bodyUserData: Pointer; serializeCallback: NewtonSerializeCallback; const serializeHandle: Pointer); cdecl; external NEWTON_API;
  499. procedure NewtonDeserializeScene (const newtonWorld: PNewtonWorld; bodyCallback: NewtonOnBodyDeserializationCallback; const bodyUserData: Pointer; serializeCallback: NewtonDeserializeCallback; const serializeHandle: Pointer); cdecl; external NEWTON_API;
  500. function NewtonFindSerializedBody (const newtonWorld: PNewtonWorld; bodySerializedID: Integer): pNewtonBody; cdecl; external NEWTON_API;
  501. procedure NewtonSetJointSerializationCallbacks (const newtonWorld: PNewtonWorld; serializeJoint: NewtonOnJointSerializationCallback; deserializeJoint: NewtonOnJointDeserializationCallback); cdecl; external NEWTON_API;
  502. procedure NewtonGetJointSerializationCallbacks (const newtonWorld: PNewtonWorld; const serializeJoint: NewtonOnJointSerializationCallback; const deserializeJoint: NewtonOnJointDeserializationCallback); cdecl; external NEWTON_API;
  503. procedure NewtonWorldCriticalSectionLock (const newtonWorld: PNewtonWorld; threadIndex: Integer); cdecl; external NEWTON_API;
  504. procedure NewtonWorldCriticalSectionUnlock (const newtonWorld: PNewtonWorld); cdecl; external NEWTON_API;
  505. procedure NewtonSetThreadsCount (const newtonWorld: PNewtonWorld; threads: Integer); cdecl; external NEWTON_API;
  506. function NewtonGetThreadsCount (const newtonWorld: PNewtonWorld): Integer; cdecl; external NEWTON_API;
  507. function NewtonGetMaxThreadsCount (const newtonWorld: PNewtonWorld): Integer; cdecl; external NEWTON_API;
  508. procedure NewtonDispachThreadJob (const newtonWorld: PNewtonWorld; task: NewtonJobTask; const usedData: Pointer; const functionName: pchar); cdecl; external NEWTON_API;
  509. procedure NewtonSyncThreadJobs (const newtonWorld: PNewtonWorld); cdecl; external NEWTON_API;
  510. function NewtonAtomicAdd (const ptr: Pinteger; value: Integer): Integer; cdecl; external NEWTON_API;
  511. function NewtonAtomicSwap (const ptr: Pinteger; value: Integer): Integer; cdecl; external NEWTON_API;
  512. procedure NewtonYield (); cdecl; external NEWTON_API;
  513. procedure NewtonSetIslandUpdateEvent (const newtonWorld: PNewtonWorld; islandUpdate: NewtonIslandUpdate); cdecl; external NEWTON_API;
  514. procedure NewtonWorldForEachJointDo (const newtonWorld: PNewtonWorld; callback: NewtonJointIterator; const userData: Pointer); cdecl; external NEWTON_API;
  515. procedure NewtonWorldForEachBodyInAABBDo (const newtonWorld: PNewtonWorld; const p0: pfloat; const p1: pfloat; callback: NewtonBodyIterator; const userData: Pointer); cdecl; external NEWTON_API;
  516. procedure NewtonWorldSetUserData (const newtonWorld: PNewtonWorld; const userData: Pointer); cdecl; external NEWTON_API;
  517. function NewtonWorldGetUserData (const newtonWorld: PNewtonWorld): Pointer; cdecl; external NEWTON_API;
  518. function NewtonWorldAddListener (const newtonWorld: PNewtonWorld; const nameId: pchar; const listenerUserData: Pointer): Pointer; cdecl; external NEWTON_API;
  519. function NewtonWorldGetListener (const newtonWorld: PNewtonWorld; const nameId: pchar): Pointer; cdecl; external NEWTON_API;
  520. procedure NewtonWorldListenerSetDebugCallback (const newtonWorld: PNewtonWorld; const listener: Pointer; callback: NewtonWorldListenerDebugCallback); cdecl; external NEWTON_API;
  521. procedure NewtonWorldListenerSetPostStepCallback (const newtonWorld: PNewtonWorld; const listener: Pointer; callback: NewtonWorldUpdateListenerCallback); cdecl; external NEWTON_API;
  522. procedure NewtonWorldListenerSetPreUpdateCallback (const newtonWorld: PNewtonWorld; const listener: Pointer; callback: NewtonWorldUpdateListenerCallback); cdecl; external NEWTON_API;
  523. procedure NewtonWorldListenerSetPostUpdateCallback (const newtonWorld: PNewtonWorld; const listener: Pointer; callback: NewtonWorldUpdateListenerCallback); cdecl; external NEWTON_API;
  524. procedure NewtonWorldListenerSetDestructorCallback (const newtonWorld: PNewtonWorld; const listener: Pointer; callback: NewtonWorldDestroyListenerCallback); cdecl; external NEWTON_API;
  525. procedure NewtonWorldListenerSetBodyDestroyCallback (const newtonWorld: PNewtonWorld; const listener: Pointer; callback: NewtonWorldListenerBodyDestroyCallback); cdecl; external NEWTON_API;
  526. procedure NewtonWorldListenerDebug (const newtonWorld: PNewtonWorld; const context: Pointer); cdecl; external NEWTON_API;
  527. function NewtonWorldGetListenerUserData (const newtonWorld: PNewtonWorld; const listener: Pointer): Pointer; cdecl; external NEWTON_API;
  528. function NewtonWorldListenerGetBodyDestroyCallback (const newtonWorld: PNewtonWorld; const listener: Pointer): PNewtonWorldListenerBodyDestroyCallback; cdecl; external NEWTON_API;
  529. procedure NewtonWorldSetDestructorCallback (const newtonWorld: PNewtonWorld; destructorparam: NewtonWorldDestructorCallback); cdecl; external NEWTON_API;
  530. function NewtonWorldGetDestructorCallback (const newtonWorld: PNewtonWorld): PNewtonWorldDestructorCallback; cdecl; external NEWTON_API;
  531. procedure NewtonWorldSetCollisionConstructorDestructorCallback (const newtonWorld: PNewtonWorld; constructorparam: NewtonCollisionCopyConstructionCallback; destructorparam: NewtonCollisionDestructorCallback); cdecl; external NEWTON_API;
  532. procedure NewtonWorldSetCreateDestroyContactCallback (const newtonWorld: PNewtonWorld; createContact: NewtonCreateContactCallback; destroyContact: NewtonDestroyContactCallback); cdecl; external NEWTON_API;
  533. procedure NewtonWorldRayCast (const newtonWorld: PNewtonWorld; const p0: pfloat; const p1: pfloat; filter: NewtonWorldRayFilterCallback; const userData: Pointer; prefilter: NewtonWorldRayPrefilterCallback; threadIndex: Integer); cdecl; external NEWTON_API;
  534. function NewtonWorldConvexCast (const newtonWorld: PNewtonWorld; const matrix: pfloat; const target: pfloat; const shape: PNewtonCollision; const param: pfloat; const userData: Pointer; prefilter: NewtonWorldRayPrefilterCallback; const info: PNewtonWorldConvexCastReturnInfo; maxContactsCount: Integer; threadIndex: Integer): Integer; cdecl; external NEWTON_API;
  535. function NewtonWorldCollide (const newtonWorld: PNewtonWorld; const matrix: pfloat; const shape: PNewtonCollision; const userData: Pointer; prefilter: NewtonWorldRayPrefilterCallback; const info: PNewtonWorldConvexCastReturnInfo; maxContactsCount: Integer; threadIndex: Integer): Integer; cdecl; external NEWTON_API;
  536. // world utility functions
  537. function NewtonWorldGetBodyCount (const newtonWorld: PNewtonWorld): Integer; cdecl; external NEWTON_API;
  538. function NewtonWorldGetConstraintCount (const newtonWorld: PNewtonWorld): Integer; cdecl; external NEWTON_API;
  539. function NewtonWorldFindJoint (const body0: pNewtonBody; const body1: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  540. // **********************************************************************************************
  541. //
  542. // Simulation islands
  543. //
  544. // **********************************************************************************************
  545. function NewtonIslandGetBody (const island: Pointer; bodyIndex: Integer): pNewtonBody; cdecl; external NEWTON_API;
  546. procedure NewtonIslandGetBodyAABB (const island: Pointer; bodyIndex: Integer; const p0: pfloat; const p1: pfloat); cdecl; external NEWTON_API;
  547. // **********************************************************************************************
  548. //
  549. // Physics Material Section
  550. //
  551. // **********************************************************************************************
  552. function NewtonMaterialCreateGroupID (const newtonWorld: PNewtonWorld): Integer; cdecl; external NEWTON_API;
  553. function NewtonMaterialGetDefaultGroupID (const newtonWorld: PNewtonWorld): Integer; cdecl; external NEWTON_API;
  554. procedure NewtonMaterialDestroyAllGroupID (const newtonWorld: PNewtonWorld); cdecl; external NEWTON_API;
  555. // material definitions that can not be overwritten in function callback
  556. function NewtonMaterialGetUserData (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer): Pointer; cdecl; external NEWTON_API;
  557. procedure NewtonMaterialSetSurfaceThickness (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer; thickness: dfloat); cdecl; external NEWTON_API;
  558. // deprecated, not longer continue collision is set on the material
  559. // NEWTON_API void NewtonMaterialSetContinuousCollisionMode (const NewtonWorld* const newtonWorld, int id0, int id1, int state);
  560. procedure NewtonMaterialSetCallbackUserData (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer; const userData: Pointer); cdecl; external NEWTON_API;
  561. procedure NewtonMaterialSetContactGenerationCallback (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer; contactGeneration: NewtonOnContactGeneration); cdecl; external NEWTON_API;
  562. procedure NewtonMaterialSetCompoundCollisionCallback (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer; compoundAabbOverlap: NewtonOnCompoundSubCollisionAABBOverlap); cdecl; external NEWTON_API;
  563. procedure NewtonMaterialSetCollisionCallback (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer; aabbOverlap: NewtonOnAABBOverlap; process: NewtonContactsProcess); cdecl; external NEWTON_API;
  564. procedure NewtonMaterialSetDefaultSoftness (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer; value: dfloat); cdecl; external NEWTON_API;
  565. procedure NewtonMaterialSetDefaultElasticity (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer; elasticCoef: dfloat); cdecl; external NEWTON_API;
  566. procedure NewtonMaterialSetDefaultCollidable (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer; state: Integer); cdecl; external NEWTON_API;
  567. procedure NewtonMaterialSetDefaultFriction (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer; staticFriction: dfloat; kineticFriction: dfloat); cdecl; external NEWTON_API;
  568. procedure NewtonMaterialJointResetIntraJointCollision (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer); cdecl; external NEWTON_API;
  569. procedure NewtonMaterialJointResetSelftJointCollision (const newtonWorld: PNewtonWorld; id0: Integer; id1: Integer); cdecl; external NEWTON_API;
  570. function NewtonWorldGetFirstMaterial (const newtonWorld: PNewtonWorld): PNewtonMaterial; cdecl; external NEWTON_API;
  571. function NewtonWorldGetNextMaterial (const newtonWorld: PNewtonWorld; const material: PNewtonMaterial): PNewtonMaterial; cdecl; external NEWTON_API;
  572. function NewtonWorldGetFirstBody (const newtonWorld: PNewtonWorld): pNewtonBody; cdecl; external NEWTON_API;
  573. function NewtonWorldGetNextBody (const newtonWorld: PNewtonWorld; const curBody: pNewtonBody): pNewtonBody; cdecl; external NEWTON_API;
  574. // **********************************************************************************************
  575. //
  576. // Physics Contact control functions
  577. //
  578. // **********************************************************************************************
  579. function NewtonMaterialGetMaterialPairUserData (const material: PNewtonMaterial): Pointer; cdecl; external NEWTON_API;
  580. function NewtonMaterialGetContactFaceAttribute (const material: PNewtonMaterial): LongWord; cdecl; external NEWTON_API;
  581. function NewtonMaterialGetBodyCollidingShape (const material: PNewtonMaterial; const body: pNewtonBody): PNewtonCollision; cdecl; external NEWTON_API;
  582. function NewtonMaterialGetContactNormalSpeed (const material: PNewtonMaterial): dfloat; cdecl; external NEWTON_API;
  583. procedure NewtonMaterialGetContactForce (const material: PNewtonMaterial; const body: pNewtonBody; const force: pfloat); cdecl; external NEWTON_API;
  584. procedure NewtonMaterialGetContactPositionAndNormal (const material: PNewtonMaterial; const body: pNewtonBody; const posit: pfloat; const normal: pfloat); cdecl; external NEWTON_API;
  585. procedure NewtonMaterialGetContactTangentDirections (const material: PNewtonMaterial; const body: pNewtonBody; const dir0: pfloat; const dir1: pfloat); cdecl; external NEWTON_API;
  586. function NewtonMaterialGetContactTangentSpeed (const material: PNewtonMaterial; index: Integer): dfloat; cdecl; external NEWTON_API;
  587. function NewtonMaterialGetContactMaxNormalImpact (const material: PNewtonMaterial): dfloat; cdecl; external NEWTON_API;
  588. function NewtonMaterialGetContactMaxTangentImpact (const material: PNewtonMaterial; index: Integer): dfloat; cdecl; external NEWTON_API;
  589. function NewtonMaterialGetContactPenetration (const material: PNewtonMaterial): dfloat; cdecl; external NEWTON_API;
  590. procedure NewtonMaterialSetAsSoftContact (const material: PNewtonMaterial; relaxation: dfloat); cdecl; external NEWTON_API;
  591. procedure NewtonMaterialSetContactSoftness (const material: PNewtonMaterial; softness: dfloat); cdecl; external NEWTON_API;
  592. procedure NewtonMaterialSetContactThickness (const material: PNewtonMaterial; thickness: dfloat); cdecl; external NEWTON_API;
  593. procedure NewtonMaterialSetContactElasticity (const material: PNewtonMaterial; restitution: dfloat); cdecl; external NEWTON_API;
  594. procedure NewtonMaterialSetContactFrictionState (const material: PNewtonMaterial; state: Integer; index: Integer); cdecl; external NEWTON_API;
  595. procedure NewtonMaterialSetContactFrictionCoef (const material: PNewtonMaterial; staticFrictionCoef: dfloat; kineticFrictionCoef: dfloat; index: Integer); cdecl; external NEWTON_API;
  596. procedure NewtonMaterialSetContactNormalAcceleration (const material: PNewtonMaterial; accel: dfloat); cdecl; external NEWTON_API;
  597. procedure NewtonMaterialSetContactNormalDirection (const material: PNewtonMaterial; const directionVector: pfloat); cdecl; external NEWTON_API;
  598. procedure NewtonMaterialSetContactPosition (const material: PNewtonMaterial; const position: pfloat); cdecl; external NEWTON_API;
  599. procedure NewtonMaterialSetContactTangentFriction (const material: PNewtonMaterial; friction: dfloat; index: Integer); cdecl; external NEWTON_API;
  600. procedure NewtonMaterialSetContactTangentAcceleration (const material: PNewtonMaterial; accel: dfloat; index: Integer); cdecl; external NEWTON_API;
  601. procedure NewtonMaterialContactRotateTangentDirections (const material: PNewtonMaterial; const directionVector: pfloat); cdecl; external NEWTON_API;
  602. {}function NewtonMaterialGetContactPruningTolerance (const contactJoint: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  603. {}procedure NewtonMaterialSetContactPruningTolerance (const contactJoint: PNewtonJoint; tolerance: dfloat); cdecl; external NEWTON_API;
  604. // **********************************************************************************************
  605. //
  606. // convex collision primitives creation functions
  607. //
  608. // **********************************************************************************************
  609. function NewtonCreateNull (const newtonWorld: PNewtonWorld): PNewtonCollision; cdecl; external NEWTON_API;
  610. function NewtonCreateSphere (const newtonWorld: PNewtonWorld; radius: dfloat; shapeID: Integer; const offsetMatrix: pfloat): PNewtonCollision; cdecl; external NEWTON_API;
  611. function NewtonCreateBox (const newtonWorld: PNewtonWorld; dx: dfloat; dy: dfloat; dz: dfloat; shapeID: Integer; const offsetMatrix: pfloat): PNewtonCollision; cdecl; external NEWTON_API;
  612. function NewtonCreateCone (const newtonWorld: PNewtonWorld; radius: dfloat; height: dfloat; shapeID: Integer; const offsetMatrix: pfloat): PNewtonCollision; cdecl; external NEWTON_API;
  613. function NewtonCreateCapsule (const newtonWorld: PNewtonWorld; radius0: dfloat; radius1: dfloat; height: dfloat; shapeID: Integer; const offsetMatrix: pfloat): PNewtonCollision; cdecl; external NEWTON_API;
  614. function NewtonCreateCylinder (const newtonWorld: PNewtonWorld; radio0: dfloat; radio1: dfloat; height: dfloat; shapeID: Integer; const offsetMatrix: pfloat): PNewtonCollision; cdecl; external NEWTON_API;
  615. function NewtonCreateChamferCylinder (const newtonWorld: PNewtonWorld; radius: dfloat; height: dfloat; shapeID: Integer; const offsetMatrix: pfloat): PNewtonCollision; cdecl; external NEWTON_API;
  616. function NewtonCreateConvexHull (const newtonWorld: PNewtonWorld; count: Integer; const vertexCloud: pfloat; strideInBytes: Integer; tolerance: dfloat; shapeID: Integer; const offsetMatrix: pfloat): PNewtonCollision; cdecl; external NEWTON_API;
  617. function NewtonCreateConvexHullFromMesh (const newtonWorld: PNewtonWorld; const mesh: PNewtonMesh; tolerance: dfloat; shapeID: Integer): PNewtonCollision; cdecl; external NEWTON_API;
  618. function NewtonCollisionGetMode (const convexCollision: PNewtonCollision): Integer; cdecl; external NEWTON_API;
  619. procedure NewtonCollisionSetMode (const convexCollision: PNewtonCollision; mode: Integer); cdecl; external NEWTON_API;
  620. function NewtonConvexHullGetFaceIndices (const convexHullCollision: PNewtonCollision; face: Integer; const faceIndices: Pinteger): Integer; cdecl; external NEWTON_API;
  621. function NewtonConvexHullGetVertexData (const convexHullCollision: PNewtonCollision; const vertexData: Pfloat; strideInBytes: Pinteger): Integer; cdecl; external NEWTON_API;
  622. function NewtonConvexCollisionCalculateVolume (const convexCollision: PNewtonCollision): dfloat; cdecl; external NEWTON_API;
  623. procedure NewtonConvexCollisionCalculateInertialMatrix (const convexCollision: PNewtonCollision; const inertia: pfloat; const origin: pfloat); cdecl; external NEWTON_API;
  624. function NewtonConvexCollisionCalculateBuoyancyVolume (const convexCollision: PNewtonCollision; const matrix: pfloat; const fluidPlane: pfloat; const centerOfBuoyancy: pfloat): dfloat; cdecl; external NEWTON_API;
  625. function NewtonCollisionDataPointer (const convexCollision: PNewtonCollision): Pointer; cdecl; external NEWTON_API;
  626. // **********************************************************************************************
  627. //
  628. // compound collision primitives creation functions
  629. //
  630. // **********************************************************************************************
  631. function NewtonCreateCompoundCollision (const newtonWorld: PNewtonWorld; shapeID: Integer): PNewtonCollision; cdecl; external NEWTON_API;
  632. function NewtonCreateCompoundCollisionFromMesh (const newtonWorld: PNewtonWorld; const mesh: PNewtonMesh; hullTolerance: dfloat; shapeID: Integer; subShapeID: Integer): PNewtonCollision; cdecl; external NEWTON_API;
  633. procedure NewtonCompoundCollisionBeginAddRemove (const compoundCollision: PNewtonCollision); cdecl; external NEWTON_API;
  634. function NewtonCompoundCollisionAddSubCollision (const compoundCollision: PNewtonCollision; const convexCollision: PNewtonCollision): Pointer; cdecl; external NEWTON_API;
  635. procedure NewtonCompoundCollisionRemoveSubCollision (const compoundCollision: PNewtonCollision; const collisionNode: Pointer); cdecl; external NEWTON_API;
  636. procedure NewtonCompoundCollisionRemoveSubCollisionByIndex (const compoundCollision: PNewtonCollision; nodeIndex: Integer); cdecl; external NEWTON_API;
  637. procedure NewtonCompoundCollisionSetSubCollisionMatrix (const compoundCollision: PNewtonCollision; const collisionNode: Pointer; const matrix: pfloat); cdecl; external NEWTON_API;
  638. procedure NewtonCompoundCollisionEndAddRemove (const compoundCollision: PNewtonCollision); cdecl; external NEWTON_API;
  639. function NewtonCompoundCollisionGetFirstNode (const compoundCollision: PNewtonCollision): Pointer; cdecl; external NEWTON_API;
  640. function NewtonCompoundCollisionGetNextNode (const compoundCollision: PNewtonCollision; const collisionNode: Pointer): Pointer; cdecl; external NEWTON_API;
  641. function NewtonCompoundCollisionGetNodeByIndex (const compoundCollision: PNewtonCollision; index: Integer): Pointer; cdecl; external NEWTON_API;
  642. function NewtonCompoundCollisionGetNodeIndex (const compoundCollision: PNewtonCollision; const collisionNode: Pointer): Integer; cdecl; external NEWTON_API;
  643. function NewtonCompoundCollisionGetCollisionFromNode (const compoundCollision: PNewtonCollision; const collisionNode: Pointer): PNewtonCollision; cdecl; external NEWTON_API;
  644. // **********************************************************************************************
  645. //
  646. // Fractured compound collision primitives interface
  647. //
  648. // **********************************************************************************************
  649. function NewtonCreateFracturedCompoundCollision (const newtonWorld: PNewtonWorld; const solidMesh: PNewtonMesh; shapeID: Integer; fracturePhysicsMaterialID: Integer; pointcloudCount: Integer; const vertexCloud: pfloat; strideInBytes: Integer; materialID: Integer; const textureMatrix: pfloat; regenerateMainMeshCallback: NewtonFractureCompoundCollisionReconstructMainMeshCallBack; emitFracturedCompound: NewtonFractureCompoundCollisionOnEmitCompoundFractured; emitFracfuredChunk: NewtonFractureCompoundCollisionOnEmitChunk): PNewtonCollision; cdecl; external NEWTON_API;
  650. function NewtonFracturedCompoundPlaneClip (const fracturedCompound: PNewtonCollision; const plane: pfloat): PNewtonCollision; cdecl; external NEWTON_API;
  651. procedure NewtonFracturedCompoundSetCallbacks (const fracturedCompound: PNewtonCollision; regenerateMainMeshCallback: NewtonFractureCompoundCollisionReconstructMainMeshCallBack; emitFracturedCompound: NewtonFractureCompoundCollisionOnEmitCompoundFractured; emitFracfuredChunk: NewtonFractureCompoundCollisionOnEmitChunk); cdecl; external NEWTON_API;
  652. function NewtonFracturedCompoundIsNodeFreeToDetach (const fracturedCompound: PNewtonCollision; const collisionNode: Pointer): Integer; cdecl; external NEWTON_API;
  653. function NewtonFracturedCompoundNeighborNodeList (const fracturedCompound: PNewtonCollision; const collisionNode: Pointer; const list: PPointer; maxCount: Integer): Integer; cdecl; external NEWTON_API;
  654. function NewtonFracturedCompoundGetMainMesh (const fracturedCompound: PNewtonCollision): PNewtonFracturedCompoundMeshPart; cdecl; external NEWTON_API;
  655. function NewtonFracturedCompoundGetFirstSubMesh (const fracturedCompound: PNewtonCollision): PNewtonFracturedCompoundMeshPart; cdecl; external NEWTON_API;
  656. function NewtonFracturedCompoundGetNextSubMesh (const fracturedCompound: PNewtonCollision; const subMesh: PNewtonFracturedCompoundMeshPart): PNewtonFracturedCompoundMeshPart; cdecl; external NEWTON_API;
  657. function NewtonFracturedCompoundCollisionGetVertexCount (const fracturedCompound: PNewtonCollision; const meshOwner: PNewtonFracturedCompoundMeshPart): Integer; cdecl; external NEWTON_API;
  658. function NewtonFracturedCompoundCollisionGetVertexPositions (const fracturedCompound: PNewtonCollision; const meshOwner: PNewtonFracturedCompoundMeshPart): pfloat; cdecl; external NEWTON_API;
  659. function NewtonFracturedCompoundCollisionGetVertexNormals (const fracturedCompound: PNewtonCollision; const meshOwner: PNewtonFracturedCompoundMeshPart): pfloat; cdecl; external NEWTON_API;
  660. function NewtonFracturedCompoundCollisionGetVertexUVs (const fracturedCompound: PNewtonCollision; const meshOwner: PNewtonFracturedCompoundMeshPart): pfloat; cdecl; external NEWTON_API;
  661. function NewtonFracturedCompoundMeshPartGetIndexStream (const fracturedCompound: PNewtonCollision; const meshOwner: PNewtonFracturedCompoundMeshPart; const segment: Pointer; const index: Pinteger): Integer; cdecl; external NEWTON_API;
  662. function NewtonFracturedCompoundMeshPartGetFirstSegment (const fractureCompoundMeshPart: PNewtonFracturedCompoundMeshPart): Pointer; cdecl; external NEWTON_API;
  663. function NewtonFracturedCompoundMeshPartGetNextSegment (const fractureCompoundMeshSegment: Pointer): Pointer; cdecl; external NEWTON_API;
  664. function NewtonFracturedCompoundMeshPartGetMaterial (const fractureCompoundMeshSegment: Pointer): Integer; cdecl; external NEWTON_API;
  665. function NewtonFracturedCompoundMeshPartGetIndexCount (const fractureCompoundMeshSegment: Pointer): Integer; cdecl; external NEWTON_API;
  666. // **********************************************************************************************
  667. //
  668. // scene collision are static compound collision that can take polygonal static collisions
  669. //
  670. // **********************************************************************************************
  671. function NewtonCreateSceneCollision (const newtonWorld: PNewtonWorld; shapeID: Integer): PNewtonCollision; cdecl; external NEWTON_API;
  672. procedure NewtonSceneCollisionBeginAddRemove (const sceneCollision: PNewtonCollision); cdecl; external NEWTON_API;
  673. function NewtonSceneCollisionAddSubCollision (const sceneCollision: PNewtonCollision; const collision: PNewtonCollision): Pointer; cdecl; external NEWTON_API;
  674. procedure NewtonSceneCollisionRemoveSubCollision (const compoundCollision: PNewtonCollision; const collisionNode: Pointer); cdecl; external NEWTON_API;
  675. procedure NewtonSceneCollisionRemoveSubCollisionByIndex (const sceneCollision: PNewtonCollision; nodeIndex: Integer); cdecl; external NEWTON_API;
  676. procedure NewtonSceneCollisionSetSubCollisionMatrix (const sceneCollision: PNewtonCollision; const collisionNode: Pointer; const matrix: pfloat); cdecl; external NEWTON_API;
  677. procedure NewtonSceneCollisionEndAddRemove (const sceneCollision: PNewtonCollision); cdecl; external NEWTON_API;
  678. function NewtonSceneCollisionGetFirstNode (const sceneCollision: PNewtonCollision): Pointer; cdecl; external NEWTON_API;
  679. function NewtonSceneCollisionGetNextNode (const sceneCollision: PNewtonCollision; const collisionNode: Pointer): Pointer; cdecl; external NEWTON_API;
  680. function NewtonSceneCollisionGetNodeByIndex (const sceneCollision: PNewtonCollision; index: Integer): Pointer; cdecl; external NEWTON_API;
  681. function NewtonSceneCollisionGetNodeIndex (const sceneCollision: PNewtonCollision; const collisionNode: Pointer): Integer; cdecl; external NEWTON_API;
  682. function NewtonSceneCollisionGetCollisionFromNode (const sceneCollision: PNewtonCollision; const collisionNode: Pointer): PNewtonCollision; cdecl; external NEWTON_API;
  683. // ***********************************************************************************************************
  684. //
  685. // User Static mesh collision interface
  686. //
  687. // ***********************************************************************************************************
  688. function NewtonCreateUserMeshCollision (const newtonWorld: PNewtonWorld; const minBox: pfloat; const maxBox: pfloat; const userData: Pointer; collideCallback: NewtonUserMeshCollisionCollideCallback; rayHitCallback: NewtonUserMeshCollisionRayHitCallback; destroyCallback: NewtonUserMeshCollisionDestroyCallback; getInfoCallback: NewtonUserMeshCollisionGetCollisionInfo; getLocalAABBCallback: NewtonUserMeshCollisionAABBTest; facesInAABBCallback: NewtonUserMeshCollisionGetFacesInAABB; serializeCallback: NewtonOnUserCollisionSerializationCallback; shapeID: Integer): PNewtonCollision; cdecl; external NEWTON_API;
  689. function NewtonUserMeshCollisionContinuousOverlapTest (const collideDescData: PNewtonUserMeshCollisionCollideDesc; const continueCollisionHandle: Pointer; const minAabb: pfloat; const maxAabb: pfloat): Integer; cdecl; external NEWTON_API;
  690. // ***********************************************************************************************************
  691. //
  692. // Collision serialization functions
  693. //
  694. // ***********************************************************************************************************
  695. function NewtonCreateCollisionFromSerialization (const newtonWorld: PNewtonWorld; deserializeFunction: NewtonDeserializeCallback; const serializeHandle: Pointer): PNewtonCollision; cdecl; external NEWTON_API;
  696. procedure NewtonCollisionSerialize (const newtonWorld: PNewtonWorld; const collision: PNewtonCollision; serializeFunction: NewtonSerializeCallback; const serializeHandle: Pointer); cdecl; external NEWTON_API;
  697. procedure NewtonCollisionGetInfo (const collision: PNewtonCollision; const collisionInfo: PNewtonCollisionInfoRecord); cdecl; external NEWTON_API;
  698. // **********************************************************************************************
  699. //
  700. // Static collision shapes functions
  701. //
  702. // **********************************************************************************************
  703. function NewtonCreateHeightFieldCollision (const newtonWorld: PNewtonWorld; width: Integer; height: Integer; gridsDiagonals: Integer; elevationdatType: Integer; const elevationMap: Pointer; const attributeMap: pchar; verticalScale: dfloat; horizontalScale_x: dfloat; horizontalScale_z: dfloat; shapeID: Integer): PNewtonCollision; cdecl; external NEWTON_API;
  704. procedure NewtonHeightFieldSetUserRayCastCallback (const heightfieldCollision: PNewtonCollision; rayHitCallback: NewtonHeightFieldRayCastCallback); cdecl; external NEWTON_API;
  705. procedure NewtonHeightFieldSetHorizontalDisplacement(heightfieldCollision : PNewtonCollision; horizontalMap : Pword; scale : dFloat); cdecl; external NEWTON_API;
  706. function NewtonCreateTreeCollision (const newtonWorld: PNewtonWorld; shapeID: Integer): PNewtonCollision; cdecl; external NEWTON_API;
  707. function NewtonCreateTreeCollisionFromMesh (const newtonWorld: PNewtonWorld; const mesh: PNewtonMesh; shapeID: Integer): PNewtonCollision; cdecl; external NEWTON_API;
  708. procedure NewtonTreeCollisionSetUserRayCastCallback (const treeCollision: PNewtonCollision; rayHitCallback: NewtonCollisionTreeRayCastCallback); cdecl; external NEWTON_API;
  709. procedure NewtonTreeCollisionBeginBuild (const treeCollision: PNewtonCollision); cdecl; external NEWTON_API;
  710. procedure NewtonTreeCollisionAddFace (const treeCollision: PNewtonCollision; vertexCount: Integer; const vertexPtr: pfloat; strideInBytes: Integer; faceAttribute: Integer); cdecl; external NEWTON_API;
  711. procedure NewtonTreeCollisionEndBuild (const treeCollision: PNewtonCollision; optimize: Integer); cdecl; external NEWTON_API;
  712. function NewtonTreeCollisionGetFaceAttribute (const treeCollision: PNewtonCollision; const faceIndexArray: Pinteger; indexCount: Integer): Integer; cdecl; external NEWTON_API;
  713. procedure NewtonTreeCollisionSetFaceAttribute (const treeCollision: PNewtonCollision; const faceIndexArray: Pinteger; indexCount: Integer; attribute: Integer); cdecl; external NEWTON_API;
  714. procedure NewtonTreeCollisionForEachFace (const treeCollision: PNewtonCollision; forEachFaceCallback: NewtonTreeCollisionFaceCallback; const context: Pointer); cdecl; external NEWTON_API;
  715. function NewtonTreeCollisionGetVertexListTriangleListInAABB (const treeCollision: PNewtonCollision; const p0: pfloat; const p1: pfloat; const vertexArray: Pfloat; const vertexCount: Pinteger; const vertexStrideInBytes: Pinteger; const indexList: Pinteger; maxIndexCount: Integer; const faceAttribute: Pinteger): Integer; cdecl; external NEWTON_API;
  716. procedure NewtonStaticCollisionSetDebugCallback (const staticCollision: PNewtonCollision; userCallback: NewtonTreeCollisionCallback); cdecl; external NEWTON_API;
  717. // **********************************************************************************************
  718. //
  719. // General purpose collision library functions
  720. //
  721. // **********************************************************************************************
  722. function NewtonCollisionCreateInstance (const collision: PNewtonCollision): PNewtonCollision; cdecl; external NEWTON_API;
  723. function NewtonCollisionGetType (const collision: PNewtonCollision): Integer; cdecl; external NEWTON_API;
  724. function NewtonCollisionIsConvexShape (const collision: PNewtonCollision): Integer; cdecl; external NEWTON_API;
  725. function NewtonCollisionIsStaticShape (const collision: PNewtonCollision): Integer; cdecl; external NEWTON_API;
  726. procedure NewtonCollisionSetUserData (const collision: PNewtonCollision; const userData: Pointer); cdecl; external NEWTON_API;
  727. function NewtonCollisionGetUserData (const collision: PNewtonCollision): Pointer; cdecl; external NEWTON_API;
  728. procedure NewtonCollisionSetUserID (const collision: PNewtonCollision; id: int64); cdecl; external NEWTON_API;
  729. function NewtonCollisionGetUserID (const collision: PNewtonCollision): int64; cdecl; external NEWTON_API;
  730. procedure NewtonCollisionGetMaterial (const collision: PNewtonCollision; const userData: PNewtonCollisionMaterial); cdecl; external NEWTON_API;
  731. procedure NewtonCollisionSetMaterial (const collision: PNewtonCollision; const userData: PNewtonCollisionMaterial); cdecl; external NEWTON_API;
  732. function NewtonCollisionGetSubCollisionHandle (const collision: PNewtonCollision): Pointer; cdecl; external NEWTON_API;
  733. function NewtonCollisionGetParentInstance (const collision: PNewtonCollision): PNewtonCollision; cdecl; external NEWTON_API;
  734. procedure NewtonCollisionSetMatrix (const collision: PNewtonCollision; const matrix: pfloat); cdecl; external NEWTON_API;
  735. procedure NewtonCollisionGetMatrix (const collision: PNewtonCollision; const matrix: pfloat); cdecl; external NEWTON_API;
  736. procedure NewtonCollisionSetScale (const collision: PNewtonCollision; scaleX: dfloat; scaleY: dfloat; scaleZ: dfloat); cdecl; external NEWTON_API;
  737. procedure NewtonCollisionGetScale (const collision: PNewtonCollision; const scaleX: pfloat; const scaleY: pfloat; const scaleZ: pfloat); cdecl; external NEWTON_API;
  738. procedure NewtonDestroyCollision (const collision: PNewtonCollision); cdecl; external NEWTON_API;
  739. function NewtonCollisionGetSkinThickness (const collision: PNewtonCollision): dfloat; cdecl; external NEWTON_API;
  740. procedure NewtonCollisionSetSkinThickness (const collision: PNewtonCollision; thickness: dfloat); cdecl; external NEWTON_API;
  741. function NewtonCollisionIntersectionTest (const newtonWorld: PNewtonWorld; const collisionA: PNewtonCollision; const matrixA: pfloat; const collisionB: PNewtonCollision; const matrixB: pfloat; threadIndex: Integer): Integer; cdecl; external NEWTON_API;
  742. function NewtonCollisionPointDistance (const newtonWorld: PNewtonWorld; const point: pfloat; const collision: PNewtonCollision; const matrix: pfloat; const contact: pfloat; const normal: pfloat; threadIndex: Integer): Integer; cdecl; external NEWTON_API;
  743. function NewtonCollisionClosestPoint (const newtonWorld: PNewtonWorld; const collisionA: PNewtonCollision; const matrixA: pfloat; const collisionB: PNewtonCollision; const matrixB: pfloat; const contactA: pfloat; const contactB: pfloat; const normalAB: pfloat; threadIndex: Integer): Integer; cdecl; external NEWTON_API;
  744. function NewtonCollisionCollide (const newtonWorld: PNewtonWorld; maxSize: Integer; const collisionA: PNewtonCollision; const matrixA: pfloat; const collisionB: PNewtonCollision; const matrixB: pfloat; const contacts: pfloat; const normals: pfloat; const penetration: pfloat; const attributeA: Pint64; const attributeB: Pint64; threadIndex: Integer): Integer; cdecl; external NEWTON_API;
  745. function NewtonCollisionCollideContinue (const newtonWorld: PNewtonWorld; maxSize: Integer; timestep: dfloat; const collisionA: PNewtonCollision; const matrixA: pfloat; const velocA: pfloat; const omegaA: pfloat; const collisionB: PNewtonCollision; const matrixB: pfloat; const velocB: pfloat; const omegaB: pfloat; const timeOfImpact: pfloat; const contacts: pfloat; const normals: pfloat; const penetration: pfloat; const attributeA: Pint64; const attributeB: Pint64; threadIndex: Integer): Integer; cdecl; external NEWTON_API;
  746. procedure NewtonCollisionSupportVertex (const collision: PNewtonCollision; const dir: pfloat; const vertex: pfloat); cdecl; external NEWTON_API;
  747. function NewtonCollisionRayCast (const collision: PNewtonCollision; const p0: pfloat; const p1: pfloat; const normal: pfloat; const attribute: Pint64): dfloat; cdecl; external NEWTON_API;
  748. procedure NewtonCollisionCalculateAABB (const collision: PNewtonCollision; const matrix: pfloat; const p0: pfloat; const p1: pfloat); cdecl; external NEWTON_API;
  749. procedure NewtonCollisionForEachPolygonDo (const collision: PNewtonCollision; const matrix: pfloat; callback: NewtonCollisionIterator; const userData: Pointer); cdecl; external NEWTON_API;
  750. // **********************************************************************************************
  751. //
  752. // collision aggregates, are a collision node on eh broad phase the serve as the root nod for a collection of rigid bodies
  753. // that shared the property of being in close proximity all the time, they are similar to compound collision by the group bodies instead of collision instances
  754. // These are good for speeding calculation calculation of rag doll, Vehicles or contractions of rigid bodied lined by joints.
  755. // also for example if you know that many the life time of a group of bodies like the object on a house of a building will be localize to the confide of the building
  756. // then warping the bodies under an aggregate will reduce collision calculation of almost an order of magnitude.
  757. //
  758. // **********************************************************************************************
  759. function NewtonCollisionAggregateCreate (const world: PNewtonWorld): Pointer; cdecl; external NEWTON_API;
  760. procedure NewtonCollisionAggregateDestroy (const aggregate: Pointer); cdecl; external NEWTON_API;
  761. procedure NewtonCollisionAggregateAddBody (const aggregate: Pointer; const body: pNewtonBody); cdecl; external NEWTON_API;
  762. procedure NewtonCollisionAggregateRemoveBody (const aggregate: Pointer; const body: pNewtonBody); cdecl; external NEWTON_API;
  763. function NewtonCollisionAggregateGetSelfCollision (const aggregate: Pointer): Integer; cdecl; external NEWTON_API;
  764. procedure NewtonCollisionAggregateSetSelfCollision (const aggregate: Pointer; state: Integer); cdecl; external NEWTON_API;
  765. { transforms utility functions }
  766. procedure NewtonSetEulerAngle (const eulersAngles: pfloat; const matrix: pfloat); cdecl; external NEWTON_API;
  767. procedure NewtonGetEulerAngle (const matrix: pfloat; const eulersAngles0: pfloat; const eulersAngles1: pfloat); cdecl; external NEWTON_API;
  768. function NewtonCalculateSpringDamperAcceleration (dt: dfloat; ks: dfloat; x: dfloat; kd: dfloat; s: dfloat): dfloat; cdecl; external NEWTON_API;
  769. { body manipulation functions }
  770. function NewtonCreateDynamicBody (const newtonWorld: PNewtonWorld; const collision: PNewtonCollision; const matrix: pfloat): pNewtonBody; cdecl; external NEWTON_API;
  771. function NewtonCreateKinematicBody (const newtonWorld: PNewtonWorld; const collision: PNewtonCollision; const matrix: pfloat): pNewtonBody; cdecl; external NEWTON_API;
  772. function NewtonCreateAsymetricDynamicBody (const newtonWorld: PNewtonWorld; const collision: PNewtonCollision; const matrix: pfloat): pNewtonBody; cdecl; external NEWTON_API;
  773. procedure NewtonDestroyBody (const body: pNewtonBody); cdecl; external NEWTON_API;
  774. function NewtonBodyGetSimulationState (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  775. procedure NewtonBodySetSimulationState (const bodyPtr: pNewtonBody; const state: Integer); cdecl; external NEWTON_API;
  776. function NewtonBodyGetType (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  777. function NewtonBodyGetCollidable (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  778. procedure NewtonBodySetCollidable (const body: pNewtonBody; collidableState: Integer); cdecl; external NEWTON_API;
  779. procedure NewtonBodyAddForce (const body: pNewtonBody; const force: pfloat); cdecl; external NEWTON_API;
  780. procedure NewtonBodyAddTorque (const body: pNewtonBody; const torque: pfloat); cdecl; external NEWTON_API;
  781. procedure NewtonBodyCalculateInverseDynamicsForce(body : PNewtonBody; timestep : dFloat; desiredVeloc : PdFloat; forceOut : PdFloat); cdecl; external NEWTON_API;
  782. procedure NewtonBodySetCentreOfMass (const body: pNewtonBody; const com: pfloat); cdecl; external NEWTON_API;
  783. procedure NewtonBodySetMassMatrix (const body: pNewtonBody; mass: dfloat; Ixx: dfloat; Iyy: dfloat; Izz: dfloat); cdecl; external NEWTON_API;
  784. procedure NewtonBodySetFullMassMatrix (const body: pNewtonBody; mass: dfloat; const inertiaMatrix: pfloat); cdecl; external NEWTON_API;
  785. procedure NewtonBodySetMassProperties (const body: pNewtonBody; mass: dfloat; const collision: PNewtonCollision); cdecl; external NEWTON_API;
  786. procedure NewtonBodySetMatrix (const body: pNewtonBody; const matrix: pfloat); cdecl; external NEWTON_API;
  787. procedure NewtonBodySetMatrixNoSleep (const body: pNewtonBody; const matrix: pfloat); cdecl; external NEWTON_API;
  788. procedure NewtonBodySetMatrixRecursive (const body: pNewtonBody; const matrix: pfloat); cdecl; external NEWTON_API;
  789. procedure NewtonBodySetMaterialGroupID (const body: pNewtonBody; id: Integer); cdecl; external NEWTON_API;
  790. procedure NewtonBodySetContinuousCollisionMode (const body: pNewtonBody; state: LongWord); cdecl; external NEWTON_API;
  791. procedure NewtonBodySetJointRecursiveCollision (const body: pNewtonBody; state: LongWord); cdecl; external NEWTON_API;
  792. procedure NewtonBodySetOmega (const body: pNewtonBody; const omega: pfloat); cdecl; external NEWTON_API;
  793. procedure NewtonBodySetOmegaNoSleep (const body: pNewtonBody; const omega: pfloat); cdecl; external NEWTON_API;
  794. procedure NewtonBodySetVelocity (const body: pNewtonBody; const velocity: pfloat); cdecl; external NEWTON_API;
  795. procedure NewtonBodySetVelocityNoSleep (const body: pNewtonBody; const velocity: pfloat); cdecl; external NEWTON_API;
  796. procedure NewtonBodySetForce (const body: pNewtonBody; const force: pfloat); cdecl; external NEWTON_API;
  797. procedure NewtonBodySetTorque (const body: pNewtonBody; const torque: pfloat); cdecl; external NEWTON_API;
  798. procedure NewtonBodySetLinearDamping (const body: pNewtonBody; linearDamp: dfloat); cdecl; external NEWTON_API;
  799. procedure NewtonBodySetAngularDamping (const body: pNewtonBody; const angularDamp: pfloat); cdecl; external NEWTON_API;
  800. procedure NewtonBodySetCollision (const body: pNewtonBody; const collision: PNewtonCollision); cdecl; external NEWTON_API;
  801. procedure NewtonBodySetCollisionScale (const body: pNewtonBody; scaleX: dfloat; scaleY: dfloat; scaleZ: dfloat); cdecl; external NEWTON_API;
  802. function NewtonBodyGetSleepState (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  803. procedure NewtonBodySetSleepState (const body: pNewtonBody; state: Integer); cdecl; external NEWTON_API;
  804. function NewtonBodyGetAutoSleep (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  805. procedure NewtonBodySetAutoSleep (const body: pNewtonBody; state: Integer); cdecl; external NEWTON_API;
  806. function NewtonBodyGetFreezeState (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  807. procedure NewtonBodySetFreezeState (const body: pNewtonBody; state: Integer); cdecl; external NEWTON_API;
  808. function NewtonBodyGetGyroscopicTorque (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  809. procedure NewtonBodySetGyroscopicTorque (const body: pNewtonBody; state: Integer); cdecl; external NEWTON_API;
  810. procedure NewtonBodySetDestructorCallback (const body: pNewtonBody; callback: NewtonBodyDestructor); cdecl; external NEWTON_API;
  811. function NewtonBodyGetDestructorCallback (const body: pNewtonBody): PNewtonBodyDestructor; cdecl; external NEWTON_API;
  812. procedure NewtonBodySetTransformCallback (const body: pNewtonBody; callback: NewtonSetTransform); cdecl; external NEWTON_API;
  813. function NewtonBodyGetTransformCallback (const body: pNewtonBody): PNewtonSetTransform; cdecl; external NEWTON_API;
  814. procedure NewtonBodySetForceAndTorqueCallback (const body: pNewtonBody; callback: NewtonApplyForceAndTorque); cdecl; external NEWTON_API;
  815. function NewtonBodyGetForceAndTorqueCallback (const body: pNewtonBody): PNewtonApplyForceAndTorque; cdecl; external NEWTON_API;
  816. function NewtonBodyGetID (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  817. procedure NewtonBodySetUserData (const body: pNewtonBody; const userData: Pointer); cdecl; external NEWTON_API;
  818. function NewtonBodyGetUserData (const body: pNewtonBody): Pointer; cdecl; external NEWTON_API;
  819. function NewtonBodyGetWorld (const body: pNewtonBody): PNewtonWorld; cdecl; external NEWTON_API;
  820. function NewtonBodyGetCollision (const body: pNewtonBody): PNewtonCollision; cdecl; external NEWTON_API;
  821. function NewtonBodyGetMaterialGroupID (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  822. function NewtonBodyGetSerializedID (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  823. function NewtonBodyGetContinuousCollisionMode (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  824. function NewtonBodyGetJointRecursiveCollision (const body: pNewtonBody): Integer; cdecl; external NEWTON_API;
  825. procedure NewtonBodyGetPosition (const body: pNewtonBody; const pos: pfloat); cdecl; external NEWTON_API;
  826. procedure NewtonBodyGetMatrix (const body: pNewtonBody; const matrix: pfloat); cdecl; external NEWTON_API;
  827. procedure NewtonBodyGetRotation (const body: pNewtonBody; const rotation: pfloat); cdecl; external NEWTON_API;
  828. procedure NewtonBodyGetMass (const body: pNewtonBody; mass: pfloat; const Ixx: pfloat; const Iyy: pfloat; const Izz: pfloat); cdecl; external NEWTON_API;
  829. procedure NewtonBodyGetInvMass (const body: pNewtonBody; const invMass: pfloat; const invIxx: pfloat; const invIyy: pfloat; const invIzz: pfloat); cdecl; external NEWTON_API;
  830. procedure NewtonBodyGetInertiaMatrix (const body: pNewtonBody; const inertiaMatrix: pfloat); cdecl; external NEWTON_API;
  831. procedure NewtonBodyGetInvInertiaMatrix (const body: pNewtonBody; const invInertiaMatrix: pfloat); cdecl; external NEWTON_API;
  832. procedure NewtonBodyGetOmega (const body: pNewtonBody; const vector: pfloat); cdecl; external NEWTON_API;
  833. procedure NewtonBodyGetVelocity (const body: pNewtonBody; const vector: pfloat); cdecl; external NEWTON_API;
  834. procedure NewtonBodyGetAlpha (const body: pNewtonBody; const vector: pfloat); cdecl; external NEWTON_API;
  835. procedure NewtonBodyGetAcceleration (const body: pNewtonBody; const vector: pfloat); cdecl; external NEWTON_API;
  836. procedure NewtonBodyGetForce (const body: pNewtonBody; const vector: pfloat); cdecl; external NEWTON_API;
  837. procedure NewtonBodyGetTorque (const body: pNewtonBody; const vector: pfloat); cdecl; external NEWTON_API;
  838. procedure NewtonBodyGetCentreOfMass (const body: pNewtonBody; const com: pfloat); cdecl; external NEWTON_API;
  839. procedure NewtonBodyGetPointVelocity (const body: pNewtonBody; const point: pfloat; const velocOut: pfloat); cdecl; external NEWTON_API;
  840. procedure NewtonBodyApplyImpulsePair (const body: pNewtonBody; const linearImpulse: pfloat; const angularImpulse: pfloat; timestep: dfloat); cdecl; external NEWTON_API;
  841. procedure NewtonBodyAddImpulse (const body: pNewtonBody; const pointDeltaVeloc: pfloat; const pointPosit: pfloat; timestep: dfloat); cdecl; external NEWTON_API;
  842. procedure NewtonBodyApplyImpulseArray (const body: pNewtonBody; impuleCount: Integer; strideInByte: Integer; const impulseArray: pfloat; const pointArray: pfloat; timestep: dfloat); cdecl; external NEWTON_API;
  843. procedure NewtonBodyIntegrateVelocity (const body: pNewtonBody; timestep: dfloat); cdecl; external NEWTON_API;
  844. function NewtonBodyGetLinearDamping (const body: pNewtonBody): dfloat; cdecl; external NEWTON_API;
  845. procedure NewtonBodyGetAngularDamping (const body: pNewtonBody; const vector: pfloat); cdecl; external NEWTON_API;
  846. procedure NewtonBodyGetAABB (const body: pNewtonBody; const p0: pfloat; const p1: pfloat); cdecl; external NEWTON_API;
  847. function NewtonBodyGetFirstJoint (const body: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  848. function NewtonBodyGetNextJoint (const body: pNewtonBody; const joint: PNewtonJoint): PNewtonJoint; cdecl; external NEWTON_API;
  849. function NewtonBodyGetFirstContactJoint (const body: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  850. function NewtonBodyGetNextContactJoint (const body: pNewtonBody; const contactJoint: PNewtonJoint): PNewtonJoint; cdecl; external NEWTON_API;
  851. function NewtonBodyFindContact (const body0: pNewtonBody; const body1: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  852. // **********************************************************************************************
  853. //
  854. // contact joints interface
  855. //
  856. // **********************************************************************************************
  857. function NewtonContactJointGetFirstContact (const contactJoint: PNewtonJoint): Pointer; cdecl; external NEWTON_API;
  858. function NewtonContactJointGetNextContact (const contactJoint: PNewtonJoint; const contact: Pointer): Pointer; cdecl; external NEWTON_API;
  859. function NewtonContactJointGetContactCount (const contactJoint: PNewtonJoint): Integer; cdecl; external NEWTON_API;
  860. procedure NewtonContactJointRemoveContact (const contactJoint: PNewtonJoint; const contact: Pointer); cdecl; external NEWTON_API;
  861. function NewtonContactJointGetClosestDistance (const contactJoint: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  862. procedure NewtonContactJointResetSelftJointCollision (const contactJoint: PNewtonJoint); cdecl; external NEWTON_API;
  863. procedure NewtonContactJointResetIntraJointCollision (const contactJoint: PNewtonJoint); cdecl; external NEWTON_API;
  864. function NewtonContactGetMaterial (const contact: Pointer): PNewtonMaterial; cdecl; external NEWTON_API;
  865. function NewtonContactGetCollision0 (const contact: Pointer): PNewtonCollision; cdecl; external NEWTON_API;
  866. function NewtonContactGetCollision1 (const contact: Pointer): PNewtonCollision; cdecl; external NEWTON_API;
  867. function NewtonContactGetCollisionID0 (const contact: Pointer): Pointer; cdecl; external NEWTON_API;
  868. function NewtonContactGetCollisionID1 (const contact: Pointer): Pointer; cdecl; external NEWTON_API;
  869. // **********************************************************************************************
  870. //
  871. // Common joint functions
  872. //
  873. // **********************************************************************************************
  874. function NewtonJointGetUserData (const joint: PNewtonJoint): Pointer; cdecl; external NEWTON_API;
  875. procedure NewtonJointSetUserData (const joint: PNewtonJoint; const userData: Pointer); cdecl; external NEWTON_API;
  876. function NewtonJointGetBody0 (const joint: PNewtonJoint): pNewtonBody; cdecl; external NEWTON_API;
  877. function NewtonJointGetBody1 (const joint: PNewtonJoint): pNewtonBody; cdecl; external NEWTON_API;
  878. procedure NewtonJointGetInfo (const joint: PNewtonJoint; const info: PNewtonJointRecord); cdecl; external NEWTON_API;
  879. function NewtonJointGetCollisionState (const joint: PNewtonJoint): Integer; cdecl; external NEWTON_API;
  880. procedure NewtonJointSetCollisionState (const joint: PNewtonJoint; state: Integer); cdecl; external NEWTON_API;
  881. function NewtonJointGetStiffness (const joint: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  882. procedure NewtonJointSetStiffness (const joint: PNewtonJoint; state: dfloat); cdecl; external NEWTON_API;
  883. procedure NewtonDestroyJoint (const newtonWorld: PNewtonWorld; const joint: PNewtonJoint); cdecl; external NEWTON_API;
  884. procedure NewtonJointSetDestructor (const joint: PNewtonJoint; destructorparam: NewtonConstraintDestructor); cdecl; external NEWTON_API;
  885. function NewtonJointIsActive (const joint: PNewtonJoint): Integer; cdecl; external NEWTON_API;
  886. // **********************************************************************************************
  887. //
  888. // particle system interface (soft bodies, individual, pressure bodies and cloth)
  889. //
  890. // **********************************************************************************************
  891. function NewtonCreateMassSpringDamperSystem (const newtonWorld: PNewtonWorld; shapeID: Integer; const points: pfloat; pointCount: Integer; strideInBytes: Integer; const pointMass: pfloat; const links: Pinteger; linksCount: Integer; const linksSpring: pfloat; const linksDamper: pfloat): PNewtonCollision; cdecl; external NEWTON_API;
  892. function NewtonCreateDeformableSolid (const newtonWorld: PNewtonWorld; const mesh: PNewtonMesh; shapeID: Integer): PNewtonCollision; cdecl; external NEWTON_API;
  893. function NewtonDeformableMeshGetParticleCount (const deformableMesh: PNewtonCollision): Integer; cdecl; external NEWTON_API;
  894. function NewtonDeformableMeshGetParticleStrideInBytes (const deformableMesh: PNewtonCollision): Integer; cdecl; external NEWTON_API;
  895. function NewtonDeformableMeshGetParticleArray (const deformableMesh: PNewtonCollision): pfloat; cdecl; external NEWTON_API;
  896. (*
  897. NEWTON_API NewtonCollision* NewtonCreateClothPatch (const NewtonWorld* const newtonWorld, NewtonMesh* const mesh, int shapeID, NewtonClothPatchMaterial* const structuralMaterial, NewtonClothPatchMaterial* const bendMaterial);
  898. NEWTON_API void NewtonDeformableMeshCreateClusters (NewtonCollision* const deformableMesh, int clusterCount, dFloat overlapingWidth);
  899. NEWTON_API void NewtonDeformableMeshSetDebugCallback (NewtonCollision* const deformableMesh, NewtonCollisionIterator callback);
  900. NEWTON_API void NewtonDeformableMeshGetParticlePosition (NewtonCollision* const deformableMesh, int particleIndex, dFloat* const posit);
  901. NEWTON_API void NewtonDeformableMeshBeginConfiguration (const NewtonCollision* const deformableMesh);
  902. NEWTON_API void NewtonDeformableMeshUnconstraintParticle (NewtonCollision* const deformableMesh, int particleIndex);
  903. NEWTON_API void NewtonDeformableMeshConstraintParticle (NewtonCollision* const deformableMesh, int particleIndex, const dFloat* const posit, const NewtonBody* const body);
  904. NEWTON_API void NewtonDeformableMeshEndConfiguration (const NewtonCollision* const deformableMesh);
  905. // NEWTON_API void NewtonDeformableMeshSetPlasticity (NewtonCollision* const deformableMesh, dFloat plasticity);
  906. // NEWTON_API void NewtonDeformableMeshSetStiffness (NewtonCollision* const deformableMesh, dFloat stiffness);
  907. NEWTON_API void NewtonDeformableMeshSetSkinThickness (NewtonCollision* const deformableMesh, dFloat skinThickness);
  908. NEWTON_API void NewtonDeformableMeshUpdateRenderNormals (const NewtonCollision* const deformableMesh);
  909. NEWTON_API int NewtonDeformableMeshGetVertexCount (const NewtonCollision* const deformableMesh);
  910. NEWTON_API void NewtonDeformableMeshGetVertexStreams (const NewtonCollision* const deformableMesh, int vertexStrideInByte, dFloat* const vertex, int normalStrideInByte, dFloat* const normal, int uvStrideInByte0, dFloat* const uv0);
  911. NEWTON_API NewtonDeformableMeshSegment* NewtonDeformableMeshGetFirstSegment (const NewtonCollision* const deformableMesh);
  912. NEWTON_API NewtonDeformableMeshSegment* NewtonDeformableMeshGetNextSegment (const NewtonCollision* const deformableMesh, const NewtonDeformableMeshSegment* const segment);
  913. NEWTON_API int NewtonDeformableMeshSegmentGetMaterialID (const NewtonCollision* const deformableMesh, const NewtonDeformableMeshSegment* const segment);
  914. NEWTON_API int NewtonDeformableMeshSegmentGetIndexCount (const NewtonCollision* const deformableMesh, const NewtonDeformableMeshSegment* const segment);
  915. NEWTON_API const int* NewtonDeformableMeshSegmentGetIndexList (const NewtonCollision* const deformableMesh, const NewtonDeformableMeshSegment* const segment);
  916. *)
  917. // **********************************************************************************************
  918. //
  919. // Ball and Socket joint functions
  920. //
  921. // **********************************************************************************************
  922. function NewtonConstraintCreateBall (const newtonWorld: PNewtonWorld; const pivotPoint: pfloat; const childBody: pNewtonBody; const parentBody: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  923. procedure NewtonBallSetUserCallback (const ball: PNewtonJoint; callback: NewtonBallCallback); cdecl; external NEWTON_API;
  924. procedure NewtonBallGetJointAngle (const ball: PNewtonJoint; angle: pfloat); cdecl; external NEWTON_API;
  925. procedure NewtonBallGetJointOmega (const ball: PNewtonJoint; omega: pfloat); cdecl; external NEWTON_API;
  926. procedure NewtonBallGetJointForce (const ball: PNewtonJoint; const force: pfloat); cdecl; external NEWTON_API;
  927. procedure NewtonBallSetConeLimits (const ball: PNewtonJoint; const pin: pfloat; maxConeAngle: dfloat; maxTwistAngle: dfloat); cdecl; external NEWTON_API;
  928. // **********************************************************************************************
  929. //
  930. // Hinge joint functions
  931. //
  932. // **********************************************************************************************
  933. function NewtonConstraintCreateHinge (const newtonWorld: PNewtonWorld; const pivotPoint: pfloat; const pinDir: pfloat; const childBody: pNewtonBody; const parentBody: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  934. procedure NewtonHingeSetUserCallback (const hinge: PNewtonJoint; callback: NewtonHingeCallback); cdecl; external NEWTON_API;
  935. function NewtonHingeGetJointAngle (const hinge: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  936. function NewtonHingeGetJointOmega (const hinge: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  937. procedure NewtonHingeGetJointForce (const hinge: PNewtonJoint; const force: pfloat); cdecl; external NEWTON_API;
  938. function NewtonHingeCalculateStopAlpha (const hinge: PNewtonJoint; const desc: PNewtonHingeSliderUpdateDesc; angle: dfloat): dfloat; cdecl; external NEWTON_API;
  939. // **********************************************************************************************
  940. //
  941. // Slider joint functions
  942. //
  943. // **********************************************************************************************
  944. function NewtonConstraintCreateSlider (const newtonWorld: PNewtonWorld; const pivotPoint: pfloat; const pinDir: pfloat; const childBody: pNewtonBody; const parentBody: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  945. procedure NewtonSliderSetUserCallback (const slider: PNewtonJoint; callback: NewtonSliderCallback); cdecl; external NEWTON_API;
  946. function NewtonSliderGetJointPosit (const slider: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  947. function NewtonSliderGetJointVeloc (const slider: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  948. procedure NewtonSliderGetJointForce (const slider: PNewtonJoint; const force: pfloat); cdecl; external NEWTON_API;
  949. function NewtonSliderCalculateStopAccel (const slider: PNewtonJoint; const desc: PNewtonHingeSliderUpdateDesc; position: dfloat): dfloat; cdecl; external NEWTON_API;
  950. // **********************************************************************************************
  951. //
  952. // Corkscrew joint functions
  953. //
  954. // **********************************************************************************************
  955. function NewtonConstraintCreateCorkscrew (const newtonWorld: PNewtonWorld; const pivotPoint: pfloat; const pinDir: pfloat; const childBody: pNewtonBody; const parentBody: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  956. procedure NewtonCorkscrewSetUserCallback (const corkscrew: PNewtonJoint; callback: NewtonCorkscrewCallback); cdecl; external NEWTON_API;
  957. function NewtonCorkscrewGetJointPosit (const corkscrew: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  958. function NewtonCorkscrewGetJointAngle (const corkscrew: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  959. function NewtonCorkscrewGetJointVeloc (const corkscrew: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  960. function NewtonCorkscrewGetJointOmega (const corkscrew: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  961. procedure NewtonCorkscrewGetJointForce (const corkscrew: PNewtonJoint; const force: pfloat); cdecl; external NEWTON_API;
  962. function NewtonCorkscrewCalculateStopAlpha (const corkscrew: PNewtonJoint; const desc: PNewtonHingeSliderUpdateDesc; angle: dfloat): dfloat; cdecl; external NEWTON_API;
  963. function NewtonCorkscrewCalculateStopAccel (const corkscrew: PNewtonJoint; const desc: PNewtonHingeSliderUpdateDesc; position: dfloat): dfloat; cdecl; external NEWTON_API;
  964. // **********************************************************************************************
  965. //
  966. // Universal joint functions
  967. //
  968. // **********************************************************************************************
  969. function NewtonConstraintCreateUniversal (const newtonWorld: PNewtonWorld; const pivotPoint: pfloat; const pinDir0: pfloat; const pinDir1: pfloat; const childBody: pNewtonBody; const parentBody: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  970. procedure NewtonUniversalSetUserCallback (const universal: PNewtonJoint; callback: NewtonUniversalCallback); cdecl; external NEWTON_API;
  971. function NewtonUniversalGetJointAngle0 (const universal: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  972. function NewtonUniversalGetJointAngle1 (const universal: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  973. function NewtonUniversalGetJointOmega0 (const universal: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  974. function NewtonUniversalGetJointOmega1 (const universal: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  975. procedure NewtonUniversalGetJointForce (const universal: PNewtonJoint; const force: pfloat); cdecl; external NEWTON_API;
  976. function NewtonUniversalCalculateStopAlpha0 (const universal: PNewtonJoint; const desc: PNewtonHingeSliderUpdateDesc; angle: dfloat): dfloat; cdecl; external NEWTON_API;
  977. function NewtonUniversalCalculateStopAlpha1 (const universal: PNewtonJoint; const desc: PNewtonHingeSliderUpdateDesc; angle: dfloat): dfloat; cdecl; external NEWTON_API;
  978. // **********************************************************************************************
  979. //
  980. // Up vector joint functions
  981. //
  982. // **********************************************************************************************
  983. function NewtonConstraintCreateUpVector (const newtonWorld: PNewtonWorld; const pinDir: pfloat; const body: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  984. procedure NewtonUpVectorGetPin (const upVector: PNewtonJoint; pin: dfloat); cdecl; external NEWTON_API;
  985. procedure NewtonUpVectorSetPin (const upVector: PNewtonJoint; const pin: dfloat); cdecl; external NEWTON_API;
  986. // **********************************************************************************************
  987. //
  988. // User defined bilateral Joint
  989. //
  990. // **********************************************************************************************
  991. function NewtonConstraintCreateUserJoint (const newtonWorld: PNewtonWorld; maxDOF: Integer; callback: NewtonUserBilateralCallback; const childBody: pNewtonBody; const parentBody: pNewtonBody): PNewtonJoint; cdecl; external NEWTON_API;
  992. function NewtonUserJointGetSolverModel (const joint: PNewtonJoint): Integer; cdecl; external NEWTON_API;
  993. procedure NewtonUserJointSetSolverModel (const joint: PNewtonJoint; model: Integer); cdecl; external NEWTON_API;
  994. {}procedure NewtonUserJointMassScale (const joint: PNewtonJoint; scaleBody0: dfloat; scaleBody1: dfloat); cdecl; external NEWTON_API;
  995. procedure NewtonUserJointSetFeedbackCollectorCallback (const joint: PNewtonJoint; getFeedback: NewtonUserBilateralCallback); cdecl; external NEWTON_API;
  996. procedure NewtonUserJointAddLinearRow (const joint: PNewtonJoint; const pivot0: pfloat; const pivot1: pfloat; const dir: pfloat); cdecl; external NEWTON_API;
  997. procedure NewtonUserJointAddAngularRow (const joint: PNewtonJoint; relativeAngle: dfloat; const dir: pfloat); cdecl; external NEWTON_API;
  998. procedure NewtonUserJointAddGeneralRow (const joint: PNewtonJoint; const jacobian0: pfloat; const jacobian1: pfloat); cdecl; external NEWTON_API;
  999. procedure NewtonUserJointSetRowMinimumFriction (const joint: PNewtonJoint; friction: dfloat); cdecl; external NEWTON_API;
  1000. procedure NewtonUserJointSetRowMaximumFriction (const joint: PNewtonJoint; friction: dfloat); cdecl; external NEWTON_API;
  1001. function NewtonUserJointCalculateRowZeroAcceleration (const joint: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  1002. function NewtonUserJointGetRowAcceleration (const joint: PNewtonJoint): dfloat; cdecl; external NEWTON_API;
  1003. {}procedure NewtonUserJointGetRowJacobian (const joint: PNewtonJoint; const linear0: pfloat; const angula0: pfloat; const linear1: pfloat; const angula1: pfloat); cdecl; external NEWTON_API;
  1004. procedure NewtonUserJointSetRowAcceleration (const joint: PNewtonJoint; acceleration: dfloat); cdecl; external NEWTON_API;
  1005. procedure NewtonUserJointSetRowSpringDamperAcceleration (const joint: PNewtonJoint; rowStiffness: dfloat; spring: dfloat; damper: dfloat); cdecl; external NEWTON_API;
  1006. procedure NewtonUserJointSetRowStiffness (const joint: PNewtonJoint; stiffness: dfloat); cdecl; external NEWTON_API;
  1007. function NewtonUserJoinRowsCount (const joint: PNewtonJoint): Integer; cdecl; external NEWTON_API;
  1008. procedure NewtonUserJointGetGeneralRow (const joint: PNewtonJoint; index: Integer; const jacobian0: pfloat; const jacobian1: pfloat); cdecl; external NEWTON_API;
  1009. function NewtonUserJointGetRowForce (const joint: PNewtonJoint; row: Integer): dfloat; cdecl; external NEWTON_API;
  1010. // **********************************************************************************************
  1011. //
  1012. // Mesh joint functions
  1013. //
  1014. // **********************************************************************************************
  1015. function NewtonMeshCreate (const newtonWorld: PNewtonWorld): PNewtonMesh; cdecl; external NEWTON_API;
  1016. function NewtonMeshCreateFromMesh (const mesh: PNewtonMesh): PNewtonMesh; cdecl; external NEWTON_API;
  1017. function NewtonMeshCreateFromCollision (const collision: PNewtonCollision): PNewtonMesh; cdecl; external NEWTON_API;
  1018. function NewtonMeshCreateTetrahedraIsoSurface (const mesh: PNewtonMesh): PNewtonMesh; cdecl; external NEWTON_API;
  1019. function NewtonMeshCreateConvexHull (const newtonWorld: PNewtonWorld; pointCount: Integer; const vertexCloud: pfloat; strideInBytes: Integer; tolerance: dfloat): PNewtonMesh; cdecl; external NEWTON_API;
  1020. function NewtonMeshCreateVoronoiConvexDecomposition (const newtonWorld: PNewtonWorld; pointCount: Integer; const vertexCloud: pfloat; strideInBytes: Integer; materialID: Integer; const textureMatrix: pfloat): PNewtonMesh; cdecl; external NEWTON_API;
  1021. function NewtonMeshCreateFromSerialization (const newtonWorld: PNewtonWorld; deserializeFunction: NewtonDeserializeCallback; const serializeHandle: Pointer): PNewtonMesh; cdecl; external NEWTON_API;
  1022. procedure NewtonMeshDestroy (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1023. procedure NewtonMeshSerialize (const mesh: PNewtonMesh; serializeFunction: NewtonSerializeCallback; const serializeHandle: Pointer); cdecl; external NEWTON_API;
  1024. procedure NewtonMeshSaveOFF (const mesh: PNewtonMesh; const filename: pchar); cdecl; external NEWTON_API;
  1025. function NewtonMeshLoadOFF (const newtonWorld: PNewtonWorld; const filename: pchar): PNewtonMesh; cdecl; external NEWTON_API;
  1026. function NewtonMeshLoadTetrahedraMesh (const newtonWorld: PNewtonWorld; const filename: pchar): PNewtonMesh; cdecl; external NEWTON_API;
  1027. {}procedure NewtonMeshFlipWinding (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1028. procedure NewtonMeshApplyTransform (const mesh: PNewtonMesh; const matrix: pfloat); cdecl; external NEWTON_API;
  1029. procedure NewtonMeshCalculateOOBB (const mesh: PNewtonMesh; const matrix: pfloat; const x: pfloat; const y: pfloat; const z: pfloat); cdecl; external NEWTON_API;
  1030. procedure NewtonMeshCalculateVertexNormals (const mesh: PNewtonMesh; angleInRadians: dfloat); cdecl; external NEWTON_API;
  1031. procedure NewtonMeshApplySphericalMapping (const mesh: PNewtonMesh; material: Integer; const aligmentMatrix: pfloat); cdecl; external NEWTON_API;
  1032. procedure NewtonMeshApplyCylindricalMapping (const mesh: PNewtonMesh; cylinderMaterial: Integer; capMaterial: Integer; const aligmentMatrix: pfloat); cdecl; external NEWTON_API;
  1033. procedure NewtonMeshApplyBoxMapping (const mesh: PNewtonMesh; frontMaterial: Integer; sideMaterial: Integer; topMaterial: Integer; const aligmentMatrix: pfloat); cdecl; external NEWTON_API;
  1034. procedure NewtonMeshApplyAngleBasedMapping (const mesh: PNewtonMesh; material: Integer; reportPrograssCallback: NewtonReportProgress; const reportPrgressUserData: Pointer; const aligmentMatrix: pfloat); cdecl; external NEWTON_API;
  1035. procedure NewtonCreateTetrahedraLinearBlendSkinWeightsChannel (const tetrahedraMesh: PNewtonMesh; const skinMesh: PNewtonMesh); cdecl; external NEWTON_API;
  1036. procedure NewtonMeshOptimize (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1037. procedure NewtonMeshOptimizePoints (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1038. procedure NewtonMeshOptimizeVertex (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1039. function NewtonMeshIsOpenMesh (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1040. procedure NewtonMeshFixTJoints (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1041. procedure NewtonMeshPolygonize (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1042. procedure NewtonMeshTriangulate (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1043. function NewtonMeshUnion (const mesh: PNewtonMesh; const clipper: PNewtonMesh; const clipperMatrix: pfloat): PNewtonMesh; cdecl; external NEWTON_API;
  1044. function NewtonMeshDifference (const mesh: PNewtonMesh; const clipper: PNewtonMesh; const clipperMatrix: pfloat): PNewtonMesh; cdecl; external NEWTON_API;
  1045. function NewtonMeshIntersection (const mesh: PNewtonMesh; const clipper: PNewtonMesh; const clipperMatrix: pfloat): PNewtonMesh; cdecl; external NEWTON_API;
  1046. procedure NewtonMeshClip (const mesh: PNewtonMesh; const clipper: PNewtonMesh; const clipperMatrix: pfloat; const topMesh: PNewtonMesh; const bottomMesh: PNewtonMesh); cdecl; external NEWTON_API;
  1047. function NewtonMeshConvexMeshIntersection (const mesh: PNewtonMesh; const convexMesh: PNewtonMesh): PNewtonMesh; cdecl; external NEWTON_API;
  1048. function NewtonMeshSimplify (const mesh: PNewtonMesh; maxVertexCount: Integer; reportPrograssCallback: NewtonReportProgress; const reportPrgressUserData: Pointer): PNewtonMesh; cdecl; external NEWTON_API;
  1049. function NewtonMeshApproximateConvexDecomposition (const mesh: PNewtonMesh; maxConcavity: dfloat; backFaceDistanceFactor: dfloat; maxCount: Integer; maxVertexPerHull: Integer; reportProgressCallback: NewtonReportProgress; const reportProgressUserData: Pointer): PNewtonMesh; cdecl; external NEWTON_API;
  1050. procedure NewtonRemoveUnusedVertices (const mesh: PNewtonMesh; const vertexRemapTable: Pinteger); cdecl; external NEWTON_API;
  1051. procedure NewtonMeshBeginBuild (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1052. procedure NewtonMeshBeginFace (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1053. procedure NewtonMeshAddPoint (const mesh: PNewtonMesh; x: double; y: double; z: double); cdecl; external NEWTON_API;
  1054. procedure NewtonMeshAddLayer (const mesh: PNewtonMesh; layerIndex: Integer); cdecl; external NEWTON_API;
  1055. procedure NewtonMeshAddMaterial (const mesh: PNewtonMesh; materialIndex: Integer); cdecl; external NEWTON_API;
  1056. procedure NewtonMeshAddNormal (const mesh: PNewtonMesh; x: dfloat; y: dfloat; z: dfloat); cdecl; external NEWTON_API;
  1057. procedure NewtonMeshAddBinormal (const mesh: PNewtonMesh; x: dfloat; y: dfloat; z: dfloat); cdecl; external NEWTON_API;
  1058. procedure NewtonMeshAddUV0 (const mesh: PNewtonMesh; u: dfloat; v: dfloat); cdecl; external NEWTON_API;
  1059. procedure NewtonMeshAddUV1 (const mesh: PNewtonMesh; u: dfloat; v: dfloat); cdecl; external NEWTON_API;
  1060. {}procedure NewtonMeshAddVertexColor (const mesh: PNewtonMesh; r: Single; g: Single; b: Single; a: Single); cdecl; external NEWTON_API;
  1061. procedure NewtonMeshEndFace (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1062. procedure NewtonMeshEndBuild (const mesh: PNewtonMesh); cdecl; external NEWTON_API;
  1063. procedure NewtonMeshClearVertexFormat (const format: PNewtonMeshVertexFormat); cdecl; external NEWTON_API;
  1064. procedure NewtonMeshBuildFromVertexListIndexList (const mesh: PNewtonMesh; const format: PNewtonMeshVertexFormat); cdecl; external NEWTON_API;
  1065. function NewtonMeshGetPointCount (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1066. function NewtonMeshGetIndexToVertexMap (const mesh: PNewtonMesh): Pinteger; cdecl; external NEWTON_API;
  1067. function NewtonMeshGetVertexWeights(mesh : PNewtonMesh; vertexIndex : Integer; weightIndex : PInteger; weightFactor : PdFloat) : Integer; cdecl; external NEWTON_API;
  1068. procedure NewtonMeshGetVertexDoubleChannel (const mesh: PNewtonMesh; vertexStrideInByte: Integer; const outBuffer: Pdouble); cdecl; external NEWTON_API;
  1069. procedure NewtonMeshGetVertexChannel (const mesh: PNewtonMesh; vertexStrideInByte: Integer; const outBuffer: pfloat); cdecl; external NEWTON_API;
  1070. procedure NewtonMeshGetNormalChannel (const mesh: PNewtonMesh; vertexStrideInByte: Integer; const outBuffer: pfloat); cdecl; external NEWTON_API;
  1071. procedure NewtonMeshGetBinormalChannel (const mesh: PNewtonMesh; vertexStrideInByte: Integer; const outBuffer: pfloat); cdecl; external NEWTON_API;
  1072. procedure NewtonMeshGetUV0Channel (const mesh: PNewtonMesh; vertexStrideInByte: Integer; const outBuffer: pfloat); cdecl; external NEWTON_API;
  1073. procedure NewtonMeshGetUV1Channel (const mesh: PNewtonMesh; vertexStrideInByte: Integer; const outBuffer: pfloat); cdecl; external NEWTON_API;
  1074. procedure NewtonMeshGetVertexColorChannel (const mesh: PNewtonMesh; vertexStrideInByte: Integer; const outBuffer: pfloat); cdecl; external NEWTON_API;
  1075. function NewtonMeshHasNormalChannel (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1076. function NewtonMeshHasBinormalChannel (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1077. function NewtonMeshHasUV0Channel (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1078. function NewtonMeshHasUV1Channel (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1079. function NewtonMeshHasVertexColorChannel (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1080. function NewtonMeshBeginHandle (const mesh: PNewtonMesh): Pointer; cdecl; external NEWTON_API;
  1081. procedure NewtonMeshEndHandle (const mesh: PNewtonMesh; const handle: Pointer); cdecl; external NEWTON_API;
  1082. function NewtonMeshFirstMaterial (const mesh: PNewtonMesh; const handle: Pointer): Integer; cdecl; external NEWTON_API;
  1083. function NewtonMeshNextMaterial (const mesh: PNewtonMesh; const handle: Pointer; materialId: Integer): Integer; cdecl; external NEWTON_API;
  1084. function NewtonMeshMaterialGetMaterial (const mesh: PNewtonMesh; const handle: Pointer; materialId: Integer): Integer; cdecl; external NEWTON_API;
  1085. function NewtonMeshMaterialGetIndexCount (const mesh: PNewtonMesh; const handle: Pointer; materialId: Integer): Integer; cdecl; external NEWTON_API;
  1086. procedure NewtonMeshMaterialGetIndexStream (const mesh: PNewtonMesh; const handle: Pointer; materialId: Integer; const index: Pinteger); cdecl; external NEWTON_API;
  1087. procedure NewtonMeshMaterialGetIndexStreamShort (const mesh: PNewtonMesh; const handle: Pointer; materialId: Integer; const index: SmallInt); cdecl; external NEWTON_API;
  1088. function NewtonMeshCreateFirstSingleSegment (const mesh: PNewtonMesh): PNewtonMesh; cdecl; external NEWTON_API;
  1089. function NewtonMeshCreateNextSingleSegment (const mesh: PNewtonMesh; const segment: PNewtonMesh): PNewtonMesh; cdecl; external NEWTON_API;
  1090. function NewtonMeshCreateFirstLayer (const mesh: PNewtonMesh): PNewtonMesh; cdecl; external NEWTON_API;
  1091. function NewtonMeshCreateNextLayer (const mesh: PNewtonMesh; const segment: PNewtonMesh): PNewtonMesh; cdecl; external NEWTON_API;
  1092. function NewtonMeshGetTotalFaceCount (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1093. function NewtonMeshGetTotalIndexCount (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1094. procedure NewtonMeshGetFaces (const mesh: PNewtonMesh; const faceIndexCount: Pinteger; const faceMaterial: Pinteger; const faceIndices: PPointer); cdecl; external NEWTON_API;
  1095. function NewtonMeshGetVertexCount (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1096. function NewtonMeshGetVertexStrideInByte (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1097. function NewtonMeshGetVertexArray (const mesh: PNewtonMesh): Pdouble; cdecl; external NEWTON_API;
  1098. function NewtonMeshGetVertexBaseCount (const mesh: PNewtonMesh): Integer; cdecl; external NEWTON_API;
  1099. procedure NewtonMeshSetVertexBaseCount (const mesh: PNewtonMesh; baseCount: Integer); cdecl; external NEWTON_API;
  1100. function NewtonMeshGetFirstVertex (const mesh: PNewtonMesh): Pointer; cdecl; external NEWTON_API;
  1101. function NewtonMeshGetNextVertex (const mesh: PNewtonMesh; const vertex: Pointer): Pointer; cdecl; external NEWTON_API;
  1102. function NewtonMeshGetVertexIndex (const mesh: PNewtonMesh; const vertex: Pointer): Integer; cdecl; external NEWTON_API;
  1103. function NewtonMeshGetFirstPoint (const mesh: PNewtonMesh): Pointer; cdecl; external NEWTON_API;
  1104. function NewtonMeshGetNextPoint (const mesh: PNewtonMesh; const point: Pointer): Pointer; cdecl; external NEWTON_API;
  1105. function NewtonMeshGetPointIndex (const mesh: PNewtonMesh; const point: Pointer): Integer; cdecl; external NEWTON_API;
  1106. function NewtonMeshGetVertexIndexFromPoint (const mesh: PNewtonMesh; const point: Pointer): Integer; cdecl; external NEWTON_API;
  1107. function NewtonMeshGetFirstEdge (const mesh: PNewtonMesh): Pointer; cdecl; external NEWTON_API;
  1108. function NewtonMeshGetNextEdge (const mesh: PNewtonMesh; const edge: Pointer): Pointer; cdecl; external NEWTON_API;
  1109. procedure NewtonMeshGetEdgeIndices (const mesh: PNewtonMesh; const edge: Pointer; const v0: Pinteger; const v1: Pinteger); cdecl; external NEWTON_API;
  1110. //NEWTON_API void NewtonMeshGetEdgePointIndices (const NewtonMesh* const mesh, const void* const edge, int* const v0, int* const v1);
  1111. function NewtonMeshGetFirstFace (const mesh: PNewtonMesh): Pointer; cdecl; external NEWTON_API;
  1112. function NewtonMeshGetNextFace (const mesh: PNewtonMesh; const face: Pointer): Pointer; cdecl; external NEWTON_API;
  1113. function NewtonMeshIsFaceOpen (const mesh: PNewtonMesh; const face: Pointer): Integer; cdecl; external NEWTON_API;
  1114. function NewtonMeshGetFaceMaterial (const mesh: PNewtonMesh; const face: Pointer): Integer; cdecl; external NEWTON_API;
  1115. function NewtonMeshGetFaceIndexCount (const mesh: PNewtonMesh; const face: Pointer): Integer; cdecl; external NEWTON_API;
  1116. procedure NewtonMeshGetFaceIndices (const mesh: PNewtonMesh; const face: Pointer; const indices: Pinteger); cdecl; external NEWTON_API;
  1117. procedure NewtonMeshGetFacePointIndices (const mesh: PNewtonMesh; const face: Pointer; const indices: Pinteger); cdecl; external NEWTON_API;
  1118. procedure NewtonMeshCalculateFaceNormal (const mesh: PNewtonMesh; const face: Pointer; const normal: Pdouble); cdecl; external NEWTON_API;
  1119. procedure NewtonMeshSetFaceMaterial (const mesh: PNewtonMesh; const face: Pointer; matId: Integer); cdecl; external NEWTON_API;
  1120. implementation
  1121. end.