2015-10-17 20:44:00 +00:00
|
|
|
#include "CollisionSdkC_Api.h"
|
|
|
|
#include "Internal/CollisionSdkInterface.h"
|
|
|
|
#include "Internal/Bullet2CollisionSdk.h"
|
2015-10-18 21:01:25 +00:00
|
|
|
#include "Internal/RealTimeBullet3CollisionSdk.h"
|
2015-10-17 20:44:00 +00:00
|
|
|
|
|
|
|
/* Collision World */
|
|
|
|
|
2015-10-18 21:01:25 +00:00
|
|
|
plCollisionWorldHandle plCreateCollisionWorld(plCollisionSdkHandle collisionSdkHandle, int maxNumObjsCapacity, int maxNumShapesCapacity, int maxNumPairsCapacity)
|
2015-10-17 20:44:00 +00:00
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
2015-10-18 21:01:25 +00:00
|
|
|
return sdk->createCollisionWorld( maxNumObjsCapacity, maxNumShapesCapacity, maxNumPairsCapacity);
|
2015-10-17 20:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void plDeleteCollisionWorld(plCollisionSdkHandle collisionSdkHandle, plCollisionWorldHandle worldHandle)
|
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
2015-10-18 21:01:25 +00:00
|
|
|
if (sdk && worldHandle)
|
|
|
|
{
|
|
|
|
sdk->deleteCollisionWorld(worldHandle);
|
|
|
|
}
|
2015-10-17 20:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
plCollisionSdkHandle plCreateBullet2CollisionSdk()
|
|
|
|
{
|
2015-10-18 21:01:25 +00:00
|
|
|
#ifndef DISABLE_BULLET2_COLLISION_SDK
|
2015-10-17 20:44:00 +00:00
|
|
|
return Bullet2CollisionSdk::createBullet2SdkHandle();
|
2015-10-18 21:01:25 +00:00
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif //DISABLE_BULLET2_COLLISION_SDK
|
|
|
|
}
|
|
|
|
|
|
|
|
plCollisionSdkHandle plCreateRealTimeBullet3CollisionSdk()
|
|
|
|
{
|
|
|
|
#ifndef DISABLE_REAL_TIME_BULLET3_COLLISION_SDK
|
|
|
|
return RealTimeBullet3CollisionSdk::createRealTimeBullet3CollisionSdkHandle();
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
2015-10-17 20:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void plDeleteCollisionSdk(plCollisionSdkHandle collisionSdkHandle)
|
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
|
|
|
delete sdk;
|
|
|
|
}
|
|
|
|
|
2015-10-18 21:01:25 +00:00
|
|
|
plCollisionShapeHandle plCreateSphereShape(plCollisionSdkHandle collisionSdkHandle, plCollisionWorldHandle worldHandle, plReal radius)
|
2015-10-17 20:44:00 +00:00
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
2015-10-18 21:01:25 +00:00
|
|
|
return sdk->createSphereShape(worldHandle,radius);
|
2015-10-17 20:44:00 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-10-18 21:01:25 +00:00
|
|
|
void plDeleteShape(plCollisionSdkHandle collisionSdkHandle, plCollisionWorldHandle worldHandle, plCollisionShapeHandle shapeHandle)
|
2015-10-17 20:44:00 +00:00
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
2015-10-18 21:01:25 +00:00
|
|
|
sdk->deleteShape(worldHandle,shapeHandle);
|
2015-10-17 20:44:00 +00:00
|
|
|
}
|
|
|
|
|
2015-10-18 21:01:25 +00:00
|
|
|
plCollisionObjectHandle plCreateCollisionObject( plCollisionSdkHandle collisionSdkHandle, plCollisionWorldHandle worldHandle, void* userData, int userIndex, plCollisionShapeHandle cshape ,plVector3 childPos,plQuaternion childOrn)
|
2015-10-17 20:44:00 +00:00
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
2015-10-19 06:43:37 +00:00
|
|
|
return sdk->createCollisionObject(worldHandle, userData, userIndex, cshape, childPos, childOrn);
|
2015-10-17 20:44:00 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-10-18 21:01:25 +00:00
|
|
|
void plDeleteCollisionObject(plCollisionSdkHandle collisionSdkHandle, plCollisionWorldHandle worldHandle, plCollisionObjectHandle body)
|
2015-10-17 20:44:00 +00:00
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
|
|
|
sdk->deleteCollisionObject(body);
|
|
|
|
}
|
|
|
|
|
2015-10-18 21:01:25 +00:00
|
|
|
void plSetCollisionObjectTransform( plCollisionSdkHandle collisionSdkHandle, plCollisionWorldHandle worldHandle, plCollisionObjectHandle objHandle, plVector3 position,plQuaternion orientation)
|
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
2015-10-19 06:43:37 +00:00
|
|
|
sdk->setCollisionObjectTransform(worldHandle,objHandle,position,orientation);
|
2015-10-18 21:01:25 +00:00
|
|
|
}
|
|
|
|
|
2015-10-17 20:44:00 +00:00
|
|
|
void plAddCollisionObject(plCollisionSdkHandle collisionSdkHandle, plCollisionWorldHandle world, plCollisionObjectHandle object)
|
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
|
|
|
sdk->addCollisionObject(world,object);
|
|
|
|
}
|
|
|
|
void plRemoveCollisionObject(plCollisionSdkHandle collisionSdkHandle, plCollisionWorldHandle world, plCollisionObjectHandle object)
|
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
|
|
|
sdk->removeCollisionObject(world,object);
|
|
|
|
}
|
|
|
|
|
2015-10-18 01:52:48 +00:00
|
|
|
/* Collision Queries */
|
|
|
|
int plCollide(plCollisionSdkHandle collisionSdkHandle, plCollisionWorldHandle worldHandle, plCollisionObjectHandle colA, plCollisionObjectHandle colB,
|
|
|
|
lwContactPoint* pointsOut, int pointCapacity)
|
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
|
|
|
return sdk->collide(worldHandle, colA,colB,pointsOut,pointCapacity);
|
|
|
|
}
|
2015-10-17 20:44:00 +00:00
|
|
|
|
2015-10-18 01:52:48 +00:00
|
|
|
void plWorldCollide(plCollisionSdkHandle collisionSdkHandle, plCollisionWorldHandle world,
|
|
|
|
plNearCallback filter, void* userData)
|
|
|
|
{
|
|
|
|
CollisionSdkInterface* sdk = (CollisionSdkInterface*) collisionSdkHandle;
|
|
|
|
sdk->collideWorld(world,filter,userData);
|
|
|
|
}
|