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-2017 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 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 } // namespace physx 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
Copyright © 2008-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com