|
newton
#113041
02/21/07 18:53
02/21/07 18:53
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
i started to convert the newton header to make it usable with lite-c. this is what i have so far: Code:
typedef float dFloat;
typedef struct NewtonBody{void* dummy;} NewtonBody; typedef struct NewtonWorld{void* dummy;} NewtonWorld; typedef struct NewtonJoint{void* dummy;} NewtonJoint; typedef struct NewtonContact{void* dummy;} NewtonContact; typedef struct NewtonMaterial{void* dummy;} NewtonMaterial; typedef struct NewtonCollision{void* dummy;} NewtonCollision;
typedef struct NewtonRagDoll{void* dummy;} NewtonRagDoll; typedef struct NewtonRagDollBone{void* dummy;} NewtonRagDollBone;
typedef struct NewtonUserMeshCollisionCollideDescTag { dFloat m_boxP0[4]; dFloat m_boxP1[4]; void* m_userData; int m_faceCount; dFloat* m_vertex; int m_vertexStrideInBytes; int* m_userAttribute; int* m_faceIndexCount; int* m_faceVertexIndex; NewtonBody* m_objBody; NewtonBody* m_polySoupBody; } NewtonUserMeshCollisionCollideDesc;
typedef struct NewtonUserMeshCollisionRayHitDescTag { dFloat m_p0[4]; dFloat m_p1[4]; dFloat m_normalOut[4]; int m_userIdOut; void* m_userData; } NewtonUserMeshCollisionRayHitDesc;
typedef struct NewtonHingeSliderUpdateDescTag { dFloat m_accel; dFloat m_minFriction; dFloat m_maxFriction; dFloat m_timestep; } NewtonHingeSliderUpdateDesc;
// newton callback functions
/* typedef void* (*NewtonAllocMemory) (int sizeInBytes); typedef void (*NewtonFreeMemory) (void *ptr, int sizeInBytes);
typedef void (*NewtonSerialize) (void* serializeHandle, const void* buffer, size_t size); typedef void (*NewtonDeserialize) (void* serializeHandle, void* buffer, size_t size);
typedef void (*NewtonUserMeshCollisionCollideCallback) (NewtonUserMeshCollisionCollideDesc* collideDescData); typedef dFloat (*NewtonUserMeshCollisionRayHitCallback) (NewtonUserMeshCollisionRayHitDesc* lineDescData); typedef void (*NewtonUserMeshCollisionDestroyCallback) (void* descData); typedef void (*NewtonTreeCollisionCallback) (const NewtonBody* bodyWithTreeCollision, const NewtonBody* body, const dFloat* vertex, int vertexstrideInBytes, int indexCount, const int* indexArray);
typedef void (*NewtonBodyDestructor) (const NewtonBody* body); typedef void (*NewtonApplyForceAndTorque) (const NewtonBody* body); typedef void (*NewtonBodyActivationState) (const NewtonBody* body, unsigned state); typedef void (*NewtonSetTransform) (const NewtonBody* body, const dFloat* matrix); typedef void (*NewtonSetRagDollTransform) (const NewtonRagDollBone* bone); typedef void (*NewtonGetBuoyancyPlane) (void *context, const dFloat* globalSpaceMatrix, dFloat* globalSpacePlane);
typedef void (*NewtonVehicleTireUpdate) (const NewtonJoint* vehicle);
typedef dFloat (*NewtonWorldRayFilterCallback)(const NewtonBody* body, const dFloat* hitNormal, int collisionID, void* userData, dFloat intersetParam); typedef void (*NewtonBodyLeaveWorld) (const NewtonBody* body);
typedef int (*NewtonContactBegin) (const NewtonMaterial* material, const NewtonBody* body0, const NewtonBody* body1); typedef int (*NewtonContactProcess) (const NewtonMaterial* material, const NewtonContact* contact); typedef void (*NewtonContactEnd) (const NewtonMaterial* material);
typedef void (*NewtonBodyIterator) (const NewtonBody* body); typedef void (*NewtonCollisionIterator) (const NewtonBody* body, int vertexCount, const dFloat* FaceArray, int faceId);
typedef void (*NewtonBallCallBack) (const NewtonJoint* ball); typedef unsigned (*NewtonHingeCallBack) (const NewtonJoint* hinge, NewtonHingeSliderUpdateDesc* desc); typedef unsigned (*NewtonSliderCallBack) (const NewtonJoint* slider, NewtonHingeSliderUpdateDesc* desc); typedef unsigned (*NewtonUniversalCallBack) (const NewtonJoint* universal, NewtonHingeSliderUpdateDesc* desc); typedef unsigned (*NewtonCorkscrewCallBack) (const NewtonJoint* corkscrew, NewtonHingeSliderUpdateDesc* desc); typedef void (*NewtonUserBilateralCallBack) (const NewtonJoint* userJoint);
typedef void (*NewtonConstraintDestructor) (const NewtonJoint* me); */
// ********************************************************************************************** // // world control functions // // ********************************************************************************************** NewtonWorld* NewtonCreate (void* malloc, void* mfree); void NewtonDestroy (NewtonWorld* newtonWorld); void NewtonDestroyAllBodies (NewtonWorld* newtonWorld);
void NewtonUpdate (NewtonWorld* newtonWorld, dFloat timestep); void NewtonSetSolverModel (NewtonWorld* newtonWorld, int model); void NewtonSetFrictionModel (NewtonWorld* newtonWorld, int model); dFloat NewtonGetTimeStep (NewtonWorld* newtonWorld); void NewtonSetMinimumFrameRate (NewtonWorld* newtonWorld, dFloat frameRate); void NewtonSetBodyLeaveWorldEvent (NewtonWorld* newtonWorld, void* callback); void NewtonSetWorldSize (NewtonWorld* newtonWorld, dFloat* minPoint, dFloat* maxPoint);
void NewtonWorldFreezeBody (NewtonWorld* newtonWorld, NewtonBody* body); void NewtonWorldUnfreezeBody (NewtonWorld* newtonWorld, NewtonBody* body);
void NewtonWorldForEachBodyDo (NewtonWorld* newtonWorld, void* callback);
void NewtonWorldSetUserData (NewtonWorld* newtonWorld, void* userData); void* NewtonWorldGetUserData (NewtonWorld* newtonWorld); int NewtonWorldGetVersion (NewtonWorld* newtonWorld);
void NewtonWorldRayCast (NewtonWorld* newtonWorld, dFloat* p0, dFloat* p1, void* filter, void* userData);
// ********************************************************************************************** // // physics material section // // ********************************************************************************************** int NewtonMaterialGetDefaultGroupID(NewtonWorld* newtonWorld); int NewtonMaterialCreateGroupID(NewtonWorld* newtonWorld); void NewtonMaterialDestroyAllGroupID(NewtonWorld* newtonWorld);
void NewtonMaterialSetDefaultSoftness (NewtonWorld* newtonWorld, int id0, int id1, dFloat value); void NewtonMaterialSetDefaultElasticity (NewtonWorld* newtonWorld, int id0, int id1, dFloat elasticCoef); void NewtonMaterialSetDefaultCollidable (NewtonWorld* newtonWorld, int id0, int id1, int state); void NewtonMaterialSetContinuousCollisionMode (NewtonWorld* newtonWorld, int id0, int id1, int state); void NewtonMaterialSetDefaultFriction (NewtonWorld* newtonWorld, int id0, int id1, dFloat staticFriction, dFloat kineticFriction);
void NewtonMaterialSetCollisionCallback (NewtonWorld* newtonWorld, int id0, int id1, void* userData, void* begin, void* process, void* end);
void* NewtonMaterialGetUserData (NewtonWorld* newtonWorld, int id0, int id1);
// ********************************************************************************************** // // physics contact control functions // // ********************************************************************************************** void NewtonMaterialDisableContact (NewtonMaterial* material); dFloat NewtonMaterialGetCurrentTimestep (NewtonMaterial* material); void* NewtonMaterialGetMaterialPairUserData (NewtonMaterial* material); int NewtonMaterialGetContactFaceAttribute (NewtonMaterial* material); // unsigned -> int? int NewtonMaterialGetBodyCollisionID (NewtonMaterial* material, NewtonBody* body); // unsigned -> int? dFloat NewtonMaterialGetContactNormalSpeed (NewtonMaterial* material, NewtonContact* contactlHandle); void NewtonMaterialGetContactForce (NewtonMaterial* material, dFloat* force); void NewtonMaterialGetContactPositionAndNormal (NewtonMaterial* material, dFloat* posit, dFloat* normal); void NewtonMaterialGetContactTangentDirections (NewtonMaterial* material, dFloat* dir0, dFloat* dir); dFloat NewtonMaterialGetContactTangentSpeed (NewtonMaterial* material, NewtonContact* contactlHandle, int index);
void NewtonMaterialSetContactSoftness (NewtonMaterial* material, dFloat softness); void NewtonMaterialSetContactElasticity (NewtonMaterial* material, dFloat restitution); void NewtonMaterialSetContactFrictionState (NewtonMaterial* material, int state, int index); void NewtonMaterialSetContactStaticFrictionCoef (NewtonMaterial* material, dFloat coef, int index); void NewtonMaterialSetContactKineticFrictionCoef (NewtonMaterial* material, dFloat coef, int index);
void NewtonMaterialSetContactNormalAcceleration (NewtonMaterial* material, dFloat accel); void NewtonMaterialSetContactNormalDirection (NewtonMaterial* material, dFloat* directionVector);
void NewtonMaterialSetContactTangentAcceleration (NewtonMaterial* material, dFloat accel, int index); void NewtonMaterialContactRotateTangentDirections (NewtonMaterial* material, dFloat* directionVector);
// ********************************************************************************************** // // convex collision primitives creation functions // // ********************************************************************************************** NewtonCollision* NewtonCreateNull (NewtonWorld* newtonWorld); NewtonCollision* NewtonCreateSphere (NewtonWorld* newtonWorld, dFloat radiusX, dFloat radiusY, dFloat radiusZ, dFloat *offsetMatrix); NewtonCollision* NewtonCreateBox (NewtonWorld* newtonWorld, dFloat dx, dFloat dy, dFloat dz, dFloat *offsetMatrix); NewtonCollision* NewtonCreateCone (NewtonWorld* newtonWorld, dFloat radius, dFloat height, dFloat *offsetMatrix); NewtonCollision* NewtonCreateCapsule (NewtonWorld* newtonWorld, dFloat radius, dFloat height, dFloat *offsetMatrix); NewtonCollision* NewtonCreateCylinder (NewtonWorld* newtonWorld, dFloat radius, dFloat height, dFloat *offsetMatrix); NewtonCollision* NewtonCreateChamferCylinder (NewtonWorld* newtonWorld, dFloat radius, dFloat height, dFloat *offsetMatrix); NewtonCollision* NewtonCreateConvexHull (NewtonWorld* newtonWorld, int count, dFloat* vertexCloud, int strideInBytes, dFloat *offsetMatrix); NewtonCollision* NewtonCreateConvexHullModifier (NewtonWorld* newtonWorld, NewtonCollision* convexHullCollision); void NewtonConvexHullModifierGetMatrix (NewtonCollision* convexHullCollision, dFloat* matrix); void NewtonConvexHullModifierSetMatrix (NewtonCollision* convexHullCollision, dFloat* matrix);
void NewtonConvexCollisionSetUserID (NewtonCollision* convexCollision, int id); // unsigned -> int? int NewtonConvexCollisionGetUserID (NewtonCollision* convexCollision); // unsigned -> int?
dFloat NewtonConvexCollisionCalculateVolume (NewtonCollision* convexCollision); void NewtonConvexCollisionCalculateInertialMatrix (NewtonCollision* convexCollision, dFloat* inertia, dFloat* origin);
void NewtonReleaseCollision (NewtonWorld* newtonWorld, NewtonCollision* collision);
// ********************************************************************************************** // // complex collision primitives creation functions // note: can only be used with static bodies (bodies with infinite mass) // // ********************************************************************************************** NewtonCollision* NewtonCreateCompoundCollision (NewtonWorld* newtonWorld, int count, NewtonCollision** collisionPrimitiveArray);
NewtonCollision* NewtonCreateUserMeshCollision (NewtonWorld* newtonWorld, dFloat *minBox, dFloat *maxBox, void *userData, void* collideCallback, void* rayHitCallback, void* destroyCallback);
// ********************************************************************************************** // // collisiontree utility functions // // ********************************************************************************************** NewtonCollision* NewtonCreateTreeCollision (NewtonWorld* newtonWorld, void* userCallback); void NewtonTreeCollisionBeginBuild (NewtonCollision* treeCollision); void NewtonTreeCollisionAddFace (NewtonCollision* treeCollision, int vertexCount, dFloat* vertexPtr, int strideInBytes, int faceAttribute); void NewtonTreeCollisionEndBuild (NewtonCollision* treeCollision, int optimize);
void NewtonTreeCollisionSerialize (NewtonCollision* treeCollision, void* serializeFunction, void* serializeHandle); NewtonCollision* NewtonCreateTreeCollisionFromSerialization (NewtonWorld* newtonWorld, void* userCallback, void* deserializeFunction, void* serializeHandle);
int NewtonTreeCollisionGetFaceAtribute (NewtonCollision* treeCollision, int* faceIndexArray); void NewtonTreeCollisionSetFaceAtribute (NewtonCollision* treeCollision, int* faceIndexArray, int attribute);
// ********************************************************************************************** // // general purpose collision library functions // // ********************************************************************************************** int NewtonCollisionPointDistance (NewtonWorld* newtonWorld, float *point, NewtonCollision* collision, dFloat* matrix, dFloat* contact, dFloat* normal);
int NewtonCollisionClosestPoint (NewtonWorld* newtonWorld, NewtonCollision* collisionA, dFloat* matrixA, NewtonCollision* collsionB, dFloat* matrixB, dFloat* contactA, dFloat* contactB, dFloat* normalAB);
int NewtonCollisionCollide (NewtonWorld* newtonWorld, int maxSize, NewtonCollision* collisionA, dFloat* matrixA, NewtonCollision* collsionB, dFloat* matrixB, dFloat* contacts, dFloat* normals, dFloat* penetration);
int NewtonCollisionCollideContinue (NewtonWorld* newtonWorld, int maxSize, dFloat timestep, NewtonCollision* collisionA, dFloat* matrixA, dFloat* velocA, dFloat* omegaA, NewtonCollision* collisionB, dFloat* matrixB, dFloat* velocB, dFloat* omegaB, dFloat* timeOfImpact, dFloat* contacts, dFloat* normals, dFloat* penetration);
dFloat NewtonCollisionRayCast (NewtonCollision* collision, dFloat* p0, dFloat* p1, dFloat* normals, int* attribute); void NewtonCollisionCalculateAABB (NewtonCollision* collision, dFloat *matrix, dFloat* p0, dFloat* p1);
// ********************************************************************************************** // // transform utility functions // // ********************************************************************************************** void NewtonGetEulerAngle (dFloat* matrix, dFloat* eulersAngles); void NewtonSetEulerAngle (dFloat* eulersAngles, dFloat* matrix);
// ********************************************************************************************** // // body manipulation functions // // ********************************************************************************************** NewtonBody* NewtonCreateBody (NewtonWorld* newtonWorld, NewtonCollision* collision); void NewtonDestroyBody(NewtonWorld* newtonWorld, NewtonBody* body);
void NewtonBodyAddForce (NewtonBody* body, dFloat* force); void NewtonBodyAddTorque (NewtonBody* body, dFloat* torque);
void NewtonBodySetMatrix (NewtonBody* body, dFloat* matrix); void NewtonBodySetMatrixRecursive (NewtonBody* body, dFloat* matrix); void NewtonBodySetMassMatrix (NewtonBody* body, dFloat mass, dFloat Ixx, dFloat Iyy, dFloat Izz); void NewtonBodySetMaterialGroupID (NewtonBody* body, int id); void NewtonBodySetContinuousCollisionMode (NewtonBody* body, int state); // unsigned -> int void NewtonBodySetJointRecursiveCollision (NewtonBody* body, int state); // unsigned -> int void NewtonBodySetOmega (NewtonBody* body, dFloat* omega); void NewtonBodySetVelocity (NewtonBody* body, dFloat* velocity); void NewtonBodySetForce (NewtonBody* body, dFloat* force); void NewtonBodySetTorque (NewtonBody* body, dFloat* torque);
void NewtonBodySetCentreOfMass (NewtonBody* body, dFloat* com); void NewtonBodySetLinearDamping (NewtonBody* body, dFloat linearDamp); void NewtonBodySetAngularDamping (NewtonBody* body, dFloat* angularDamp); void NewtonBodySetUserData (NewtonBody* body, void* userData); void NewtonBodyCoriolisForcesMode (NewtonBody* body, int mode); void NewtonBodySetCollision (NewtonBody* body, NewtonCollision* collision); void NewtonBodySetAutoFreeze (NewtonBody* body, int state); void NewtonBodySetFreezeTreshold (NewtonBody* body, dFloat freezeSpeed2, dFloat freezeOmega2, int framesCount);
void NewtonBodySetTransformCallback (NewtonBody* body, void* callback); void NewtonBodySetDestructorCallback (NewtonBody* body, void* callback); void NewtonBodySetAutoactiveCallback (NewtonBody* body, void* callback); void NewtonBodySetForceAndTorqueCallback (NewtonBody* body, void* callback); void* NewtonBodyGetForceAndTorqueCallback (NewtonBody* body);
void* NewtonBodyGetUserData (NewtonBody* body); NewtonWorld* NewtonBodyGetWorld (NewtonBody* body); NewtonCollision* NewtonBodyGetCollision (NewtonBody* body); int NewtonBodyGetMaterialGroupID (NewtonBody* body); int NewtonBodyGetContinuousCollisionMode (NewtonBody* body); int NewtonBodyGetJointRecursiveCollision (NewtonBody* body);
void NewtonBodyGetMatrix(NewtonBody* body, dFloat* matrix); void NewtonBodyGetMassMatrix (NewtonBody* body, dFloat* mass, dFloat* Ixx, dFloat* Iyy, dFloat* Izz); void NewtonBodyGetInvMass(NewtonBody* body, dFloat* invMass, dFloat* invIxx, dFloat* invIyy, dFloat* invIzz); void NewtonBodyGetOmega(NewtonBody* body, dFloat* vector); void NewtonBodyGetVelocity(NewtonBody* body, dFloat* vector); void NewtonBodyGetForce(NewtonBody* body, dFloat* vector); void NewtonBodyGetTorque(NewtonBody* body, dFloat* vector); void NewtonBodyGetCentreOfMass (NewtonBody* body, dFloat* com);
int NewtonBodyGetSleepingState(NewtonBody* body); int NewtonBodyGetAutoFreeze(NewtonBody* body); dFloat NewtonBodyGetLinearDamping (NewtonBody* body); void NewtonBodyGetAngularDamping (NewtonBody* body, dFloat* vector); void NewtonBodyGetAABB (NewtonBody* body, dFloat* p0, dFloat* p1); void NewtonBodyGetFreezeTreshold (NewtonBody* body, dFloat* freezeSpeed2, dFloat* freezeOmega2);
void NewtonBodyAddBuoyancyForce (NewtonBody* body, dFloat fluidDensity, dFloat fluidLinearViscosity, dFloat fluidAngularViscosity, dFloat* gravityVector, void* buoyancyPlane, void* context);
void NewtonBodyForEachPolygonDo (NewtonBody* body, void* callback); void NewtonAddBodyImpulse (NewtonBody* body, dFloat* pointDeltaVeloc, dFloat* pointPosit);
// ********************************************************************************************** // // common joint functions // // ********************************************************************************************** void* NewtonJointGetUserData (NewtonJoint* joint); void NewtonJointSetUserData (NewtonJoint* joint, void* userData);
int NewtonJointGetCollisionState (NewtonJoint* joint); void NewtonJointSetCollisionState (NewtonJoint* joint, int state);
dFloat NewtonJointGetStiffness (NewtonJoint* joint); void NewtonJointSetStiffness (NewtonJoint* joint, dFloat state);
void NewtonDestroyJoint(NewtonWorld* newtonWorld, NewtonJoint* joint); void NewtonJointSetDestructor (NewtonJoint* joint, void* destructor);
// ********************************************************************************************** // // ball and socket joint functions // // ********************************************************************************************** NewtonJoint* NewtonConstraintCreateBall (NewtonWorld* newtonWorld, dFloat* pivotPoint, NewtonBody* childBody, NewtonBody* parentBody); void NewtonBallSetUserCallback (NewtonJoint* ball, void* callback); void NewtonBallGetJointAngle (NewtonJoint* ball, dFloat* angle); void NewtonBallGetJointOmega (NewtonJoint* ball, dFloat* omega); void NewtonBallGetJointForce (NewtonJoint* ball, dFloat* force); void NewtonBallSetConeLimits (NewtonJoint* ball, dFloat* pin, dFloat maxConeAngle, dFloat maxTwistAngle);
// ********************************************************************************************** // // hinge joint functions // // ********************************************************************************************** NewtonJoint* NewtonConstraintCreateHinge (NewtonWorld* newtonWorld, dFloat* pivotPoint, dFloat* pinDir, NewtonBody* childBody, NewtonBody* parentBody); void NewtonHingeSetUserCallback (NewtonJoint* hinge, void* callback); dFloat NewtonHingeGetJointAngle (NewtonJoint* hinge); dFloat NewtonHingeGetJointOmega (NewtonJoint* hinge); void NewtonHingeGetJointForce (NewtonJoint* hinge, dFloat* force); dFloat NewtonHingeCalculateStopAlpha (NewtonJoint* hinge, NewtonHingeSliderUpdateDesc* desc, dFloat angle);
// ********************************************************************************************** // // slider joint functions // // ********************************************************************************************** NewtonJoint* NewtonConstraintCreateSlider (NewtonWorld* newtonWorld, dFloat* pivotPoint, dFloat* pinDir, NewtonBody* childBody, NewtonBody* parentBody); void NewtonSliderSetUserCallback (NewtonJoint* slider, void* callback); dFloat NewtonSliderGetJointPosit (NewtonJoint* slider); dFloat NewtonSliderGetJointVeloc (NewtonJoint* slider); void NewtonSliderGetJointForce (NewtonJoint* slider, dFloat* force); dFloat NewtonSliderCalculateStopAccel (NewtonJoint* slider, NewtonHingeSliderUpdateDesc* desc, dFloat position);
// ********************************************************************************************** // // corkscrew joint functions // // ********************************************************************************************** NewtonJoint* NewtonConstraintCreateCorkscrew (NewtonWorld* newtonWorld, dFloat* pivotPoint, dFloat* pinDir, NewtonBody* childBody, NewtonBody* parentBody); void NewtonCorkscrewSetUserCallback (NewtonJoint* corkscrew, void* callback); dFloat NewtonCorkscrewGetJointPosit (NewtonJoint* corkscrew); dFloat NewtonCorkscrewGetJointAngle (NewtonJoint* corkscrew); dFloat NewtonCorkscrewGetJointVeloc (NewtonJoint* corkscrew); dFloat NewtonCorkscrewGetJointOmega (NewtonJoint* corkscrew); void NewtonCorkscrewGetJointForce (NewtonJoint* corkscrew, dFloat* force); dFloat NewtonCorkscrewCalculateStopAlpha (NewtonJoint* corkscrew, NewtonHingeSliderUpdateDesc* desc, dFloat angle); dFloat NewtonCorkscrewCalculateStopAccel (NewtonJoint* corkscrew, NewtonHingeSliderUpdateDesc* desc, dFloat position);
// ********************************************************************************************** // // universal joint functions // // ********************************************************************************************** NewtonJoint* NewtonConstraintCreateUniversal (NewtonWorld* newtonWorld, dFloat* pivotPoint, dFloat* pinDir0, dFloat* pinDir1, NewtonBody* childBody, NewtonBody* parentBody); void NewtonUniversalSetUserCallback (NewtonJoint* universal, void* callback); dFloat NewtonUniversalGetJointAngle0 (NewtonJoint* universal); dFloat NewtonUniversalGetJointAngle1 (NewtonJoint* universal); dFloat NewtonUniversalGetJointOmega0 (NewtonJoint* universal); dFloat NewtonUniversalGetJointOmega1 (NewtonJoint* universal); void NewtonUniversalGetJointForce (NewtonJoint* universal, dFloat* force); dFloat NewtonUniversalCalculateStopAlpha0 (NewtonJoint* universal, NewtonHingeSliderUpdateDesc* desc, dFloat angle); dFloat NewtonUniversalCalculateStopAlpha1 (NewtonJoint* universal, NewtonHingeSliderUpdateDesc* desc, dFloat angle);
// ********************************************************************************************** // // up vector joint functions // // ********************************************************************************************** NewtonJoint* NewtonConstraintCreateUpVector (NewtonWorld* newtonWorld, dFloat* pinDir, NewtonBody* body); void NewtonUpVectorGetPin (NewtonJoint* upVector, dFloat *pin); void NewtonUpVectorSetPin (NewtonJoint* upVector, dFloat *pin);
// ********************************************************************************************** // // user defined bilateral joint // // ********************************************************************************************** NewtonJoint* NewtonConstraintCreateUserJoint (NewtonWorld* newtonWorld, int maxDOF, void* callback, NewtonBody* childBody, NewtonBody* parentBody); void NewtonUserJointAddLinearRow (NewtonJoint* joint, dFloat *pivot0, dFloat *pivot1, dFloat *dir); void NewtonUserJointAddAngularRow (NewtonJoint* joint, dFloat relativeAngle, dFloat *dir); void NewtonUserJointSetRowMinimumFriction (NewtonJoint* joint, dFloat friction); void NewtonUserJointSetRowMaximumFriction (NewtonJoint* joint, dFloat friction); void NewtonUserJointSetRowAcceleration (NewtonJoint* joint, dFloat acceleration); void NewtonUserJointSetRowSpringDamperAcceleration (NewtonJoint* joint, dFloat springK, dFloat springD); void NewtonUserJointSetRowStiffness (NewtonJoint* joint, dFloat stiffness); dFloat NewtonUserJointGetRowForce (NewtonJoint* joint, int row);
// ********************************************************************************************** // // rag doll joint container functions // // ********************************************************************************************** NewtonRagDoll* NewtonCreateRagDoll (NewtonWorld* newtonWorld); void NewtonDestroyRagDoll (NewtonWorld* newtonWorld, NewtonRagDoll* ragDoll);
void NewtonRagDollBegin (NewtonRagDoll* ragDoll); void NewtonRagDollEnd (NewtonRagDoll* ragDoll);
// void NewtonRagDollSetFriction (NewtonRagDoll* ragDoll, dFloat friction);
NewtonRagDollBone* NewtonRagDollFindBone (NewtonRagDoll* ragDoll, int id); // NewtonRagDollBone* NewtonRagDollGetRootBone (NewtonRagDoll* ragDoll);
void NewtonRagDollSetForceAndTorqueCallback (NewtonRagDoll* ragDoll, void* callback); void NewtonRagDollSetTransformCallback (NewtonRagDoll* ragDoll, void* callback); NewtonRagDollBone* NewtonRagDollAddBone (NewtonRagDoll* ragDoll, NewtonRagDollBone* parent, void *userData, dFloat mass, dFloat* matrix, NewtonCollision* boneCollision, dFloat* size);
void* NewtonRagDollBoneGetUserData (NewtonRagDollBone* bone); NewtonBody* NewtonRagDollBoneGetBody (NewtonRagDollBone* bone); void NewtonRagDollBoneSetID (NewtonRagDollBone* bone, int id);
void NewtonRagDollBoneSetLimits (NewtonRagDollBone* bone, dFloat* coneDir, dFloat minConeAngle, dFloat maxConeAngle, dFloat maxTwistAngle, dFloat* bilateralConeDir, dFloat negativeBilateralConeAngle, dFloat positiveBilateralConeAngle);
// NewtonRagDollBone* NewtonRagDollBoneGetChild (NewtonRagDollBone* bone); // NewtonRagDollBone* NewtonRagDollBoneGetSibling (NewtonRagDollBone* bone); // NewtonRagDollBone* NewtonRagDollBoneGetParent (NewtonRagDollBone* bone); // void NewtonRagDollBoneSetLocalMatrix (NewtonRagDollBone* bone, dFloat* matrix); // void NewtonRagDollBoneSetGlobalMatrix (NewtonRagDollBone* bone, dFloat* matrix);
void NewtonRagDollBoneGetLocalMatrix (NewtonRagDollBone* bone, dFloat* matrix); void NewtonRagDollBoneGetGlobalMatrix (NewtonRagDollBone* bone, dFloat* matrix);
// ********************************************************************************************** // // vehicle joint functions // // ********************************************************************************************** NewtonJoint* NewtonConstraintCreateVehicle (NewtonWorld* newtonWorld, dFloat* upDir, NewtonBody* body); void NewtonVehicleReset (NewtonJoint* vehicle); void NewtonVehicleSetTireCallback (NewtonJoint* vehicle, void* update); int NewtonVehicleAddTire (NewtonJoint* vehicle, dFloat* localMatrix, dFloat* pin, dFloat mass, dFloat width, dFloat radius, dFloat suspensionShock, dFloat suspensionSpring, dFloat suspensionLength, void* userData, int collisionID); void NewtonVehicleRemoveTire (NewtonJoint* vehicle, int tireIndex);
int NewtonVehicleGetFirstTireID (NewtonJoint* vehicle); int NewtonVehicleGetNextTireID (NewtonJoint* vehicle, int tireId);
int NewtonVehicleTireIsAirBorne (NewtonJoint* vehicle, int tireId); int NewtonVehicleTireLostSideGrip (NewtonJoint* vehicle, int tireId); int NewtonVehicleTireLostTraction (NewtonJoint* vehicle, int tireId);
void* NewtonVehicleGetTireUserData (NewtonJoint* vehicle, int tireId); dFloat NewtonVehicleGetTireOmega (NewtonJoint* vehicle, int tireId); dFloat NewtonVehicleGetTireNormalLoad (NewtonJoint* vehicle, int tireId); dFloat NewtonVehicleGetTireSteerAngle (NewtonJoint* vehicle, int tireId); dFloat NewtonVehicleGetTireLateralSpeed (NewtonJoint* vehicle, int tireId); dFloat NewtonVehicleGetTireLongitudinalSpeed (NewtonJoint* vehicle, int tireId); void NewtonVehicleGetTireMatrix (NewtonJoint* vehicle, int tireId, dFloat* matrix);
void NewtonVehicleSetTireTorque (NewtonJoint* vehicle, int tireId, dFloat torque); void NewtonVehicleSetTireSteerAngle (NewtonJoint* vehicle, int tireId, dFloat angle);
void NewtonVehicleSetTireMaxSideSleepSpeed (NewtonJoint* vehicle, int tireId, dFloat speed); void NewtonVehicleSetTireSideSleepCoeficient (NewtonJoint* vehicle, int tireId, dFloat coefficient); void NewtonVehicleSetTireMaxLongitudinalSlideSpeed (NewtonJoint* vehicle, int tireId, dFloat speed); void NewtonVehicleSetTireLongitudinalSlideCoeficient (NewtonJoint* vehicle, int tireId, dFloat coefficient);
dFloat NewtonVehicleTireCalculateMaxBrakeAcceleration (NewtonJoint* vehicle, int tireId); void NewtonVehicleTireSetBrakeAcceleration (NewtonJoint* vehicle, int tireId, dFloat acceleration, dFloat torqueLimit);
// ********************************************************************************************** // // // // ********************************************************************************************** void newton_startup() { long dll = LoadLibrary("newton"); //------------------------------------------------------------ NewtonCreate = GetProcAddress(dll, "NewtonCreate"); NewtonDestroy = GetProcAddress(dll, "NewtonDestroy"); NewtonDestroyAllBodies = GetProcAddress(dll, "NewtonDestroyAllBodies");
NewtonUpdate = GetProcAddress(dll, "NewtonUpdate"); NewtonSetSolverModel = GetProcAddress(dll, "NewtonSetSolverModel"); NewtonSetFrictionModel = GetProcAddress(dll, "NewtonSetFrictionModel"); NewtonGetTimeStep = GetProcAddress(dll, "NewtonGetTimeStep"); NewtonSetMinimumFrameRate = GetProcAddress(dll, "NewtonSetMinimumFrameRate"); NewtonSetBodyLeaveWorldEvent = GetProcAddress(dll, "NewtonSetBodyLeaveWorldEvent"); NewtonSetWorldSize = GetProcAddress(dll, "NewtonSetWorldSize");
NewtonWorldFreezeBody = GetProcAddress(dll, "NewtonWorldFreezeBody"); NewtonWorldUnfreezeBody = GetProcAddress(dll, "NewtonWorldUnfreezeBody");
NewtonWorldForEachBodyDo = GetProcAddress(dll, "NewtonWorldForEachBodyDo");
NewtonWorldSetUserData = GetProcAddress(dll, "NewtonWorldSetUserData"); NewtonWorldGetUserData = GetProcAddress(dll, "NewtonWorldGetUserData"); NewtonWorldGetVersion = GetProcAddress(dll, "NewtonWorldGetVersion"); NewtonWorldRayCast = GetProcAddress(dll, "NewtonDestroyAllBodies"); //------------------------------------------------------------ NewtonMaterialGetDefaultGroupID = GetProcAddress(dll, "NewtonMaterialGetDefaultGroupID"); NewtonMaterialCreateGroupID = GetProcAddress(dll, "NewtonMaterialCreateGroupID"); NewtonMaterialDestroyAllGroupID = GetProcAddress(dll, "NewtonMaterialDestroyAllGroupID");
NewtonMaterialSetDefaultSoftness = GetProcAddress(dll, "NewtonMaterialSetDefaultSoftness"); NewtonMaterialSetDefaultElasticity = GetProcAddress(dll, "NewtonMaterialSetDefaultElasticity"); NewtonMaterialSetDefaultCollidable = GetProcAddress(dll, "NewtonMaterialSetDefaultCollidable"); NewtonMaterialSetContinuousCollisionMode = GetProcAddress(dll, "NewtonMaterialSetContinuousCollisionMode"); NewtonMaterialSetDefaultFriction = GetProcAddress(dll, "NewtonMaterialSetDefaultFriction");
NewtonMaterialSetCollisionCallback = GetProcAddress(dll, "NewtonMaterialSetCollisionCallback");
NewtonMaterialGetUserData = GetProcAddress(dll, "NewtonMaterialGetUserData");
//------------------------------------------------------------ NewtonMaterialDisableContact = GetProcAddress(dll, "NewtonMaterialDisableContact"); NewtonMaterialGetCurrentTimestep = GetProcAddress(dll, "NewtonMaterialGetCurrentTimestep"); NewtonMaterialGetMaterialPairUserData = GetProcAddress(dll, "NewtonMaterialGetMaterialPairUserData"); NewtonMaterialGetContactFaceAttribute = GetProcAddress(dll, "NewtonMaterialGetContactFaceAttribute"); NewtonMaterialGetBodyCollisionID = GetProcAddress(dll, "NewtonMaterialGetBodyCollisionID"); NewtonMaterialGetContactNormalSpeed = GetProcAddress(dll, "NewtonMaterialGetContactNormalSpeed"); NewtonMaterialGetContactForce = GetProcAddress(dll, "NewtonMaterialGetContactForce"); NewtonMaterialGetContactPositionAndNormal = GetProcAddress(dll, "NewtonMaterialGetContactPositionAndNormal"); NewtonMaterialGetContactTangentDirections = GetProcAddress(dll, "NewtonMaterialGetContactTangentDirections"); NewtonMaterialGetContactTangentSpeed = GetProcAddress(dll, "NewtonCreate");
NewtonMaterialSetContactSoftness = GetProcAddress(dll, "NewtonMaterialSetContactSoftness"); NewtonMaterialSetContactElasticity = GetProcAddress(dll, "NewtonMaterialSetContactElasticity"); NewtonMaterialSetContactFrictionState = GetProcAddress(dll, "NewtonMaterialSetContactFrictionState"); NewtonMaterialSetContactStaticFrictionCoef = GetProcAddress(dll, "NewtonMaterialSetContactStaticFrictionCoef"); NewtonMaterialSetContactKineticFrictionCoef = GetProcAddress(dll, "NewtonMaterialSetContactKineticFrictionCoef");
NewtonMaterialSetContactNormalAcceleration = GetProcAddress(dll, "NewtonMaterialSetContactNormalAcceleration"); NewtonMaterialSetContactNormalDirection = GetProcAddress(dll, "NewtonMaterialSetContactNormalDirection");
NewtonMaterialSetContactTangentAcceleration = GetProcAddress(dll, "NewtonMaterialSetContactTangentAcceleration"); NewtonMaterialContactRotateTangentDirections = GetProcAddress(dll, "NewtonMaterialContactRotateTangentDirections");
//------------------------------------------------------------ NewtonCreateNull = GetProcAddress(dll, "NewtonCreateNull"); NewtonCreateSphere = GetProcAddress(dll, "NewtonCreateSphere"); NewtonCreateBox = GetProcAddress(dll, "NewtonCreateBox"); NewtonCreateCone = GetProcAddress(dll, "NewtonCreateCone"); NewtonCreateCapsule = GetProcAddress(dll, "NewtonCreateCapsule"); NewtonCreateCylinder = GetProcAddress(dll, "NewtonCreateCylinder"); NewtonCreateChamferCylinder = GetProcAddress(dll, "NewtonCreateChamferCylinder"); NewtonCreateConvexHull = GetProcAddress(dll, "NewtonCreateConvexHull"); NewtonCreateConvexHullModifier = GetProcAddress(dll, "NewtonCreateConvexHullModifier"); NewtonConvexHullModifierGetMatrix = GetProcAddress(dll, "NewtonConvexHullModifierGetMatrix"); NewtonConvexHullModifierSetMatrix = GetProcAddress(dll, "NewtonConvexHullModifierSetMatrix"); NewtonConvexCollisionSetUserID = GetProcAddress(dll, "NewtonConvexCollisionSetUserID"); NewtonConvexCollisionGetUserID = GetProcAddress(dll, "NewtonConvexCollisionGetUserID"); NewtonConvexCollisionCalculateVolume = GetProcAddress(dll, "NewtonConvexCollisionCalculateVolume"); NewtonConvexCollisionCalculateInertialMatrix = GetProcAddress(dll, "NewtonConvexCollisionCalculateInertialMatrix"); NewtonReleaseCollision = GetProcAddress(dll, "NewtonReleaseCollision"); //------------------------------------------------------------ NewtonCreateCompoundCollision = GetProcAddress(dll, "NewtonCreateCompoundCollision"); NewtonCreateUserMeshCollision = GetProcAddress(dll, "NewtonCreateUserMeshCollision"); //------------------------------------------------------------ NewtonCreateTreeCollision = GetProcAddress(dll, "NewtonCreateTreeCollision"); NewtonTreeCollisionBeginBuild = GetProcAddress(dll, "NewtonTreeCollisionBeginBuild"); NewtonTreeCollisionAddFace = GetProcAddress(dll, "NewtonTreeCollisionAddFace"); NewtonTreeCollisionEndBuild = GetProcAddress(dll, "NewtonTreeCollisionEndBuild"); NewtonTreeCollisionSerialize = GetProcAddress(dll, "NewtonTreeCollisionSerialize"); NewtonCreateTreeCollisionFromSerialization = GetProcAddress(dll, "NewtonCreateTreeCollisionFromSerialization"); NewtonTreeCollisionGetFaceAtribute = GetProcAddress(dll, "NewtonTreeCollisionGetFaceAtribute"); NewtonTreeCollisionSetFaceAtribute = GetProcAddress(dll, "NewtonTreeCollisionSetFaceAtribute"); //------------------------------------------------------------ NewtonCollisionPointDistance = GetProcAddress(dll, "NewtonCollisionPointDistance"); NewtonCollisionClosestPoint = GetProcAddress(dll, "NewtonCollisionClosestPoint"); NewtonCollisionCollide = GetProcAddress(dll, "NewtonCollisionCollide"); NewtonCollisionCollideContinue = GetProcAddress(dll, "NewtonCollisionCollideContinue"); NewtonCollisionRayCast = GetProcAddress(dll, "NewtonCollisionRayCast"); NewtonCollisionCalculateAABB = GetProcAddress(dll, "NewtonCollisionCalculateAABB");
//------------------------------------------------------------ NewtonGetEulerAngle = GetProcAddress(dll, "NewtonGetEulerAngle"); NewtonSetEulerAngle = GetProcAddress(dll, "NewtonSetEulerAngle"); //------------------------------------------------------------ NewtonCreateBody = GetProcAddress(dll, "NewtonCreateBody"); NewtonDestroyBody = GetProcAddress(dll, "NewtonDestroyBody"); NewtonBodyAddForce = GetProcAddress(dll, "NewtonBodyAddForce"); NewtonBodyAddTorque = GetProcAddress(dll, "NewtonBodyAddTorque"); NewtonBodySetMatrix = GetProcAddress(dll, "NewtonBodySetMatrix"); NewtonBodySetMatrixRecursive = GetProcAddress(dll, "NewtonBodySetMatrixRecursive"); NewtonBodySetMassMatrix = GetProcAddress(dll, "NewtonBodySetMassMatrix"); NewtonBodySetMaterialGroupID = GetProcAddress(dll, "NewtonBodySetMaterialGroupID"); NewtonBodySetContinuousCollisionMode = GetProcAddress(dll, "NewtonBodySetContinuousCollisionMode"); NewtonBodySetJointRecursiveCollision = GetProcAddress(dll, "NewtonBodySetJointRecursiveCollision"); NewtonBodySetOmega = GetProcAddress(dll, "NewtonBodySetOmega"); NewtonBodySetVelocity = GetProcAddress(dll, "NewtonBodySetVelocity"); NewtonBodySetForce = GetProcAddress(dll, "NewtonBodySetForce"); NewtonBodySetTorque = GetProcAddress(dll, "NewtonBodySetTorque"); NewtonBodySetCentreOfMass = GetProcAddress(dll, "NewtonBodySetCentreOfMass"); NewtonBodySetLinearDamping = GetProcAddress(dll, "NewtonBodySetLinearDamping"); NewtonBodySetAngularDamping = GetProcAddress(dll, "NewtonBodySetAngularDamping"); NewtonBodySetUserData = GetProcAddress(dll, "NewtonBodySetUserData"); NewtonBodyCoriolisForcesMode = GetProcAddress(dll, "NewtonBodyCoriolisForcesMode"); NewtonBodySetCollision = GetProcAddress(dll, "NewtonBodySetCollision"); NewtonBodySetAutoFreeze = GetProcAddress(dll, "NewtonBodySetAutoFreeze"); NewtonBodySetFreezeTreshold = GetProcAddress(dll, "NewtonBodySetFreezeTreshold"); NewtonBodySetTransformCallback = GetProcAddress(dll, "NewtonBodySetTransformCallback"); NewtonBodySetDestructorCallback = GetProcAddress(dll, "NewtonBodySetDestructorCallback"); NewtonBodySetAutoactiveCallback = GetProcAddress(dll, "NewtonBodySetAutoactiveCallback"); NewtonBodySetForceAndTorqueCallback = GetProcAddress(dll, "NewtonBodySetForceAndTorqueCallback"); NewtonBodyGetForceAndTorqueCallback = GetProcAddress(dll, "NewtonBodyGetForceAndTorqueCallback"); NewtonBodyGetUserData = GetProcAddress(dll, "NewtonBodyGetUserData"); NewtonBodyGetWorld = GetProcAddress(dll, "NewtonBodyGetWorld"); NewtonBodyGetCollision = GetProcAddress(dll, "NewtonBodyGetCollision"); NewtonBodyGetMaterialGroupID = GetProcAddress(dll, "NewtonBodyGetMaterialGroupID"); NewtonBodyGetContinuousCollisionMode = GetProcAddress(dll, "NewtonBodyGetContinuousCollisionMode"); NewtonBodyGetJointRecursiveCollision = GetProcAddress(dll, "NewtonBodyGetJointRecursiveCollision"); NewtonBodyGetMatrix = GetProcAddress(dll, "NewtonBodyGetMatrix"); NewtonBodyGetMassMatrix = GetProcAddress(dll, "NewtonBodyGetMassMatrix"); NewtonBodyGetInvMass = GetProcAddress(dll, "NewtonBodyGetInvMass"); NewtonBodyGetOmega = GetProcAddress(dll, "NewtonBodyGetOmega"); NewtonBodyGetVelocity = GetProcAddress(dll, "NewtonBodyGetVelocity"); NewtonBodyGetForce = GetProcAddress(dll, "NewtonBodyGetForce"); NewtonBodyGetTorque = GetProcAddress(dll, "NewtonBodyGetTorque"); NewtonBodyGetCentreOfMass = GetProcAddress(dll, "NewtonBodyGetCentreOfMass"); NewtonBodyGetSleepingState = GetProcAddress(dll, "NewtonBodyGetSleepingState"); NewtonBodyGetAutoFreeze = GetProcAddress(dll, "NewtonBodyGetAutoFreeze"); NewtonBodyGetLinearDamping = GetProcAddress(dll, "NewtonBodyGetLinearDamping"); NewtonBodyGetAngularDamping = GetProcAddress(dll, "NewtonBodyGetAngularDamping"); NewtonBodyGetAABB = GetProcAddress(dll, "NewtonBodyGetAABB"); NewtonBodyGetFreezeTreshold = GetProcAddress(dll, "NewtonBodyGetFreezeTreshold"); NewtonBodyAddBuoyancyForce = GetProcAddress(dll, "NewtonBodyAddBuoyancyForce"); NewtonBodyForEachPolygonDo = GetProcAddress(dll, "NewtonBodyForEachPolygonDo"); NewtonAddBodyImpulse = GetProcAddress(dll, "NewtonAddBodyImpulse"); //------------------------------------------------------------ NewtonJointGetUserData = GetProcAddress(dll, "NewtonJointGetUserData"); NewtonJointSetUserData = GetProcAddress(dll, "NewtonJointSetUserData"); NewtonJointGetCollisionState = GetProcAddress(dll, "NewtonJointGetCollisionState"); NewtonJointSetCollisionState = GetProcAddress(dll, "NewtonJointSetCollisionState"); NewtonJointGetStiffness = GetProcAddress(dll, "NewtonJointGetStiffness"); NewtonJointSetStiffness = GetProcAddress(dll, "NewtonJointSetStiffness"); NewtonDestroyJoint = GetProcAddress(dll, "NewtonDestroyJoint"); NewtonJointSetDestructor = GetProcAddress(dll, "NewtonJointSetDestructor");
//------------------------------------------------------------ NewtonConstraintCreateBall = GetProcAddress(dll, "NewtonConstraintCreateBall"); NewtonBallSetUserCallback = GetProcAddress(dll, "NewtonBallSetUserCallback"); NewtonBallGetJointAngle = GetProcAddress(dll, "NewtonBallGetJointAngle"); NewtonBallGetJointOmega = GetProcAddress(dll, "NewtonBallGetJointOmega"); NewtonBallGetJointForce = GetProcAddress(dll, "NewtonBallGetJointForce"); NewtonBallSetConeLimits = GetProcAddress(dll, "NewtonBallSetConeLimits");
//------------------------------------------------------------ NewtonConstraintCreateHinge = GetProcAddress(dll, "NewtonConstraintCreateHinge"); NewtonHingeSetUserCallback = GetProcAddress(dll, "NewtonHingeSetUserCallback"); NewtonHingeGetJointAngle = GetProcAddress(dll, "NewtonHingeGetJointAngle"); NewtonHingeGetJointOmega = GetProcAddress(dll, "NewtonHingeGetJointOmega"); NewtonHingeGetJointForce = GetProcAddress(dll, "NewtonHingeGetJointForce"); NewtonHingeCalculateStopAlpha = GetProcAddress(dll, "NewtonHingeCalculateStopAlpha");
//------------------------------------------------------------ NewtonConstraintCreateSlider = GetProcAddress(dll, "NewtonConstraintCreateSlider"); NewtonSliderSetUserCallback = GetProcAddress(dll, "NewtonSliderSetUserCallback"); NewtonSliderGetJointPosit = GetProcAddress(dll, "NewtonSliderGetJointPosit"); NewtonSliderGetJointVeloc = GetProcAddress(dll, "NewtonSliderGetJointVeloc"); NewtonSliderGetJointForce = GetProcAddress(dll, "NewtonSliderGetJointForce"); NewtonSliderCalculateStopAccel = GetProcAddress(dll, "NewtonSliderCalculateStopAccel");
//------------------------------------------------------------ NewtonConstraintCreateCorkscrew = GetProcAddress(dll, "NewtonConstraintCreateCorkscrew"); NewtonCorkscrewSetUserCallback = GetProcAddress(dll, "NewtonCorkscrewSetUserCallback"); NewtonCorkscrewGetJointPosit = GetProcAddress(dll, "NewtonCorkscrewGetJointPosit"); NewtonCorkscrewGetJointAngle = GetProcAddress(dll, "NewtonCorkscrewGetJointAngle"); NewtonCorkscrewGetJointVeloc = GetProcAddress(dll, "NewtonCorkscrewGetJointVeloc"); NewtonCorkscrewGetJointOmega = GetProcAddress(dll, "NewtonCorkscrewGetJointOmega"); NewtonCorkscrewGetJointForce = GetProcAddress(dll, "NewtonCorkscrewGetJointForce"); NewtonCorkscrewCalculateStopAlpha = GetProcAddress(dll, "NewtonCorkscrewCalculateStopAlpha"); NewtonCorkscrewCalculateStopAccel = GetProcAddress(dll, "NewtonCorkscrewCalculateStopAccel");
//------------------------------------------------------------ NewtonConstraintCreateUniversal = GetProcAddress(dll, "NewtonConstraintCreateUniversal"); NewtonUniversalSetUserCallback = GetProcAddress(dll, "NewtonUniversalSetUserCallback"); NewtonUniversalGetJointAngle0 = GetProcAddress(dll, "NewtonUniversalGetJointAngle0"); NewtonUniversalGetJointAngle1 = GetProcAddress(dll, "NewtonUniversalGetJointAngle1"); NewtonUniversalGetJointOmega0 = GetProcAddress(dll, "NewtonUniversalGetJointOmega0"); NewtonUniversalGetJointOmega1 = GetProcAddress(dll, "NewtonUniversalGetJointOmega1"); NewtonUniversalGetJointForce = GetProcAddress(dll, "NewtonUniversalGetJointForce"); NewtonUniversalCalculateStopAlpha0 = GetProcAddress(dll, "NewtonUniversalCalculateStopAlpha0"); NewtonUniversalCalculateStopAlpha1 = GetProcAddress(dll, "NewtonUniversalCalculateStopAlpha1");
//------------------------------------------------------------ NewtonConstraintCreateUpVector = GetProcAddress(dll, "NewtonConstraintCreateUpVector"); NewtonUpVectorGetPin = GetProcAddress(dll, "NewtonUpVectorGetPin"); NewtonUpVectorSetPin = GetProcAddress(dll, "NewtonUpVectorSetPin");
//------------------------------------------------------------ NewtonConstraintCreateUserJoint = GetProcAddress(dll, "NewtonConstraintCreateUserJoint"); NewtonUserJointAddLinearRow = GetProcAddress(dll, "NewtonUserJointAddLinearRow"); NewtonUserJointAddAngularRow = GetProcAddress(dll, "NewtonUserJointAddAngularRow"); NewtonUserJointSetRowMinimumFriction = GetProcAddress(dll, "NewtonUserJointSetRowMinimumFriction"); NewtonUserJointSetRowMaximumFriction = GetProcAddress(dll, "NewtonUserJointSetRowMaximumFriction"); NewtonUserJointSetRowAcceleration = GetProcAddress(dll, "NewtonUserJointSetRowAcceleration"); NewtonUserJointSetRowSpringDamperAcceleration = GetProcAddress(dll, "NewtonUserJointSetRowSpringDamperAcceleration"); NewtonUserJointSetRowStiffness = GetProcAddress(dll, "NewtonUserJointSetRowStiffness"); NewtonUserJointGetRowForce = GetProcAddress(dll, "NewtonUserJointGetRowForce");
//------------------------------------------------------------ NewtonCreateRagDoll = GetProcAddress(dll, "NewtonCreateRagDoll"); NewtonDestroyRagDoll = GetProcAddress(dll, "NewtonDestroyRagDoll"); NewtonRagDollBegin = GetProcAddress(dll, "NewtonRagDollBegin"); NewtonRagDollEnd = GetProcAddress(dll, "NewtonRagDollEnd"); NewtonRagDollFindBone = GetProcAddress(dll, "NewtonRagDollFindBone"); NewtonRagDollSetForceAndTorqueCallback = GetProcAddress(dll, "NewtonRagDollSetForceAndTorqueCallback"); NewtonRagDollSetTransformCallback = GetProcAddress(dll, "NewtonRagDollSetTransformCallback"); NewtonRagDollAddBone = GetProcAddress(dll, "NewtonRagDollAddBone"); NewtonRagDollBoneGetUserData = GetProcAddress(dll, "NewtonRagDollBoneGetUserData"); NewtonRagDollBoneGetBody = GetProcAddress(dll, "NewtonRagDollBoneGetBody"); NewtonRagDollBoneSetID = GetProcAddress(dll, "NewtonRagDollBoneSetID"); NewtonRagDollBoneSetLimits = GetProcAddress(dll, "NewtonRagDollBoneSetLimits "); NewtonRagDollBoneGetLocalMatrix = GetProcAddress(dll, "NewtonRagDollBoneGetLocalMatrix"); NewtonRagDollBoneGetGlobalMatrix = GetProcAddress(dll, "NewtonRagDollBoneGetGlobalMatrix");
//------------------------------------------------------------ NewtonConstraintCreateVehicle = GetProcAddress(dll, "NewtonConstraintCreateVehicle"); NewtonVehicleReset = GetProcAddress(dll, "NewtonVehicleReset"); NewtonVehicleSetTireCallback = GetProcAddress(dll, "NewtonVehicleSetTireCallback"); NewtonVehicleAddTire = GetProcAddress(dll, "NewtonVehicleAddTire"); NewtonVehicleRemoveTire = GetProcAddress(dll, "NewtonVehicleRemoveTire"); NewtonVehicleGetFirstTireID = GetProcAddress(dll, "NewtonVehicleGetFirstTireID"); NewtonVehicleGetNextTireID = GetProcAddress(dll, "NewtonVehicleGetNextTireID"); NewtonVehicleTireIsAirBorne = GetProcAddress(dll, "NewtonVehicleTireIsAirBorne"); NewtonVehicleTireLostSideGrip = GetProcAddress(dll, "NewtonVehicleTireLostSideGrip"); NewtonVehicleTireLostTraction = GetProcAddress(dll, "NewtonVehicleTireLostTraction"); NewtonVehicleGetTireUserData = GetProcAddress(dll, "NewtonVehicleGetTireUserData"); NewtonVehicleGetTireOmega = GetProcAddress(dll, "NewtonVehicleGetTireOmega"); NewtonVehicleGetTireNormalLoad = GetProcAddress(dll, "NewtonVehicleGetTireNormalLoad"); NewtonVehicleGetTireSteerAngle = GetProcAddress(dll, "NewtonVehicleGetTireSteerAngle"); NewtonVehicleGetTireLateralSpeed = GetProcAddress(dll, "NewtonVehicleGetTireLateralSpeed"); NewtonVehicleGetTireLongitudinalSpeed = GetProcAddress(dll, "NewtonVehicleGetTireLongitudinalSpeed"); NewtonVehicleGetTireMatrix = GetProcAddress(dll, "NewtonVehicleGetTireMatrix"); NewtonVehicleSetTireTorque = GetProcAddress(dll, "NewtonVehicleSetTireTorque"); NewtonVehicleSetTireSteerAngle = GetProcAddress(dll, "NewtonVehicleSetTireSteerAngle"); NewtonVehicleSetTireMaxSideSleepSpeed = GetProcAddress(dll, "NewtonVehicleSetTireMaxSideSleepSpeed"); NewtonVehicleSetTireSideSleepCoeficient = GetProcAddress(dll, "NewtonVehicleSetTireSideSleepCoeficient"); NewtonVehicleSetTireMaxLongitudinalSlideSpeed = GetProcAddress(dll, "NewtonVehicleSetTireMaxLongitudinalSlideSpeed"); NewtonVehicleSetTireLongitudinalSlideCoeficient = GetProcAddress(dll, "NewtonVehicleSetTireLongitudinalSlideCoeficient"); NewtonVehicleTireCalculateMaxBrakeAcceleration = GetProcAddress(dll, "NewtonVehicleTireCalculateMaxBrakeAcceleration"); NewtonVehicleTireSetBrakeAcceleration = GetProcAddress(dll, "NewtonVehicleTireSetBrakeAcceleration"); }
create an empty file "ngd.c" and copy the above into it. copy the newton.dll to your directory and then you can test it like that: Code:
#include "ngd.c"
void main() { wait(3); level_load("empty.wmb"); wait(1);
NewtonWorld* world; world = NewtonCreate(0, 0); int version; version = NewtonWorldGetVersion(world); printf("version: %d", version);
NewtonDestroy(world); }
still a lot to do. 
|
|
|
|