RavEngine
Loading...
Searching...
No Matches
NpPhysics.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef NP_PHYSICS_H
30#define NP_PHYSICS_H
31
32#include "PxPhysics.h"
33#include "foundation/PxUserAllocated.h"
34#include "foundation/PxHashSet.h"
35#include "foundation/PxHashMap.h"
36#include "GuMeshFactory.h"
37#include "NpMaterial.h"
38#include "NpFEMSoftBodyMaterial.h"
39#include "NpFEMClothMaterial.h"
40#include "NpPBDMaterial.h"
41#include "NpFLIPMaterial.h"
42#include "NpMPMMaterial.h"
43#include "NpPhysicsInsertionCallback.h"
44#include "NpMaterialManager.h"
45#include "ScPhysics.h"
46
47#ifdef LINUX
48#include <string.h>
49#endif
50
51#if PX_SUPPORT_GPU_PHYSX
52#include "device/PhysXIndicator.h"
53#endif
54
55#include "PsPvd.h"
56
57#if PX_SUPPORT_OMNI_PVD
58class OmniPvdPxSampler;
59namespace physx
60{
61 class PxOmniPvd;
62}
63#endif
64
65namespace physx
66{
67
68#if PX_SUPPORT_PVD
69namespace Vd
70{
71 class PvdPhysicsClient;
72}
73#endif
75 {
76 NpMaterialIndexTranslator() : indicesNeedTranslation(false) {}
77
79 bool indicesNeedTranslation;
80 };
81
82 class NpScene;
83 struct PxvOffsetTable;
84
85#if PX_VC
86#pragma warning(push)
87#pragma warning(disable:4996) // We have to implement deprecated member functions, do not warn.
88#endif
89
90template <typename T> class NpMaterialAccessor;
91
92class NpPhysics : public PxPhysics, public PxUserAllocated
93{
94 NpPhysics& operator=(const NpPhysics&);
95 NpPhysics(const NpPhysics &);
96
97 struct NpDelListenerEntry : public PxUserAllocated
98 {
99 NpDelListenerEntry(const PxDeletionEventFlags& de, bool restrictedObjSet)
100 : flags(de)
101 , restrictedObjectSet(restrictedObjSet)
102 {
103 }
104
105 PxHashSet<const PxBase*> registeredObjects; // specifically registered objects for deletion events
107 bool restrictedObjectSet;
108 };
109
110
111 NpPhysics( const PxTolerancesScale& scale,
112 const PxvOffsetTable& pxvOffsetTable,
113 bool trackOutstandingAllocations,
116 physx::PxOmniPvd* omniPvd);
117 virtual ~NpPhysics();
118
119public:
120
121 static NpPhysics* createInstance( PxU32 version,
122 PxFoundation& foundation,
123 const PxTolerancesScale& scale,
124 bool trackOutstandingAllocations,
126 physx::PxOmniPvd* omniPvd);
127
128 static PxU32 releaseInstance();
129
130 static NpPhysics& getInstance() { return *mInstance; }
131
132 virtual void release() PX_OVERRIDE;
133
135
137 void releaseSceneInternal(PxScene&);
138 virtual PxU32 getNbScenes() const PX_OVERRIDE;
139 virtual PxU32 getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
140
144 virtual PxSoftBody* createSoftBody(PxCudaContextManager& cudaContextManager) PX_OVERRIDE;
145 virtual PxHairSystem* createHairSystem(PxCudaContextManager& cudaContextManager) PX_OVERRIDE;
146 virtual PxFEMCloth* createFEMCloth(PxCudaContextManager& cudaContextManager) PX_OVERRIDE;
147 virtual PxPBDParticleSystem* createPBDParticleSystem(PxCudaContextManager& cudaContexManager, PxU32 maxNeighborhood) PX_OVERRIDE;
148 virtual PxFLIPParticleSystem* createFLIPParticleSystem(PxCudaContextManager& cudaContexManager) PX_OVERRIDE;
149 virtual PxMPMParticleSystem* createMPMParticleSystem(PxCudaContextManager& cudaContexManager) PX_OVERRIDE;
150 virtual PxCustomParticleSystem* createCustomParticleSystem(PxCudaContextManager& cudaContexManager, PxU32 maxNeighborhood) PX_OVERRIDE;
151
152 virtual PxBuffer* createBuffer(PxU64 byteSize, PxBufferType::Enum bufferType, PxCudaContextManager* cudaContextManager) PX_OVERRIDE;
153 virtual PxConstraint* createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) PX_OVERRIDE;
154 virtual PxAggregate* createAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint) PX_OVERRIDE;
155
156 virtual PxShape* createShape(const PxGeometry&, PxMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE;
157 virtual PxShape* createShape(const PxGeometry&, PxFEMSoftBodyMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE;
158 virtual PxShape* createShape(const PxGeometry&, PxFEMClothMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE;
159
160 virtual PxU32 getNbShapes() const PX_OVERRIDE;
161 virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex) const PX_OVERRIDE;
162
163 virtual PxMaterial* createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) PX_OVERRIDE;
164 virtual PxU32 getNbMaterials() const PX_OVERRIDE;
165 virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
166
167 virtual PxFEMSoftBodyMaterial* createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) PX_OVERRIDE;
168 virtual PxU32 getNbFEMSoftBodyMaterials() const PX_OVERRIDE;
169 virtual PxU32 getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
170
171 virtual PxFEMClothMaterial* createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) PX_OVERRIDE;
172 virtual PxU32 getNbFEMClothMaterials() const PX_OVERRIDE;
173 virtual PxU32 getFEMClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
174
175 virtual PxPBDMaterial* createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, PxReal surfaceTension, PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient, PxReal gravityScale) PX_OVERRIDE;
176 virtual PxU32 getNbPBDMaterials() const PX_OVERRIDE;
177 virtual PxU32 getPBDMaterials(PxPBDMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
178
179 virtual PxFLIPMaterial* createFLIPMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, PxReal viscosity, PxReal gravityScale) PX_OVERRIDE;
180 virtual PxU32 getNbFLIPMaterials() const PX_OVERRIDE;
181 virtual PxU32 getFLIPMaterials(PxFLIPMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
182
183 virtual PxMPMMaterial* createMPMMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, PxReal criticalCompression, PxReal criticalStretch, PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, PxReal attractiveForceResidual, PxReal gravityScale) PX_OVERRIDE;
184 virtual PxU32 getNbMPMMaterials() const PX_OVERRIDE;
185 virtual PxU32 getMPMMaterials(PxMPMMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
186
187 virtual PxCustomMaterial* createCustomMaterial(void* gpuBuffer) PX_OVERRIDE;
188 virtual PxU32 getNbCustomMaterials() const PX_OVERRIDE;
189 virtual PxU32 getCustomMaterials(PxCustomMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
190
192 virtual PxU32 getNbTriangleMeshes() const PX_OVERRIDE;
193 virtual PxU32 getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
194
196 virtual PxU32 getNbTetrahedronMeshes() const PX_OVERRIDE;
197 virtual PxU32 getTetrahedronMeshes(PxTetrahedronMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
198
200
202 virtual PxU32 getNbHeightFields() const PX_OVERRIDE;
203 virtual PxU32 getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
204
206 virtual PxU32 getNbConvexMeshes() const PX_OVERRIDE;
207 virtual PxU32 getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
208
210 virtual PxU32 getNbBVHs() const PX_OVERRIDE;
211 virtual PxU32 getBVHs(PxBVH** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
212
213 virtual PxParticleBuffer* createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager* cudaContexManager) PX_OVERRIDE;
214 virtual PxParticleAndDiffuseBuffer* createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager* cudaContexManager) PX_OVERRIDE;
215 virtual PxParticleClothBuffer* createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager* cudaContexManager) PX_OVERRIDE;
216 virtual PxParticleRigidBuffer* createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager* cudaContexManager) PX_OVERRIDE;
217
218#if PX_SUPPORT_GPU_PHYSX
219 void registerPhysXIndicatorGpuClient();
220 void unregisterPhysXIndicatorGpuClient();
221#else
222 PX_FORCE_INLINE void registerPhysXIndicatorGpuClient() {}
223 PX_FORCE_INLINE void unregisterPhysXIndicatorGpuClient() {}
224#endif
225
226 virtual PxPruningStructure* createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors) PX_OVERRIDE;
227
228 virtual const PxTolerancesScale& getTolerancesScale() const PX_OVERRIDE;
229
231
232 PX_INLINE NpScene* getScene(PxU32 i) const { return mSceneArray[i]; }
233 PX_INLINE PxU32 getNumScenes() const { return mSceneArray.size(); }
234#if PX_CHECKED
235 static PX_INLINE void heightfieldsAreRegistered() { mHeightFieldsRegistered = true; }
236#endif
237
238 virtual void registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet) PX_OVERRIDE;
240 virtual void registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) PX_OVERRIDE;
241 virtual void unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) PX_OVERRIDE;
242
243 void notifyDeletionListeners(const PxBase*, void* userData, PxDeletionEventFlag::Enum deletionEvent);
244 PX_FORCE_INLINE void notifyDeletionListenersUserRelease(const PxBase* b, void* userData) { notifyDeletionListeners(b, userData, PxDeletionEventFlag::eUSER_RELEASE); }
245 PX_FORCE_INLINE void notifyDeletionListenersMemRelease(const PxBase* b, void* userData) { notifyDeletionListeners(b, userData, PxDeletionEventFlag::eMEMORY_RELEASE); }
246
247 virtual PxInsertionCallback& getPhysicsInsertionCallback() PX_OVERRIDE { return mObjectInsertion; }
248
249 void removeMaterialFromTable(NpMaterial&);
250 void updateMaterial(NpMaterial&);
251 bool sendMaterialTable(NpScene&);
252
253 NpMaterialManager<NpMaterial>& getMaterialManager() { return mMasterMaterialManager; }
254 NpMaterialManager<NpFEMSoftBodyMaterial>& getFEMSoftBodyMaterialManager() { return mMasterFEMSoftBodyMaterialManager; }
255#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
256 NpMaterialManager<NpFEMClothMaterial>& getFEMClothMaterialManager() { return mMasterFEMClothMaterialManager; }
257#endif
258 NpMaterialManager<NpPBDMaterial>& getPBDMaterialManager() { return mMasterPBDMaterialManager; }
259#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
260 NpMaterialManager<NpFLIPMaterial>& getFLIPMaterialManager() { return mMasterFLIPMaterialManager; }
261 NpMaterialManager<NpMPMMaterial>& getMPMMaterialManager() { return mMasterMPMMaterialManager; }
262 NpMaterialManager<NpCustomMaterial>& getCustomMaterialManager() { return mMasterCustomMaterialManager; }
263#endif
264 /*template <typename T>
265 NpMaterialManager<T>* getMaterialManagerT();
266 template <>
267 NpMaterialManager<NpMaterial>* getMaterialManagerT() { return &mMasterMaterialManager; }
268 template <>
269 NpMaterialManager<NpFEMSoftBodyMaterial>* getMaterialManagerT() { return &mMasterFEMSoftBodyMaterialManager; }
270 template <>
271 NpMaterialManager<NpFEMClothMaterial>* getMaterialManagerT() { return &mMasterFEMClothMaterialManager; }*/
272
273 NpMaterial* addMaterial(NpMaterial* np);
274
275 void removeFEMSoftBodyMaterialFromTable(NpFEMSoftBodyMaterial&);
276 void updateFEMSoftBodyMaterial(NpFEMSoftBodyMaterial&);
277
278 NpFEMSoftBodyMaterial* addFEMMaterial(NpFEMSoftBodyMaterial* np);
279
280#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
281 void removeFEMClothMaterialFromTable(NpFEMClothMaterial&);
282 void updateFEMClothMaterial(NpFEMClothMaterial&);
283 NpFEMClothMaterial* addFEMClothMaterial(NpFEMClothMaterial* np);
284#endif
285 void removePBDMaterialFromTable(NpPBDMaterial&);
286 void updatePBDMaterial(NpPBDMaterial&);
287 NpPBDMaterial* addPBDMaterial(NpPBDMaterial* np);
288#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
289 void removeFLIPMaterialFromTable(NpFLIPMaterial&);
290 void updateFLIPMaterial(NpFLIPMaterial&);
291 NpFLIPMaterial* addFLIPMaterial(NpFLIPMaterial* np);
292
293 void removeMPMMaterialFromTable(NpMPMMaterial&);
294 void updateMPMMaterial(NpMPMMaterial&);
295 NpMPMMaterial* addMPMMaterial(NpMPMMaterial* np);
296
297 void removeCustomMaterialFromTable(NpCustomMaterial&);
298 void updateCustomMaterial(NpCustomMaterial&);
299 NpCustomMaterial* addCustomMaterial(NpCustomMaterial* np);
300#endif
301 static void initOffsetTables(PxvOffsetTable& pxvOffsetTable);
302
303 static bool apiReentryLock;
304
305#if PX_SUPPORT_OMNI_PVD
306 OmniPvdPxSampler* mOmniPvdSampler;
307 PxOmniPvd* mOmniPvd;
308#endif
309
310private:
311 typedef PxCoalescedHashMap<PxDeletionListener*, NpDelListenerEntry*> DeletionListenerMap;
312
313 PxArray<NpScene*> mSceneArray;
314
315 Sc::Physics mPhysics;
316 NpMaterialManager<NpMaterial> mMasterMaterialManager;
317 NpMaterialManager<NpFEMSoftBodyMaterial> mMasterFEMSoftBodyMaterialManager;
318#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
319 NpMaterialManager<NpFEMClothMaterial> mMasterFEMClothMaterialManager;
320#endif
321 NpMaterialManager<NpPBDMaterial> mMasterPBDMaterialManager;
322#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
323 NpMaterialManager<NpFLIPMaterial> mMasterFLIPMaterialManager;
324 NpMaterialManager<NpMPMMaterial> mMasterMPMMaterialManager;
325 NpMaterialManager<NpCustomMaterial> mMasterCustomMaterialManager;
326#endif
327 NpPhysicsInsertionCallback mObjectInsertion;
328
329 struct MeshDeletionListener: public Gu::MeshFactoryListener
330 {
331 void onMeshFactoryBufferRelease(const PxBase* object, PxType type)
332 {
333 PX_UNUSED(type);
334 NpPhysics::getInstance().notifyDeletionListeners(object, NULL, PxDeletionEventFlag::eMEMORY_RELEASE);
335 }
336 };
337
338 PxMutex mDeletionListenerMutex;
339 DeletionListenerMap mDeletionListenerMap;
340 MeshDeletionListener mDeletionMeshListener;
341 bool mDeletionListenersExist;
342
343 PxMutex mSceneAndMaterialMutex; // guarantees thread safety for API calls related to scene and material containers
344
345 PxFoundation& mFoundation;
346
347#if PX_SUPPORT_GPU_PHYSX
348 PhysXIndicator mPhysXIndicator;
349 PxU32 mNbRegisteredGpuClients;
350 PxMutex mPhysXIndicatorMutex;
351#endif
352#if PX_SUPPORT_PVD
354 Vd::PvdPhysicsClient* mPvdPhysicsClient;
355#endif
356
357 static PxU32 mRefCount;
358 static NpPhysics* mInstance;
359
360#if PX_CHECKED
361 static bool mHeightFieldsRegistered; //just for error checking
362#endif
363
364 friend class NpCollection;
365
366#if PX_SUPPORT_OMNI_PVD
367 class OmniPvdListener : public physx::NpFactoryListener
368 {
369 public:
370 virtual void onMeshFactoryBufferRelease(const PxBase*, PxType) {}
371 virtual void onObjectAdd(const PxBase*);
372 virtual void onObjectRemove(const PxBase*);
373 }
374 mOmniPvdListener;
375#endif
376};
377
379{
380public:
381 static NpMaterialManager<NpMaterial>& getMaterialManager(NpPhysics& physics)
382 {
383 return physics.getMaterialManager();
384 }
385};
386
388{
389public:
390 static NpMaterialManager<NpFEMSoftBodyMaterial>& getMaterialManager(NpPhysics& physics)
391 {
392 return physics.getFEMSoftBodyMaterialManager();
393 }
394};
395
396#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
397template <> class NpMaterialAccessor<NpFEMClothMaterial>
398{
399public:
400 static NpMaterialManager<NpFEMClothMaterial>& getMaterialManager(NpPhysics& physics)
401 {
402 return physics.getFEMClothMaterialManager();
403 }
404};
405#endif
406
408{
409public:
410 static NpMaterialManager<NpPBDMaterial>& getMaterialManager(NpPhysics& physics)
411 {
412 return physics.getPBDMaterialManager();
413 }
414};
415
416#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
417template <> class NpMaterialAccessor<NpFLIPMaterial>
418{
419public:
420 static NpMaterialManager<NpFLIPMaterial>& getMaterialManager(NpPhysics& physics)
421 {
422 return physics.getFLIPMaterialManager();
423 }
424};
425
426template <> class NpMaterialAccessor<NpMPMMaterial>
427{
428public:
429 static NpMaterialManager<NpMPMMaterial>& getMaterialManager(NpPhysics& physics)
430 {
431 return physics.getMPMMaterialManager();
432 }
433};
434
435template <> class NpMaterialAccessor<NpCustomMaterial>
436{
437public:
438 static NpMaterialManager<NpCustomMaterial>& getMaterialManager(NpPhysics& physics)
439 {
440 return physics.getCustomMaterialManager();
441 }
442};
443#endif
444
445#if PX_VC
446#pragma warning(pop)
447#endif
448}
449
450#endif
Definition NpFEMSoftBodyMaterial.h:46
Definition NpFactory.h:116
Definition NpPhysics.h:90
Definition NpMaterialManager.h:40
Definition NpMaterial.h:46
Definition NpPBDMaterial.h:47
Definition NpPhysics.h:93
virtual PxConvexMesh * createConvexMesh(PxInputStream &) PX_OVERRIDE
Creates a convex mesh object.
Definition NpPhysics.cpp:1504
virtual PxCustomParticleSystem * createCustomParticleSystem(PxCudaContextManager &cudaContexManager, PxU32 maxNeighborhood) PX_OVERRIDE
Creates a customizable particle system to simulate effects that are not supported by PhysX natively (...
Definition NpPhysics.cpp:572
virtual void unregisterDeletionListener(PxDeletionListener &observer) PX_OVERRIDE
Unregister a deletion listener.
Definition NpPhysics.cpp:1623
virtual PxParticleBuffer * createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager *cudaContexManager) PX_OVERRIDE
Create particle buffer to simulate fluid/granular material.
Definition NpPhysics.cpp:1538
virtual PxMaterial * createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) PX_OVERRIDE
Creates a new rigid body material with certain default properties.
Definition NpPhysics.cpp:640
virtual PxSoftBodyMesh * createSoftBodyMesh(PxInputStream &) PX_OVERRIDE
Creates a softbody mesh object.
Definition NpPhysics.cpp:1480
virtual PxAggregate * createAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint) PX_OVERRIDE
Creates an aggregate with the specified maximum size and filtering hint.
Definition NpPhysics.cpp:602
virtual PxFLIPMaterial * createFLIPMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, PxReal viscosity, PxReal gravityScale) PX_OVERRIDE
Creates a new FLIP material with certain default properties.
Definition NpPhysics.cpp:1124
virtual PxConstraint * createConstraint(PxRigidActor *actor0, PxRigidActor *actor1, PxConstraintConnector &connector, const PxConstraintShaderTable &shaders, PxU32 dataSize) PX_OVERRIDE
Creates a constraint shader.
Definition NpPhysics.cpp:516
virtual void registerDeletionListener(PxDeletionListener &observer, const PxDeletionEventFlags &deletionEvents, bool restrictedObjectSet) PX_OVERRIDE
Register a deletion listener. Listeners will be called whenever an object is deleted.
Definition NpPhysics.cpp:1600
virtual PxU32 getPBDMaterials(PxPBDMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of PBD material pointers to a user buffer.
Definition NpPhysics.cpp:1024
virtual PxU32 getNbShapes() const PX_OVERRIDE
Return the number of shapes that currently exist.
Definition NpPhysics.cpp:500
virtual PxU32 getTriangleMeshes(PxTriangleMesh **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of triangle mesh pointers to a user buffer.
Definition NpPhysics.cpp:1458
virtual PxTriangleMesh * createTriangleMesh(PxInputStream &) PX_OVERRIDE
Creates a triangle mesh object.
Definition NpPhysics.cpp:1448
virtual PxU32 getTetrahedronMeshes(PxTetrahedronMesh **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of tetrahedron mesh pointers to a user buffer.
Definition NpPhysics.cpp:1475
virtual PxU32 getNbMPMMaterials() const PX_OVERRIDE
Return the number of MPM materials that currently exist.
Definition NpPhysics.cpp:1253
virtual PxU32 getNbTetrahedronMeshes() const PX_OVERRIDE
Return the number of tetrahedron meshes that currently exist.
Definition NpPhysics.cpp:1470
virtual PxU32 getShapes(PxShape **userBuffer, PxU32 bufferSize, PxU32 startIndex) const PX_OVERRIDE
Writes the array of shape pointers to a user buffer.
Definition NpPhysics.cpp:505
virtual PxOmniPvd * getOmniPvd() PX_OVERRIDE
Retrieves the PxOmniPvd instance if there is one registered with PxPhysics.
Definition NpPhysics.cpp:233
virtual PxU32 getNbFEMClothMaterials() const PX_OVERRIDE
Return the number of FEM cloth materials that currently exist.
Definition NpPhysics.cpp:904
virtual PxU32 getScenes(PxScene **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of scene pointers to a user buffer.
Definition NpPhysics.cpp:442
virtual PxSoftBody * createSoftBody(PxCudaContextManager &cudaContextManager) PX_OVERRIDE
Creates a FEM-based soft body with all fields initialized to their default values.
Definition NpPhysics.cpp:526
virtual PxMPMMaterial * createMPMMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, PxReal criticalCompression, PxReal criticalStretch, PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, PxReal attractiveForceResidual, PxReal gravityScale) PX_OVERRIDE
Creates a new MPM material with certain default properties.
Definition NpPhysics.cpp:1247
virtual void unregisterDeletionListenerObjects(PxDeletionListener &observer, const PxBase *const *observables, PxU32 observableCount) PX_OVERRIDE
Unregister specific objects for deletion events.
Definition NpPhysics.cpp:1657
virtual PxU32 getFEMClothMaterials(PxFEMClothMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of FEM cloth material pointers to a user buffer.
Definition NpPhysics.cpp:914
virtual PxU32 getNbHeightFields() const PX_OVERRIDE
Return the number of heightfields that currently exist.
Definition NpPhysics.cpp:1492
virtual PxU32 getNbFEMSoftBodyMaterials() const PX_OVERRIDE
Return the number of FEM soft body materials that currently exist.
Definition NpPhysics.cpp:794
virtual PxFEMSoftBodyMaterial * createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) PX_OVERRIDE
Creates a new FEM soft body material with certain default properties.
Definition NpPhysics.cpp:788
virtual PxFoundation & getFoundation() PX_OVERRIDE
Retrieves the Foundation instance.
Definition NpPhysics.cpp:1730
virtual PxPruningStructure * createPruningStructure(PxRigidActor *const *actors, PxU32 nbActors) PX_OVERRIDE
Creates a pruning structure from actors.
Definition NpPhysics.cpp:1560
virtual PxU32 getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of FEM soft body material pointers to a user buffer.
Definition NpPhysics.cpp:800
virtual PxParticleAndDiffuseBuffer * createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager *cudaContexManager) PX_OVERRIDE
Create a particle buffer for fluid dynamics with diffuse particles. Diffuse particles are used to sim...
Definition NpPhysics.cpp:1543
virtual const PxTolerancesScale & getTolerancesScale() const PX_OVERRIDE
Returns the simulation tolerance parameters.
Definition NpPhysics.cpp:1725
virtual PxScene * createScene(const PxSceneDesc &) PX_OVERRIDE
Creates a scene.
Definition NpPhysics.cpp:367
virtual PxU32 getHeightFields(PxHeightField **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of heightfield pointers to a user buffer.
Definition NpPhysics.cpp:1497
virtual PxU32 getConvexMeshes(PxConvexMesh **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of convex mesh pointers to a user buffer.
Definition NpPhysics.cpp:1514
virtual PxU32 getBVHs(PxBVH **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of bounding volume hierarchy pointers to a user buffer.
Definition NpPhysics.cpp:1531
virtual PxU32 getNbBVHs() const PX_OVERRIDE
Return the number of bounding volume hierarchies that currently exist.
Definition NpPhysics.cpp:1526
virtual PxFEMCloth * createFEMCloth(PxCudaContextManager &cudaContextManager) PX_OVERRIDE
Creates a FEM-based cloth with all fields initialized to their default values.
Definition NpPhysics.cpp:576
virtual PxU32 getNbTriangleMeshes() const PX_OVERRIDE
Return the number of triangle meshes that currently exist.
Definition NpPhysics.cpp:1453
virtual PxBVH * createBVH(PxInputStream &) PX_OVERRIDE
Creates a bounding volume hierarchy.
Definition NpPhysics.cpp:1521
virtual PxU32 getNbScenes() const PX_OVERRIDE
Gets number of created scenes.
Definition NpPhysics.cpp:436
virtual PxPBDParticleSystem * createPBDParticleSystem(PxCudaContextManager &cudaContexManager, PxU32 maxNeighborhood) PX_OVERRIDE
Creates a particle system with a position-based dynamics (PBD) solver.
Definition NpPhysics.cpp:531
virtual PxU32 getMaterials(PxMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of rigid body material pointers to a user buffer.
Definition NpPhysics.cpp:656
virtual PxRigidDynamic * createRigidDynamic(const PxTransform &) PX_OVERRIDE
Creates a dynamic rigid actor with the specified pose and all other fields initialized to their defau...
Definition NpPhysics.cpp:510
virtual PxArticulationReducedCoordinate * createArticulationReducedCoordinate() PX_OVERRIDE
Creates a reduced-coordinate articulation with all fields initialized to their default values.
Definition NpPhysics.cpp:521
virtual PxHeightField * createHeightField(PxInputStream &stream) PX_OVERRIDE
Creates a heightfield object from previously cooked stream.
Definition NpPhysics.cpp:1487
virtual PxU32 getCustomMaterials(PxCustomMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of custom material pointers to a user buffer.
Definition NpPhysics.cpp:1402
virtual PxFLIPParticleSystem * createFLIPParticleSystem(PxCudaContextManager &cudaContexManager) PX_OVERRIDE
Creates a particle system with a fluid-implicit particle solver (FLIP).
Definition NpPhysics.cpp:562
virtual PxPBDMaterial * createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, PxReal surfaceTension, PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient, PxReal gravityScale) PX_OVERRIDE
Creates a new PBD material with certain default properties.
Definition NpPhysics.cpp:1011
virtual PxU32 getNbCustomMaterials() const PX_OVERRIDE
Return the number of custom materials that currently exist.
Definition NpPhysics.cpp:1373
virtual void registerDeletionListenerObjects(PxDeletionListener &observer, const PxBase *const *observables, PxU32 observableCount) PX_OVERRIDE
Register specific objects for deletion events.
Definition NpPhysics.cpp:1637
virtual PxMPMParticleSystem * createMPMParticleSystem(PxCudaContextManager &cudaContexManager) PX_OVERRIDE
Creates a particle system with a material-point-method solver (MPM).
Definition NpPhysics.cpp:567
virtual PxU32 getMPMMaterials(PxMPMMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of MPM material pointers to a user buffer.
Definition NpPhysics.cpp:1282
virtual PxU32 getNbFLIPMaterials() const PX_OVERRIDE
Return the number of FLIP materials that currently exist.
Definition NpPhysics.cpp:1130
virtual PxParticleRigidBuffer * createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager *cudaContexManager) PX_OVERRIDE
Create a particle buffer to simulate rigid bodies using shape matching with particles.
Definition NpPhysics.cpp:1553
virtual PxU32 getFLIPMaterials(PxFLIPMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE
Writes the array of FLIP material pointers to a user buffer.
Definition NpPhysics.cpp:1159
virtual PxRigidStatic * createRigidStatic(const PxTransform &) PX_OVERRIDE
Creates a static rigid actor with the specified pose and all other fields initialized to their defaul...
Definition NpPhysics.cpp:448
virtual PxFEMClothMaterial * createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) PX_OVERRIDE
Creates a new FEM cloth material with certain default properties.
Definition NpPhysics.cpp:898
virtual void release() PX_OVERRIDE
Destroys the instance it is called on.
Definition NpPhysics.cpp:362
virtual PxShape * createShape(const PxGeometry &, PxMaterial *const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE
Creates a shape which may be attached to multiple actors.
Definition NpPhysics.cpp:454
virtual PxU32 getNbPBDMaterials() const PX_OVERRIDE
Return the number of PBD materials that currently exist.
Definition NpPhysics.cpp:1018
virtual PxParticleClothBuffer * createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager *cudaContexManager) PX_OVERRIDE
Create a particle buffer to simulate particle cloth.
Definition NpPhysics.cpp:1548
virtual PxInsertionCallback & getPhysicsInsertionCallback() PX_OVERRIDE
Gets PxPhysics object insertion interface.
Definition NpPhysics.h:247
virtual PxTetrahedronMesh * createTetrahedronMesh(PxInputStream &) PX_OVERRIDE
Creates a tetrahedron mesh object.
Definition NpPhysics.cpp:1465
virtual PxCustomMaterial * createCustomMaterial(void *gpuBuffer) PX_OVERRIDE
Creates a new material for custom particle systems.
Definition NpPhysics.cpp:1367
virtual PxU32 getNbConvexMeshes() const PX_OVERRIDE
Return the number of convex meshes that currently exist.
Definition NpPhysics.cpp:1509
virtual PxU32 getNbMaterials() const PX_OVERRIDE
Return the number of rigid body materials that currently exist.
Definition NpPhysics.cpp:650
virtual PxHairSystem * createHairSystem(PxCudaContextManager &cudaContextManager) PX_OVERRIDE
Creates a hair system with all fields initialized to their default values.
Definition NpPhysics.cpp:580
virtual PxBuffer * createBuffer(PxU64 byteSize, PxBufferType::Enum bufferType, PxCudaContextManager *cudaContextManager) PX_OVERRIDE
Create a buffer for reading and writing data across host and device memory spaces.
Definition NpPhysics.cpp:586
Definition NpScene.h:130
Class to aggregate actors into a single broad-phase entry.
Definition PxAggregate.h:98
A tree structure of bodies connected by joints that is treated as a unit by the dynamics solver....
Definition PxArticulationReducedCoordinate.h:448
Class representing a bounding volume hierarchy.
Definition PxBVH.h:63
Base class for objects that can be members of a PxCollection.
Definition PxBase.h:73
Buffer for delayed bulk read and write operations supporting host and GPU device memory spaces.
Definition PxBuffer.h:66
This class connects a custom constraint to the SDK.
Definition PxConstraintDesc.h:354
A plugin class for implementing constraints.
Definition PxConstraint.h:100
A convex mesh.
Definition PxConvexMesh.h:83
Definition PxPBDMaterial.h:215
interface to get notification on object deletion
Definition PxDeletionListener.h:72
Material class to represent a set of FEM material properties.
Definition PxFEMClothMaterial.h:48
Material class to represent a set of softbody FEM material properties.
Definition PxFEMSoftBodyMaterial.h:49
Material class to represent a set of FLIP particle material properties.
Definition PxFLIPMaterial.h:49
Foundation SDK singleton class.
Definition PxFoundation.h:57
A geometry object.
Definition PxGeometry.h:79
Definition PxHashMap.h:78
Definition PxHashSet.h:77
A height field class.
Definition PxHeightField.h:84
Input stream class for I/O.
Definition PxIO.h:50
Callback interface that permits TriangleMesh, Heightfield, ConvexMesh or BVH to be used directly with...
Definition PxInsertionCallback.h:57
Material class to represent a set of MPM particle material properties.
Definition PxMPMMaterial.h:94
Material class to represent a set of surface properties.
Definition PxMaterial.h:149
Definition PxOmniPvd.h:45
Material class to represent a set of PBD particle material properties.
Definition PxPBDMaterial.h:49
A particle system that uses the position based dynamics(PBD) solver.
Definition PxPBDParticleSystem.h:57
A particle buffer used to simulate diffuse particles.
Definition PxParticleBuffer.h:283
The shared base class for all particle buffers, can be instantiated directly to simulate granular and...
Definition PxParticleBuffer.h:81
A particle buffer used to simulate particle cloth.
Definition PxParticleBuffer.h:429
A particle buffer used to simulate rigid bodies using shape matching with particles.
Definition PxParticleBuffer.h:491
Abstract singleton factory class used for instancing objects in the Physics SDK.
Definition PxPhysics.h:91
A precomputed pruning structure to accelerate scene queries against newly added actors.
Definition PxPruningStructure.h:61
PxRigidActor represents a base class shared between dynamic and static rigid bodies in the physics SD...
Definition PxRigidActor.h:53
PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.
Definition PxRigidDynamic.h:82
PxRigidStatic represents a static rigid body simulation object in the physics SDK.
Definition PxRigidStatic.h:58
Descriptor class for scenes. See #PxScene.
Definition PxSceneDesc.h:426
A scene is a collection of bodies and constraints which can interact.
Definition PxScene.h:178
Abstract class for collision shapes.
Definition PxShape.h:146
A softbody mesh, containing structures to store collision shape, simulation shape and deformation sta...
Definition PxTetrahedronMesh.h:214
Represents a FEM softbody including everything to calculate its definition like geometry and material...
Definition PxSoftBody.h:104
A tetramedron mesh, also called a 'tetrahedron soup'.
Definition PxTetrahedronMesh.h:115
Class to define the scale at which simulation runs. Most simulation tolerances are calculated in term...
Definition PxTolerancesScale.h:53
class representing a rigid euclidean transform as a quaternion and a vector
Definition PxTransform.h:49
A triangle mesh, also called a 'polygon soup'.
Definition PxTriangleMesh.h:118
Definition PxUserAllocated.h:43
Definition PsPvd.h:56
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_OVERRIDE
Definition PxPreprocessor.h:375
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition NpPhysics.h:75
a table of function pointers for a constraint
Definition PxConstraint.h:87
Enum
Definition PxDeletionListener.h:52
@ eMEMORY_RELEASE
The destructor of an object has been called and the memory has been released.
Definition PxDeletionListener.h:54
@ eUSER_RELEASE
The user has called release on an object.
Definition PxDeletionListener.h:53
Definition PxvGlobals.h:66