common.bmx 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ' Copyright (c) 2015-2016 Bruce A Henderson
  2. '
  3. ' This software is provided 'as-is', without any express or implied
  4. ' warranty. In no event will the authors be held liable for any damages
  5. ' arising from the use of this software.
  6. '
  7. ' Permission is granted to anyone to use this software for any purpose,
  8. ' including commercial applications, and to alter it and redistribute it
  9. ' freely, subject to the following restrictions:
  10. '
  11. ' 1. The origin of this software must not be misrepresented; you must not
  12. ' claim that you wrote the original software. If you use this software
  13. ' in a product, an acknowledgment in the product documentation would be
  14. ' appreciated but is not required.
  15. '
  16. ' 2. Altered source versions must be plainly marked as such, and must not be
  17. ' misrepresented as being the original software.
  18. '
  19. ' 3. This notice may not be removed or altered from any source
  20. ' distribution.
  21. '
  22. SuperStrict
  23. Import "source.bmx"
  24. Extern
  25. Function bmx_newtondynamics_NewtonCreate:Byte Ptr(obj:Object)
  26. Function NewtonDestroy(world:Byte Ptr)
  27. Function NewtonDestroyAllBodies(world:Byte Ptr)
  28. Function NewtonInvalidateCache(world:Byte Ptr)
  29. Function NewtonUpdate(world:Byte Ptr, timestep:Float)
  30. Function NewtonSetFrictionModel(world:Byte Ptr, model:Int)
  31. Function NewtonSetMinimumFrameRate(world:Byte Ptr, framerate:Float)
  32. Function NewtonSetContactMergeTolerance(world:Byte Ptr, tolerance:Float)
  33. Function bmx_newtondynamics_NewtonCreateDynamicBody:Byte Ptr(obj:Object, world:Byte Ptr, coll:Byte Ptr, matrix:Float Ptr)
  34. Function bmx_newtondynamics_NewtonCreateSphere:Byte Ptr(obj:Object, world:Byte Ptr, radius:Float, shapeID:Int, offsetMatrix:Float Ptr)
  35. Function bmx_newtondynamics_NewtonCreateBox:Byte Ptr(obj:Object, world:Byte Ptr, dx:Float, dy:Float, dz:Float, shapeID:Int, offsetMatrix:Float Ptr)
  36. Function bmx_newtondynamics_NewtonCreateTreeCollision:Byte Ptr(obj:Object, world:Byte Ptr, shapeID:Int)
  37. Function bmx_newtondynamics_NewtonCreateCylinder:Byte Ptr(obj:Object, world:Byte Ptr, radius:Float, height:Float, shapeID:Int, offsetMatrix:Float Ptr)
  38. Function NewtonMeshCreate:Byte Ptr(world:Byte Ptr)
  39. Function bmx_newtondynamics_NewtonWorldRayCast(world:Byte Ptr, p0x:Float, p0y:Float, p0z:Float, p1x:Float, p1y:Float, p1z:Float, ..
  40. fcb:Float(bodyPtr:Byte Ptr, collPtr:Byte Ptr, hitContact:Float Ptr, hitNormal:Float Ptr, delPtr:Byte Ptr, intersectParam:Float), ..
  41. delegate:Object, _pfcb:Int(bodyPtr:Byte Ptr, collPtr:Byte Ptr, delPtr:Byte Ptr), threadIndex:Int)
  42. Function NewtonWorldGetBodyCount:Int(world:Byte Ptr)
  43. Function NewtonWorldGetConstraintCount:Int(world:Byte Ptr)
  44. Function NewtonDestroyCollision(coll:Byte Ptr)
  45. Function NewtonTreeCollisionBeginBuild(coll:Byte Ptr)
  46. Function NewtonTreeCollisionEndBuild(coll:Byte Ptr, optimize:Int)
  47. Function NewtonTreeCollisionAddFace(coll:Byte Ptr, vertexCount:Int, vertexPtr:Float Ptr, strideInBytes:Int, faceAttribute:Int)
  48. Function NewtonDestroyBody(body:Byte Ptr)
  49. Function NewtonBodyGetMatrix(body:Byte Ptr, matrix:Float Ptr)
  50. Function NewtonBodySetForceAndTorqueCallback(body:Byte Ptr, callback(body:Byte Ptr, timestamp:Float, threadIndex:Int))
  51. Function NewtonBodySetSimulationState(body:Byte Ptr, state:Int)
  52. Function NewtonBodyGetSimulationState:Int(body:Byte Ptr)
  53. Function NewtonBodyGetType:Int(body:Byte Ptr)
  54. Function NewtonBodyGetCollidable:Int(body:Byte Ptr)
  55. Function NewtonBodySetCollidable(body:Byte Ptr, collidableState:Int)
  56. Function NewtonBodyGetMassMatrix(body:Byte Ptr, mass:Float Ptr, Ixx:Float Ptr, Iyy:Float Ptr, Izz:Float Ptr)
  57. Function NewtonBodySetMassProperties(body:Byte Ptr, mass:Float, coll:Byte Ptr)
  58. Function NewtonBodySetLinearDamping(body:Byte Ptr, linearDamp:Float)
  59. Function NewtonBodyGetInvMass(body:Byte Ptr, mass:Float Ptr, Ixx:Float Ptr, Iyy:Float Ptr, Izz:Float Ptr)
  60. Function NewtonBodyGetInertiaMatrix(body:Byte Ptr, matrix:Float Ptr)
  61. Function NewtonBodyGetInvInertiaMatrix(body:Byte Ptr, matrix:Float Ptr)
  62. Function NewtonBodySetMatrix(body:Byte Ptr, matrix:Float Ptr)
  63. Function NewtonBodySetTransformCallback(body:Byte Ptr, callback(body:Byte Ptr, matrix:Float Ptr, threadIndex:Int))
  64. Function bmx_newtondynamics_NewtonBodyGetRotation(body:Byte Ptr, q0:Float Ptr, q1:Float Ptr, q2:Float Ptr, q3:Float Ptr)
  65. Function bmx_newtondynamics_NewtonBodyGetOmega(body:Byte Ptr, ox:Float Ptr, oy:Float Ptr, oz:Float Ptr)
  66. Function bmx_newtondynamics_NewtonBodyGetVelocity(body:Byte Ptr, vx:Float Ptr, vy:Float Ptr, vz:Float Ptr)
  67. Function bmx_newtondynamics_NewtonBodyGetForce(body:Byte Ptr, fx:Float Ptr, fy:Float Ptr, fz:Float Ptr)
  68. Function bmx_newtondynamics_NewtonBodyGetTorque(body:Byte Ptr, tx:Float Ptr, ty:Float Ptr, tz:Float Ptr)
  69. Function bmx_newtondynamics_NewtonBodyGetForceAcc(body:Byte Ptr, fx:Float Ptr, fy:Float Ptr, fz:Float Ptr)
  70. Function bmx_newtondynamics_NewtonBodyGetTorqueAcc(body:Byte Ptr, tx:Float Ptr, ty:Float Ptr, tz:Float Ptr)
  71. Function bmx_newtondynamics_NewtonBodyGetCentreOfMass(body:Byte Ptr, cx:Float Ptr, cy:Float Ptr, cz:Float Ptr)
  72. Function bmx_newtondynamics_NewtonBodySetAngularDamping(body:Byte Ptr, aX:Float, aY:Float, aZ:Float)
  73. Function bmx_newtondynamics_NewtonBodyGetAngularDamping(body:Byte Ptr, aX:Float Ptr, aY:Float Ptr, aZ:Float Ptr)
  74. Function bmx_newtondynamics_NewtonBodySetOmega(body:Byte Ptr, ox:Float, oy:Float, oz:Float, ow:Float)
  75. Function bmx_newtondynamics_NewtonBodySetVelocity(body:Byte Ptr, vx:Float, vy:Float, vz:Float, vw:Float)
  76. Function bmx_newtondynamics_NewtonBodySetForce(body:Byte Ptr, fx:Float, fy:Float, yz:Float, fw:Float)
  77. Function bmx_newtondynamics_NewtonBodySetTorque(body:Byte Ptr, tx:Float, ty:Float, tz:Float, tw:Float)
  78. Function bmx_newtondynamics_NewtonBodyGetAABB(body:Byte Ptr, p0x:Float Ptr, p0y:Float Ptr, p0z:Float Ptr, p1x:Float Ptr, p1y:Float Ptr, p1z:Float Ptr)
  79. Function bmx_newtondynamics_NewtonBodyAddForce(body:Byte Ptr, fx:Float, fy:Float, yz:Float)
  80. Function bmx_newtondynamics_NewtonBodyAddTorque(body:Byte Ptr, tx:Float, ty:Float, tz:Float)
  81. Function bmx_newtondynamics_NewtonBodyCalculateInverseDynamicsForce(body:Byte Ptr, timestep:Float, vx:Float, vy:Float, vz:Float, fx:Float Ptr, fy:Float Ptr, fz:Float Ptr)
  82. Function bmx_newtondynamics_matrix_GetEulerAngles(frontX:Float Ptr, pitch0:Float Ptr, yaw0:Float Ptr, roll0:Float Ptr, pitch1:Float Ptr, yaw1:Float Ptr, roll1:Float Ptr)
  83. Function NewtonMeshDestroy(mesh:Byte Ptr)
  84. Function NewtonMeshApplyTransform(mesh:Byte Ptr, matrix:Float Ptr)
  85. Function NewtonMeshCalculateOOBB(mesh:Byte Ptr, matrix:Float Ptr, x:Float Ptr, y:Float Ptr, z:Float Ptr)
  86. Function NewtonMeshCalculateVertexNormals(mesh:Byte Ptr, angle:Float)
  87. Function NewtonMeshApplySphericalMapping(mesh:Byte Ptr, material:Int)
  88. Function NewtonMeshApplyCylindricalMapping(mesh:Byte Ptr, cylinderMaterial:Int, capMaterial:Int)
  89. Function NewtonMeshApplyBoxMapping(mesh:Byte Ptr, front:Int, side:Int, top:Int)
  90. Function NewtonMeshIsOpenMesh:Int(mesh:Byte Ptr)
  91. Function NewtonMeshFixTJoints(mesh:Byte Ptr)
  92. Function NewtonMeshPolygonize(mesh:Byte Ptr)
  93. Function NewtonMeshTriangulate(mesh:Byte Ptr)
  94. Function NewtonMeshBeginFace(mesh:Byte Ptr)
  95. Function NewtonMeshAddFace(mesh:Byte Ptr, vertexCount:Int, vertex:Float Ptr, strideInBytes:Int, materialIndex:Int)
  96. Function NewtonMeshEndFace(mesh:Byte Ptr)
  97. Function NewtonMeshGetVertexCount:Int(mesh:Byte Ptr)
  98. Function NewtonMeshGetVertexStrideInByte:Int(mesh:Byte Ptr)
  99. Function NewtonMeshGetVertexArray:Double Ptr(mesh:Byte Ptr)
  100. Function NewtonMeshGetTotalFaceCount:Int(mesh:Byte Ptr)
  101. Function NewtonMeshGetTotalIndexCount:Int(mesh:Byte Ptr)
  102. Function NewtonMeshGetPointCount:Int(mesh:Byte Ptr)
  103. Function NewtonMeshGetPointStrideInByte:Int(mesh:Byte Ptr)
  104. Function NewtonMeshGetPointArray:Double Ptr(mesh:Byte Ptr)
  105. Function NewtonMeshGetNormalArray:Double Ptr(mesh:Byte Ptr)
  106. Function NewtonMeshGetUV0Array:Double Ptr(mesh:Byte Ptr)
  107. Function NewtonMeshGetUV1Array:Double Ptr(mesh:Byte Ptr)
  108. End Extern
  109. Const NEWTON_DYNAMIC_BODY:Int = 0
  110. Const NEWTON_KINEMATIC_BODY :Int = 1
  111. Const NEWTON_DEFORMABLE_BODY:Int = 2