Advertisement
Guest User

Newton Header 3.14 WIP 2016/02/19

a guest
Feb 19th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 101.63 KB | None | 0 0
  1. {
  2. ********************************************************************************
  3. *                                                                              *
  4. * Newton Game Dynamics Header Translation (Delphi/FreePascal)                  *
  5. *  Newton Version 3.14 (2013/02/15)                                            *
  6. *  Header Version 1.03                                                         *
  7. *                                                                              *
  8. *  Translation started by Stuart "Stucuk" Carey on 2012/08/09                  *
  9. *                                                                              *
  10. *  Contributors:                                                               *
  11. *                                                                              *
  12. *                                                                              *
  13. ********************************************************************************
  14. *                                                                              *
  15. * Copyright (c) <2003-2012> <Julio Jerez, Newton Game Dynamics>                *
  16. *                                                                              *
  17. * This software is provided 'as-is', without any express or implied            *
  18. * warranty. In no event will the authors be held liable for any damages        *
  19. * arising from the use of this software.                                       *
  20. *                                                                              *
  21. * Permission is granted to anyone to use this software for any purpose,        *
  22. * including commercial applications, and to alter it and redistribute it       *
  23. * freely, subject to the following restrictions:                               *
  24. *                                                                              *
  25. * 1. The origin of this software must not be misrepresented; you must not      *
  26. * claim that you wrote the original software. If you use this software         *
  27. * in a product, an acknowledgment in the product documentation would be        *
  28. * appreciated but is not required.                                             *
  29. *                                                                              *
  30. * 2. Altered source versions must be plainly marked as such, and must not be   *
  31. * misrepresented as being the original software.                               *
  32. *                                                                              *
  33. * 3. This notice may not be removed or altered from any source distribution.   *
  34. *                                                                              *
  35. ********************************************************************************
  36. }
  37.  
  38. unit Newton;
  39.  
  40. {== Local Defines ==
  41.   __NONDELPHI__            - Enables compatiblity with compilers other than Delphi.
  42.                              Note that pascaldefines.inc and newtonpascal.inc
  43.                              are protected under the Mozilla Public License.
  44.  
  45.  == Conditionals ==
  46.  Declare the Following in Projects->Options->Conditionals to enable them:
  47.   __USE_DOUBLE_PRECISION__ - Toggles Double Precision. DLL used must match this setting.
  48.  
  49.  == Local Defines ==}
  50.  //{$DEFINE __NONDELPHI__}
  51.  
  52.  
  53.  
  54. {$IFDEF __NONDELPHI__}
  55.  {$I pascaldefines.inc}
  56. {$ENDIF}
  57.  
  58. interface
  59.  
  60. {$IFDEF __NONDELPHI__}
  61.  {$I newtonpascal.inc}
  62. {$ELSE}
  63.  const
  64.  {$IFDEF __USE_DOUBLE_PRECISION__}
  65.   NEWTON_API = 'newtond.dll';
  66.  {$ELSE}
  67.   NEWTON_API = 'newton.dll';
  68.  {$ENDIF}
  69. {$ENDIF}
  70.  
  71.  NEWTON_MAJOR_VERSION                            = 3;
  72.  NEWTON_MINOR_VERSION                            = 14;
  73.  
  74.  NEWTON_DYNAMIC_BODY                             = 0;
  75.  NEWTON_KINEMATIC_BODY                           = 1;
  76.  NEWTON_DEFORMABLE_BODY                          = 2;
  77.  
  78.  SERIALIZE_ID_SPHERE                             = 0;
  79.  SERIALIZE_ID_CAPSULE                            = 1;
  80.  SERIALIZE_ID_CHAMFERCYLINDER                    = 2;
  81.  SERIALIZE_ID_TAPEREDCAPSULE                     = 3;
  82.  SERIALIZE_ID_CYLINDER                           = 4;
  83.  SERIALIZE_ID_TAPEREDCYLINDER                    = 5;
  84.  SERIALIZE_ID_BOX                                = 6;
  85.  SERIALIZE_ID_CONE                               = 7;
  86.  SERIALIZE_ID_CONVEXHULL                         = 8;
  87.  SERIALIZE_ID_NULL                               = 9;
  88.  SERIALIZE_ID_COMPOUND                           = 10;
  89.  SERIALIZE_ID_TREE                               = 11;
  90.  SERIALIZE_ID_HEIGHTFIELD                        = 12;
  91.  SERIALIZE_ID_CLOTH_PATCH                        = 13;
  92.  SERIALIZE_ID_DEFORMABLE_SOLID                   = 14;
  93.  SERIALIZE_ID_USERMESH                           = 15;
  94.  SERIALIZE_ID_SCENE                              = 16;
  95.  SERIALIZE_ID_FRACTURED_COMPOUND                 = 17;
  96.  
  97. type
  98. {$IFDEF __USE_DOUBLE_PRECISION__}
  99.  dFloat                       = Double;
  100. {$ELSE}
  101.  dFloat                       = Single;
  102. {$ENDIF}
  103.  dFloat64                     = Double;
  104.  dLong                        = Int64;
  105.  
  106.  PdFloat                      = ^dFloat;
  107.  PdFloat64                    = ^dFloat64;
  108.  PdLong                       = ^dLong;
  109.  
  110.  NewtonMesh                   = ^Pointer;
  111.  NewtonBody                   = ^Pointer;
  112.  NewtonWorld                  = ^Pointer;
  113.  NewtonJoint                  = ^Pointer;
  114.  NewtonMaterial               = ^Pointer;
  115.  NewtonCollision              = ^Pointer;
  116. // NewtonSceneProxy           = ^Pointer;
  117.  NewtonSkeletonContainer      = ^Pointer;
  118.  NewtonDeformableMeshSegment  = ^Pointer;
  119.  NewtonFracturedCompoundMeshPart = ^Pointer;
  120.  
  121.  NewtonSerializeHandle        = ^Pointer;
  122.  NewtonMeshHandle             = ^Pointer;
  123.  NewtonMeshVertex             = ^Pointer;
  124.  NewtonMeshPoint              = ^Pointer;
  125.  NewtonMeshEdge               = ^Pointer;
  126.  NewtonMeshFace               = ^Pointer;
  127.  NewtonListener               = ^Pointer;
  128.  
  129.  TNewtonBoxParam = Packed Record
  130.   m_x,
  131.   m_y,
  132.   m_z                    : dFloat;
  133.  end;
  134.  
  135.  TNewtonSphereParam = Packed Record
  136.   m_radio                : dFloat;
  137.  end;
  138.  
  139.  TNewtonCylinderParam = Packed Record
  140.   m_radio,
  141.   m_height               : dFloat;
  142.  end;
  143.  
  144.  TNewtonCapsuleParam = Packed Record
  145.   m_radio,
  146.   m_height               : dFloat;
  147.  end;
  148.  
  149.  TNewtonConeParam = Packed Record
  150.   m_radio,
  151.   m_height               : dFloat;
  152.  end;
  153.  
  154.  TNewtonTaperedCapsuleParam = Packed Record
  155.   m_radio0,
  156.   m_radio1,
  157.   m_height               : dFloat;
  158.  end;
  159.  
  160.  
  161.  TNewtonTaperedCylinderParam = Packed Record
  162.   m_radio0,
  163.   m_radio1,
  164.   m_height               : dFloat;
  165.  end;
  166.  
  167.  TNewtonChamferCylinderParam = Packed Record
  168.   m_radio,
  169.   m_height               : dFloat;
  170.  end;
  171.  
  172.  TNewtonConvexHullParam = Packed Record
  173.   m_vertexCount,
  174.   m_vertexStrideInBytes,
  175.   m_faceCount            : Integer;
  176.   m_vertex               : PdFloat;
  177.  end;
  178.  
  179.  
  180.  TNewtonCompoundCollisionParam = Packed Record
  181.   m_chidrenCount         : Integer;
  182.  end;
  183.  
  184.  
  185.  TNewtonCollisionTreeParam = Packed Record
  186.   m_vertexCount,
  187.   m_indexCount           : Integer;
  188.  end;
  189.  
  190.  TNewtonDeformableMeshParam = Packed Record
  191.   m_vertexCount,
  192.   m_triangleCount,
  193.   m_vertexStrideInBytes  : Integer;
  194.   m_indexList            : PWord;
  195.   m_vertexList           : PdFloat;
  196.  end;
  197.  
  198.  
  199.  TNewtonHeightFieldCollisionParam = Packed Record
  200.   m_width,
  201.   m_height,
  202.   m_gridsDiagonals,
  203.   m_elevationDataType     : Integer;// 0 = 32 bit floats, 1 = unsigned 16 bit integers
  204.   m_horizonalScale,
  205.   m_verticalScale         : dFloat;
  206.   m_horizonalDisplacementScale : dFloat;
  207.   m_vertialElevation      : Pointer;
  208.   m_horizotalDisplacement : PSmallInt;
  209.   m_atributes             : PShortInt;
  210.  end;
  211.  
  212.  TNewtonSceneCollisionParam = Packed Record
  213.   m_childrenProxyCount   : Integer;
  214.  end;
  215.  
  216.  TNewtonCollisionNullParam = packed record
  217.  end;
  218.  
  219.  PNewtonCollisionInfoRecord = ^TNewtonCollisionInfoRecord;
  220.  TNewtonCollisionInfoRecord = Packed Record
  221.   m_offsetMatrix         : Array [0..3,0..3] of dFloat;
  222.   m_collisionType,    // tag id to identify the collision primitive
  223.   m_collisionUserID      : Integer;
  224.  
  225.   case Integer of
  226.        SERIALIZE_ID_SPHERE           : (sdSphere             : TNewtonSphereParam);
  227.        SERIALIZE_ID_CAPSULE          : (sdCapsule            : TNewtonCapsuleParam);
  228.        SERIALIZE_ID_CHAMFERCYLINDER  : (sdChamferCylinder    : TNewtonChamferCylinderParam);
  229.        SERIALIZE_ID_TAPEREDCAPSULE   : (sdTaperedCapsule     : TNewtonTaperedCapsuleParam);
  230.        SERIALIZE_ID_CYLINDER         : (sdCylinder           : TNewtonCylinderParam);
  231.        SERIALIZE_ID_TAPEREDCYLINDER  : (sdTaperedCylinder    : TNewtonTaperedCylinderParam);
  232.        SERIALIZE_ID_BOX              : (sdBox                : TNewtonBoxParam);
  233.        SERIALIZE_ID_CONE             : (sdCone               : TNewtonConeParam);
  234.        SERIALIZE_ID_CONVEXHULL       : (sdConvexHull         : TNewtonConvexHullParam);
  235.        SERIALIZE_ID_NULL             : (sdNull               : TNewtonCollisionNullParam);
  236.        SERIALIZE_ID_COMPOUND         : (sdCompound           : TNewtonCompoundCollisionParam);
  237.        SERIALIZE_ID_TREE             : (sdTree               : TNewtonCollisionTreeParam);
  238.        SERIALIZE_ID_HEIGHTFIELD      : (sdHeightField        : TNewtonHeightFieldCollisionParam);
  239.        SERIALIZE_ID_DEFORMABLE_SOLID : (sdDeformableMesh     : TNewtonDeformableMeshParam);
  240.        SERIALIZE_ID_USERMESH         : (sdUserMesh           : Array[0..63] of dFloat);
  241.        SERIALIZE_ID_SCENE            : (sdSceneCollision     : TNewtonSceneCollisionParam);
  242.  
  243.   end;
  244.  
  245.  PNewtonJointRecord = ^TNewtonJointRecord;
  246.  TNewtonJointRecord = Packed Record
  247.   m_attachmenMatrix_0    : Array [0..3,0..3] of dFloat;
  248.   m_attachmenMatrix_1    : Array [0..3,0..3] of dFloat;
  249.   m_minLinearDof         : Array [0..2] of dFloat;
  250.   m_maxLinearDof         : Array [0..2] of dFloat;
  251.   m_minAngularDof        : Array [0..2] of dFloat;
  252.   m_maxAngularDof        : Array [0..2] of dFloat;
  253.   m_attachBody_0         : NewtonBody;
  254.   m_attachBody_1         : NewtonBody;
  255.   m_extraParameters      : Array [0..63] of dFloat;
  256.   m_bodiesCollisionOn    : Integer;
  257.   m_descriptionType      : Array [0..127] of ShortInt;
  258.  end;
  259.  
  260.  PNewtonUserMeshCollisionCollideDesc = ^TNewtonUserMeshCollisionCollideDesc;
  261.  TNewtonUserMeshCollisionCollideDesc = Packed Record
  262.   m_boxP0,                                              // lower bounding box of intersection query in local space
  263.   m_boxP1,                                              // upper bounding box of intersection query in local space
  264.   m_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.
  265.                                                         // used this for continue collision mode
  266.   m_threadNumber,                                       // current thread executing this query
  267.   m_faceCount,                                          // the application should set here how many polygons intersect the query box
  268.   m_vertexStrideInBytes  : Integer;                     // the application should set here the size of each vertex
  269.   m_skinThickness        : dFloat;                      // this is the minimum skin separation specified by the material between these two colliding shapes
  270.   m_userData             : Pointer;                     // user data passed to the collision geometry at creation time
  271.  
  272.   m_objBody,                                            // pointer to the colliding body
  273.   m_polySoupBody         : NewtonBody;                  // pointer to the rigid body owner of this collision tree
  274.   m_objCollision,                                       // collision shape of the colliding body, (no necessarily the collision of m_objBody)
  275.   m_polySoupCollision    : NewtonCollision;             // collision shape of teh collsion tree, (no necessarily the collision of m_polySoupBody)
  276.  
  277.   m_vertex               : PdFloat;                     // the application should set here the pointer to the global vertex of the mesh.
  278.   m_faceIndexCount,                                     // the application should set here the pointer to the vertex count of each face.
  279.   m_faceVertexIndex      : PInteger;                    // the application should set here the pointer index array for each vertex on a face.
  280.                                                         // the format of a face is I0, I1, I2, I3, ..., M, N, E0, E1, E2, ..., A
  281.                                                         // I0, I1, I2, .. are the indices to the vertex, relative to m_vertex pointer
  282.                                                         // M is the index to the material sub shape id
  283.                                                         // N in the index to the vertex normal relative to m_vertex pointer
  284.                                                         // 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
  285.                                                         // 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.
  286.  end;
  287.  
  288.  PNewtonWorldConvexCastReturnInfo = ^TNewtonWorldConvexCastReturnInfo;
  289.  TNewtonWorldConvexCastReturnInfo = Packed Record
  290.   m_point,                                              // collision point in global space
  291.   m_normal{,                                             // surface normal at collision point in global space
  292.   m_normalOnHitPoint}     : Array [0..3] of dFloat;      // surface normal at the surface of the hit body,
  293.                                                         // is the same as the normal calculated by a ray cast hitting the body at the hit point
  294.   m_contactID            : Integer;                     // collision ID at contact point
  295.   m_hitBody              : NewtonBody;                  // body hit at contact point
  296.   m_penetration          : dFloat;                      // contact penetration at collision point
  297.  end;
  298.  
  299.  PNewtonUserMeshCollisionRayHitDesc = ^TNewtonUserMeshCollisionRayHitDesc;
  300.  TNewtonUserMeshCollisionRayHitDesc = Packed Record
  301.   m_p0,                                                 // ray origin in collision local space
  302.   m_p1,                                                 // ray destination in collision local space
  303.   m_normalOut            : Array [0..3] of dFloat;      // copy here the normal at the ray intersection
  304.   m_userIdOut            : dLong;                       // copy here a user defined id for further feedback
  305.   m_userData             : Pointer;                     // user data passed to the collision geometry at creation time
  306.  end;
  307.  
  308.  PNewtonHingeSliderUpdateDesc = ^TNewtonHingeSliderUpdateDesc;
  309.  TNewtonHingeSliderUpdateDesc = Packed Record
  310.   m_accel,
  311.   m_minFriction,
  312.   m_maxFriction,
  313.   m_timestep             : dFloat;
  314.  end;
  315.  
  316.  PNewtonClothPatchMaterial = ^TNewtonClothPatchMaterial;
  317.  TNewtonClothPatchMaterial = Packed Record
  318.   m_damper,
  319.   m_stiffness            : dFloat;
  320.  end;
  321.  
  322.  PNewtonSkeletonBoneJacobian = ^TNewtonSkeletonBoneJacobian;
  323.  TNewtonSkeletonBoneJacobian = Packed Record
  324.   m_linear,
  325.   m_angular              : Array [0..3] of dFloat;
  326.  end;
  327.  
  328.  PNewtonSkeletonBoneJacobianPair = ^TNewtonSkeletonBoneJacobianPair;
  329.  TNewtonSkeletonBoneJacobianPair = Packed Record
  330.   m_j01,
  331.   m_j10                  : TNewtonSkeletonBoneJacobian;
  332.  end;
  333.  
  334.  PNewtonUserContactPoint = ^TNewtonUserContactPoint;
  335.  TNewtonUserContactPoint = Packed Record
  336.   m_point,
  337.   m_normal               : Array [0..3] of dFloat;
  338.   m_shapeId0             : dLong;
  339.   m_shapeId1             : dLong;
  340.   m_penetration          : dFloat;
  341.   m_unused               : Array [0..2] of Integer;
  342.  end;
  343.  
  344.  // Newton callback functions
  345.  PNewtonAllocMemory                          = ^TNewtonAllocMemory;
  346.  TNewtonAllocMemory                          = function (sizeInBytes : Integer) : Pointer;
  347.  PNewtonFreeMemory                           = ^TNewtonFreeMemory;
  348.  TNewtonFreeMemory                           = procedure (ptr : Pointer; sizeInBytes : Integer);
  349.  
  350.  PNewtonWorldDestructorCallback              = ^TNewtonWorldDestructorCallback;
  351.  TNewtonWorldDestructorCallback              = procedure (const World : NewtonWorld);
  352.  
  353.  PNewtonWorldListenerBodyDestroyCallback          = ^TNewtonWorldListenerBodyDestroyCallback;
  354.  TNewtonWorldListenerBodyDestroyCallback          = procedure (const World : NewtonWorld; listenerUserData : Pointer; body : NewtonBody);
  355.  
  356.  PNewtonWorldUpdateListenerCallback          = ^TNewtonWorldUpdateListenerCallback;
  357.  TNewtonWorldUpdateListenerCallback          = procedure (const World : NewtonWorld; listenerUserData : Pointer; timestep : dFloat);
  358.  PNewtonWorldDestroyListenerCallback         = ^TNewtonWorldDestroyListenerCallback;
  359.  TNewtonWorldDestroyListenerCallback         = procedure (const World : NewtonWorld; listenerUserData : Pointer);
  360.  
  361.  PNewtonGetTicksCountCallback                = ^TNewtonGetTicksCountCallback;
  362.  TNewtonGetTicksCountCallback                = function () : Cardinal;
  363.  
  364.  PNewtonSerializeCallback                    = ^TNewtonSerializeCallback;
  365.  TNewtonSerializeCallback                    = procedure (Handle : NewtonSerializeHandle; const buffer : Pointer; size : Integer);
  366.  PNewtonDeserializeCallback                  = ^TNewtonDeserializeCallback;
  367.  TNewtonDeserializeCallback                  = procedure (Handle : NewtonSerializeHandle; buffer : Pointer; size : Integer);
  368.  
  369.  PNewtonOnBodySerializationCallback          = ^TNewtonOnBodySerializationCallback;
  370.  TNewtonOnBodySerializationCallback          = procedure (body : NewtonBody; userData : Pointer; Callback : PNewtonSerializeCallback; Handle : NewtonSerializeHandle);
  371.  PNewtonOnBodyDeserializationCallback        = ^TNewtonOnBodyDeserializationCallback;
  372.  TNewtonOnBodyDeserializationCallback        = procedure (body : NewtonBody; userData : Pointer; Callback : PNewtonDeserializeCallback; Handle : NewtonSerializeHandle);
  373.  
  374.  PNewtonOnJointSerializationCallback         = ^TNewtonOnJointSerializationCallback;
  375.  TNewtonOnJointSerializationCallback         = procedure (joint : NewtonJoint; funct : PNewtonSerializeCallback; serializeHandle : NewtonSerializeHandle);
  376.  
  377.  PNewtonOnJointDeserializationCallback       = ^TNewtonOnJointDeserializationCallback;
  378.  TNewtonOnJointDeserializationCallback       = procedure (body0 : NewtonBody; body1 : NewtonBody; funct : PNewtonDeserializeCallback; serializeHandle : NewtonSerializeHandle);
  379.  
  380.  PNewtonOnUserCollisionSerializationCallback = ^TNewtonOnUserCollisionSerializationCallback;
  381.  TNewtonOnUserCollisionSerializationCallback = procedure (userData : Pointer; Callback : PNewtonSerializeCallback; Handle : NewtonSerializeHandle);
  382.  
  383.  
  384.  // user collision callbacks
  385.  PNewtonUserMeshCollisionDestroyCallback     = ^TNewtonUserMeshCollisionDestroyCallback;
  386.  TNewtonUserMeshCollisionDestroyCallback     = procedure (userData : Pointer);
  387.  PNewtonUserMeshCollisionRayHitCallback      = ^TNewtonUserMeshCollisionRayHitCallback;
  388.  TNewtonUserMeshCollisionRayHitCallback      = function (lineDescData : PNewtonUserMeshCollisionRayHitDesc) : dFloat;
  389.  PNewtonUserMeshCollisionGetCollisionInfo    = ^TNewtonUserMeshCollisionGetCollisionInfo;
  390.  TNewtonUserMeshCollisionGetCollisionInfo    = procedure (userData : Pointer; infoRecord : PNewtonCollisionInfoRecord);
  391.  PNewtonUserMeshCollisionAABBTest            = ^TNewtonUserMeshCollisionAABBTest;
  392.  TNewtonUserMeshCollisionAABBTest            = function (userData : Pointer; const boxP0,boxP1 : PdFloat) : Integer;
  393.  PNewtonUserMeshCollisionGetFacesInAABB      = ^TNewtonUserMeshCollisionGetFacesInAABB;
  394.  TNewtonUserMeshCollisionGetFacesInAABB      = function (userData : Pointer; const p0 : PdFloat; const p1 : PdFloat;
  395.                                                         const vertexArray : PdFloat; vertexCount : PInteger;
  396.                                                         vertexStrideInBytes : PInteger; const indexList : PInteger;
  397.                                                         maxIndexCount : Integer; const userDataList : PInteger) : Integer;
  398.  
  399.  PNewtonUserMeshCollisionCollideCallback     = ^TNewtonUserMeshCollisionCollideCallback;
  400.  TNewtonUserMeshCollisionCollideCallback     = procedure (collideDescData : PNewtonUserMeshCollisionCollideDesc; continueCollisionHandle : Pointer);
  401.  
  402.  PNewtonTreeCollisionFaceCallback            = ^TNewtonTreeCollisionFaceCallback;
  403.  TNewtonTreeCollisionFaceCallback            = function (context : Pointer; polygon : PdFloat; strideInBytes : Integer; indexArray : PInteger; indexCount : Integer) : Integer;
  404.  
  405.  PNewtonCollisionTreeRayCastCallback         = ^TNewtonCollisionTreeRayCastCallback;
  406.  TNewtonCollisionTreeRayCastCallback         = function (const body : NewtonBody; const treeCollision : NewtonCollision;
  407.                                                         interception : dFloat; normal : PdFloat; faceID : Integer;
  408.                                                         userData : Pointer) : dFloat;
  409.  PNewtonHeightFieldRayCastCallback           = ^TNewtonHeightFieldRayCastCallback;
  410.  TNewtonHeightFieldRayCastCallback           = function (const body : NewtonBody; const heightFieldCollision : NewtonCollision;
  411.                                                         interception : dFloat; row, col : Integer; normal : PdFloat;
  412.                                                         faceID : Integer; userData : Pointer) : dFloat;
  413.  
  414.  PNewtonCollisionCopyConstructionCallback    = ^TNewtonCollisionCopyConstructionCallback;
  415.  TNewtonCollisionCopyConstructionCallback    = procedure (newtonWorld : NewtonWorld; collision : NewtonCollision; sourceCollision : NewtonCollision);
  416.  
  417.  PNewtonCollisionDestructorCallback          = ^TNewtonCollisionDestructorCallback;
  418.  TNewtonCollisionDestructorCallback          = procedure (newtonWorld : NewtonWorld; collision : NewtonCollision);
  419.  
  420.  // collision tree call back (obsoleted no recommended)
  421.  PNewtonTreeCollisionCallback                = ^TNewtonTreeCollisionCallback;
  422.  TNewtonTreeCollisionCallback                = procedure (const bodyWithTreeCollision : NewtonBody; const body : NewtonBody;
  423.                                                          faceID : Integer; vertexCount : Integer; const vertexArray : PdFloat;
  424.                                                          vertexStrideInBytes : Integer);
  425.  
  426.  PNewtonBodyDestructor                       = ^TNewtonBodyDestructor;
  427.  TNewtonBodyDestructor                       = procedure (const body : NewtonBody);
  428.  PNewtonApplyForceAndTorque                  = ^TNewtonApplyForceAndTorque;
  429.  TNewtonApplyForceAndTorque                  = procedure (const body : NewtonBody; timestep : dFloat; threadIndex : Integer);
  430.  PNewtonSetTransform                         = ^TNewtonSetTransform;
  431.  TNewtonSetTransform                         = procedure (const body : NewtonBody; const matrix : PdFloat; threadIndex : Integer);
  432.  
  433.  PNewtonIslandUpdate                         = ^TNewtonIslandUpdate;
  434.  TNewtonIslandUpdate                         = function (const world : NewtonWorld; islandHandle : Pointer; bodyCount : Integer) : Integer;
  435.  
  436.  PNewtonFractureCompoundCollisionOnEmitCompoundFractured   = ^TNewtonFractureCompoundCollisionOnEmitCompoundFractured;
  437.  TNewtonFractureCompoundCollisionOnEmitCompoundFractured   = procedure (fracturedBody : NewtonBody);
  438.  
  439.  PNewtonFractureCompoundCollisionOnEmitChunk   = ^TNewtonFractureCompoundCollisionOnEmitChunk;
  440.  TNewtonFractureCompoundCollisionOnEmitChunk   = procedure (chunkBody : NewtonBody; fracturexChunkMesh : NewtonFracturedCompoundMeshPart; fracturedCompountCollision : NewtonCollision);
  441.  
  442.  PNewtonFractureCompoundCollisionReconstructMainMeshCallBack   = ^TNewtonFractureCompoundCollisionReconstructMainMeshCallBack;
  443.  TNewtonFractureCompoundCollisionReconstructMainMeshCallBack   = procedure (body : NewtonBody; mainMesh : NewtonFracturedCompoundMeshPart; fracturedCompountCollision : NewtonCollision);
  444.  
  445.  PNewtonWorldRayPrefilterCallback            = ^TNewtonWorldRayPrefilterCallback;
  446.  TNewtonWorldRayPrefilterCallback            = function (const body : NewtonBody; collision : NewtonCollision; userData : Pointer) : Cardinal;
  447.  PNewtonWorldRayFilterCallback               = ^TNewtonWorldRayFilterCallback;
  448.  TNewtonWorldRayFilterCallback               = function (const body : NewtonBody; const shapeHit : NewtonCollision; const hitContact : PDFloat; const hitNormal : PdFloat; collisionID : dLong;
  449.                                                         userData : Pointer; intersectParam : dFloat) : dFloat;
  450.  
  451.   PNewtonContactsProcess                      = ^TNewtonContactsProcess;
  452.  TNewtonContactsProcess                      = procedure (const contact : NewtonJoint; timestep : dFloat; threadIndex : Integer);
  453.  
  454.  PNewtonOnAABBOverlap                        = ^TNewtonOnAABBOverlap;
  455.  TNewtonOnAABBOverlap                        = function (const material : NewtonMaterial; const body0 : NewtonBody; const body1 : NewtonBody;
  456.                                                         threadIndex : Integer) : Integer;
  457.  
  458.  PNewtonOnCompoundSubCollisionAABBOverlap    = ^TNewtonOnCompoundSubCollisionAABBOverlap;
  459.  TNewtonOnCompoundSubCollisionAABBOverlap    = function (const material : NewtonMaterial; body0 : NewtonBody; collisionNode0 : Pointer; body1 : NewtonBody; collisionNode1 : Pointer; threadIndex : Integer) : Integer;
  460.  
  461.  PNewtonOnContactGeneration                  = ^TNewtonOnContactGeneration;
  462.  TNewtonOnContactGeneration                  = function (const material : NewtonMaterial; body0 : NewtonBody; collision0 : Pointer; body1 : NewtonBody; collision1 : Pointer; contactBuffer : PNewtonUserContactPoint; maxCount : Integer; threadIndex : Integer) : Integer;
  463.  
  464.  PNewtonBodyIterator                         = ^TNewtonBodyIterator;
  465.  TNewtonBodyIterator                         = function (const body : NewtonBody; userData : Pointer) : Integer;
  466.  PNewtonJointIterator                        = ^TNewtonJointIterator;
  467.  TNewtonJointIterator                        = procedure (const joint : NewtonJoint; userData : Pointer);
  468.  PNewtonCollisionIterator                    = ^TNewtonCollisionIterator;
  469.  TNewtonCollisionIterator                    = procedure (userData : Pointer; vertexCount : Integer; const faceArray : PdFloat; faceId : Integer);
  470.  
  471.  PNewtonBallCallback                         = ^TNewtonBallCallback;
  472.  TNewtonBallCallback                         = procedure (const ball : NewtonJoint; timestep : dFloat);
  473.  PNewtonHingeCallback                        = ^TNewtonHingeCallback;
  474.  TNewtonHingeCallback                        = function (const hinge : NewtonJoint; desc : PNewtonHingeSliderUpdateDesc) : Cardinal;
  475.  PNewtonSliderCallback                       = ^TNewtonSliderCallback;
  476.  TNewtonSliderCallback                       = function (const slider : NewtonJoint; desc : PNewtonHingeSliderUpdateDesc) : Cardinal;
  477.  PNewtonUniversalCallback                    = ^TNewtonUniversalCallback;
  478.  TNewtonUniversalCallback                    = function (const universal : NewtonJoint; desc : PNewtonHingeSliderUpdateDesc) : Cardinal;
  479.  PNewtonCorkscrewCallback                    = ^TNewtonCorkscrewCallback;
  480.  TNewtonCorkscrewCallback                    = function (const corkscrew : NewtonJoint; desc : PNewtonHingeSliderUpdateDesc) : Cardinal;
  481.  
  482.  PNewtonUserBilateralCallback                = ^TNewtonUserBilateralCallback;
  483.  TNewtonUserBilateralCallback                = procedure (const userJoint : NewtonJoint; timestep : dFloat; threadIndex : Integer);
  484.  PNewtonUserBilateralGetInfoCallback         = ^TNewtonUserBilateralGetInfoCallback;
  485.  TNewtonUserBilateralGetInfoCallback         = procedure (const userJoint : NewtonJoint; info : PNewtonJointRecord);
  486.  
  487.  PNewtonConstraintDestructor                 = ^TNewtonConstraintDestructor;
  488.  TNewtonConstraintDestructor                 = procedure (const me : NewtonJoint);
  489.  
  490.  PNewtonSkeletontDestructor                  = ^TNewtonSkeletontDestructor;
  491.  TNewtonSkeletontDestructor                  = procedure (const me : NewtonSkeletonContainer);
  492.  
  493.  PNewtonJobTask                              = ^TNewtonJobTask;
  494.  TNewtonJobTask                              = procedure (userData : Pointer; threadIndex : Integer);
  495.  
  496.  PNewtonReportProgress                       = ^TNewtonReportProgress;
  497.  TNewtonReportProgress                       = procedure (progressNormalzedPercent : dFloat);
  498.  
  499.  // **********************************************************************************************
  500.  //
  501.  // world control functions
  502.  //
  503.  // **********************************************************************************************
  504.  function NewtonWorldGetVersion () : Integer; cdecl; external NEWTON_API;
  505.  function NewtonWorldFloatSize () : Integer; cdecl; external NEWTON_API;
  506.  
  507.  function NewtonGetMemoryUsed () : Integer; cdecl; external NEWTON_API;
  508.  procedure NewtonSetMemorySystem (malloc : PNewtonAllocMemory; free : PNewtonFreeMemory); cdecl; external NEWTON_API;
  509.  
  510.  function NewtonCreate () : NewtonWorld; cdecl; external NEWTON_API;
  511.  procedure NewtonDestroy (const world : NewtonWorld); cdecl; external NEWTON_API;
  512.  procedure NewtonDestroyAllBodies (const world : NewtonWorld); cdecl; external NEWTON_API;
  513.  
  514.  function NewtonAlloc (sizeInBytes : Integer) : Pointer; cdecl; external NEWTON_API;
  515.  procedure NewtonFree (ptr : Pointer); cdecl; external NEWTON_API;
  516.  
  517.  // procedure NewtonSetPlatformArchitecture (const world : NewtonWorld; int mode);
  518.  // NEWTON_API int NewtonGetPlatformArchitecture(const world : NewtonWorld; char* description);
  519.  
  520.  function NewtonEnumerateDevices (const world : NewtonWorld) : Integer; cdecl; external NEWTON_API;
  521.  function NewtonGetCurrentDevice (const world : NewtonWorld) : Integer; cdecl; external NEWTON_API;
  522.  procedure NewtonSetCurrentDevice (const world : NewtonWorld; deviceIndex : Integer); cdecl; external NEWTON_API;
  523.  procedure NewtonGetDeviceString (const world : NewtonWorld; deviceIndex : Integer; vendorString : PChar; maxSize : Integer); cdecl; external NEWTON_API;
  524.  
  525.  function NewtonGetGlobalScale (const world : NewtonWorld) : dFloat; cdecl; external NEWTON_API;
  526.  procedure NewtonSetGlobalScale (const world : NewtonWorld; scale : dFloat); cdecl; external NEWTON_API;
  527.  
  528.  function NewtonGetContactMergeTolerance (const world : NewtonWorld) : dFloat; cdecl; external NEWTON_API;
  529.  procedure NewtonSetContactMergeTolerance (const world : NewtonWorld; tolerance : dFloat); cdecl; external NEWTON_API;
  530.  
  531.  procedure NewtonInvalidateCache (const world : NewtonWorld); cdecl; external NEWTON_API;
  532.  procedure NewtonSetSolverModel (const world : NewtonWorld; model : Integer); cdecl; external NEWTON_API;
  533.  procedure NewtonSetSolverConvergenceQuality (const world : NewtonWorld; lowOrHigh : Integer); cdecl; external NEWTON_API;
  534.  
  535.  procedure NewtonSetMultiThreadSolverOnSingleIsland (const world : NewtonWorld; mode : Integer); cdecl; external NEWTON_API;
  536.  function NewtonGetMultiThreadSolverOnSingleIsland (const world : NewtonWorld) : Integer; cdecl; external NEWTON_API;
  537.  
  538.  //procedure NewtonSetPerformanceClock (const world : NewtonWorld; callback : PNewtonGetTicksCountCallback); cdecl; external NEWTON_API;
  539.  //function NewtonReadPerformanceTicks (const world : NewtonWorld; performanceEntry : Cardinal) : Cardinal; cdecl; external NEWTON_API;
  540.  
  541.  function NewtonGetBroadphaseAlgorithm (const world : NewtonWorld) : Integer; cdecl; external NEWTON_API;
  542.  procedure NewtonSelectBroadphaseAlgorithm (const world : NewtonWorld; algorithmType : Integer); cdecl; external NEWTON_API;
  543.  
  544.  procedure NewtonUpdate (const world : NewtonWorld; timestep : dFloat); cdecl; external NEWTON_API;
  545.  procedure NewtonUpdateAsync (const world : NewtonWorld; timestep : dFloat); cdecl; external NEWTON_API;
  546.  procedure NewtonWaitForUpdateToFinish (const world : NewtonWorld); cdecl; external NEWTON_API;
  547.  
  548.  procedure NewtonSerializeToFile (const world : NewtonWorld; const filename : PChar; bodyCallback : PNewtonOnBodySerializationCallback; bodyUserData : Pointer); cdecl; external NEWTON_API;
  549.  procedure NewtonDeserializeFromFile (const world : NewtonWorld; const filename : PChar; bodyCallback : PNewtonOnBodyDeserializationCallback; bodyUserData : Pointer); cdecl; external NEWTON_API;
  550.  
  551.  procedure NewtonSetJointSerializationCallbacks (const world : NewtonWorld; serializeJoint : PNewtonOnJointSerializationCallback; deserializeJoint : PNewtonOnJointDeserializationCallback); cdecl; external NEWTON_API;
  552.  procedure NewtonGetJointSerializationCallbacks (const world : NewtonWorld; serializeJoint : PNewtonOnJointSerializationCallback; deserializeJoint : PNewtonOnJointDeserializationCallback); cdecl; external NEWTON_API;
  553.  
  554.  // multi threading interface
  555.  procedure NewtonWorldCriticalSectionLock (const world : NewtonWorld; threadIndex : Integer); cdecl; external NEWTON_API;
  556.  procedure NewtonWorldCriticalSectionUnlock (const world : NewtonWorld); cdecl; external NEWTON_API;
  557.  procedure NewtonSetThreadsCount (const world : NewtonWorld; threads : Integer); cdecl; external NEWTON_API;
  558.  function NewtonGetThreadsCount(const world : NewtonWorld) : Integer; cdecl; external NEWTON_API;
  559.  function NewtonGetMaxThreadsCount(const world : NewtonWorld) : Integer; cdecl; external NEWTON_API;
  560.  procedure NewtonDispachThreadJob(const world : NewtonWorld; task : PNewtonJobTask; userData : Pointer); cdecl; external NEWTON_API;
  561.  procedure NewtonSyncThreadJobs(const world : NewtonWorld); cdecl; external NEWTON_API;
  562.  
  563.  // atomic operations
  564.  function NewtonAtomicAdd(ptr : PInteger; Value : Integer) : Integer; cdecl; external NEWTON_API;
  565.  function NewtonAtomicSwap(ptr : PInteger; Value : Integer) : Integer; cdecl; external NEWTON_API;
  566.  procedure NewtonYield(); cdecl; external NEWTON_API;
  567.  
  568.  procedure NewtonSetFrictionModel (const world : NewtonWorld; model : Integer); cdecl; external NEWTON_API;
  569.  procedure NewtonSetMinimumFrameRate (const world : NewtonWorld; frameRate : dFloat); cdecl; external NEWTON_API;
  570.  procedure NewtonSetIslandUpdateEvent (const world : NewtonWorld; islandUpdate : PNewtonIslandUpdate); cdecl; external NEWTON_API;
  571.  //procedure NewtonSetDestroyBodyByExeciveForce (const world : NewtonWorld; callback : PNewtonDestroyBodyByExeciveForce); cdecl; external NEWTON_API;
  572.  
  573. // procedure NewtonWorldForEachBodyDo (const world : NewtonWorld; NewtonBodyIterator callback);
  574.  procedure NewtonWorldForEachJointDo (const world : NewtonWorld; callback : PNewtonJointIterator; userData : Pointer); cdecl; external NEWTON_API;
  575.  procedure NewtonWorldForEachBodyInAABBDo (const world : NewtonWorld; const p0 : PdFloat; const p1 : PdFloat; callback : PNewtonBodyIterator; userData : Pointer); cdecl; external NEWTON_API;
  576.  
  577.  
  578.  procedure NewtonWorldSetUserData (const world : NewtonWorld; userData : Pointer); cdecl; external NEWTON_API;
  579.  function NewtonWorldGetUserData (const world : NewtonWorld) : Pointer; cdecl; external NEWTON_API;
  580.  
  581.  function NewtonWorldGetListenerUserData (const world : NewtonWorld; Listener : NewtonListener) : Pointer; cdecl; external NEWTON_API;
  582.  function NewtonWorldListenerGetBodyDestroyCallback (const world : NewtonWorld; Listener : NewtonListener) : PNewtonWorldListenerBodyDestroyCallback; cdecl; external NEWTON_API;
  583.  procedure NewtonWorldListenerSetBodyDestroyCallback (const world : NewtonWorld; Listener : NewtonListener; bodyDestroyCallback : PNewtonWorldListenerBodyDestroyCallback); cdecl; external NEWTON_API;
  584.  
  585.  function NewtonWorldGetPreListener (const world : NewtonWorld; nameID : PChar) : NewtonListener; cdecl; external NEWTON_API;
  586.  function NewtonWorldAddPreListener (const world : NewtonWorld; nameID : PChar; listenerUserData : Pointer; Update : PNewtonWorldUpdateListenerCallback; Destroy : PNewtonWorldDestroyListenerCallback) : NewtonListener; cdecl; external NEWTON_API;
  587.  
  588.  function NewtonWorldGetPostListener (const world : NewtonWorld; nameID : PChar) : NewtonListener; cdecl; external NEWTON_API;
  589.  function NewtonWorldAddPostListener (const world : NewtonWorld; nameID : PChar; listenerUserData : Pointer; Update : PNewtonWorldUpdateListenerCallback; Destroy : PNewtonWorldDestroyListenerCallback) : NewtonListener; cdecl; external NEWTON_API;
  590.  
  591.  procedure NewtonWorldSetDestructorCallback (const world : NewtonWorld; callback : PNewtonWorldDestructorCallback); cdecl; external NEWTON_API;
  592.  function NewtonWorldGetDestructorCallback (const world : NewtonWorld) : PNewtonWorldDestructorCallback; cdecl; external NEWTON_API;
  593.  
  594.  procedure NewtonWorldSetCollisionConstructorDestructorCallback (const world : NewtonWorld; construct : PNewtonCollisionCopyConstructionCallback; destruct : PNewtonCollisionDestructorCallback); cdecl; external NEWTON_API;
  595.  
  596.  
  597.  procedure NewtonWorldRayCast (const world : NewtonWorld; const p0 : PdFloat; const p1 : PdFloat; filter : PNewtonWorldRayFilterCallback; userData : Pointer;
  598.                                prefilter : PNewtonWorldRayPrefilterCallback; threadIndex : Integer); cdecl; external NEWTON_API;
  599.  
  600.  procedure NewtonWorldConvexRayCast (const world : NewtonWorld; shape : NewtonCollision; const Matrix : PdFloat; p1 : PdFloat; filter : PNewtonWorldRayFilterCallback; userData : Pointer;
  601.                                prefilter : PNewtonWorldRayPrefilterCallback; threadIndex : Integer); cdecl; external NEWTON_API;
  602.  
  603.  function NewtonWorldCollide (const world : NewtonWorld; const Matrix : PdFloat; const shape : NewtonCollision; UserData : Pointer;
  604.                               prefilter : PNewtonWorldRayPrefilterCallback; Info : PNewtonWorldConvexCastReturnInfo; maxContactsCount : Integer; threadIndex : Integer) : Integer; cdecl; external NEWTON_API;
  605.  
  606.  function NewtonWorldConvexCast (const world : NewtonWorld; const matrix : PdFloat; const target : PdFloat; const shape : NewtonCollision; hitParam : PdFloat; userData : Pointer;
  607.                                  prefilter : PNewtonWorldRayPrefilterCallback; info : PNewtonWorldConvexCastReturnInfo; maxContactsCount : Integer; threadIndex : Integer) : Integer; cdecl; external NEWTON_API;
  608.  
  609.  
  610.  // world utility functions
  611.  function NewtonWorldGetBodyCount(const world : NewtonWorld) : Integer; cdecl; external NEWTON_API;
  612.  function NewtonWorldGetConstraintCount(const world : NewtonWorld) : Integer; cdecl; external NEWTON_API;
  613.  
  614.  
  615.  // **********************************************************************************************
  616.  //
  617.  // Simulation islands
  618.  //
  619.  // **********************************************************************************************
  620.  function NewtonIslandGetBody (const island : Pointer; bodyIndex : Integer) : NewtonBody; cdecl; external NEWTON_API;
  621.  procedure NewtonIslandGetBodyAABB (const island : Pointer; bodyIndex : Integer; p0 : PdFloat; p1 : PdFloat); cdecl; external NEWTON_API;
  622.  
  623.  // **********************************************************************************************
  624.  //
  625.  // Physics Material Section
  626.  //
  627.  // **********************************************************************************************
  628.  function NewtonMaterialCreateGroupID(const world : NewtonWorld) : Integer; cdecl; external NEWTON_API;
  629.  function NewtonMaterialGetDefaultGroupID(const world : NewtonWorld) : Integer; cdecl; external NEWTON_API;
  630.  procedure NewtonMaterialDestroyAllGroupID(const world : NewtonWorld); cdecl; external NEWTON_API;
  631.  
  632.  // material definitions that can not be overwritten in function callback
  633.  function NewtonMaterialGetUserData (const world : NewtonWorld; id0 : Integer; id1 : Integer) : Pointer; cdecl; external NEWTON_API;
  634.  procedure NewtonMaterialSetSurfaceThickness (const world : NewtonWorld; id0 : Integer; id1 : Integer; thickness : dFloat); cdecl; external NEWTON_API;
  635.  
  636. // deprecated, not longer continue collision is set on the material  
  637. // procedure NewtonMaterialSetContinuousCollisionMode (const world : NewtonWorld; id0 : Integer; id1 : Integer; state : Integer);
  638.  procedure NewtonMaterialSetCallbackUserData (const world : NewtonWorld; id0 : Integer; id1 : Integer; userData : Pointer); cdecl; external NEWTON_API;
  639.  procedure NewtonMaterialSetContactGenerationCallback (const world : NewtonWorld; id0 : Integer; id1 : Integer; contactGeneration : PNewtonOnContactGeneration); cdecl; external NEWTON_API;
  640.  procedure NewtonMaterialSetCompoundCollisionCallback (const world : NewtonWorld; id0 : Integer; id1 : Integer; compoundAabbOverlap : PNewtonOnCompoundSubCollisionAABBOverlap); cdecl; external NEWTON_API;
  641.  procedure NewtonMaterialSetCollisionCallback (const world : NewtonWorld; id0 : Integer; id1 : Integer; aabbOverlap : PNewtonOnAABBOverlap; process : PNewtonContactsProcess); cdecl; external NEWTON_API;
  642.  
  643.  procedure NewtonMaterialSetDefaultSoftness (const world : NewtonWorld; id0 : Integer; id1 : Integer; value : dFloat); cdecl; external NEWTON_API;
  644.  procedure NewtonMaterialSetDefaultElasticity (const world : NewtonWorld; id0 : Integer; id1 : Integer; elasticCoef : dFloat); cdecl; external NEWTON_API;
  645.  procedure NewtonMaterialSetDefaultCollidable (const world : NewtonWorld; id0 : Integer; id1 : Integer; state : Integer); cdecl; external NEWTON_API;
  646.  procedure NewtonMaterialSetDefaultFriction (const world : NewtonWorld; id0 : Integer; id1 : Integer; staticFriction : dFloat; kineticFriction : dFloat); cdecl; external NEWTON_API;
  647.  
  648.  function NewtonWorldGetFirstMaterial (const world : NewtonWorld) : NewtonMaterial; cdecl; external NEWTON_API;
  649.  function NewtonWorldGetNextMaterial (const world : NewtonWorld; const material : NewtonMaterial) : NewtonMaterial; cdecl; external NEWTON_API;
  650.  
  651.  function NewtonWorldGetFirstBody (const world : NewtonWorld) : NewtonBody; cdecl; external NEWTON_API;
  652.  function NewtonWorldGetNextBody (const world : NewtonWorld; const curBody : NewtonBody) : NewtonBody; cdecl; external NEWTON_API;
  653.  
  654.  
  655.  // **********************************************************************************************
  656.  //
  657.  // Physics Contact control functions
  658.  //
  659.  // **********************************************************************************************
  660.  function NewtonMaterialGetMaterialPairUserData (const material : NewtonMaterial) : Pointer; cdecl; external NEWTON_API;
  661.  function NewtonMaterialGetContactFaceAttribute (const material : NewtonMaterial) : Cardinal; cdecl; external NEWTON_API;
  662.  function NewtonMaterialGetBodyCollidingShape (const material : NewtonMaterial; const body : NewtonBody) : NewtonCollision; cdecl; external NEWTON_API;
  663.  function NewtonMaterialGetContactNormalSpeed (const material : NewtonMaterial) : dFloat; cdecl; external NEWTON_API;
  664.  procedure NewtonMaterialGetContactForce (const material : NewtonMaterial; const body : NewtonBody; force : PdFloat); cdecl; external NEWTON_API;
  665.  procedure NewtonMaterialGetContactPositionAndNormal (const material : NewtonMaterial; const body : NewtonBody; posit : PdFloat; normal : PdFloat); cdecl; external NEWTON_API;
  666.  procedure NewtonMaterialGetContactTangentDirections (const material : NewtonMaterial; const body : NewtonBody; dir0 : PdFloat; dir1 : PdFloat); cdecl; external NEWTON_API;
  667.  function NewtonMaterialGetContactTangentSpeed (const material : NewtonMaterial; index : Integer) : dFloat; cdecl; external NEWTON_API;
  668.  
  669.  function NewtonMaterialGetContactMaxNormalImpact (const material : NewtonMaterial) : dFloat; cdecl; external NEWTON_API;
  670.  function NewtonMaterialGetContactMaxTangentImpact (const material : NewtonMaterial; index : Integer) : dFloat; cdecl; external NEWTON_API;
  671.  
  672.  procedure NewtonMaterialSetContactSoftness (const material : NewtonMaterial; softness : dFloat); cdecl; external NEWTON_API;
  673.  procedure NewtonMaterialSetContactElasticity (const material : NewtonMaterial; restitution : dFloat); cdecl; external NEWTON_API;
  674.  procedure NewtonMaterialSetContactFrictionState (const material : NewtonMaterial; state : Integer; index : Integer); cdecl; external NEWTON_API;
  675.  procedure NewtonMaterialSetContactFrictionCoef (const material : NewtonMaterial; staticFrictionCoef : dFloat; kineticFrictionCoef : dFloat; index : Integer); cdecl; external NEWTON_API;
  676.  
  677.  procedure NewtonMaterialSetContactNormalAcceleration (const material : NewtonMaterial; accel : dFloat); cdecl; external NEWTON_API;
  678.  procedure NewtonMaterialSetContactNormalDirection (const material : NewtonMaterial; const directionVector : PdFloat); cdecl; external NEWTON_API;
  679.  
  680.  procedure NewtonMaterialSetContactPosition (const material : NewtonMaterial; const position : PdFloat); cdecl; external NEWTON_API;
  681.  procedure NewtonMaterialSetContactTangentFriction (const material : NewtonMaterial; friction : dFloat; index : Integer); cdecl; external NEWTON_API;
  682.  
  683.  procedure NewtonMaterialSetContactTangentAcceleration (const material : NewtonMaterial; accel : dFloat; index : Integer); cdecl; external NEWTON_API;
  684.  procedure NewtonMaterialContactRotateTangentDirections (const material : NewtonMaterial; const directionVector : PdFloat); cdecl; external NEWTON_API;
  685.  
  686.  // **********************************************************************************************
  687.  //
  688.  // convex collision primitives creation functions
  689.  //
  690.  // **********************************************************************************************
  691.  function NewtonCreateNull (const world : NewtonWorld) : NewtonCollision; cdecl; external NEWTON_API;
  692.  function NewtonCreateSphere (const world : NewtonWorld; radius : dFloat; shapeID : Integer; const offsetMatrix : PdFloat) : NewtonCollision; cdecl; external NEWTON_API;
  693.  function NewtonCreateBox (const world : NewtonWorld; dx : dFloat; dy : dFloat; dz : dFloat; shapeID : Integer; const offsetMatrix : PdFloat) : NewtonCollision; cdecl; external NEWTON_API;
  694.  function NewtonCreateCone (const world : NewtonWorld; radius : dFloat; height : dFloat; shapeID : Integer; const offsetMatrix : PdFloat) : NewtonCollision; cdecl; external NEWTON_API;
  695.  function NewtonCreateCapsule (const world : NewtonWorld; radius : dFloat; height : dFloat; shapeID : Integer; const offsetMatrix : PdFloat) : NewtonCollision; cdecl; external NEWTON_API;
  696.  function NewtonCreateCylinder (const world : NewtonWorld; radius : dFloat; height : dFloat; shapeID : Integer; const offsetMatrix : PdFloat) : NewtonCollision; cdecl; external NEWTON_API;
  697.  function NewtonCreateTaperedCapsule (const world : NewtonWorld; radio0 : dFloat; radio1 : dFloat; height : dFloat; shapeID : Integer; const offsetMatrix : PdFloat) : NewtonCollision; cdecl; external NEWTON_API;
  698.  function NewtonCreateTaperedCylinder (const world : NewtonWorld; radio0 : dFloat; radio1 : dFloat; height : dFloat; shapeID : Integer; const offsetMatrix : PdFloat) : NewtonCollision; cdecl; external NEWTON_API;
  699.  function NewtonCreateChamferCylinder (const world : NewtonWorld; radius : dFloat; height : dFloat; shapeID : Integer; const offsetMatrix : PdFloat) : NewtonCollision; cdecl; external NEWTON_API;
  700.  function NewtonCreateConvexHull (const world : NewtonWorld; count : Integer; const vertexCloud : PdFloat; strideInBytes : Integer; tolerance : dFloat; shapeID : Integer; const offsetMatrix : PdFloat) : NewtonCollision; cdecl; external NEWTON_API;
  701.  function NewtonCreateConvexHullFromMesh (const world : NewtonWorld; const mesh : NewtonMesh; tolerance : dFloat; shapeID : Integer) : NewtonCollision; cdecl; external NEWTON_API;
  702.  
  703.  function NewtonCollisionGetMode(const convexCollision : NewtonCollision) : Integer; cdecl; external NEWTON_API;
  704.  procedure NewtonCollisionSetMode(const convexCollision : NewtonCollision; mode : Integer); cdecl; external NEWTON_API;
  705.  
  706. // procedure NewtonCollisionSetMaxBreakImpactImpulse(const convexHullCollision : NewtonCollision; dFloat maxImpactImpulse);
  707. // NEWTON_API dFloat NewtonCollisionGetMaxBreakImpactImpulse(const NewtonCollision* const convexHullCollision);
  708.  
  709.  
  710.  function NewtonConvexHullGetFaceIndices (const convexHullCollision : NewtonCollision; face : Integer; faceIndices : PInteger) : Integer; cdecl; external NEWTON_API;
  711.  
  712.  function NewtonConvexHullGetVertexData (const convexHullCollision : NewtonCollision; vertexData : PdFloat; strideInBytes : PInteger) : Integer; cdecl; external NEWTON_API;
  713.  
  714.  function NewtonConvexCollisionCalculateVolume (const convexCollision : NewtonCollision) : dFloat; cdecl; external NEWTON_API;
  715.  procedure NewtonConvexCollisionCalculateInertialMatrix (const convexCollision : NewtonCollision; inertia : PdFloat; origin : PdFloat); cdecl; external NEWTON_API;
  716.  
  717.  procedure NewtonConvexCollisionCalculateBuoyancyAcceleration (const convexCollision : NewtonCollision; matrix : PdFloat; shapeOrigin : PdFloat; gravityVector : PdFloat; fluidPlane : PdFloat; fluidDensity : dFloat; fluidViscosity : dFloat; accel : PdFloat; alpha : PdFloat); cdecl; external NEWTON_API;
  718.  function NewtonCollisionDataPointer (const convexCollision : NewtonCollision) : Pointer; cdecl; external NEWTON_API;
  719.  
  720.  
  721.  // **********************************************************************************************
  722.  //
  723.  // compound collision primitives creation functions
  724.  //
  725.  // **********************************************************************************************
  726.  function NewtonCreateCompoundCollision (const world : NewtonWorld; shapeID : Integer) : NewtonCollision; cdecl; external NEWTON_API;
  727.  function NewtonCreateCompoundCollisionFromMesh (const world : NewtonWorld; const mesh : NewtonMesh; hullTolerance : dFloat; shapeID : Integer; subShapeID : Integer) : NewtonCollision; cdecl; external NEWTON_API;
  728.  
  729.  procedure NewtonCompoundCollisionBeginAddRemove (compoundCollision : NewtonCollision); cdecl; external NEWTON_API;
  730.  function NewtonCompoundCollisionAddSubCollision (const compoundCollision : NewtonCollision; convexCollision : NewtonCollision) : Pointer; cdecl; external NEWTON_API;
  731.  procedure NewtonCompoundCollisionRemoveSubCollision (const compoundCollision : NewtonCollision; collisionNode : Pointer); cdecl; external NEWTON_API;
  732.  procedure NewtonCompoundCollisionRemoveSubCollisionByIndex (const compoundCollision : NewtonCollision; nodeIndex : Integer); cdecl; external NEWTON_API;
  733.  procedure NewtonCompoundCollisionSetSubCollisionMatrix (const compoundCollision : NewtonCollision; node : Pointer; matrix : PdFloat); cdecl; external NEWTON_API;
  734.  procedure NewtonCompoundCollisionEndAddRemove (compoundCollision : NewtonCollision); cdecl; external NEWTON_API;
  735.  
  736.  function NewtonCompoundCollisionGetFirstNode (compoundCollision : NewtonCollision) : Pointer; cdecl; external NEWTON_API;
  737.  function NewtonCompoundCollisionGetNextNode (const compoundCollision : NewtonCollision; node : Pointer) : Pointer; cdecl; external NEWTON_API;
  738.  
  739.  function NewtonCompoundCollisionGetNodeByIndex (const compoundCollision : NewtonCollision; index : Integer) : Pointer; cdecl; external NEWTON_API;
  740.  function NewtonCompoundCollisionGetNodeIndex (const compoundCollision : NewtonCollision; node : Pointer) : Integer; cdecl; external NEWTON_API;
  741.  function NewtonCompoundCollisionGetCollisionFromNode (const compoundCollision : NewtonCollision; node : Pointer) : NewtonCollision; cdecl; external NEWTON_API;
  742.  
  743.  
  744.  // **********************************************************************************************
  745.  //
  746.  // Fractured compound collision primitives interface
  747.  //
  748.  // **********************************************************************************************
  749.  
  750.  function NewtonCreateFracturedCompoundCollision (world : NewtonWorld; solidMesh : NewtonMesh; shapeID : Integer;fracturePhysicsMaterialID : Integer; pointcloudCount : Integer; const vertexCloud : PdFloat; strideInBytes : Integer; materialID : Integer; const textureMatrix : PdFloat;
  751.                           regenerateMainMeshCallback : PNewtonFractureCompoundCollisionReconstructMainMeshCallBack; emitFracturedCompound : PNewtonFractureCompoundCollisionOnEmitCompoundFractured; emitFracfuredChunk : PNewtonFractureCompoundCollisionOnEmitChunk) : NewtonCollision; cdecl; external NEWTON_API;
  752.  
  753.  {  NEWTON_API NewtonCollision* NewtonFracturedCompoundPlaneClip (const NewtonCollision* const fracturedCompound, const dFloat* const plane);
  754.  
  755.  
  756.     NEWTON_API void NewtonFracturedCompoundSetCallbacks (const NewtonCollision* const fracturedCompound, NewtonFractureCompoundCollisionReconstructMainMeshCallBack regenerateMainMeshCallback,
  757.                                                          NewtonFractureCompoundCollisionOnEmitCompoundFractured emitFracturedCompound, NewtonFractureCompoundCollisionOnEmitChunk emitFracfuredChunk);
  758.  
  759.  
  760.     NEWTON_API int NewtonFracturedCompoundIsNodeFreeToDetach (const NewtonCollision* const fracturedCompound, void* const collisionNode);
  761.     NEWTON_API int NewtonFracturedCompoundNeighborNodeList (const NewtonCollision* const fracturedCompound, void* const collisionNode, void** const list, int maxCount);
  762.  
  763.  
  764.     NEWTON_API NewtonFracturedCompoundMeshPart* NewtonFracturedCompoundGetMainMesh (const NewtonCollision* const fracturedCompound);
  765.     NEWTON_API NewtonFracturedCompoundMeshPart* NewtonFracturedCompoundGetFirstSubMesh(const NewtonCollision* const fracturedCompound);
  766.     NEWTON_API NewtonFracturedCompoundMeshPart* NewtonFracturedCompoundGetNextSubMesh(const NewtonCollision* const fracturedCompound, NewtonFracturedCompoundMeshPart* const subMesh);
  767.  
  768.     NEWTON_API int NewtonFracturedCompoundCollisionGetVertexCount (const NewtonCollision* const fracturedCompound, const NewtonFracturedCompoundMeshPart* const meshOwner);
  769.     NEWTON_API const dFloat* NewtonFracturedCompoundCollisionGetVertexPositions (const NewtonCollision* const fracturedCompound, const NewtonFracturedCompoundMeshPart* const meshOwner);
  770.     NEWTON_API const dFloat* NewtonFracturedCompoundCollisionGetVertexNormals (const NewtonCollision* const fracturedCompound, const NewtonFracturedCompoundMeshPart* const meshOwner);
  771.     NEWTON_API const dFloat* NewtonFracturedCompoundCollisionGetVertexUVs (const NewtonCollision* const fracturedCompound, const NewtonFracturedCompoundMeshPart* const meshOwner);
  772.     NEWTON_API int NewtonFracturedCompoundMeshPartGetIndexStream (const NewtonCollision* const fracturedCompound, const NewtonFracturedCompoundMeshPart* const meshOwner, const void* const segment, int* const index);
  773.  
  774.     NEWTON_API void* NewtonFracturedCompoundMeshPartGetFirstSegment (const NewtonFracturedCompoundMeshPart* const fractureCompoundMeshPart);
  775.     NEWTON_API void* NewtonFracturedCompoundMeshPartGetNextSegment (const void* const fractureCompoundMeshSegment);
  776.     NEWTON_API int NewtonFracturedCompoundMeshPartGetMaterial (const void* const fractureCompoundMeshSegment);
  777.     NEWTON_API int NewtonFracturedCompoundMeshPartGetIndexCount (const void* const fractureCompoundMeshSegment);
  778.            }
  779.  // **********************************************************************************************
  780.  //
  781.  // scene collision are static compound collision that can take polygonal static collisions
  782.  //
  783.  // **********************************************************************************************
  784.  function NewtonCreateSceneCollision (const world : NewtonWorld; shapeID : Integer) : NewtonCollision; cdecl; external NEWTON_API;
  785.  
  786.  procedure NewtonSceneCollisionBeginAddRemove (sceneCollision : NewtonCollision); cdecl; external NEWTON_API;
  787.  function NewtonSceneCollisionAddSubCollision (sceneCollision : NewtonCollision; collision : NewtonCollision) : Pointer; cdecl; external NEWTON_API;
  788.  procedure NewtonSceneCollisionSetSubCollisionMatrix (sceneCollision : NewtonCollision; node : Pointer; matrix : PdFloat); cdecl; external NEWTON_API;
  789.  procedure NewtonSceneCollisionEndAddRemove (sceneCollision : NewtonCollision); cdecl; external NEWTON_API;
  790.  
  791.  
  792.  function NewtonSceneCollisionGetFirstNode (sceneCollision : NewtonCollision) : Pointer; cdecl; external NEWTON_API;
  793.  function NewtonSceneCollisionGetNextNode (sceneCollision : NewtonCollision; node : Pointer) : Pointer; cdecl; external NEWTON_API;
  794.  
  795.  function NewtonSceneCollisionGetCollisionFromNode (sceneCollision : NewtonCollision; node : Pointer) : NewtonCollision; cdecl; external NEWTON_API;
  796.  
  797.  
  798.  // **********************************************************************************************
  799.  //
  800.  // complex breakable collision primitives interface
  801.  //
  802.  // **********************************************************************************************
  803. (*
  804.  NEWTON_API NewtonCollision* NewtonCreateCompoundBreakable (const world : NewtonWorld; int meshCount,
  805.                   const NewtonMesh** const solids, const int* const shapeIDArray,
  806.                   const dFloat* const densities, const int* const internalFaceMaterial,
  807.                   shapeID : Integer; int debriID, dFloat debriSeparationGap); cdecl; external NEWTON_API;
  808.  
  809.  
  810.  procedure NewtonCompoundBreakableResetAnchoredPieces (const NewtonCollision* const compoundBreakable); cdecl; external NEWTON_API;
  811.  procedure NewtonCompoundBreakableSetAnchoredPieces (const NewtonCollision* const compoundBreakable, int fixShapesCount, matrix : PdFloatPallete, NewtonCollision** const fixedShapesArray); cdecl; external NEWTON_API;
  812.  
  813.  NEWTON_API int NewtonCompoundBreakableGetVertexCount (const NewtonCollision* const compoundBreakable); cdecl; external NEWTON_API;
  814.  procedure NewtonCompoundBreakableGetVertexStreams (const NewtonCollision* const compoundBreakable, int vertexStrideInByte, dFloat* const vertex,
  815.                int normalStrideInByte, dFloat* const normal, int uvStrideInByte, dFloat* const uv); cdecl; external NEWTON_API;
  816.  
  817.  
  818.  NEWTON_API NewtonBreakableComponentMesh* NewtonBreakableGetMainMesh (const NewtonCollision* const compoundBreakable); cdecl; external NEWTON_API;
  819.  NEWTON_API NewtonBreakableComponentMesh* NewtonBreakableGetFirstComponent (const NewtonCollision* const compoundBreakable); cdecl; external NEWTON_API;
  820.  NEWTON_API NewtonBreakableComponentMesh* NewtonBreakableGetNextComponent (const NewtonBreakableComponentMesh* const component); cdecl; external NEWTON_API;
  821.  
  822.  procedure NewtonBreakableBeginDelete (const NewtonCollision* const compoundBreakable); cdecl; external NEWTON_API;
  823.  NEWTON_API NewtonBody* NewtonBreakableCreateDebrieBody (const NewtonCollision* const compoundBreakable, const NewtonBreakableComponentMesh* const component); cdecl; external NEWTON_API;
  824.  procedure NewtonBreakableDeleteComponent (const NewtonCollision* const compoundBreakable, const NewtonBreakableComponentMesh* const component); cdecl; external NEWTON_API;
  825.  procedure NewtonBreakableEndDelete (const NewtonCollision* const compoundBreakable); cdecl; external NEWTON_API;
  826.  
  827.  
  828.  NEWTON_API int NewtonBreakableGetComponentsInRadius (const NewtonCollision* const compoundBreakable, const dFloat* position, radius : dFloat; NewtonBreakableComponentMesh** const segments, int maxCount); cdecl; external NEWTON_API;
  829.  
  830.  NEWTON_API void* NewtonBreakableGetFirstSegment (const NewtonBreakableComponentMesh* const breakableComponent); cdecl; external NEWTON_API;
  831.  NEWTON_API void* NewtonBreakableGetNextSegment (const void* const segment); cdecl; external NEWTON_API;
  832.  
  833.  NEWTON_API int NewtonBreakableSegmentGetMaterial (const void* const segment); cdecl; external NEWTON_API;
  834.  NEWTON_API int NewtonBreakableSegmentGetIndexCount (const void* const segment); cdecl; external NEWTON_API;
  835.  NEWTON_API int NewtonBreakableSegmentGetIndexStream (const NewtonCollision* const compoundBreakable, const NewtonBreakableComponentMesh* const meshOwner, const void* const segment, int* const index); cdecl; external NEWTON_API;
  836.  NEWTON_API int NewtonBreakableSegmentGetIndexStreamShort (const NewtonCollision* const compoundBreakable, const NewtonBreakableComponentMesh* const meshOwner, const void* const segment, short int* const index); cdecl; external NEWTON_API;
  837. *)
  838.  
  839.  function NewtonCreateUserMeshCollision (const world : NewtonWorld; const minBox : PdFloat; const maxBox : PdFloat; userData : Pointer;
  840.                                          collideCallback : PNewtonUserMeshCollisionCollideCallback; rayHitCallback : PNewtonUserMeshCollisionRayHitCallback;
  841.                                          destroyCallback : PNewtonUserMeshCollisionDestroyCallback; getInfoCallback : PNewtonUserMeshCollisionGetCollisionInfo;
  842.                                          getLocalAABBCallback : PNewtonUserMeshCollisionAABBTest; facesInAABBCallback : PNewtonUserMeshCollisionGetFacesInAABB; serializeCallback : PNewtonOnUserCollisionSerializationCallback;
  843.                                          shapeID : Integer) : NewtonCollision; cdecl; external NEWTON_API;
  844.  
  845.  //  ***********************************************************************************************************
  846.  //
  847.  // Collision serialization functions
  848.  //
  849.  // ***********************************************************************************************************
  850.  function NewtonCreateCollisionFromSerialization (const world : NewtonWorld; deserializeFunction : PNewtonDeserializeCallback; Handle : NewtonSerializeHandle) : NewtonCollision; cdecl; external NEWTON_API;
  851.  procedure NewtonCollisionSerialize (const world : NewtonWorld; const collision : NewtonCollision; serializeFunction : PNewtonSerializeCallback; Handle : NewtonSerializeHandle); cdecl; external NEWTON_API;
  852.  procedure NewtonCollisionGetInfo (const collision : NewtonCollision; collisionInfo : PNewtonCollisionInfoRecord); cdecl; external NEWTON_API;
  853.  
  854.  // **********************************************************************************************
  855.  //
  856.  // Static collision shapes functions
  857.  //
  858.  // **********************************************************************************************
  859.  function NewtonCreateHeightFieldCollision (const world : NewtonWorld; width : Integer; height : Integer; gridsDiagonals : Integer;
  860.                                             const elevationMap : PdFloat; const attributeMap : PShortInt; horizontalScale : dFloat; shapeID : Integer) : NewtonCollision; cdecl; external NEWTON_API;
  861.  procedure NewtonHeightFieldSetUserRayCastCallback (const heightfieldCollision : NewtonCollision; rayHitCallback : PNewtonHeightFieldRayCastCallback); cdecl; external NEWTON_API;
  862.  
  863.  
  864.  function NewtonCreateTreeCollision (const world : NewtonWorld; shapeID : Integer) : NewtonCollision; cdecl; external NEWTON_API;
  865.  function NewtonCreateTreeCollisionFromMesh (const world : NewtonWorld; const mesh : NewtonMesh; shapeID : Integer) : NewtonCollision; cdecl; external NEWTON_API;
  866.  
  867.  procedure NewtonTreeCollisionSetUserRayCastCallback (const treeCollision : NewtonCollision; rayHitCallback : PNewtonCollisionTreeRayCastCallback); cdecl; external NEWTON_API;
  868.  
  869.  procedure NewtonTreeCollisionBeginBuild (const treeCollision : NewtonCollision); cdecl; external NEWTON_API;
  870.  procedure NewtonTreeCollisionAddFace (const treeCollision : NewtonCollision; vertexCount : Integer; const vertexPtr : PdFloat; strideInBytes : Integer; faceAttribute : Integer); cdecl; external NEWTON_API;
  871.  procedure NewtonTreeCollisionEndBuild (const treeCollision : NewtonCollision; optimize : Integer); cdecl; external NEWTON_API;
  872.  
  873.  function NewtonTreeCollisionGetFaceAtribute (const treeCollision : NewtonCollision; const faceIndexArray : PInteger; indexCount : Integer) : Integer; cdecl; external NEWTON_API;
  874.  procedure NewtonTreeCollisionSetFaceAtribute (const treeCollision : NewtonCollision; const faceIndexArray : PInteger; indexCount : Integer; attribute : Integer); cdecl; external NEWTON_API;
  875.  function NewtonTreeCollisionGetVertexListIndexListInAABB (const treeCollision : NewtonCollision; const p0 : PdFloat; const p1 : PdFloat; const vertexArray : PdFloat; vertexCount : PInteger;
  876.                                                                  vertexStrideInBytes : PInteger; const indexList : PInteger; maxIndexCount : Integer; const faceAttribute : PInteger) : Integer; cdecl; external NEWTON_API;
  877.  
  878.  
  879.  procedure NewtonStaticCollisionSetDebugCallback (const staticCollision : NewtonCollision; userCallback : PNewtonTreeCollisionCallback); cdecl; external NEWTON_API;
  880.  
  881.  // **********************************************************************************************
  882.  //
  883.  // General purpose collision library functions
  884.  //
  885.  // **********************************************************************************************
  886.  
  887.  function NewtonCollisionCreateInstance (const collision : NewtonCollision) : NewtonCollision; cdecl; external NEWTON_API;
  888.  function NewtonCollisionGetType (const collision : NewtonCollision) : Integer; cdecl; external NEWTON_API;
  889.  
  890.  procedure NewtonCollisionSetUserData (const collision : NewtonCollision; userData : Pointer); cdecl; external NEWTON_API;
  891.  function NewtonCollisionGetUserData (const collision : NewtonCollision) : Pointer; cdecl; external NEWTON_API;
  892.  
  893.  procedure NewtonCollisionSetUserID (const collision : NewtonCollision; id : Cardinal); cdecl; external NEWTON_API;
  894.  function NewtonCollisionGetUserID (const collision : NewtonCollision) : Cardinal; cdecl; external NEWTON_API;
  895.  
  896.  procedure NewtonCollisionSetMatrix (const collision : NewtonCollision; const matrix : PdFloat); cdecl; external NEWTON_API;
  897.  procedure NewtonCollisionGetMatrix (const collision : NewtonCollision; matrix : PdFloat); cdecl; external NEWTON_API;
  898.  
  899.  procedure NewtonCollisionSetScale (const collision : NewtonCollision; scaleX : dFloat; scaleY : dFloat; scaleZ : dFloat); cdecl; external NEWTON_API;
  900.  procedure NewtonCollisionGetScale (const collision : NewtonCollision; scaleX : dFloat; scaleY : dFloat; scaleZ : dFloat); cdecl; external NEWTON_API;
  901.  procedure NewtonDestroyCollision (const collision : NewtonCollision); cdecl; external NEWTON_API;
  902.  
  903.  
  904.  
  905.  function NewtonCollisionPointDistance (const world : NewtonWorld; const point : PdFloat; const collision : NewtonCollision; const matrix : PdFloat;
  906.                                         contact : PdFloat; normal : PdFloat; threadIndex : Integer) : Integer; cdecl; external NEWTON_API;
  907.  
  908.  function NewtonCollisionClosestPoint (const world : NewtonWorld;
  909.                                        const collisionA : NewtonCollision; const matrixA : PdFloat; const collisionB : NewtonCollision; const matrixB : PdFloat;
  910.                                        contactA : PdFloat; contactB : PdFloat; normalAB : PdFloat; threadIndex : Integer) : Integer; cdecl; external NEWTON_API;
  911.  
  912.  function NewtonCollisionCollide (const world : NewtonWorld; maxSize : Integer; const collisionA : NewtonCollision; const matrixA : PdFloat;
  913.                                   const collisionB : NewtonCollision; const matrixB : PdFloat; contacts : PdFloat; normals : PdFloat;
  914.                                   penetration : PdFloat; attribute : PInteger; threadIndex : Integer) : Integer; cdecl; external NEWTON_API;
  915.  
  916.  function NewtonCollisionCollideContinue (const world : NewtonWorld; maxSize : Integer; const timestep : dFloat; const collisionA : NewtonCollision;
  917.                                           const matrixA : PdFloat; const velocA : PdFloat; const omegaA : PdFloat; const collisionB : NewtonCollision;
  918.                                           const matrixB : PdFloat; const velocB : PdFloat; const omegaB : PdFloat; timeOfImpact : PdFloat; contacts : PdFloat;
  919.                                           normals : PdFloat; penetration : PdFloat; threadIndex : Integer) : Integer; cdecl; external NEWTON_API;
  920.  
  921.  procedure NewtonCollisionSupportVertex (const collision : NewtonCollision; const dir : PdFloat; vertex : PdFloat); cdecl; external NEWTON_API;
  922.  function NewtonCollisionRayCast (const collision : NewtonCollision; const p0 : PdFloat; const p1 : PdFloat; normal : PdFloat; attribute : PInteger) : dFloat; cdecl; external NEWTON_API;
  923.  procedure NewtonCollisionCalculateAABB (const collision : NewtonCollision; const matrix : PdFloat; p0 : PdFloat; p1 : PdFloat); cdecl; external NEWTON_API;
  924.  procedure NewtonCollisionForEachPolygonDo (const collision : NewtonCollision; const matrix : PdFloat; callback : PNewtonCollisionIterator; userData : Pointer); cdecl; external NEWTON_API;
  925.  
  926.  
  927.  
  928.  // **********************************************************************************************
  929.  //
  930.  // transforms utility functions
  931.  //
  932.  // **********************************************************************************************
  933.  procedure NewtonGetEulerAngle (const matrix : PdFloat; eulersAngles : PdFloat); cdecl; external NEWTON_API;
  934.  procedure NewtonSetEulerAngle (const eulersAngles : PdFloat; matrix : PdFloat); cdecl; external NEWTON_API;
  935.  function NewtonCalculateSpringDamperAcceleration (dt : dFloat; ks : dFloat; x : dFloat; kd : dFloat; s : dFloat) : dFloat; cdecl; external NEWTON_API;
  936.  
  937.  // **********************************************************************************************
  938.  //
  939.  // body manipulation functions
  940.  //
  941.  // **********************************************************************************************
  942.  function  NewtonCreateDynamicBody (const world : NewtonWorld; const collision : NewtonCollision; const matrix : PdFloat) : NewtonBody; cdecl; external NEWTON_API;
  943.  function  NewtonCreateKinematicBody (const world : NewtonWorld; const collision : NewtonCollision; const matrix : PdFloat) : NewtonBody; cdecl; external NEWTON_API;
  944.  
  945.  procedure NewtonDestroyBody (const body : NewtonBody); cdecl; external NEWTON_API;
  946.  
  947.  function  NewtonBodyGetType (const body : NewtonBody) : Integer; cdecl; external NEWTON_API;
  948.  
  949.  procedure NewtonBodyAddForce (const body : NewtonBody; const force : PdFloat); cdecl; external NEWTON_API;
  950.  procedure NewtonBodyAddTorque (const body : NewtonBody; const torque : PdFloat); cdecl; external NEWTON_API;
  951.  procedure NewtonBodyCalculateInverseDynamicsForce (const body : NewtonBody; timestep : dFloat; const desiredVeloc : PdFloat; forceOut : PdFloat); cdecl; external NEWTON_API;
  952.  
  953.  procedure NewtonBodySetCentreOfMass (const body : NewtonBody; const com : PdFloat); cdecl; external NEWTON_API;
  954.  procedure NewtonBodySetMassMatrix (const body : NewtonBody; mass : dFloat; Ixx : dFloat; Iyy : dFloat; Izz : dFloat); cdecl; external NEWTON_API;
  955.  
  956.  procedure NewtonBodySetMassProperties (const body : NewtonBody; mass : dFloat; const collision : NewtonCollision); cdecl; external NEWTON_API;
  957.  procedure NewtonBodySetMatrix (const body : NewtonBody; const matrix : PdFloat); cdecl; external NEWTON_API;
  958.  procedure NewtonBodySetMatrixRecursive (const body : NewtonBody; const matrix : PdFloat); cdecl; external NEWTON_API;
  959.  
  960.  procedure NewtonBodySetMaterialGroupID (const body : NewtonBody; id : Integer); cdecl; external NEWTON_API;
  961.  procedure NewtonBodySetContinuousCollisionMode (const body : NewtonBody; state : Cardinal); cdecl; external NEWTON_API;
  962.  procedure NewtonBodySetJointRecursiveCollision (const body : NewtonBody; state : Cardinal); cdecl; external NEWTON_API;
  963.  procedure NewtonBodySetOmega (const body : NewtonBody; const omega : PdFloat); cdecl; external NEWTON_API;
  964.  procedure NewtonBodySetVelocity (const body : NewtonBody; const velocity : PdFloat); cdecl; external NEWTON_API;
  965.  procedure NewtonBodySetForce (const body : NewtonBody; const force : PdFloat); cdecl; external NEWTON_API;
  966.  procedure NewtonBodySetTorque (const body : NewtonBody; const torque : PdFloat); cdecl; external NEWTON_API;
  967.  
  968.  procedure NewtonBodySetLinearDamping (const body : NewtonBody; linearDamp : dFloat); cdecl; external NEWTON_API;
  969.  procedure NewtonBodySetAngularDamping (const body : NewtonBody; const angularDamp : PdFloat); cdecl; external NEWTON_API;
  970.  procedure NewtonBodySetCollision (const body : NewtonBody; const collision : NewtonCollision); cdecl; external NEWTON_API;
  971.  procedure NewtonBodySetCollisionScale (const body : NewtonBody; scaleX : dFloat; scaleY : dFloat; scaleZ : dFloat); cdecl; external NEWTON_API;
  972.  
  973.  function  NewtonBodyGetSleepState (const body : NewtonBody) : Integer; cdecl; external NEWTON_API;
  974.  procedure NewtonBodySetSleepState (const body : NewtonBody; state : Integer); cdecl; external NEWTON_API;
  975.  
  976.  function  NewtonBodyGetAutoSleep (const body : NewtonBody) : Integer; cdecl; external NEWTON_API;
  977.  procedure NewtonBodySetAutoSleep (const body : NewtonBody; state : Integer); cdecl; external NEWTON_API;
  978.  
  979.  function  NewtonBodyGetFreezeState(const body : NewtonBody) : Integer; cdecl; external NEWTON_API;
  980.  procedure NewtonBodySetFreezeState (const body : NewtonBody; state : Integer); cdecl; external NEWTON_API;
  981.  
  982.  
  983. // procedure NewtonBodySetAutoFreeze(const body : NewtonBody; state : Integer);
  984. // procedure NewtonBodyCoriolisForcesMode (const body : NewtonBody; int mode);
  985. // procedure NewtonBodySetGyroscopicForcesMode (const body : NewtonBody; int mode);
  986. // NEWTON_API int  NewtonBodyGetGyroscopicForcesMode (const body : NewtonBody);
  987. // NEWTON_API int  NewtonBodyGetFreezeState (const body : NewtonBody);
  988. // procedure NewtonBodySetFreezeState  (const body : NewtonBody; state : Integer);
  989. // procedure NewtonBodyGetFreezeTreshold (const body : NewtonBody; dFloat* freezeSpeed2, dFloat* freezeOmega2);
  990. // procedure NewtonBodySetFreezeTreshold (const body : NewtonBody; dFloat freezeSpeed2, dFloat freezeOmega2, int framesCount);
  991. // procedure NewtonBodySetAutoactiveCallback (const body : NewtonBody; NewtonBodyActivationState callback);
  992.  
  993.  
  994.  procedure NewtonBodySetDestructorCallback (const body : NewtonBody; callback : PNewtonBodyDestructor); cdecl; external NEWTON_API;
  995.  function NewtonBodyGetDestructorCallback (const body : NewtonBody) : PNewtonBodyDestructor; cdecl; external NEWTON_API;
  996.  
  997.  procedure NewtonBodySetTransformCallback (const body : NewtonBody; callback : PNewtonSetTransform); cdecl; external NEWTON_API;
  998.  function NewtonBodyGetTransformCallback (const body : NewtonBody) : PNewtonSetTransform; cdecl; external NEWTON_API;
  999.  
  1000.  procedure NewtonBodySetForceAndTorqueCallback (const body : NewtonBody; callback : PNewtonApplyForceAndTorque); cdecl; external NEWTON_API;
  1001.  function NewtonBodyGetForceAndTorqueCallback (const body : NewtonBody) : PNewtonApplyForceAndTorque; cdecl; external NEWTON_API;
  1002.  
  1003.  function NewtonBodyGetID (const body : NewtonBody) : Integer; cdecl; external NEWTON_API;
  1004.  
  1005.  procedure NewtonBodySetUserData (const body : NewtonBody; userData : Pointer); cdecl; external NEWTON_API;
  1006.  function NewtonBodyGetUserData (const body : NewtonBody) : Pointer; cdecl; external NEWTON_API;
  1007.  
  1008.  function NewtonBodyGetWorld (const body : NewtonBody) : NewtonWorld; cdecl; external NEWTON_API;
  1009.  function NewtonBodyGetCollision (const body : NewtonBody) : NewtonCollision; cdecl; external NEWTON_API;
  1010.  function NewtonBodyGetMaterialGroupID (const body : NewtonBody) : Integer; cdecl; external NEWTON_API;
  1011.  
  1012.  function NewtonBodyGetContinuousCollisionMode (const body : NewtonBody) : Integer; cdecl; external NEWTON_API;
  1013.  function NewtonBodyGetJointRecursiveCollision (const body : NewtonBody) : Integer; cdecl; external NEWTON_API;
  1014.  
  1015.  procedure  NewtonBodyGetMatrix(const body : NewtonBody; matrix : PdFloat); cdecl; external NEWTON_API;
  1016.  procedure  NewtonBodyGetRotation(const body : NewtonBody; rotation : PdFloat); cdecl; external NEWTON_API;
  1017.  procedure  NewtonBodyGetMassMatrix (const body : NewtonBody; mass : PdFloat; Ixx : PdFloat; Iyy : PdFloat; Izz : PdFloat); cdecl; external NEWTON_API;
  1018.  procedure  NewtonBodyGetInvMass(const body : NewtonBody; invMass : PdFloat; invIxx : PdFloat; invIyy : PdFloat; invIzz : PdFloat); cdecl; external NEWTON_API;
  1019.  procedure  NewtonBodyGetInertiaMatrix(const body : NewtonBody; inertiaMatrix : PdFloat); cdecl; external NEWTON_API;
  1020.  procedure  NewtonBodyGetInvInertiaMatrix(const body : NewtonBody; invInertiaMatrix : PdFloat); cdecl; external NEWTON_API;
  1021.  procedure  NewtonBodyGetOmega(const body : NewtonBody; vector : PdFloat); cdecl; external NEWTON_API;
  1022.  procedure  NewtonBodyGetVelocity(const body : NewtonBody; vector : PdFloat); cdecl; external NEWTON_API;
  1023.  procedure  NewtonBodyGetForce(const body : NewtonBody; vector : PdFloat); cdecl; external NEWTON_API;
  1024.  procedure  NewtonBodyGetTorque(const body : NewtonBody; vector : PdFloat); cdecl; external NEWTON_API;
  1025.  procedure  NewtonBodyGetForceAcc(const body : NewtonBody; vector : PdFloat); cdecl; external NEWTON_API;
  1026.  procedure  NewtonBodyGetTorqueAcc(const body : NewtonBody; vector : PdFloat); cdecl; external NEWTON_API;
  1027.  procedure  NewtonBodyGetCentreOfMass (const body : NewtonBody; com : PdFloat); cdecl; external NEWTON_API;
  1028.  
  1029.  procedure NewtonBodyGetPointVelocity (const body : NewtonBody; const point : PdFloat; velocOut : PdFloat); cdecl; external NEWTON_API;
  1030.  procedure NewtonBodyAddImpulse (const body : NewtonBody; const pointDeltaVeloc : PdFloat; const pointPosit : PdFloat); cdecl; external NEWTON_API;
  1031.  procedure NewtonBodyApplyImpulseArray (const body : NewtonBody; impuleCount : Integer; strideinBytes : Integer; const impulseArray : PdFloat; const pointArray : PdFloat); cdecl; external NEWTON_API;
  1032.  
  1033.  procedure NewtonBodyApplyImpulsePair (const body : NewtonBody; linearImpulse : PdFloat; angularImpulse : PdFloat); cdecl; external NEWTON_API;
  1034.  
  1035.  procedure NewtonBodyIntegrateVelocity (const body : NewtonBody; timestep : dFloat); cdecl; external NEWTON_API;
  1036.  
  1037.  function NewtonBodyGetLinearDamping (const body : NewtonBody) : dFloat; cdecl; external NEWTON_API;
  1038.  procedure  NewtonBodyGetAngularDamping (const body : NewtonBody; vector : PdFloat); cdecl; external NEWTON_API;
  1039.  procedure  NewtonBodyGetAABB (const body : NewtonBody; p0 : PdFloat; p1 : PdFloat); cdecl; external NEWTON_API;
  1040.  
  1041.  function NewtonBodyGetFirstJoint (const body : NewtonBody) : NewtonJoint; cdecl; external NEWTON_API;
  1042.  function NewtonBodyGetNextJoint (const body : NewtonBody; const joint : NewtonJoint) : NewtonJoint; cdecl; external NEWTON_API;
  1043.  function NewtonBodyGetFirstContactJoint (const body : NewtonBody) : NewtonJoint; cdecl; external NEWTON_API;
  1044.  function NewtonBodyGetNextContactJoint (const body : NewtonBody; const contactJoint : NewtonJoint) : NewtonJoint; cdecl; external NEWTON_API;
  1045.  
  1046.  // **********************************************************************************************
  1047.  //
  1048.  // contact joints interface
  1049.  //
  1050.  // **********************************************************************************************
  1051.  
  1052.  function NewtonContactJointGetFirstContact (const contactJoint : NewtonJoint) : Pointer; cdecl; external NEWTON_API;
  1053.  function NewtonContactJointGetNextContact (const contactJoint : NewtonJoint; contact : Pointer) : Pointer; cdecl; external NEWTON_API;
  1054.  
  1055.  function NewtonContactJointGetContactCount(const contactJoint : NewtonJoint) : Integer; cdecl; external NEWTON_API;
  1056.  procedure NewtonContactJointRemoveContact(const contactJoint : NewtonJoint; contact : Pointer); cdecl; external NEWTON_API;
  1057.  
  1058.  function NewtonContactGetMaterial (const contact : Pointer) : NewtonMaterial; cdecl; external NEWTON_API;
  1059.  
  1060.  
  1061.  // **********************************************************************************************
  1062.  //
  1063.  // Common joint functions
  1064.  //
  1065.  // **********************************************************************************************
  1066.  function NewtonJointGetUserData (const joint : NewtonJoint) : Pointer; cdecl; external NEWTON_API;
  1067.  procedure NewtonJointSetUserData (const joint : NewtonJoint; userData : Pointer); cdecl; external NEWTON_API;
  1068.  
  1069.  function NewtonJointGetBody0 (const joint : NewtonJoint) : NewtonBody; cdecl; external NEWTON_API;
  1070.  function NewtonJointGetBody1 (const joint : NewtonJoint) : NewtonBody; cdecl; external NEWTON_API;
  1071.  
  1072.  procedure NewtonJointGetInfo (const joint : NewtonJoint; info : PNewtonJointRecord); cdecl; external NEWTON_API;
  1073.  function NewtonJointGetCollisionState (const joint : NewtonJoint) : Integer; cdecl; external NEWTON_API;
  1074.  procedure NewtonJointSetCollisionState (const joint : NewtonJoint; state : Integer); cdecl; external NEWTON_API;
  1075.  
  1076.  function NewtonJointGetStiffness (const joint : NewtonJoint) : dFloat; cdecl; external NEWTON_API;
  1077.  procedure NewtonJointSetStiffness (const joint : NewtonJoint; state : dFloat); cdecl; external NEWTON_API;
  1078.  
  1079.  procedure NewtonDestroyJoint(const world : NewtonWorld; const joint : NewtonJoint); cdecl; external NEWTON_API;
  1080.  procedure NewtonJointSetDestructor (const joint : NewtonJoint; callback : PNewtonConstraintDestructor); cdecl; external NEWTON_API;
  1081.  
  1082.  
  1083.  
  1084.  // **********************************************************************************************
  1085.  //
  1086.  // particle system interface (soft bodies, individual, pressure bodies and cloth)
  1087.  //
  1088.  // **********************************************************************************************
  1089.  function NewtonCreateDeformableMesh (const world : NewtonWorld; mesh : NewtonMesh; shapeID : Integer) : NewtonCollision; cdecl; external NEWTON_API;
  1090.  
  1091.  procedure NewtonDeformableMeshSetPlasticity (deformableMesh : NewtonCollision; plasticity : dFloat); cdecl; external NEWTON_API;
  1092.  procedure NewtonDeformableMeshSetStiffness (deformableMesh : NewtonCollision; stiffness : dFloat); cdecl; external NEWTON_API;
  1093.  procedure NewtonDeformableMeshSetSkinThickness (deformableMesh : NewtonCollision; skinThickness : dFloat); cdecl; external NEWTON_API;
  1094.  
  1095.  function NewtonCreateDeformableBody (const world : NewtonWorld; const deformableMesh : NewtonCollision; const matrix : PdFloat) : NewtonBody; cdecl; external NEWTON_API;
  1096.  
  1097.  
  1098.  procedure NewtonDeformableMeshUpdateRenderNormals (const deformableMesh : NewtonCollision); cdecl; external NEWTON_API;
  1099.  function NewtonDeformableMeshGetVertexCount (const deformableMesh : NewtonCollision) : Integer; cdecl; external NEWTON_API;
  1100.  procedure NewtonDeformableMeshGetVertexStreams (const deformableMesh : NewtonCollision;
  1101.                                                  vertexStrideInBytes : Integer; vertex : PdFloat;
  1102.                                                  normalStrideInBytes : Integer; normal : PdFloat;
  1103.                                                  uvStrideInBytes0 : Integer; uv0 : PdFloat;
  1104.                                                  uvStrideInBytes1 : Integer; uv1 : PdFloat); cdecl; external NEWTON_API;
  1105.  function NewtonDeformableMeshGetFirstSegment (const deformableMesh : NewtonCollision) : NewtonDeformableMeshSegment; cdecl; external NEWTON_API;
  1106.  function NewtonDeformableMeshGetNextSegment (const deformableMesh : NewtonCollision; const segment : NewtonDeformableMeshSegment) : NewtonDeformableMeshSegment; cdecl; external NEWTON_API;
  1107.  
  1108.  function NewtonDeformableMeshSegmentGetMaterialID (const deformableMesh : NewtonCollision; const segment : NewtonDeformableMeshSegment) : Integer; cdecl; external NEWTON_API;
  1109.  function NewtonDeformableMeshSegmentGetIndexCount (const deformableMesh : NewtonCollision; const segment : NewtonDeformableMeshSegment) : Integer; cdecl; external NEWTON_API;
  1110.  function NewtonDeformableMeshSegmentGetIndexList (const deformableMesh : NewtonCollision; const segment : NewtonDeformableMeshSegment) : PSmallInt; cdecl; external NEWTON_API;
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  // **********************************************************************************************
  1116.  //
  1117.  // Ball and Socket joint functions
  1118.  //
  1119.  // **********************************************************************************************
  1120.  function NewtonConstraintCreateBall (const world : NewtonWorld; const pivotPoint : PdFloat;
  1121.                                       const childBody : NewtonBody; const parentBody : NewtonBody) : NewtonJoint; cdecl; external NEWTON_API;
  1122.  procedure NewtonBallSetUserCallback (const ball : NewtonJoint; callback : PNewtonBallCallback); cdecl; external NEWTON_API;
  1123.  procedure NewtonBallGetJointAngle (const ball : NewtonJoint; angle : PdFloat); cdecl; external NEWTON_API;
  1124.  procedure NewtonBallGetJointOmega (const ball : NewtonJoint; omega : PdFloat); cdecl; external NEWTON_API;
  1125.  procedure NewtonBallGetJointForce (const ball : NewtonJoint; force : PdFloat); cdecl; external NEWTON_API;
  1126.  procedure NewtonBallSetConeLimits (const ball : NewtonJoint; const pin : PdFloat; maxConeAngle : dFloat; maxTwistAngle : dFloat); cdecl; external NEWTON_API;
  1127.  
  1128.  // **********************************************************************************************
  1129.  //
  1130.  // Hinge joint functions
  1131.  //
  1132.  // **********************************************************************************************
  1133.  function NewtonConstraintCreateHinge (const world : NewtonWorld; const pivotPoint : PdFloat; const pinDir : PdFloat;
  1134.                                        const childBody : NewtonBody; const parentBody : NewtonBody) : NewtonJoint; cdecl; external NEWTON_API;
  1135.  
  1136.  procedure NewtonHingeSetUserCallback (const hinge : NewtonJoint; callback : PNewtonHingeCallback); cdecl; external NEWTON_API;
  1137.  function NewtonHingeGetJointAngle (const hinge : NewtonJoint) : dFloat; cdecl; external NEWTON_API;
  1138.  function NewtonHingeGetJointOmega (const hinge : NewtonJoint) : dFloat; cdecl; external NEWTON_API;
  1139.  procedure NewtonHingeGetJointForce (const hinge : NewtonJoint; force : PdFloat); cdecl; external NEWTON_API;
  1140.  function NewtonHingeCalculateStopAlpha (const hinge : NewtonJoint; const desc : PNewtonHingeSliderUpdateDesc; angle : dFloat) : dFloat; cdecl; external NEWTON_API;
  1141.  
  1142.  // **********************************************************************************************
  1143.  //
  1144.  // Slider joint functions
  1145.  //
  1146.  // **********************************************************************************************
  1147.  function NewtonConstraintCreateSlider (const world : NewtonWorld; const pivotPoint : PdFloat; const pinDir : PdFloat;
  1148.                                         const childBody : NewtonBody; const parentBody : NewtonBody) : NewtonJoint; cdecl; external NEWTON_API;
  1149.  procedure NewtonSliderSetUserCallback (const slider : NewtonJoint; callback : PNewtonSliderCallback); cdecl; external NEWTON_API;
  1150.  function NewtonSliderGetJointPosit (const slider : NewtonJoint) : dFloat; cdecl; external NEWTON_API;
  1151.  function NewtonSliderGetJointVeloc (const slider : NewtonJoint) : dFloat; cdecl; external NEWTON_API;
  1152.  procedure NewtonSliderGetJointForce (const slider : NewtonJoint; force : PdFloat); cdecl; external NEWTON_API;
  1153.  function NewtonSliderCalculateStopAccel (const slider : NewtonJoint; const desc : PNewtonHingeSliderUpdateDesc; position : dFloat) : dFloat; cdecl; external NEWTON_API;
  1154.  
  1155.  
  1156.  // **********************************************************************************************
  1157.  //
  1158.  // Corkscrew joint functions
  1159.  //
  1160.  // **********************************************************************************************
  1161.  function NewtonConstraintCreateCorkscrew (const world : NewtonWorld; const pivotPoint : PdFloat; const pinDir : PdFloat;
  1162.                                            const childBody : NewtonBody; const parentBody : NewtonBody) : NewtonJoint; cdecl; external NEWTON_API;
  1163.  procedure NewtonCorkscrewSetUserCallback (const corkscrew : NewtonJoint; callback : PNewtonCorkscrewCallback); cdecl; external NEWTON_API;
  1164.  function NewtonCorkscrewGetJointPosit (const corkscrew : NewtonJoint) : dFloat; cdecl; external NEWTON_API;
  1165.  function NewtonCorkscrewGetJointAngle (const corkscrew : NewtonJoint) : dFloat; cdecl; external NEWTON_API;
  1166.  function NewtonCorkscrewGetJointVeloc (const corkscrew : NewtonJoint) : dFloat; cdecl; external NEWTON_API;
  1167.  function NewtonCorkscrewGetJointOmega (const corkscrew : NewtonJoint) : dFloat; cdecl; external NEWTON_API;
  1168.  procedure NewtonCorkscrewGetJointForce (const corkscrew : NewtonJoint; force: PdFloat); cdecl; external NEWTON_API;
  1169.  function NewtonCorkscrewCalculateStopAlpha (const corkscrew : NewtonJoint; const desc : PNewtonHingeSliderUpdateDesc; angle: dFloat) : dFloat; cdecl; external NEWTON_API;
  1170.  function NewtonCorkscrewCalculateStopAccel (const corkscrew : NewtonJoint; const desc : PNewtonHingeSliderUpdateDesc; position: dFloat) : dFloat; cdecl; external NEWTON_API;
  1171.  
  1172.  
  1173.  // **********************************************************************************************
  1174.  //
  1175.  // Universal joint functions
  1176.  //
  1177.  // **********************************************************************************************
  1178.  function NewtonConstraintCreateUniversal (const world : NewtonWorld; const pivotPoint : PdFloat; const pinDir0 : PdFloat; const pinDir1 : PdFloat;
  1179.                                            const childBody : NewtonBody; const parentBody : NewtonBody) : NewtonJoint; cdecl; external NEWTON_API;
  1180.  procedure NewtonUniversalSetUserCallback (const universal : NewtonJoint; callback : PNewtonUniversalCallback); cdecl; external NEWTON_API;
  1181.  function NewtonUniversalGetJointAngle0 (const universal : NewtonJoint): dFloat; cdecl; external NEWTON_API;
  1182.  function NewtonUniversalGetJointAngle1 (const universal : NewtonJoint): dFloat; cdecl; external NEWTON_API;
  1183.  function NewtonUniversalGetJointOmega0 (const universal : NewtonJoint): dFloat; cdecl; external NEWTON_API;
  1184.  function NewtonUniversalGetJointOmega1 (const universal : NewtonJoint): dFloat; cdecl; external NEWTON_API;
  1185.  procedure NewtonUniversalGetJointForce (const universal : NewtonJoint; force : PdFloat); cdecl; external NEWTON_API;
  1186.  function NewtonUniversalCalculateStopAlpha0 (const universal : NewtonJoint; const desc : PNewtonHingeSliderUpdateDesc; angle : dFloat) : dFloat; cdecl; external NEWTON_API;
  1187.  function NewtonUniversalCalculateStopAlpha1 (const universal : NewtonJoint; const desc : PNewtonHingeSliderUpdateDesc; angle : dFloat) : dFloat; cdecl; external NEWTON_API;
  1188.  
  1189.  
  1190.  // **********************************************************************************************
  1191.  //
  1192.  // Up vector joint functions
  1193.  //
  1194.  // **********************************************************************************************
  1195.  function NewtonConstraintCreateUpVector (const world : NewtonWorld; const pinDir : PdFloat; const body : NewtonBody) : NewtonJoint; cdecl; external NEWTON_API;
  1196.  procedure NewtonUpVectorGetPin (const upVector : NewtonJoint; pin : PdFloat); cdecl; external NEWTON_API;
  1197.  procedure NewtonUpVectorSetPin (const upVector : NewtonJoint; const pin : PdFloat); cdecl; external NEWTON_API;
  1198.  
  1199.  
  1200.  // **********************************************************************************************
  1201.  //
  1202.  // User defined bilateral Joint
  1203.  //
  1204.  // **********************************************************************************************
  1205.  function NewtonConstraintCreateUserJoint (const world : NewtonWorld; maxDOF : Integer; callback : PNewtonUserBilateralCallback;
  1206.                                            getInfo : PNewtonUserBilateralGetInfoCallback; const childBody : NewtonBody;
  1207.                                            const parentBody : NewtonBody) : NewtonJoint; cdecl; external NEWTON_API;
  1208.  procedure NewtonUserJointSetFeedbackCollectorCallback (const joint : NewtonJoint; getFeedback : PNewtonUserBilateralCallback); cdecl; external NEWTON_API;
  1209.  procedure NewtonUserJointAddLinearRow (const joint : NewtonJoint; const pivot0 : PdFloat; const pivot1 : PdFloat; const dir : PdFloat); cdecl; external NEWTON_API;
  1210.  procedure NewtonUserJointAddAngularRow (const joint : NewtonJoint; relativeAngle : dFloat; const dir : PdFloat); cdecl; external NEWTON_API;
  1211.  procedure NewtonUserJointAddGeneralRow (const joint : NewtonJoint; const jacobian0 : PdFloat; const jacobian1 : PdFloat); cdecl; external NEWTON_API;
  1212.  procedure NewtonUserJointSetRowMinimumFriction (const joint : NewtonJoint; friction : dFloat); cdecl; external NEWTON_API;
  1213.  procedure NewtonUserJointSetRowMaximumFriction (const joint : NewtonJoint; friction : dFloat); cdecl; external NEWTON_API;
  1214.  procedure NewtonUserJointSetRowAcceleration (const joint : NewtonJoint; acceleration : dFloat); cdecl; external NEWTON_API;
  1215.  procedure NewtonUserJointSetRowSpringDamperAcceleration (const joint : NewtonJoint; springK : dFloat; springD : dFloat); cdecl; external NEWTON_API;
  1216.  procedure NewtonUserJointSetRowStiffness (const joint : NewtonJoint; stiffness : dFloat); cdecl; external NEWTON_API;
  1217.  function NewtonUserJointGetRowForce (const joint : NewtonJoint; row : Integer) : dFloat; cdecl; external NEWTON_API;
  1218.  
  1219.  procedure NewtonUserJointSetSolver (const joint : NewtonJoint; solver : Integer; maxContactJoints : Integer); cdecl; external NEWTON_API;
  1220.  
  1221.  
  1222.  // **********************************************************************************************
  1223.  //
  1224.  // Mesh joint functions
  1225.  //
  1226.  // **********************************************************************************************
  1227.  function NewtonMeshCreate(const world : NewtonWorld) : NewtonMesh; cdecl; external NEWTON_API;
  1228.  function NewtonMeshCreateFromMesh(const mesh : NewtonMesh) : NewtonMesh; cdecl; external NEWTON_API;
  1229.  function NewtonMeshCreateFromCollision(const collision : NewtonCollision) : NewtonMesh; cdecl; external NEWTON_API;
  1230.  function NewtonMeshCreateConvexHull (const world : NewtonWorld; pointCount : Integer; const vertexCloud : PdFloat; strideInBytes : Integer; tolerance : dFloat) : NewtonMesh; cdecl; external NEWTON_API;
  1231.  function NewtonMeshCreateDelaunayTetrahedralization (const world : NewtonWorld; pointCount : Integer; const vertexCloud : PdFloat; strideInBytes : Integer; materialID : Integer; const textureMatrix : PdFloat) : NewtonMesh; cdecl; external NEWTON_API;
  1232.  function NewtonMeshCreateVoronoiConvexDecomposition (const world : NewtonWorld; pointCount : Integer; const vertexCloud : PdFloat; strideInBytes : Integer; materialID : Integer; const textureMatrix : PdFloat; boderConvexSize : dFloat) : NewtonMesh; cdecl; external NEWTON_API;
  1233.  
  1234.  procedure NewtonMeshDestroy(const mesh : NewtonMesh); cdecl; external NEWTON_API;
  1235.  
  1236.  procedure NewtonMeshSaveOFF(const mesh : NewtonMesh; const filename : PChar); cdecl; external NEWTON_API;
  1237.  function NewtonMeshLoadOFF(const world : NewtonWorld; const filename : PChar) : NewtonMesh; cdecl; external NEWTON_API;
  1238.  
  1239.  procedure NewtonMesApplyTransform (const mesh : NewtonMesh; const matrix : PdFloat); cdecl; external NEWTON_API;
  1240.  procedure NewtonMeshCalculateOOBB(const mesh : NewtonMesh; matrix : PdFloat; x : PdFloat; y : PdFloat; z : PdFloat); cdecl; external NEWTON_API;
  1241.  
  1242.  procedure NewtonMeshCalculateVertexNormals(const mesh : NewtonMesh; angleInRadians : dFloat); cdecl; external NEWTON_API;
  1243.  procedure NewtonMeshApplySphericalMapping(const mesh : NewtonMesh; material : Integer); cdecl; external NEWTON_API;
  1244.  procedure NewtonMeshApplyBoxMapping(const mesh : NewtonMesh; front : Integer; side : Integer; top : Integer); cdecl; external NEWTON_API;
  1245.  procedure NewtonMeshApplyCylindricalMapping(const mesh : NewtonMesh; cylinderMaterial : Integer; capMaterial : Integer); cdecl; external NEWTON_API;
  1246.  
  1247.  function NewtonMeshIsOpenMesh (const mesh : NewtonMesh) : Integer; cdecl; external NEWTON_API;
  1248.  procedure NewtonMeshFixTJoints (const mesh : NewtonMesh); cdecl; external NEWTON_API;
  1249.  
  1250.  procedure NewtonMeshPolygonize (const mesh : NewtonMesh); cdecl; external NEWTON_API;
  1251.  procedure NewtonMeshTriangulate (const mesh : NewtonMesh); cdecl; external NEWTON_API;
  1252.  function NewtonMeshUnion (const mesh : NewtonMesh; const clipper : NewtonMesh; const clipperMatrix : PdFloat) : NewtonMesh; cdecl; external NEWTON_API;
  1253.  function NewtonMeshDifference (const mesh : NewtonMesh; const clipper : NewtonMesh; const clipperMatrix : PdFloat) : NewtonMesh; cdecl; external NEWTON_API;
  1254.  function NewtonMeshIntersection (const mesh : NewtonMesh; const clipper : NewtonMesh; const clipperMatrix : PdFloat) : NewtonMesh; cdecl; external NEWTON_API;
  1255.  procedure NewtonMeshClip (const mesh : NewtonMesh; const clipper : NewtonMesh; const clipperMatrix : PdFloat; topMesh : NewtonMesh; bottomMesh : NewtonMesh); cdecl; external NEWTON_API;
  1256.  
  1257.  function NewtonMeshSimplify (const mesh : NewtonMesh; maxVertexCount : Integer; reportPrograssCallback : PNewtonReportProgress) : NewtonMesh; cdecl; external NEWTON_API;
  1258.  function NewtonMeshApproximateConvexDecomposition (const mesh : NewtonMesh; maxConcavity : dFloat; backFaceDistanceFactor : dFloat; maxCount : Integer; maxVertexPerHull : Integer; reportPrograssCallback : PNewtonReportProgress) : NewtonMesh; cdecl; external NEWTON_API;
  1259.  
  1260.  procedure NewtonRemoveUnusedVertices(const mesh : NewtonMesh; vertexRemapTable : PInteger); cdecl; external NEWTON_API;
  1261.  
  1262.  procedure NewtonMeshBeginFace(const mesh : NewtonMesh); cdecl; external NEWTON_API;
  1263.  procedure NewtonMeshAddFace(const mesh : NewtonMesh; vertexCount : Integer; const vertex : PdFloat; strideInBytes : Integer; materialIndex : Integer); cdecl; external NEWTON_API;
  1264.  procedure NewtonMeshEndFace(const mesh : NewtonMesh); cdecl; external NEWTON_API;
  1265.  
  1266.  procedure NewtonMeshBuildFromVertexListIndexList(const mesh : NewtonMesh; faceCount : Integer; const faceIndexCount : PInteger; const faceMaterialIndex : PInteger;
  1267.   const vertex : PdFloat; vertexStrideInBytes : Integer; const vertexIndex: PInteger; const normal : PdFloat; normalStrideInBytes : Integer; const normalIndex: PInteger;
  1268.   const uv0 : PdFloat; uv0StrideInBytes : Integer; const uv0Index : PInteger; const uv1 : PdFloat; uv1StrideInBytes : Integer; const uv1Index : PInteger); cdecl; external NEWTON_API;
  1269.  
  1270.  
  1271.  
  1272.  procedure NewtonMeshGetVertexStreams (const mesh : NewtonMesh; vertexStrideInByte : Integer; vertex : PdFloat;
  1273.                                        normalStrideInByte : Integer; normal : PdFloat; uvStrideInByte0 : Integer;
  1274.                                        uv0 : PdFloat; uvStrideInByte1 : Integer; uv1 : PdFloat); cdecl; external NEWTON_API;
  1275.  procedure NewtonMeshGetIndirectVertexStreams(const mesh : NewtonMesh; vertexStrideInByte : Integer;
  1276.                                               vertex : PdFloat; vertexIndices : PInteger; vertexCount : PInteger;
  1277.                                               normalStrideInByte : Integer; normal : PdFloat; normalIndices : PInteger;
  1278.                                               normalCount : PInteger; uvStrideInByte0 : Integer; uv0 : PdFloat;
  1279.                                               uvIndices0 : PInteger; uvCount0 : PInteger; uvStrideInByte1 : Integer;
  1280.                                               uv1 : PdFloat; uvIndices1 : PInteger; uvCount1 : PInteger); cdecl; external NEWTON_API;
  1281.  function NewtonMeshBeginHandle (const mesh : NewtonMesh) : NewtonMeshHandle; cdecl; external NEWTON_API;
  1282.  procedure NewtonMeshEndHandle (const mesh : NewtonMesh; handle : NewtonMeshHandle); cdecl; external NEWTON_API;
  1283.  function NewtonMeshFirstMaterial (const mesh : NewtonMesh; handle : NewtonMeshHandle) : Integer; cdecl; external NEWTON_API;
  1284.  function NewtonMeshNextMaterial (const mesh : NewtonMesh; handle : NewtonMeshHandle; materialId : Integer) : Integer; cdecl; external NEWTON_API;
  1285.  function NewtonMeshMaterialGetMaterial (const mesh : NewtonMesh; handle : NewtonMeshHandle; materialId : Integer) : Integer; cdecl; external NEWTON_API;
  1286.  function NewtonMeshMaterialGetIndexCount (const mesh : NewtonMesh; handle : NewtonMeshHandle; materialId : Integer) : Integer; cdecl; external NEWTON_API;
  1287.  procedure NewtonMeshMaterialGetIndexStream (const mesh : NewtonMesh; handle : NewtonMeshHandle; materialId : Integer; index : PInteger); cdecl; external NEWTON_API;
  1288.  procedure NewtonMeshMaterialGetIndexStreamShort (const mesh : NewtonMesh; handle : NewtonMeshHandle; materialId : Integer; index : PSmallInt); cdecl; external NEWTON_API;
  1289.  
  1290.  function NewtonMeshCreateFirstSingleSegment (const mesh : NewtonMesh) : NewtonMesh; cdecl; external NEWTON_API;
  1291.  function NewtonMeshCreateNextSingleSegment (const mesh : NewtonMesh; const segment : NewtonMesh) : NewtonMesh; cdecl; external NEWTON_API;
  1292.  
  1293.  function NewtonMeshCreateFirstLayer (const mesh : NewtonMesh) : NewtonMesh; cdecl; external NEWTON_API;
  1294.  function NewtonMeshCreateNextLayer (const mesh : NewtonMesh; const segment : NewtonMesh) : NewtonMesh; cdecl; external NEWTON_API;
  1295.  
  1296.  
  1297.  function NewtonMeshGetTotalFaceCount (const mesh : NewtonMesh) : Integer; cdecl; external NEWTON_API;
  1298.  function NewtonMeshGetTotalIndexCount (const mesh : NewtonMesh) : Integer; cdecl; external NEWTON_API;
  1299.  procedure NewtonMeshGetFaces (const mesh : NewtonMesh; faceIndexCount : PInteger; faceMaterial : PInteger; faceIndices : Pointer); cdecl; external NEWTON_API;
  1300.  
  1301.  
  1302.  function NewtonMeshGetPointCount (const mesh : NewtonMesh) : Integer; cdecl; external NEWTON_API;
  1303.  function NewtonMeshGetPointStrideInByte (const mesh : NewtonMesh) : Integer; cdecl; external NEWTON_API;
  1304.  function NewtonMeshGetPointArray (const mesh : NewtonMesh) : PdFloat64; cdecl; external NEWTON_API;
  1305.  function NewtonMeshGetNormalArray (const mesh : NewtonMesh) : PdFloat64; cdecl; external NEWTON_API;
  1306.  function NewtonMeshGetUV0Array (const mesh : NewtonMesh) : PdFloat64; cdecl; external NEWTON_API;
  1307.  function NewtonMeshGetUV1Array (const mesh : NewtonMesh) : PdFloat64; cdecl; external NEWTON_API;
  1308.  
  1309.  function NewtonMeshGetVertexCount (const mesh : NewtonMesh) : Integer; cdecl; external NEWTON_API;
  1310.  function NewtonMeshGetVertexStrideInByte (const mesh : NewtonMesh) : Integer; cdecl; external NEWTON_API;
  1311.  function NewtonMeshGetVertexArray (const mesh : NewtonMesh) : PdFloat64; cdecl; external NEWTON_API;
  1312.  
  1313.  
  1314.  function NewtonMeshGetFirstVertex (const mesh : NewtonMesh) : NewtonMeshVertex; cdecl; external NEWTON_API;
  1315.  function NewtonMeshGetNextVertex (const mesh : NewtonMesh; const vertex : NewtonMeshVertex) : NewtonMeshVertex; cdecl; external NEWTON_API;
  1316.  function NewtonMeshGetVertexIndex (const mesh : NewtonMesh; const vertex : NewtonMeshVertex) : Integer; cdecl; external NEWTON_API;
  1317.  
  1318.  function NewtonMeshGetFirstPoint (const mesh : NewtonMesh) : NewtonMeshPoint; cdecl; external NEWTON_API;
  1319.  function NewtonMeshGetNextPoint (const mesh : NewtonMesh; const point : NewtonMeshPoint) : NewtonMeshPoint; cdecl; external NEWTON_API;
  1320.  function NewtonMeshGetPointIndex (const mesh : NewtonMesh; const point : NewtonMeshPoint) : Integer; cdecl; external NEWTON_API;
  1321.  function NewtonMeshGetVertexIndexFromPoint (const mesh : NewtonMesh; const point : NewtonMeshPoint) : Integer; cdecl; external NEWTON_API;
  1322.  
  1323.  
  1324.  function NewtonMeshGetFirstEdge (const mesh : NewtonMesh) : NewtonMeshEdge; cdecl; external NEWTON_API;
  1325.  function NewtonMeshGetNextEdge (const mesh : NewtonMesh; const edge : NewtonMeshEdge) : NewtonMeshEdge; cdecl; external NEWTON_API;
  1326.  procedure NewtonMeshGetEdgeIndices (const mesh : NewtonMesh; const edge : NewtonMeshEdge; v0 : PInteger; v1 : PInteger); cdecl; external NEWTON_API;
  1327.  //procedure NewtonMeshGetEdgePointIndices (const mesh : NewtonMesh; const void* const edge, int* const v0, int* const v1);
  1328.  
  1329.  function NewtonMeshGetFirstFace (const mesh : NewtonMesh) : NewtonMeshFace; cdecl; external NEWTON_API;
  1330.  function NewtonMeshGetNextFace (const mesh : NewtonMesh; const face : NewtonMeshFace) : NewtonMeshFace; cdecl; external NEWTON_API;
  1331.  function NewtonMeshIsFaceOpen (const mesh : NewtonMesh; const face : NewtonMeshFace) : Integer; cdecl; external NEWTON_API;
  1332.  function NewtonMeshGetFaceMaterial (const mesh : NewtonMesh; const face : NewtonMeshFace) : Integer; cdecl; external NEWTON_API;
  1333.  function NewtonMeshGetFaceIndexCount (const mesh : NewtonMesh; const face : NewtonMeshFace) : Integer; cdecl; external NEWTON_API;
  1334.  procedure NewtonMeshGetFaceIndices (const mesh : NewtonMesh; const face : NewtonMeshFace; indices : PInteger); cdecl; external NEWTON_API;
  1335.  procedure NewtonMeshGetFacePointIndices (const mesh : NewtonMesh; const face : NewtonMeshFace; indices : PInteger); cdecl; external NEWTON_API;
  1336.  procedure NewtonMeshCalculateFaceNormal (const mesh : NewtonMesh; const face : NewtonMeshFace; normal : PdFloat64); cdecl; external NEWTON_API;
  1337.  
  1338.  procedure NewtonMeshSetFaceMaterial (const mesh : NewtonMesh; const face : NewtonMeshFace; matId : Integer); cdecl; external NEWTON_API;
  1339.  
  1340.  
  1341. implementation
  1342.  
  1343. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement