PxPhysics.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12 
13 
14 #ifndef PX_PHYSICS_NX_PHYSICS
15 #define PX_PHYSICS_NX_PHYSICS
16 
17 
22 #include "PxPhysXConfig.h"
23 #include "PxDeletionListener.h"
24 #include "foundation/PxTransform.h"
25 #include "PxShape.h"
26 #include "physxvisualdebuggersdk/PvdConnectionManager.h"
27 
28 #if PX_USE_CLOTH_API
29 #include "cloth/PxClothTypes.h"
30 #include "cloth/PxClothFabric.h"
31 #endif
32 
33 #ifndef PX_DOXYGEN
34 namespace physx
35 {
36 #endif
37 
38 class PxInputStream;
39 class PxOutputStream;
41 
42 class PxRigidActor;
45 
46 class PxProfileZone;
47 class PxProfileZoneManager;
48 
49 class PxGeometry;
50 
52 
54 {
55  enum Enum
56  {
75  eMESH_VERSION_PLAYSTATION3
76  };
77 };
78 
89 class PxPhysics
90 {
91 public:
92 
96 
97 
98 
99  virtual ~PxPhysics() {}
100 
101 
120  virtual void release() = 0;
121 
126  virtual PxFoundation& getFoundation() = 0;
127 
132  virtual PxVisualDebugger* getVisualDebugger() = 0;
133 
143  virtual PxVisualDebuggerConnectionManager* getPvdConnectionManager() = 0;
144 
145  /*
146  \brief Retrieves the profile sdk manager.
147  * The profile sdk manager manages collections of SDKs and objects that are interested in
148  * receiving events from them. This is the hook if you want to write the profiling events
149  * from multiple SDK's out to a file.
150  \return The SDK's profiling system manager.
151  */
152  virtual PxProfileZoneManager* getProfileZoneManager() = 0;
153 
163  virtual PxAggregate* createAggregate(PxU32 maxSize, bool enableSelfCollision) = 0;
164 
169  virtual const PxTolerancesScale& getTolerancesScale() const = 0;
170 
171 
173 
176 
187  virtual PxTriangleMesh* createTriangleMesh(PxInputStream& stream) = 0;
188 
189 
190 
198  virtual PxU32 getNbTriangleMeshes() const = 0;
199 
214  virtual PxU32 getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
215 
228  PX_DEPRECATED virtual PxHeightField* createHeightField(const PxHeightFieldDesc& heightFieldDesc) = 0;
229 
240  virtual PxHeightField* createHeightField(PxInputStream& stream) = 0;
241 
249  virtual PxU32 getNbHeightFields() const = 0;
250 
265  virtual PxU32 getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
266 
277  virtual PxConvexMesh* createConvexMesh(PxInputStream &stream) = 0;
278 
286  virtual PxU32 getNbConvexMeshes() const = 0;
287 
302  virtual PxU32 getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
303 
304 
305 #if PX_USE_CLOTH_API
306 
316  virtual PxClothFabric* createClothFabric(PxInputStream& stream) = 0;
317 
330  virtual PxClothFabric* createClothFabric(const PxClothFabricDesc& desc) = 0;
331 
339  virtual PxU32 getNbClothFabrics() const = 0;
340 
354  virtual PxU32 getClothFabrics(PxClothFabric** userBuffer, PxU32 bufferSize) const = 0;
355 #endif
356 
358 
361 
370  virtual PxScene* createScene(const PxSceneDesc& sceneDesc) = 0;
371 
379  virtual PxU32 getNbScenes() const = 0;
380 
395  virtual PxU32 getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
396 
398 
401 
411  virtual PxRigidStatic* createRigidStatic(const PxTransform& pose) = 0;
412 
413 
414 
424  virtual PxRigidDynamic* createRigidDynamic(const PxTransform& pose) = 0;
425 
426 
427 #if PX_USE_PARTICLE_SYSTEM_API
428 
437  virtual PxParticleSystem* createParticleSystem(PxU32 maxParticles, bool perParticleRestOffset = false) = 0;
438 
448  virtual PxParticleFluid* createParticleFluid(PxU32 maxParticles, bool perParticleRestOffset = false) = 0;
449 #endif
450 
451 
452 #if PX_USE_CLOTH_API
453 
464  virtual PxCloth* createCloth(const PxTransform& globalPose, PxClothFabric& fabric, const PxClothParticle* particles, PxClothFlags flags) = 0;
465 #endif
466 
468 
471 
472 
489  const PxMaterial& material,
490  bool isExclusive = false,
492  {
493  PxMaterial* materialPtr = const_cast<PxMaterial*>(&material);
494  return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags);
495  }
496 
497 
514  virtual PxShape* createShape(const PxGeometry& geometry,
515  PxMaterial*const * materials,
516  PxU16 materialCount,
517  bool isExclusive = false,
519 
520 
528  virtual PxU32 getNbShapes() const = 0;
529 
544  virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
545 
547 
550 
551 
568  virtual PxConstraint* createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) = 0;
569 
570 
578  virtual PxArticulation* createArticulation() = 0;
579 
581 
584 
585 
597  virtual PxMaterial* createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) = 0;
598 
599 
607  virtual PxU32 getNbMaterials() const = 0;
608 
623  virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
624 
626 
629 
645  virtual void registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet = false) = 0;
646 
656  virtual void unregisterDeletionListener(PxDeletionListener& observer) = 0;
657 
673  virtual void registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0;
674 
690  virtual void unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0;
691 
700  virtual PxPhysicsInsertionCallback& getPhysicsInsertionCallback() = 0;
701 
703 };
704 
705 #ifndef PX_DOXYGEN
706 } // namespace physx
707 #endif
708 
714 PX_C_EXPORT PX_PHYSX_CORE_API physx::PxU32 PX_CALL_CONV PxGetValue(physx::PxCookingValue::Enum cookValue);
715 
716 
724 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterArticulations(physx::PxPhysics& physics);
725 
742 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterHeightFields(physx::PxPhysics& physics);
743 
758 
766 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterCloth(physx::PxPhysics& physics);
767 
775 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterParticles(physx::PxPhysics& physics);
776 
798  physx::PxFoundation& foundation,
799  const physx::PxTolerancesScale& scale,
800  bool trackOutstandingAllocations = false,
801  physx::PxProfileZoneManager* profileZoneManager = NULL);
802 
831 PX_INLINE physx::PxPhysics* PxCreatePhysics(physx::PxU32 version,
832  physx::PxFoundation& foundation,
833  const physx::PxTolerancesScale& scale,
834  bool trackOutstandingAllocations = false,
835  physx::PxProfileZoneManager* profileZoneManager = NULL)
836 {
837  physx::PxPhysics* physics = PxCreateBasePhysics(version, foundation, scale, trackOutstandingAllocations, profileZoneManager);
838  if(!physics)
839  return NULL;
840 
841  PxRegisterArticulations(*physics);
842  PxRegisterHeightFields(*physics);
843  PxRegisterCloth(*physics);
844  PxRegisterParticles(*physics);
845 
846  return physics;
847 }
848 
857 
858 #ifndef PX_DOXYGEN
859 
864 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxGetPhysicsBinaryMetaData(physx::PxOutputStream& stream);
865 
871 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterPhysicsSerializers(physx::PxSerializationRegistry& sr);
872 
878 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxUnregisterPhysicsSerializers(physx::PxSerializationRegistry& sr);
879 
880 
890 PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxAddCollectionToPhysics(const physx::PxCollection& collection);
891 
892 #endif
893 
895 #endif


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