aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/LowLevelParticles/include
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /PhysX_3.4/Source/LowLevelParticles/include
downloadphysx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz
physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip
Initial commit:
PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167]
Diffstat (limited to 'PhysX_3.4/Source/LowLevelParticles/include')
-rw-r--r--PhysX_3.4/Source/LowLevelParticles/include/PtBodyTransformVault.h107
-rw-r--r--PhysX_3.4/Source/LowLevelParticles/include/PtContext.h179
-rw-r--r--PhysX_3.4/Source/LowLevelParticles/include/PtGridCellVector.h203
-rw-r--r--PhysX_3.4/Source/LowLevelParticles/include/PtParticle.h60
-rw-r--r--PhysX_3.4/Source/LowLevelParticles/include/PtParticleContactManagerStream.h214
-rw-r--r--PhysX_3.4/Source/LowLevelParticles/include/PtParticleData.h186
-rw-r--r--PhysX_3.4/Source/LowLevelParticles/include/PtParticleShape.h60
-rw-r--r--PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemCore.h154
-rw-r--r--PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemFlags.h100
-rw-r--r--PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemSim.h136
10 files changed, 1399 insertions, 0 deletions
diff --git a/PhysX_3.4/Source/LowLevelParticles/include/PtBodyTransformVault.h b/PhysX_3.4/Source/LowLevelParticles/include/PtBodyTransformVault.h
new file mode 100644
index 00000000..e25fd6f3
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelParticles/include/PtBodyTransformVault.h
@@ -0,0 +1,107 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PT_BODY_TRANSFORM_VAULT_H
+#define PT_BODY_TRANSFORM_VAULT_H
+
+#include "PxPhysXConfig.h"
+#if PX_USE_PARTICLE_SYSTEM_API
+
+#include "foundation/PxTransform.h"
+#include "PsPool.h"
+#include "CmPhysXCommon.h"
+
+namespace physx
+{
+
+struct PxsBodyCore;
+
+namespace Pt
+{
+
+#define PT_BODY_TRANSFORM_HASH_SIZE 1024 // Size of hash table for last frame's body to world transforms
+ // NOTE: Needs to be power of 2
+
+/*!
+Structure to store the current and the last frame's body to world transformations
+for bodies that collide with particles.
+*/
+class BodyTransformVault : public Ps::UserAllocated
+{
+ public:
+ BodyTransformVault();
+ ~BodyTransformVault();
+
+ void addBody(const PxsBodyCore& body);
+ void removeBody(const PxsBodyCore& body);
+ void teleportBody(const PxsBodyCore& body);
+ const PxTransform* getTransform(const PxsBodyCore& body) const;
+ void update();
+ PX_FORCE_INLINE bool isInVault(const PxsBodyCore& body) const;
+ PX_FORCE_INLINE PxU32 getBodyCount() const
+ {
+ return mBodyCount;
+ }
+
+ private:
+ struct Body2World
+ {
+ PxTransform b2w; // The old transform
+ const PxsBodyCore* body;
+ Body2World* next;
+ PxU32 refCount;
+ };
+
+ PX_FORCE_INLINE PxU32 getHashIndex(const PxsBodyCore& body) const;
+ PX_FORCE_INLINE Body2World* createEntry(const PxsBodyCore& body);
+ PX_FORCE_INLINE bool findEntry(const PxsBodyCore& body, Body2World*& entry, Body2World*& prevEntry) const;
+
+ void updateInternal();
+ bool isInVaultInternal(const PxsBodyCore& body) const;
+
+ private:
+ Body2World* mBody2WorldHash[PT_BODY_TRANSFORM_HASH_SIZE]; // Hash table for last frames world to shape transforms.
+ Ps::Pool<Body2World> mBody2WorldPool; // Pool of last frames body to world transforms.
+ PxU32 mBodyCount;
+};
+
+bool BodyTransformVault::isInVault(const PxsBodyCore& body) const
+{
+ // if the vault is not even used this should be fast and inlined
+ if(mBodyCount == 0)
+ return false;
+
+ return isInVaultInternal(body);
+}
+
+} // namespace Pt
+} // namespace physx
+
+#endif // PX_USE_PARTICLE_SYSTEM_API
+#endif // PT_BODY_TRANSFORM_VAULT_H
diff --git a/PhysX_3.4/Source/LowLevelParticles/include/PtContext.h b/PhysX_3.4/Source/LowLevelParticles/include/PtContext.h
new file mode 100644
index 00000000..8983a559
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelParticles/include/PtContext.h
@@ -0,0 +1,179 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PT_CONTEXT_H
+#define PT_CONTEXT_H
+
+#include "PxPhysXConfig.h"
+#if PX_USE_PARTICLE_SYSTEM_API
+
+#include "PtParticleSystemSim.h"
+#include "PtParticleShape.h"
+#include "PtBodyTransformVault.h"
+
+namespace physx
+{
+
+class PxSceneGpu;
+class PxBaseTask;
+class PxLightCpuTask;
+class PxTaskManager;
+
+namespace Cm
+{
+class FlushPool;
+}
+
+namespace Pt
+{
+
+class BodyTransformVault;
+
+/**
+Per scene manager class for particle systems. All particle systems part of a context are stepped collectively.
+
+The class represents a common interface for CPU and GPU particles. Currently the Pt::ContextCpu implementation
+also contains code to create and schedule GPU particle systems. Eventually all that logic should move either to a
+Pt::ContextGPU class or PxSceneGpu should be changed to implement the Content interface directly.
+*/
+class Context
+{
+ PX_NOCOPY(Context)
+ public:
+ /**
+ Deallocates all resources created for the particle context instance.
+ */
+ virtual void destroy() = 0;
+
+ /**
+ Add a particle system to the particle low level context.
+ Onwership of ParticleData is transfered to the low level particle system in case of the
+ CPU implementation. For the GPU implementation, the content is copied and the ParticleData released.
+ If GPU creation fails, NULL is returned.
+ */
+ virtual ParticleSystemSim* addParticleSystem(class ParticleData* particleData,
+ const ParticleSystemParameter& parameter, bool useGpuSupport) = 0;
+
+ /**
+ Removes a particle system from the particle low level context. If acquireParticleData is specified, the particle
+ state is returned. In case of the CPU implementation, ParticleData ownership is returned - in case of the GPU
+ implementation a new ParticleData instance is created and the particle state copied to it.
+ */
+ virtual ParticleData* removeParticleSystem(ParticleSystemSim* system, bool acquireParticleData) = 0;
+
+ /**
+ Issues shape update stages for a batch of particle systems.
+ Ownership of Pt::ParticleShapeUpdateInput::shapes passed to callee!
+ */
+ virtual PxBaseTask& scheduleShapeGeneration(class ParticleSystemSim** particleSystems,
+ struct ParticleShapesUpdateInput* inputs, PxU32 batchSize,
+ PxBaseTask& continuation) = 0;
+
+ /**
+ Issues dynamics (SPH) update on CPUs.
+ */
+ virtual physx::PxBaseTask& scheduleDynamicsCpu(class ParticleSystemSim** particleSystems, PxU32 batchSize,
+ physx::PxBaseTask& continuation) = 0;
+
+ /**
+ Schedules collision prep work.
+ */
+ virtual physx::PxBaseTask& scheduleCollisionPrep(class ParticleSystemSim** particleSystems,
+ physx::PxLightCpuTask** inputPrepTasks, PxU32 batchSize,
+ physx::PxBaseTask& continuation) = 0;
+
+ /**
+ Schedules collision update stages for a batch of particle systems on CPU.
+ Ownership of Pt::ParticleCollisionUpdateInput::contactManagerStream passed to callee!
+ */
+ virtual physx::PxBaseTask& scheduleCollisionCpu(class ParticleSystemSim** particleSystems, PxU32 batchSize,
+ physx::PxBaseTask& continuation) = 0;
+
+ /**
+ Schedule gpu pipeline.
+ */
+ virtual physx::PxBaseTask& schedulePipelineGpu(ParticleSystemSim** particleSystems, PxU32 batchSize,
+ physx::PxBaseTask& continuation) = 0;
+
+#if PX_SUPPORT_GPU_PHYSX
+ /**
+ Lazily creates a GPU scene (context)
+ and returns it.
+ */
+ virtual class PxSceneGpu* createOrGetSceneGpu() = 0;
+#endif
+
+#if PX_SUPPORT_GPU_PHYSX
+ /**
+ Returns the GPU scene (context).
+ Non-virtual implementation.
+ */
+ PX_FORCE_INLINE PxSceneGpu* getSceneGpuFast()
+ {
+ return mSceneGpu;
+ }
+#endif
+
+ /**
+ Returns Body hash data structure, which is used to store previous pose for RBs for particle collision.
+ */
+ PX_FORCE_INLINE BodyTransformVault& getBodyTransformVaultFast()
+ {
+ return *mBodyTransformVault;
+ }
+
+ protected:
+ Context() : mBodyTransformVault(NULL), mSceneGpu(NULL)
+ {
+ }
+ virtual ~Context()
+ {
+ }
+
+ // members for 'fast', non virtual access
+ BodyTransformVault* mBodyTransformVault; // Hash table to store last frames world to body transforms.
+ PxSceneGpu* mSceneGpu;
+};
+
+/**
+Creates a particle system context
+*/
+Context* createParticleContext(physx::PxTaskManager* taskManager, Cm::FlushPool& taskPool);
+
+/**
+Register particle functionality.
+Not calling this should allow the code to be stripped at link time.
+*/
+void registerParticles();
+
+} // namespace Pt
+} // namespace physx
+
+#endif // PX_USE_PARTICLE_SYSTEM_API
+#endif // PT_CONTEXT_H
diff --git a/PhysX_3.4/Source/LowLevelParticles/include/PtGridCellVector.h b/PhysX_3.4/Source/LowLevelParticles/include/PtGridCellVector.h
new file mode 100644
index 00000000..c7ca11a3
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelParticles/include/PtGridCellVector.h
@@ -0,0 +1,203 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PT_GRID_CELL_VECTOR_H
+#define PT_GRID_CELL_VECTOR_H
+
+#include "PxPhysXConfig.h"
+#if PX_USE_PARTICLE_SYSTEM_API
+
+#include "foundation/PxVec3.h"
+#include <string.h>
+#include "PxvConfig.h"
+#include "PsMathUtils.h"
+
+namespace physx
+{
+
+namespace Pt
+{
+
+/*!
+Simple integer vector in R3 with basic operations.
+
+Used to define coordinates of a uniform grid cell.
+*/
+class GridCellVector
+{
+ public:
+ PX_CUDA_CALLABLE PX_FORCE_INLINE GridCellVector()
+ {
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE GridCellVector(const GridCellVector& v)
+ {
+ x = v.x;
+ y = v.y;
+ z = v.z;
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE GridCellVector(PxI16 _x, PxI16 _y, PxI16 _z)
+ {
+ x = _x;
+ y = _y;
+ z = _z;
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE GridCellVector(const PxVec3& realVec, PxReal scale)
+ {
+ set(realVec, scale);
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const GridCellVector& v) const
+ {
+ return ((x == v.x) && (y == v.y) && (z == v.z));
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const GridCellVector& v) const
+ {
+ return ((x != v.x) || (y != v.y) || (z != v.z));
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE const GridCellVector operator+(const GridCellVector& v)
+ {
+ return GridCellVector(x + v.x, y + v.y, z + v.z);
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE const GridCellVector& operator+=(const GridCellVector& v)
+ {
+ x += v.x;
+ y += v.y;
+ z += v.z;
+ return *this;
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE const GridCellVector operator-(const GridCellVector& v)
+ {
+ return GridCellVector(x - v.x, y - v.y, z - v.z);
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE const GridCellVector& operator-=(const GridCellVector& v)
+ {
+ x -= v.x;
+ y -= v.y;
+ z -= v.z;
+ return *this;
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE const GridCellVector& operator=(const GridCellVector& v)
+ {
+ x = v.x;
+ y = v.y;
+ z = v.z;
+ return *this;
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE const GridCellVector operator<<(const PxU32 shift) const
+ {
+ return GridCellVector(x << shift, y << shift, z << shift);
+ }
+
+ //! Shift grid cell coordinates (can be used to retrieve coordinates of a coarser grid cell that contains the
+ //! defined cell)
+ PX_CUDA_CALLABLE PX_FORCE_INLINE const GridCellVector operator>>(const PxU32 shift) const
+ {
+ return GridCellVector(x >> shift, y >> shift, z >> shift);
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE const GridCellVector& operator<<=(const PxU32 shift)
+ {
+ x <<= shift;
+ y <<= shift;
+ z <<= shift;
+ return *this;
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE const GridCellVector& operator>>=(const PxU32 shift)
+ {
+ x >>= shift;
+ y >>= shift;
+ z >>= shift;
+ return *this;
+ }
+
+ //! Set grid cell coordinates based on a point in space and a scaling factor
+ PX_CUDA_CALLABLE PX_FORCE_INLINE void set(const PxVec3& realVec, PxReal scale)
+ {
+ set(realVec * scale);
+ }
+
+#ifdef __CUDACC__
+ //! Set grid cell coordinates based on a point in space
+ PX_CUDA_CALLABLE PX_FORCE_INLINE void set(const PxVec3& realVec)
+ {
+ x = static_cast<PxI16>(floorf(realVec.x));
+ y = static_cast<PxI16>(floorf(realVec.y));
+ z = static_cast<PxI16>(floorf(realVec.z));
+ }
+#else
+ //! Set grid cell coordinates based on a point in space
+ PX_FORCE_INLINE void set(const PxVec3& realVec)
+ {
+ x = static_cast<PxI16>(Ps::floor(realVec.x));
+ y = static_cast<PxI16>(Ps::floor(realVec.y));
+ z = static_cast<PxI16>(Ps::floor(realVec.z));
+ }
+#endif
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE void set(PxI16 _x, PxI16 _y, PxI16 _z)
+ {
+ x = _x;
+ y = _y;
+ z = _z;
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE void setZero()
+ {
+ x = 0;
+ y = 0;
+ z = 0;
+ }
+
+ PX_CUDA_CALLABLE PX_FORCE_INLINE bool isZero() const
+ {
+ return x == 0 && y == 0 && z == 0;
+ }
+
+ public:
+ PxI16 x;
+ PxI16 y;
+ PxI16 z;
+};
+
+} // namespace Pt
+} // namespace physx
+
+#endif // PX_USE_PARTICLE_SYSTEM_API
+#endif // PT_GRID_CELL_VECTOR_H
diff --git a/PhysX_3.4/Source/LowLevelParticles/include/PtParticle.h b/PhysX_3.4/Source/LowLevelParticles/include/PtParticle.h
new file mode 100644
index 00000000..12c4c4d5
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelParticles/include/PtParticle.h
@@ -0,0 +1,60 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PT_FLUID_PARTICLE_H
+#define PT_FLUID_PARTICLE_H
+
+#include "PxPhysXConfig.h"
+#if PX_USE_PARTICLE_SYSTEM_API
+
+#include "foundation/PxVec3.h"
+#include "PtParticleSystemFlags.h"
+
+namespace physx
+{
+
+namespace Pt
+{
+
+// NOTE: Vector fields of this structure should be 16byte aligned,
+// this implies that the size of this structure should be a multiple of 16bytes.
+struct Particle
+{
+ PxVec3 position;
+ PxF32 density;
+
+ PxVec3 velocity;
+ ParticleFlags flags;
+};
+
+} // namespace Pt
+} // namespace physx
+
+#endif // PX_USE_PARTICLE_SYSTEM_API
+#endif // PT_FLUID_PARTICLE_H
diff --git a/PhysX_3.4/Source/LowLevelParticles/include/PtParticleContactManagerStream.h b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleContactManagerStream.h
new file mode 100644
index 00000000..86320ca0
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleContactManagerStream.h
@@ -0,0 +1,214 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PT_PARTICLE_CONTACT_MANAGER_STREAM_H
+#define PT_PARTICLE_CONTACT_MANAGER_STREAM_H
+
+#include "PxPhysXConfig.h"
+#if PX_USE_PARTICLE_SYSTEM_API
+
+namespace physx
+{
+
+struct PxsRigidCore;
+
+namespace Pt
+{
+
+class ParticleShape;
+
+struct ParticleStreamContactManager
+{
+ const PxsRigidCore* rigidCore;
+ const PxsShapeCore* shapeCore;
+ const PxTransform* w2sOld;
+ bool isDrain;
+ bool isDynamic;
+};
+
+struct ParticleStreamShape
+{
+ const ParticleShape* particleShape;
+ PxU32 numContactManagers;
+ const ParticleStreamContactManager* contactManagers;
+};
+
+class ParticleContactManagerStreamWriter
+{
+ public:
+ static PxU32 getStreamSize(PxU32 numParticleShapes, PxU32 numContactManagers)
+ {
+ return sizeof(PxU32) + // particle shape count
+ sizeof(PxU32) + // stream size
+ numParticleShapes * (sizeof(ParticleShape*) + sizeof(PxU32)) + // shape ll pointer + contact manager
+ // count per shape
+ numContactManagers * sizeof(ParticleStreamContactManager); // contact manager data
+ }
+
+ PX_FORCE_INLINE ParticleContactManagerStreamWriter(PxU8* stream, PxU32 numParticleShapes, PxU32 numContactManagers)
+ : mStream(stream), mNumContactsPtr(NULL)
+ {
+ PX_ASSERT(mStream);
+ *reinterpret_cast<PxU32*>(mStream) = numParticleShapes;
+ mStream += sizeof(PxU32);
+
+ *reinterpret_cast<PxU32*>(mStream) = getStreamSize(numParticleShapes, numContactManagers);
+ mStream += sizeof(PxU32);
+ }
+
+ PX_FORCE_INLINE void addParticleShape(const ParticleShape* particleShape)
+ {
+ *reinterpret_cast<const ParticleShape**>(mStream) = particleShape;
+ mStream += sizeof(const ParticleShape*);
+
+ mNumContactsPtr = reinterpret_cast<PxU32*>(mStream);
+ mStream += sizeof(PxU32);
+
+ *mNumContactsPtr = 0;
+ }
+
+ PX_FORCE_INLINE void addContactManager(const PxsRigidCore* rigidCore, const PxsShapeCore* shapeCore,
+ const PxTransform* w2sOld, bool isDrain, bool isDynamic)
+ {
+ ParticleStreamContactManager& cm = *reinterpret_cast<ParticleStreamContactManager*>(mStream);
+ mStream += sizeof(ParticleStreamContactManager);
+
+ cm.rigidCore = rigidCore;
+ cm.shapeCore = shapeCore;
+ cm.w2sOld = w2sOld;
+ cm.isDrain = isDrain;
+ cm.isDynamic = isDynamic;
+
+ PX_ASSERT(mNumContactsPtr);
+ (*mNumContactsPtr)++;
+ }
+
+ private:
+ PxU8* mStream;
+ PxU32* mNumContactsPtr;
+};
+
+class ParticleContactManagerStreamIterator
+{
+ public:
+ PX_FORCE_INLINE ParticleContactManagerStreamIterator()
+ {
+ }
+ PX_FORCE_INLINE ParticleContactManagerStreamIterator(const PxU8* stream) : mStream(stream)
+ {
+ }
+
+ ParticleContactManagerStreamIterator getNext(ParticleStreamShape& next)
+ {
+ const ParticleShape* const* tmp0 = reinterpret_cast<const ParticleShape* const*>(mStream);
+ mStream += sizeof(ParticleShape*);
+ const PxU32* tmp1 = reinterpret_cast<const PxU32*>(mStream);
+ next.particleShape = *tmp0;
+ next.numContactManagers = *tmp1;
+ mStream += sizeof(PxU32);
+
+ next.contactManagers = reinterpret_cast<const ParticleStreamContactManager*>(mStream);
+ mStream += next.numContactManagers * sizeof(ParticleStreamContactManager);
+
+ return ParticleContactManagerStreamIterator(mStream);
+ }
+
+ PX_FORCE_INLINE ParticleContactManagerStreamIterator getNext()
+ {
+ mStream += sizeof(ParticleShape*);
+ PxU32 numContactManagers = *reinterpret_cast<const PxU32*>(mStream);
+
+ mStream += sizeof(PxU32);
+ mStream += numContactManagers * sizeof(ParticleStreamContactManager);
+ return ParticleContactManagerStreamIterator(mStream);
+ }
+
+ PX_FORCE_INLINE bool operator==(const ParticleContactManagerStreamIterator& it)
+ {
+ return mStream == it.mStream;
+ }
+
+ PX_FORCE_INLINE bool operator!=(const ParticleContactManagerStreamIterator& it)
+ {
+ return mStream != it.mStream;
+ }
+
+ PX_FORCE_INLINE const PxU8* getStream()
+ {
+ return mStream;
+ }
+
+ private:
+ friend class ParticleContactManagerStreamReader;
+
+ private:
+ const PxU8* mStream;
+};
+
+class ParticleContactManagerStreamReader
+{
+ public:
+ /*
+ Reads header of stream consisting of shape count and stream end pointer
+ */
+ PX_FORCE_INLINE ParticleContactManagerStreamReader(const PxU8* stream)
+ {
+ PX_ASSERT(stream);
+ mStreamDataBegin = stream;
+ mNumParticleShapes = *reinterpret_cast<const PxU32*>(mStreamDataBegin);
+ mStreamDataBegin += sizeof(PxU32);
+ PxU32 streamSize = *reinterpret_cast<const PxU32*>(mStreamDataBegin);
+ mStreamDataBegin += sizeof(PxU32);
+ mStreamDataEnd = stream + streamSize;
+ }
+
+ PX_FORCE_INLINE ParticleContactManagerStreamIterator getBegin() const
+ {
+ return ParticleContactManagerStreamIterator(mStreamDataBegin);
+ }
+ PX_FORCE_INLINE ParticleContactManagerStreamIterator getEnd() const
+ {
+ return ParticleContactManagerStreamIterator(mStreamDataEnd);
+ }
+ PX_FORCE_INLINE PxU32 getNumParticleShapes() const
+ {
+ return mNumParticleShapes;
+ }
+
+ private:
+ PxU32 mNumParticleShapes;
+ const PxU8* mStreamDataBegin;
+ const PxU8* mStreamDataEnd;
+};
+
+} // namespace Pt
+} // namespace physx
+
+#endif // PX_USE_PARTICLE_SYSTEM_API
+#endif // PT_PARTICLE_CONTACT_MANAGER_STREAM_H
diff --git a/PhysX_3.4/Source/LowLevelParticles/include/PtParticleData.h b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleData.h
new file mode 100644
index 00000000..8093f2de
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleData.h
@@ -0,0 +1,186 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PT_PARTICLE_DATA_H
+#define PT_PARTICLE_DATA_H
+
+#include "PxPhysXConfig.h"
+#if PX_USE_PARTICLE_SYSTEM_API
+
+#include "PtParticleSystemCore.h"
+#include "PtParticle.h"
+
+namespace physx
+{
+
+namespace Pt
+{
+
+class ParticleData : public ParticleSystemState
+{
+ //= ATTENTION! =====================================================================================
+ // Changing the data layout of this class breaks the binary serialization format. See comments for
+ // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
+ // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
+ // accordingly.
+ //==================================================================================================
+ PX_NOCOPY(ParticleData)
+ public:
+ //---------------------------
+ // Implements ParticleSystemState
+ virtual bool addParticlesV(const PxParticleCreationData& creationData);
+ virtual void removeParticlesV(PxU32 count, const PxStrideIterator<const PxU32>& indices);
+ virtual void removeParticlesV();
+ virtual PxU32 getParticleCountV() const;
+ virtual void getParticlesV(ParticleSystemStateDataDesc& particles, bool fullState, bool devicePtr) const;
+ virtual void setPositionsV(PxU32 numParticles, const PxStrideIterator<const PxU32>& indices,
+ const PxStrideIterator<const PxVec3>& positions);
+ virtual void setVelocitiesV(PxU32 numParticles, const PxStrideIterator<const PxU32>& indices,
+ const PxStrideIterator<const PxVec3>& velocities);
+ virtual void setRestOffsetsV(PxU32 numParticles, const PxStrideIterator<const PxU32>& indices,
+ const PxStrideIterator<const PxF32>& restOffsets);
+ virtual void addDeltaVelocitiesV(const Cm::BitMap& bufferMap, const PxVec3* buffer, PxReal multiplier);
+
+ virtual PxBounds3 getWorldBoundsV() const;
+ virtual PxU32 getMaxParticlesV() const;
+ //~Implements ParticleSystemState
+ //---------------------------
+
+ PX_FORCE_INLINE PxU32 getMaxParticles() const
+ {
+ return mMaxParticles;
+ }
+ PX_FORCE_INLINE PxU32 getParticleCount() const
+ {
+ return mValidParticleCount;
+ }
+ PX_FORCE_INLINE const Cm::BitMap& getParticleMap() const
+ {
+ return mParticleMap;
+ }
+ PX_FORCE_INLINE PxU32 getValidParticleRange() const
+ {
+ return mValidParticleRange;
+ }
+
+ PX_FORCE_INLINE Particle* getParticleBuffer()
+ {
+ return mParticleBuffer;
+ }
+ PX_FORCE_INLINE PxF32* getRestOffsetBuffer()
+ {
+ return mRestOffsetBuffer;
+ }
+ PX_FORCE_INLINE PxBounds3& getWorldBounds()
+ {
+ return mWorldBounds;
+ }
+
+ // creation with copy
+ static ParticleData* create(ParticleSystemStateDataDesc& particles, const PxBounds3& bounds);
+
+ // creation with init
+ static ParticleData* create(PxU32 maxParticles, bool perParticleRestOffsets);
+ static ParticleData* create(PxDeserializationContext& context);
+
+ // creation from memory
+
+ // release this instance and associated memory
+ void release();
+
+ // exports particle state and aggregated data to the binary stream.
+ void exportData(PxSerializationContext& stream);
+ static void getBinaryMetaData(PxOutputStream& stream);
+ // special function to get rid of non transferable state
+ void clearSimState();
+
+ void onOriginShift(const PxVec3& shift);
+
+ private:
+ // placement serialization
+ ParticleData(PxU32 maxParticles, bool perParticleRestOffset);
+ ParticleData(ParticleSystemStateDataDesc& particles, const PxBounds3& bounds);
+
+ // inplace deserialization
+ ParticleData(PxU8* address);
+
+ virtual ~ParticleData();
+
+ PX_FORCE_INLINE static PxU32 getHeaderSize()
+ {
+ return (sizeof(ParticleData) + 15) & ~15;
+ }
+ PX_FORCE_INLINE static PxU32 getParticleBufferSize(PxU32 maxParticles)
+ {
+ return maxParticles * sizeof(Particle);
+ }
+ PX_FORCE_INLINE static PxU32 getRestOffsetBufferSize(PxU32 maxParticles, bool perParticleRestOffsets)
+ {
+ return perParticleRestOffsets ? maxParticles * sizeof(PxF32) : 0;
+ }
+ PX_FORCE_INLINE static PxU32 getBitmapSize(PxU32 maxParticles)
+ {
+ return ((maxParticles + 31) >> 5) * 4;
+ }
+
+ PX_FORCE_INLINE static PxU32 getTotalSize(PxU32 maxParticles, bool perParticleRestOffsets)
+ {
+ return getHeaderSize() + getDataSize(maxParticles, perParticleRestOffsets);
+ }
+
+ static PxU32 getDataSize(PxU32 maxParticles, bool perParticleRestOffsets)
+ {
+ PxU32 size = (getBitmapSize(maxParticles) + 15) & ~15;
+ size += getParticleBufferSize(maxParticles);
+ size += getRestOffsetBufferSize(maxParticles, perParticleRestOffsets);
+ return size;
+ }
+
+ PX_FORCE_INLINE void removeParticle(PxU32 particleIndex);
+
+ void fixupPointers();
+
+ private:
+ // This class is laid out following a strict convention for serialization/deserialization
+ bool mOwnMemory;
+ PxU32 mMaxParticles; // Maximal number of particles.
+ bool mHasRestOffsets; // Whether per particle offsets are supported.
+ PxU32 mValidParticleRange; // Index range in which valid particles are situated.
+ PxU32 mValidParticleCount; // The number of valid particles.
+ PxBounds3 mWorldBounds; // World bounds including all particles.
+ Particle* mParticleBuffer; // Main particle data buffer.
+ PxF32* mRestOffsetBuffer; // Per particle rest offsets.
+ Cm::BitMap mParticleMap; // Contains occupancy of all per particle data buffers.
+};
+
+} // namespace Pt
+} // namespace physx
+
+#endif // PX_USE_PARTICLE_SYSTEM_API
+#endif // PT_PARTICLE_DATA_H
diff --git a/PhysX_3.4/Source/LowLevelParticles/include/PtParticleShape.h b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleShape.h
new file mode 100644
index 00000000..7b9bdd29
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleShape.h
@@ -0,0 +1,60 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PT_PARTICLE_SHAPE_H
+#define PT_PARTICLE_SHAPE_H
+
+#include "PxPhysXConfig.h"
+#if PX_USE_PARTICLE_SYSTEM_API
+
+#include "CmPhysXCommon.h"
+
+namespace physx
+{
+
+namespace Pt
+{
+
+class ParticleShape
+{
+ public:
+ virtual ~ParticleShape()
+ {
+ }
+ virtual PxBounds3 getBoundsV() const = 0;
+ virtual void setUserDataV(void* data) = 0;
+ virtual void* getUserDataV() const = 0;
+ virtual void destroyV() = 0;
+};
+
+} // namespace Pt
+} // namespace physx
+
+#endif // PX_USE_PARTICLE_SYSTEM_API
+#endif // PT_PARTICLE_SHAPE_H
diff --git a/PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemCore.h b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemCore.h
new file mode 100644
index 00000000..1005e4ec
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemCore.h
@@ -0,0 +1,154 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PT_PARTICLE_SYSTEM_CORE_H
+#define PT_PARTICLE_SYSTEM_CORE_H
+
+#include "PxPhysXConfig.h"
+#if PX_USE_PARTICLE_SYSTEM_API
+
+#include "foundation/PxBounds3.h"
+#include "foundation/PxStrideIterator.h"
+
+#include "CmPhysXCommon.h"
+#include "PtParticleSystemFlags.h"
+#include "particles/PxParticleReadData.h"
+#include "CmBitMap.h"
+
+namespace physx
+{
+
+class PxParticleCreationData;
+class PxSerializationContext;
+
+namespace Pt
+{
+
+typedef size_t ShapeHandle;
+typedef size_t BodyHandle;
+
+/*!
+Particle system / particle fluid parameter. API + internal.
+*/
+struct ParticleSystemParameter
+{
+ //= ATTENTION! =====================================================================================
+ // Changing the data layout of this class breaks the binary serialization format. See comments for
+ // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
+ // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
+ // accordingly.
+ //==================================================================================================
+
+ ParticleSystemParameter(const PxEMPTY) : particleReadDataFlags(PxEmpty)
+ {
+ }
+ ParticleSystemParameter()
+ {
+ }
+
+ PxReal restParticleDistance;
+ PxReal kernelRadiusMultiplier;
+ PxReal viscosity;
+ PxReal surfaceTension;
+ PxReal fadeInTime;
+ PxU32 flags;
+ PxU32 packetSizeMultiplierLog2;
+ PxReal restitution;
+ PxReal dynamicFriction;
+ PxReal staticFriction;
+ PxReal restDensity;
+ PxReal damping;
+ PxReal stiffness;
+ PxReal maxMotionDistance;
+ PxReal restOffset;
+ PxReal contactOffset;
+ PxPlane projectionPlane;
+ PxParticleReadDataFlags particleReadDataFlags;
+ PxU32 noiseCounter; // Needed for deterministic temporal noise
+};
+
+/*!
+Descriptor for particle retrieval
+*/
+struct ParticleSystemStateDataDesc
+{
+ PxU32 maxParticles;
+ PxU32 numParticles;
+ PxU32 validParticleRange;
+ const Cm::BitMap* bitMap;
+ PxStrideIterator<const PxVec3> positions;
+ PxStrideIterator<const PxVec3> velocities;
+ PxStrideIterator<const ParticleFlags> flags;
+ PxStrideIterator<const PxF32> restOffsets;
+};
+
+/*!
+Descriptor for particle retrieval: TODO
+*/
+struct ParticleSystemSimDataDesc
+{
+ PxStrideIterator<const PxF32> densities; //! Particle densities
+ PxStrideIterator<const PxVec3> collisionNormals; //! Particle collision normals
+ PxStrideIterator<const PxVec3> collisionVelocities; //! Particle collision velocities
+ PxStrideIterator<const PxVec3> twoWayImpluses; //! collision impulses(for two way interaction)
+ PxStrideIterator<BodyHandle> twoWayBodies; //! Colliding rigid bodies each particle (zero if no collision)
+};
+
+class ParticleSystemState
+{
+ public:
+ virtual ~ParticleSystemState()
+ {
+ }
+ virtual bool addParticlesV(const PxParticleCreationData& creationData) = 0;
+ virtual void removeParticlesV(PxU32 count, const PxStrideIterator<const PxU32>& indices) = 0;
+ virtual void removeParticlesV() = 0;
+
+ /**
+ If fullState is set, the entire particle state is read, ignoring PxParticleReadDataFlags
+ */
+ virtual void getParticlesV(ParticleSystemStateDataDesc& particles, bool fullState, bool devicePtr) const = 0;
+ virtual void setPositionsV(PxU32 numParticles, const PxStrideIterator<const PxU32>& indices,
+ const PxStrideIterator<const PxVec3>& positions) = 0;
+ virtual void setVelocitiesV(PxU32 numParticles, const PxStrideIterator<const PxU32>& indices,
+ const PxStrideIterator<const PxVec3>& velocities) = 0;
+ virtual void setRestOffsetsV(PxU32 numParticles, const PxStrideIterator<const PxU32>& indices,
+ const PxStrideIterator<const PxF32>& restOffsets) = 0;
+ virtual void addDeltaVelocitiesV(const Cm::BitMap& bufferMap, const PxVec3* buffer, PxReal multiplier) = 0;
+
+ virtual PxBounds3 getWorldBoundsV() const = 0;
+ virtual PxU32 getMaxParticlesV() const = 0;
+ virtual PxU32 getParticleCountV() const = 0;
+};
+
+} // namespace Pt
+} // namespace physx
+
+#endif // PX_USE_PARTICLE_SYSTEM_API
+#endif // PT_PARTICLE_SYSTEM_CORE_H
diff --git a/PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemFlags.h b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemFlags.h
new file mode 100644
index 00000000..9052cce7
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemFlags.h
@@ -0,0 +1,100 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PT_PARTICLE_SYSTEM_FLAGS_H
+#define PT_PARTICLE_SYSTEM_FLAGS_H
+
+#include "PxPhysXConfig.h"
+#if PX_USE_PARTICLE_SYSTEM_API
+
+#include "CmPhysXCommon.h"
+#include "particles/PxParticleBaseFlag.h"
+
+namespace physx
+{
+
+namespace Pt
+{
+
+/*
+ParticleSystems related constants
+*/
+// Maximum number of particles per particle system
+#define PT_PARTICLE_SYSTEM_PARTICLE_LIMIT 0xfffffffe
+
+/*!
+PxParticleBaseFlag extension.
+*/
+struct InternalParticleSystemFlag
+{
+ enum Enum
+ {
+ // flags need to go into the unused bits of PxParticleBaseFlag
+ eSPH = (1 << 16),
+ eDISABLE_POSITION_UPDATE_ON_CREATE = (1 << 17),
+ eDISABLE_POSITION_UPDATE_ON_SETPOS = (1 << 18)
+ };
+};
+
+struct InternalParticleFlag
+{
+ enum Enum
+ {
+ // constraint info
+ eCONSTRAINT_0_VALID = (1 << 0),
+ eCONSTRAINT_1_VALID = (1 << 1),
+ eANY_CONSTRAINT_VALID = (eCONSTRAINT_0_VALID | eCONSTRAINT_1_VALID),
+ eCONSTRAINT_0_DYNAMIC = (1 << 2),
+ eCONSTRAINT_1_DYNAMIC = (1 << 3),
+ eALL_CONSTRAINT_MASK = (eANY_CONSTRAINT_VALID | eCONSTRAINT_0_DYNAMIC | eCONSTRAINT_1_DYNAMIC),
+
+ // static geometry cache: 00 (cache invalid), 11 (cache valid and refreshed), 01 (cache valid, but aged by one
+ // step).
+ eGEOM_CACHE_BIT_0 = (1 << 4),
+ eGEOM_CACHE_BIT_1 = (1 << 5),
+ eGEOM_CACHE_MASK = (eGEOM_CACHE_BIT_0 | eGEOM_CACHE_BIT_1),
+
+ // cuda update info
+ eCUDA_NOTIFY_CREATE = (1 << 6),
+ eCUDA_NOTIFY_SET_POSITION = (1 << 7),
+ eCUDA_NOTIFY_POSITION_CHANGE = (eCUDA_NOTIFY_CREATE | eCUDA_NOTIFY_SET_POSITION)
+ };
+};
+
+struct ParticleFlags
+{
+ PxU16 api; // this is PxParticleFlag
+ PxU16 low; // this is InternalParticleFlag
+};
+
+} // namespace Pt
+} // namespace physx
+
+#endif // PX_USE_PARTICLE_SYSTEM_API
+#endif // PT_PARTICLE_SYSTEM_FLAGS_H
diff --git a/PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemSim.h b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemSim.h
new file mode 100644
index 00000000..c915d2fb
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelParticles/include/PtParticleSystemSim.h
@@ -0,0 +1,136 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PT_PARTICLE_SYSTEM_SIM_H
+#define PT_PARTICLE_SYSTEM_SIM_H
+
+#include "PxPhysXConfig.h"
+#if PX_USE_PARTICLE_SYSTEM_API
+
+#include "CmPhysXCommon.h"
+#include "PtParticleSystemCore.h"
+#include "PtParticleShape.h"
+
+namespace physx
+{
+
+class PxParticleDeviceExclusiveAccess;
+
+namespace Pt
+{
+
+struct ParticleSystemSimDataDesc;
+class ParticleSystemSim;
+
+/*!
+\file
+ParticleSystemSim interface.
+*/
+
+/************************************************************************/
+/* ParticleSystemsSim */
+/************************************************************************/
+
+/**
+Descriptor for the batched shape update pipeline stage
+*/
+struct ParticleShapesUpdateInput
+{
+ ParticleShape** shapes;
+ PxU32 shapeCount;
+};
+
+/**
+Descriptor for the batched collision update pipeline stage
+*/
+struct ParticleCollisionUpdateInput
+{
+ PxU8* contactManagerStream;
+};
+
+/*!
+Descriptor for updated particle packet shapes
+*/
+struct ParticleShapeUpdateResults
+{
+ ParticleShape* const* createdShapes; //! Handles of newly created particle packet shapes
+ PxU32 createdShapeCount; //! Number of newly created particle packet shapes
+ ParticleShape* const* destroyedShapes; //! Handles of particle packet shapes to delete
+ PxU32 destroyedShapeCount; //! Number of particle packet shapes to delete
+};
+
+class ParticleSystemSim
+{
+ public:
+ virtual ParticleSystemState& getParticleStateV() = 0;
+ virtual void getSimParticleDataV(ParticleSystemSimDataDesc& simParticleData, bool devicePtr) const = 0;
+ virtual void getShapesUpdateV(ParticleShapeUpdateResults& updateResults) const = 0;
+
+ virtual void setExternalAccelerationV(const PxVec3& v) = 0;
+ virtual const PxVec3& getExternalAccelerationV() const = 0;
+
+ virtual void setSimulationTimeStepV(PxReal value) = 0;
+ virtual PxReal getSimulationTimeStepV() const = 0;
+
+ virtual void setSimulatedV(bool) = 0;
+ virtual Ps::IntBool isSimulatedV() const = 0;
+
+ // gpuBuffer specifies that the interaction was created asynchronously to gpu execution (for rb ccd)
+ virtual void addInteractionV(const ParticleShape& particleShape, ShapeHandle shape, BodyHandle body, bool isDynamic,
+ bool gpuBuffer) = 0;
+
+ // gpuBuffer specifies that the interaction was created asynchronously to gpu execution (for rb ccd)
+ virtual void removeInteractionV(const ParticleShape& particleShape, ShapeHandle shape, BodyHandle body,
+ bool isDynamic, bool isDyingRb, bool gpuBuffer) = 0;
+
+ virtual void onRbShapeChangeV(const ParticleShape& particleShape, ShapeHandle shape) = 0;
+
+ // applies the buffered interaction updates.
+ virtual void flushBufferedInteractionUpdatesV() = 0;
+
+ // passes the contact manager stream needed for collision - the callee is responsible for releasing it
+ virtual void passCollisionInputV(ParticleCollisionUpdateInput input) = 0;
+
+#if PX_SUPPORT_GPU_PHYSX
+ virtual Ps::IntBool isGpuV() const = 0;
+ virtual void enableDeviceExclusiveModeGpuV() = 0;
+ virtual PxParticleDeviceExclusiveAccess* getDeviceExclusiveAccessGpuV() const = 0;
+#endif
+
+ protected:
+ virtual ~ParticleSystemSim()
+ {
+ }
+};
+
+} // namespace Pt
+} // namespace physx
+
+#endif // PX_USE_PARTICLE_SYSTEM_API
+#endif // PT_PARTICLE_SYSTEM_SIM_H