00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef PX_PHYSICS_NX_PHYSICS
00031 #define PX_PHYSICS_NX_PHYSICS
00032
00037 #include "PxPhysXConfig.h"
00038 #include "PxDeletionListener.h"
00039 #include "foundation/PxTransform.h"
00040 #include "PxShape.h"
00041
00042 #if !PX_DOXYGEN
00043 namespace physx
00044 {
00045 #endif
00046
00047 class PxPvd;
00048 class PxPhysicsInsertionCallback;
00049
00050 class PxRigidActor;
00051 class PxConstraintConnector;
00052 struct PxConstraintShaderTable;
00053
00054 class PxGeometry;
00055 class PxFoundation;
00056 class PxSerializationRegistry;
00057
00058 class PxPruningStructure;
00059 class PxBVHStructure;
00060
00071 class PxPhysics
00072 {
00073 public:
00074
00078
00079 virtual ~PxPhysics() {}
00080
00099 virtual void release() = 0;
00100
00105 virtual PxFoundation& getFoundation() = 0;
00106
00116 virtual PxAggregate* createAggregate(PxU32 maxSize, bool enableSelfCollision) = 0;
00117
00122 virtual const PxTolerancesScale& getTolerancesScale() const = 0;
00123
00125
00128
00139 virtual PxTriangleMesh* createTriangleMesh(PxInputStream& stream) = 0;
00140
00148 virtual PxU32 getNbTriangleMeshes() const = 0;
00149
00164 virtual PxU32 getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00165
00176 virtual PxHeightField* createHeightField(PxInputStream& stream) = 0;
00177
00185 virtual PxU32 getNbHeightFields() const = 0;
00186
00201 virtual PxU32 getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00202
00213 virtual PxConvexMesh* createConvexMesh(PxInputStream &stream) = 0;
00214
00222 virtual PxU32 getNbConvexMeshes() const = 0;
00223
00238 virtual PxU32 getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00239
00248 virtual PxBVHStructure* createBVHStructure(PxInputStream &stream) = 0;
00249
00257 virtual PxU32 getNbBVHStructures() const = 0;
00258
00273 virtual PxU32 getBVHStructures(PxBVHStructure** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00274
00276
00279
00291 virtual PxScene* createScene(const PxSceneDesc& sceneDesc) = 0;
00292
00300 virtual PxU32 getNbScenes() const = 0;
00301
00316 virtual PxU32 getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00317
00319
00322
00331 virtual PxRigidStatic* createRigidStatic(const PxTransform& pose) = 0;
00332
00341 virtual PxRigidDynamic* createRigidDynamic(const PxTransform& pose) = 0;
00342
00356 virtual PxPruningStructure* createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors) = 0;
00357
00359
00362
00377 PX_FORCE_INLINE PxShape* createShape( const PxGeometry& geometry,
00378 const PxMaterial& material,
00379 bool isExclusive = false,
00380 PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE)
00381 {
00382 PxMaterial* materialPtr = const_cast<PxMaterial*>(&material);
00383 return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags);
00384 }
00385
00401 virtual PxShape* createShape(const PxGeometry& geometry,
00402 PxMaterial*const * materials,
00403 PxU16 materialCount,
00404 bool isExclusive = false,
00405 PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0;
00406
00414 virtual PxU32 getNbShapes() const = 0;
00415
00430 virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00431
00433
00436
00453 virtual PxConstraint* createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) = 0;
00454
00462 virtual PxArticulation* createArticulation() = 0;
00463
00471 virtual PxArticulationReducedCoordinate* createArticulationReducedCoordinate() = 0;
00472
00473
00475
00478
00490 virtual PxMaterial* createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) = 0;
00491
00492
00500 virtual PxU32 getNbMaterials() const = 0;
00501
00516 virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00517
00519
00522
00538 virtual void registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet = false) = 0;
00539
00549 virtual void unregisterDeletionListener(PxDeletionListener& observer) = 0;
00550
00566 virtual void registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0;
00567
00583 virtual void unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0;
00584
00593 virtual PxPhysicsInsertionCallback& getPhysicsInsertionCallback() = 0;
00594
00596 };
00597
00598 #if !PX_DOXYGEN
00599 }
00600 #endif
00601
00609 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterArticulations(physx::PxPhysics& physics);
00610
00611
00612 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterArticulationsReducedCoordinate(physx::PxPhysics& physics);
00613
00631 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterHeightFields(physx::PxPhysics& physics);
00632
00654 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics* PX_CALL_CONV PxCreateBasePhysics(physx::PxU32 version,
00655 physx::PxFoundation& foundation,
00656 const physx::PxTolerancesScale& scale,
00657 bool trackOutstandingAllocations = false,
00658 physx::PxPvd* pvd = NULL);
00659
00685 PX_INLINE physx::PxPhysics* PxCreatePhysics(physx::PxU32 version,
00686 physx::PxFoundation& foundation,
00687 const physx::PxTolerancesScale& scale,
00688 bool trackOutstandingAllocations = false,
00689 physx::PxPvd* pvd = NULL )
00690 {
00691 physx::PxPhysics* physics = PxCreateBasePhysics(version, foundation, scale, trackOutstandingAllocations, pvd);
00692 if(!physics)
00693 return NULL;
00694
00695 PxRegisterArticulations(*physics);
00696 PxRegisterArticulationsReducedCoordinate(*physics);
00697 PxRegisterHeightFields(*physics);
00698
00699 return physics;
00700 }
00701
00702
00710 #ifdef __clang__
00711 #pragma clang diagnostic push
00712 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
00713 #endif
00714
00715 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics& PX_CALL_CONV PxGetPhysics();
00716
00717 #ifdef __clang__
00718 #pragma clang diagnostic pop
00719 #endif
00720
00722 #endif