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 
00266     virtual PxClothFabric*      createClothFabric(PxInputStream& stream) = 0;
00267 
00280     virtual PxClothFabric*      createClothFabric(const PxClothFabricDesc& desc) = 0;
00281 
00289     virtual PxU32               getNbClothFabrics() const = 0;
00290 
00304     virtual PxU32               getClothFabrics(PxClothFabric** userBuffer, PxU32 bufferSize) const = 0;
00305 #endif
00306 
00308 
00311 
00323     virtual PxScene*            createScene(const PxSceneDesc& sceneDesc) = 0;
00324 
00332     virtual PxU32               getNbScenes()           const   = 0;
00333 
00348     virtual PxU32               getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00349     
00351 
00354 
00364     virtual PxRigidStatic*      createRigidStatic(const PxTransform& pose) = 0;
00365 
00366 
00367 
00377     virtual PxRigidDynamic*      createRigidDynamic(const PxTransform& pose) = 0;
00378 
00379 
00380 #if PX_USE_PARTICLE_SYSTEM_API
00381 
00392     PX_DEPRECATED virtual PxParticleSystem* createParticleSystem(PxU32 maxParticles, bool perParticleRestOffset = false) = 0;
00393 
00405     PX_DEPRECATED virtual PxParticleFluid*  createParticleFluid(PxU32 maxParticles, bool perParticleRestOffset = false) = 0;
00406 #endif
00407 
00408 
00409 #if PX_USE_CLOTH_API
00410 
00421     virtual PxCloth*            createCloth(const PxTransform& globalPose, PxClothFabric& fabric, const PxClothParticle* particles, PxClothFlags flags) = 0;
00422 #endif
00423 
00437     virtual PxPruningStructure* createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors)  = 0;
00438     
00440 
00443     
00444 
00460     PX_FORCE_INLINE PxShape*    createShape(    const PxGeometry& geometry, 
00461                                                 const PxMaterial& material, 
00462                                                 bool isExclusive = false, 
00463                                                 PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE)
00464     {
00465         PxMaterial* materialPtr = const_cast<PxMaterial*>(&material);
00466         return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags);
00467     }
00468 
00469 
00486     virtual PxShape*            createShape(const PxGeometry& geometry, 
00487                                             PxMaterial*const * materials, 
00488                                             PxU16 materialCount, 
00489                                             bool isExclusive = false,
00490                                             PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0;
00491 
00492 
00500     virtual PxU32               getNbShapes() const = 0;
00501 
00516     virtual PxU32               getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00517 
00519 
00522 
00523 
00540     virtual PxConstraint*      createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize)       = 0;
00541 
00542 
00550     virtual PxArticulation*      createArticulation() = 0;
00551 
00553 
00556 
00557 
00569     virtual PxMaterial*        createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution)        = 0;
00570 
00571 
00579     virtual PxU32               getNbMaterials() const = 0;
00580 
00595     virtual PxU32               getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00596 
00598 
00601 
00617     virtual void registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet = false) = 0;
00618 
00628     virtual void unregisterDeletionListener(PxDeletionListener& observer) = 0;
00629 
00645     virtual void registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0;
00646 
00662     virtual void unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0;
00663 
00672     virtual PxPhysicsInsertionCallback& getPhysicsInsertionCallback() = 0;
00673 
00675 };
00676 
00677 #if !PX_DOXYGEN
00678 } 
00679 #endif
00680 
00688 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterArticulations(physx::PxPhysics& physics);
00689 
00707 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterHeightFields(physx::PxPhysics& physics);
00708 
00721 PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterLegacyHeightFields(physx::PxPhysics& physics);
00722 
00730 PX_DEPRECATED PX_INLINE void PX_CALL_CONV PxRegisterUnifiedHeightFields(physx::PxPhysics& physics)
00731 {
00732     PxRegisterHeightFields(physics);
00733 }
00734 
00735 
00743 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterCloth(physx::PxPhysics& physics);
00744 
00754 PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterParticles(physx::PxPhysics& physics);
00755 
00777 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics* PX_CALL_CONV PxCreateBasePhysics(physx::PxU32 version,
00778                                                                                  physx::PxFoundation& foundation,
00779                                                                                  const physx::PxTolerancesScale& scale,                                                                              
00780                                                                                  bool trackOutstandingAllocations = false,
00781                                                                                  physx::PxPvd* pvd = NULL);
00782 
00810 PX_INLINE physx::PxPhysics* PxCreatePhysics(physx::PxU32 version,
00811                                             physx::PxFoundation& foundation,
00812                                             const physx::PxTolerancesScale& scale,                                          
00813                                             bool trackOutstandingAllocations = false,
00814                                             physx::PxPvd* pvd = NULL )
00815 {
00816     physx::PxPhysics* physics = PxCreateBasePhysics(version, foundation, scale, trackOutstandingAllocations, pvd);
00817     if(!physics)
00818         return NULL;
00819 
00820     PxRegisterArticulations(*physics);
00821     PxRegisterHeightFields(*physics);
00822     PxRegisterCloth(*physics);
00823     PxRegisterParticles(*physics);
00824 
00825     return physics;
00826 }
00827 
00835 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics& PX_CALL_CONV PxGetPhysics();
00836 
00838 #endif