PxPhysics.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.  
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 
00320     virtual PxScene*            createScene(const PxSceneDesc& sceneDesc) = 0;
00321 
00329     virtual PxU32               getNbScenes()           const   = 0;
00330 
00345     virtual PxU32               getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00346     
00348 
00351 
00361     virtual PxRigidStatic*      createRigidStatic(const PxTransform& pose) = 0;
00362 
00363 
00364 
00374     virtual PxRigidDynamic*      createRigidDynamic(const PxTransform& pose) = 0;
00375 
00376 
00377 #if PX_USE_PARTICLE_SYSTEM_API
00378 
00389     PX_DEPRECATED virtual PxParticleSystem* createParticleSystem(PxU32 maxParticles, bool perParticleRestOffset = false) = 0;
00390 
00402     PX_DEPRECATED virtual PxParticleFluid*  createParticleFluid(PxU32 maxParticles, bool perParticleRestOffset = false) = 0;
00403 #endif
00404 
00405 
00406 #if PX_USE_CLOTH_API
00407 
00418     virtual PxCloth*            createCloth(const PxTransform& globalPose, PxClothFabric& fabric, const PxClothParticle* particles, PxClothFlags flags) = 0;
00419 #endif
00420 
00434     virtual PxPruningStructure* createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors)  = 0;
00435     
00437 
00440     
00441 
00457     PX_FORCE_INLINE PxShape*    createShape(    const PxGeometry& geometry, 
00458                                                 const PxMaterial& material, 
00459                                                 bool isExclusive = false, 
00460                                                 PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE)
00461     {
00462         PxMaterial* materialPtr = const_cast<PxMaterial*>(&material);
00463         return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags);
00464     }
00465 
00466 
00483     virtual PxShape*            createShape(const PxGeometry& geometry, 
00484                                             PxMaterial*const * materials, 
00485                                             PxU16 materialCount, 
00486                                             bool isExclusive = false,
00487                                             PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0;
00488 
00489 
00497     virtual PxU32               getNbShapes() const = 0;
00498 
00513     virtual PxU32               getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00514 
00516 
00519 
00520 
00537     virtual PxConstraint*      createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize)       = 0;
00538 
00539 
00547     virtual PxArticulation*      createArticulation() = 0;
00548 
00550 
00553 
00554 
00566     virtual PxMaterial*        createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution)        = 0;
00567 
00568 
00576     virtual PxU32               getNbMaterials() const = 0;
00577 
00592     virtual PxU32               getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00593 
00595 
00598 
00614     virtual void registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet = false) = 0;
00615 
00625     virtual void unregisterDeletionListener(PxDeletionListener& observer) = 0;
00626 
00642     virtual void registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0;
00643 
00659     virtual void unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0;
00660 
00669     virtual PxPhysicsInsertionCallback& getPhysicsInsertionCallback() = 0;
00670 
00672 };
00673 
00674 #if !PX_DOXYGEN
00675 } // namespace physx
00676 #endif
00677 
00685 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterArticulations(physx::PxPhysics& physics);
00686 
00704 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterHeightFields(physx::PxPhysics& physics);
00705 
00718 PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterLegacyHeightFields(physx::PxPhysics& physics);
00719 
00727 PX_DEPRECATED PX_INLINE void PX_CALL_CONV PxRegisterUnifiedHeightFields(physx::PxPhysics& physics)
00728 {
00729     PxRegisterHeightFields(physics);
00730 }
00731 
00732 
00740 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterCloth(physx::PxPhysics& physics);
00741 
00751 PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterParticles(physx::PxPhysics& physics);
00752 
00774 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics* PX_CALL_CONV PxCreateBasePhysics(physx::PxU32 version,
00775                                                                                  physx::PxFoundation& foundation,
00776                                                                                  const physx::PxTolerancesScale& scale,                                                                              
00777                                                                                  bool trackOutstandingAllocations = false,
00778                                                                                  physx::PxPvd* pvd = NULL);
00779 
00807 PX_INLINE physx::PxPhysics* PxCreatePhysics(physx::PxU32 version,
00808                                             physx::PxFoundation& foundation,
00809                                             const physx::PxTolerancesScale& scale,                                          
00810                                             bool trackOutstandingAllocations = false,
00811                                             physx::PxPvd* pvd = NULL )
00812 {
00813     physx::PxPhysics* physics = PxCreateBasePhysics(version, foundation, scale, trackOutstandingAllocations, pvd);
00814     if(!physics)
00815         return NULL;
00816 
00817     PxRegisterArticulations(*physics);
00818     PxRegisterHeightFields(*physics);
00819     PxRegisterCloth(*physics);
00820     PxRegisterParticles(*physics);
00821 
00822     return physics;
00823 }
00824 
00832 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics& PX_CALL_CONV PxGetPhysics();
00833 
00835 #endif


Copyright © 2008-2016 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com