PhysX SDK 3.2 API Reference: PxPhysics.h Source File

PhysX SDK 3.2 API

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-2012 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 "PxPhysX.h"
00040 #include "common/PxSerialFramework.h"
00041 #include "foundation/PxTransform.h"
00042 #if PX_USE_CLOTH_API
00043 #include "cloth/PxClothTypes.h"
00044 #include "cloth/PxClothFabricTypes.h"
00045 #endif
00046 
00047 namespace physx { namespace debugger { namespace comm {
00048     class PvdConnectionManager;
00049 }}}
00050 
00051 #ifndef PX_DOXYGEN
00052 namespace physx
00053 {
00054 #endif
00055 
00056 class PxInputStream;
00057 class PxOutputStream;
00058 
00059 class PxRigidActor;
00060 class PxConstraintConnector;
00061 struct PxConstraintShaderTable;
00062 
00063 class PxProfileZone;
00064 class PxProfileZoneManager;
00065 
00066 class PxGeometry;
00067 
00068 struct PxCookingValue
00069 {
00070     enum Enum
00071     {
00085         eCONVEX_VERSION_PC,
00086         eMESH_VERSION_PC,
00087         eCONVEX_VERSION_XENON,
00088         eMESH_VERSION_XENON,
00089         eCONVEX_VERSION_PLAYSTATION3,
00090         eMESH_VERSION_PLAYSTATION3,
00091     };
00092 };
00093 
00104 class PxPhysics
00105 {
00106 public:
00107 
00108     virtual ~PxPhysics() {};
00109 
00110     virtual bool registerClass(PxType type, PxClassCreationCallback callback) = 0;
00111 
00120     virtual PxUserReferences*   createUserReferences() = 0;
00121 
00122     PX_DEPRECATED virtual   void                releaseUserReferences(PxUserReferences& ref) = 0;
00123 
00135     virtual PxCollection*       createCollection() = 0;
00136 
00137     PX_DEPRECATED virtual   void                releaseCollection(PxCollection&) = 0;
00138 
00151     virtual void                addCollection(const PxCollection& collection, PxScene& scene) = 0;
00152 
00169     virtual void release() = 0;
00170 
00181     virtual PxScene*            createScene(const PxSceneDesc& sceneDesc) = 0;
00182 
00190     virtual PxU32               getNbScenes()           const   = 0;
00191 
00206     virtual PxU32               getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00207 
00208 
00218     virtual PxRigidStatic*      createRigidStatic(const PxTransform& pose) = 0;
00219 
00220 
00221 
00231     virtual PxRigidDynamic*      createRigidDynamic(const PxTransform& pose) = 0;
00232 
00233 
00234 
00250     virtual PxConstraint*      createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize)       = 0;
00251 
00252 
00261     virtual PxArticulation*      createArticulation() = 0;
00262 
00272     virtual PxAggregate*        createAggregate(PxU32 maxSize, bool enableSelfCollision)    = 0;
00273 
00274 #if PX_USE_PARTICLE_SYSTEM_API
00275 
00282     virtual PxParticleSystem*   createParticleSystem(PxU32 maxParticles, bool perParticleRestOffset = false) = 0;
00283 
00291     virtual PxParticleFluid*    createParticleFluid(PxU32 maxParticles, bool perParticleRestOffset = false) = 0;
00292 #endif
00293 
00294 
00295 #if PX_USE_CLOTH_API
00296 
00309     virtual PxCloth*            createCloth(const PxTransform& globalPose, PxClothFabric& fabric, const PxClothParticle* particles, const PxClothCollisionData& collData, PxClothFlags flags) = 0;
00310 #endif
00311 
00323     virtual PxMaterial*        createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution)        = 0;
00324 
00325 
00333     virtual PxU32               getNbMaterials() const = 0;
00334 
00349     virtual PxU32               getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00350 
00361     virtual PxTriangleMesh*    createTriangleMesh(PxInputStream& stream)                    = 0;
00362     
00363 
00371     virtual PxU32               getNbTriangleMeshes() const = 0;
00372 
00387     virtual PxU32               getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00388 
00399     virtual PxHeightField*      createHeightField(const PxHeightFieldDesc& heightFieldDesc) = 0;
00400 
00408     virtual PxU32               getNbHeightFields() const = 0;
00409 
00424     virtual PxU32               getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00425 
00436     virtual PxConvexMesh*       createConvexMesh(PxInputStream &stream)                 = 0;
00437 
00445     virtual PxU32               getNbConvexMeshes() const = 0;
00446 
00461     virtual PxU32               getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00462 
00463 
00464 #if PX_USE_CLOTH_API
00465 
00475     virtual PxClothFabric*      createClothFabric(PxInputStream& stream) = 0;
00476 
00500     virtual PxClothFabric*      createClothFabric(PxU32 nbParticles, PxU32 nbPhases, const PxU32* phases, 
00501                                     const PxClothFabricPhaseType::Enum* phaseTypes, PxU32 nbRestvalues, const PxReal* restvalues, 
00502                                     PxU32 nbSets, const PxU32* sets, const PxU32* fibers,  const PxU32* indices) = 0;
00503 
00511     virtual PxU32               getNbClothFabrics() const = 0;
00512 
00526     virtual PxU32               getClothFabrics(PxClothFabric** userBuffer, PxU32 bufferSize) const = 0;
00527 #endif
00528 
00533     virtual const PxTolerancesScale&        getTolerancesScale() const = 0;
00534 
00539     virtual PxFoundation&       getFoundation() = 0;
00540 
00545     virtual PxVisualDebugger*   getVisualDebugger() = 0;
00546 
00556     virtual physx::debugger::comm::PvdConnectionManager* getPvdConnectionManager() = 0;
00557 
00558     /*
00559     \brief Retrieves the profile sdk manager.
00560     *   The profile sdk manager manages collections of SDKs and objects that are interested in 
00561     *   receiving events from them.  This is the hook if you want to write the profiling events
00562     *   from multiple SDK's out to a file.
00563     \return The SDK's profiling system manager.
00564     */
00565     virtual physx::PxProfileZoneManager* getProfileZoneManager() = 0;
00566 
00567 };
00568 
00569 #ifndef PX_DOXYGEN
00570 } // namespace physx
00571 #endif
00572 
00578 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxU32 PX_CALL_CONV PxGetValue(physx::PxCookingValue::Enum cookValue);
00579 
00580 
00585 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterArticulations(physx::PxPhysics& physics);
00586 
00587 
00591 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterHeightFields(physx::PxPhysics& physics);
00592 
00593 
00613 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics* PX_CALL_CONV PxCreateBasePhysics(physx::PxU32 version,
00614                                                                                  physx::PxFoundation& foundation,
00615                                                                                  const physx::PxTolerancesScale& scale,
00616                                                                                  bool trackOutstandingAllocations = false,
00617                                                                                  physx::PxProfileZoneManager* profileZoneManager = NULL);
00618 
00640 PX_INLINE physx::PxPhysics* PxCreatePhysics(physx::PxU32 version,
00641                                             physx::PxFoundation& foundation,
00642                                             const physx::PxTolerancesScale& scale,
00643                                             bool trackOutstandingAllocations = false,
00644                                             physx::PxProfileZoneManager* profileZoneManager = NULL)
00645 {
00646     physx::PxPhysics* physics = PxCreateBasePhysics(version, foundation, scale, trackOutstandingAllocations, profileZoneManager);
00647     if(!physics)
00648         return NULL;
00649 
00650     PxRegisterArticulations(*physics);
00651     PxRegisterHeightFields(*physics);
00652     return physics;
00653 }
00654 
00662 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxGetSDKMetaData(const physx::PxPhysics& physics, physx::PxOutputStream& stream);
00663 
00671 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics& PX_CALL_CONV PxGetPhysics();
00672 
00673 
00675 #endif


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