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
00031 #ifndef PX_PHYSICS_NX_PHYSICS
00032 #define PX_PHYSICS_NX_PHYSICS
00033
00034
00039 #include "PxPhysXConfig.h"
00040 #include "PxDeletionListener.h"
00041 #include "foundation/PxTransform.h"
00042 #include "PxShape.h"
00043
00044
00045 #if PX_USE_CLOTH_API
00046 #include "cloth/PxClothTypes.h"
00047 #include "cloth/PxClothFabric.h"
00048 #endif
00049
00050
00051 #if !PX_DOXYGEN
00052 namespace physx
00053 {
00054 #endif
00055
00056 class PxPvd;
00057 class PxPhysicsInsertionCallback;
00058
00059 class PxRigidActor;
00060 class PxConstraintConnector;
00061 struct PxConstraintShaderTable;
00062
00063 class PxGeometry;
00064 class PxFoundation;
00065 class PxSerializationRegistry;
00066
00067 class PxPruningStructure;
00068
00079 class PxPhysics
00080 {
00081 public:
00082
00086
00087
00088
00089 virtual ~PxPhysics() {}
00090
00091
00110 virtual void release() = 0;
00111
00116 virtual PxFoundation& getFoundation() = 0;
00117
00127 virtual PxAggregate* createAggregate(PxU32 maxSize, bool enableSelfCollision) = 0;
00128
00133 virtual const PxTolerancesScale& getTolerancesScale() const = 0;
00134
00135
00137
00140
00151 virtual PxTriangleMesh* createTriangleMesh(PxInputStream& stream) = 0;
00152
00153
00154
00162 virtual PxU32 getNbTriangleMeshes() const = 0;
00163
00178 virtual PxU32 getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00179
00190 virtual PxHeightField* createHeightField(PxInputStream& stream) = 0;
00191
00199 virtual PxU32 getNbHeightFields() const = 0;
00200
00215 virtual PxU32 getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00216
00227 virtual PxConvexMesh* createConvexMesh(PxInputStream &stream) = 0;
00228
00236 virtual PxU32 getNbConvexMeshes() const = 0;
00237
00252 virtual PxU32 getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00253
00254
00255 #if PX_USE_CLOTH_API
00256
00268 PX_DEPRECATED virtual PxClothFabric* createClothFabric(PxInputStream& stream) = 0;
00269
00284 PX_DEPRECATED virtual PxClothFabric* createClothFabric(const PxClothFabricDesc& desc) = 0;
00285
00295 PX_DEPRECATED virtual PxU32 getNbClothFabrics() const = 0;
00296
00312 PX_DEPRECATED virtual PxU32 getClothFabrics(PxClothFabric** userBuffer, PxU32 bufferSize) const = 0;
00313 #endif
00314
00316
00319
00331 virtual PxScene* createScene(const PxSceneDesc& sceneDesc) = 0;
00332
00340 virtual PxU32 getNbScenes() const = 0;
00341
00356 virtual PxU32 getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00357
00359
00362
00372 virtual PxRigidStatic* createRigidStatic(const PxTransform& pose) = 0;
00373
00374
00375
00385 virtual PxRigidDynamic* createRigidDynamic(const PxTransform& pose) = 0;
00386
00387
00388 #if PX_USE_PARTICLE_SYSTEM_API
00389
00400 PX_DEPRECATED virtual PxParticleSystem* createParticleSystem(PxU32 maxParticles, bool perParticleRestOffset = false) = 0;
00401
00413 PX_DEPRECATED virtual PxParticleFluid* createParticleFluid(PxU32 maxParticles, bool perParticleRestOffset = false) = 0;
00414 #endif
00415
00416
00417 #if PX_USE_CLOTH_API
00418
00431 PX_DEPRECATED virtual PxCloth* createCloth(const PxTransform& globalPose, PxClothFabric& fabric, const PxClothParticle* particles, PxClothFlags flags) = 0;
00432 #endif
00433
00447 virtual PxPruningStructure* createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors) = 0;
00448
00450
00453
00454
00470 PX_FORCE_INLINE PxShape* createShape( const PxGeometry& geometry,
00471 const PxMaterial& material,
00472 bool isExclusive = false,
00473 PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE)
00474 {
00475 PxMaterial* materialPtr = const_cast<PxMaterial*>(&material);
00476 return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags);
00477 }
00478
00479
00496 virtual PxShape* createShape(const PxGeometry& geometry,
00497 PxMaterial*const * materials,
00498 PxU16 materialCount,
00499 bool isExclusive = false,
00500 PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0;
00501
00502
00510 virtual PxU32 getNbShapes() const = 0;
00511
00526 virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00527
00529
00532
00533
00550 virtual PxConstraint* createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) = 0;
00551
00552
00560 virtual PxArticulation* createArticulation() = 0;
00561
00563
00566
00567
00579 virtual PxMaterial* createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) = 0;
00580
00581
00589 virtual PxU32 getNbMaterials() const = 0;
00590
00605 virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00606
00608
00611
00627 virtual void registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet = false) = 0;
00628
00638 virtual void unregisterDeletionListener(PxDeletionListener& observer) = 0;
00639
00655 virtual void registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0;
00656
00672 virtual void unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0;
00673
00682 virtual PxPhysicsInsertionCallback& getPhysicsInsertionCallback() = 0;
00683
00685 };
00686
00687 #if !PX_DOXYGEN
00688 }
00689 #endif
00690
00698 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterArticulations(physx::PxPhysics& physics);
00699
00717 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterHeightFields(physx::PxPhysics& physics);
00718
00731 PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterLegacyHeightFields(physx::PxPhysics& physics);
00732
00740 PX_DEPRECATED PX_INLINE void PX_CALL_CONV PxRegisterUnifiedHeightFields(physx::PxPhysics& physics)
00741 {
00742 PxRegisterHeightFields(physics);
00743 }
00744
00745
00755 PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterCloth(physx::PxPhysics& physics);
00756
00766 PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterParticles(physx::PxPhysics& physics);
00767
00789 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics* PX_CALL_CONV PxCreateBasePhysics(physx::PxU32 version,
00790 physx::PxFoundation& foundation,
00791 const physx::PxTolerancesScale& scale,
00792 bool trackOutstandingAllocations = false,
00793 physx::PxPvd* pvd = NULL);
00794
00822 PX_INLINE physx::PxPhysics* PxCreatePhysics(physx::PxU32 version,
00823 physx::PxFoundation& foundation,
00824 const physx::PxTolerancesScale& scale,
00825 bool trackOutstandingAllocations = false,
00826 physx::PxPvd* pvd = NULL )
00827 {
00828 physx::PxPhysics* physics = PxCreateBasePhysics(version, foundation, scale, trackOutstandingAllocations, pvd);
00829 if(!physics)
00830 return NULL;
00831
00832 PxRegisterArticulations(*physics);
00833 PxRegisterHeightFields(*physics);
00834 PxRegisterCloth(*physics);
00835 PxRegisterParticles(*physics);
00836
00837 return physics;
00838 }
00839
00847 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics& PX_CALL_CONV PxGetPhysics();
00848
00850 #endif