aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/LowLevelCloth/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/LowLevelCloth/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/LowLevelCloth/include')
-rw-r--r--PhysX_3.4/Source/LowLevelCloth/include/Cloth.h321
-rw-r--r--PhysX_3.4/Source/LowLevelCloth/include/Fabric.h98
-rw-r--r--PhysX_3.4/Source/LowLevelCloth/include/Factory.h196
-rw-r--r--PhysX_3.4/Source/LowLevelCloth/include/PhaseConfig.h56
-rw-r--r--PhysX_3.4/Source/LowLevelCloth/include/Range.h148
-rw-r--r--PhysX_3.4/Source/LowLevelCloth/include/Solver.h87
-rw-r--r--PhysX_3.4/Source/LowLevelCloth/include/Types.h52
7 files changed, 958 insertions, 0 deletions
diff --git a/PhysX_3.4/Source/LowLevelCloth/include/Cloth.h b/PhysX_3.4/Source/LowLevelCloth/include/Cloth.h
new file mode 100644
index 00000000..27644162
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelCloth/include/Cloth.h
@@ -0,0 +1,321 @@
+// 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.
+
+#pragma once
+
+#include "Range.h"
+#include "PhaseConfig.h"
+
+struct ID3D11Buffer;
+
+namespace physx
+{
+namespace cloth
+{
+
+class Factory;
+class Fabric;
+class Cloth;
+
+template <typename T>
+struct MappedRange : public Range<T>
+{
+ MappedRange(T* first, T* last, const Cloth& cloth, void (Cloth::*lock)() const, void (Cloth::*unlock)() const)
+ : Range<T>(first, last), mCloth(cloth), mLock(lock), mUnlock(unlock)
+ {
+ }
+
+ MappedRange(const MappedRange& other)
+ : Range<T>(other), mCloth(other.mCloth), mLock(other.mLock), mUnlock(other.mUnlock)
+ {
+ (mCloth.*mLock)();
+ }
+
+ ~MappedRange()
+ {
+ (mCloth.*mUnlock)();
+ }
+
+ private:
+ MappedRange& operator=(const MappedRange&);
+
+ const Cloth& mCloth;
+ void (Cloth::*mLock)() const;
+ void (Cloth::*mUnlock)() const;
+};
+
+struct GpuParticles
+{
+ PxVec4* mCurrent;
+ PxVec4* mPrevious;
+ ID3D11Buffer* mBuffer;
+};
+
+// abstract cloth instance
+class Cloth
+{
+ Cloth& operator=(const Cloth&);
+
+ protected:
+ Cloth()
+ {
+ }
+ Cloth(const Cloth&)
+ {
+ }
+
+ public:
+ virtual ~Cloth()
+ {
+ }
+
+ // same as factory.clone(*this)
+ virtual Cloth* clone(Factory& factory) const = 0;
+
+ virtual Fabric& getFabric() const = 0;
+ virtual Factory& getFactory() const = 0;
+
+ /* particle properties */
+
+ virtual uint32_t getNumParticles() const = 0;
+ virtual void lockParticles() const = 0;
+ virtual void unlockParticles() const = 0;
+ // return particle data for current and previous frame
+ // setting current invMass to zero locks particle.
+ virtual MappedRange<PxVec4> getCurrentParticles() = 0;
+ virtual MappedRange<const PxVec4> getCurrentParticles() const = 0;
+ virtual MappedRange<PxVec4> getPreviousParticles() = 0;
+ virtual MappedRange<const PxVec4> getPreviousParticles() const = 0;
+ virtual GpuParticles getGpuParticles() = 0;
+
+ // set position of cloth after next call to simulate()
+ virtual void setTranslation(const PxVec3& trans) = 0;
+ virtual void setRotation(const PxQuat& rot) = 0;
+
+ // get current position of cloth
+ virtual const PxVec3& getTranslation() const = 0;
+ virtual const PxQuat& getRotation() const = 0;
+
+ // zero inertia derived from method calls above (once)
+ virtual void clearInertia() = 0;
+
+ // adjust the position of the cloth without affecting the dynamics (to call after a world origin shift, for example)
+ virtual void teleport(const PxVec3& delta) = 0;
+
+ /* solver parameters */
+
+ // return delta time used for previous iteration
+ virtual float getPreviousIterationDt() const = 0;
+
+ // gravity in global coordinates
+ virtual void setGravity(const PxVec3&) = 0;
+ virtual PxVec3 getGravity() const = 0;
+
+ // damping of local particle velocity (1/stiffnessFrequency)
+ // 0 (default): velocity is unaffected, 1: velocity is zero'ed
+ virtual void setDamping(const PxVec3&) = 0;
+ virtual PxVec3 getDamping() const = 0;
+
+ // portion of local frame velocity applied to particles
+ // 0 (default): particles are unaffected
+ // same as damping: damp global particle velocity
+ virtual void setLinearDrag(const PxVec3&) = 0;
+ virtual PxVec3 getLinearDrag() const = 0;
+ virtual void setAngularDrag(const PxVec3&) = 0;
+ virtual PxVec3 getAngularDrag() const = 0;
+
+ // portion of local frame accelerations applied to particles
+ // 0: particles are unaffected, 1 (default): physically correct
+ virtual void setLinearInertia(const PxVec3&) = 0;
+ virtual PxVec3 getLinearInertia() const = 0;
+ virtual void setAngularInertia(const PxVec3&) = 0;
+ virtual PxVec3 getAngularInertia() const = 0;
+ virtual void setCentrifugalInertia(const PxVec3&) = 0;
+ virtual PxVec3 getCentrifugalInertia() const = 0;
+
+ // target solver iterations per second
+ virtual void setSolverFrequency(float) = 0;
+ virtual float getSolverFrequency() const = 0;
+
+ // damp, drag, stiffness exponent per second
+ virtual void setStiffnessFrequency(float) = 0;
+ virtual float getStiffnessFrequency() const = 0;
+
+ // filter width for averaging dt^2 factor of gravity and
+ // external acceleration, in numbers of iterations (default=30).
+ virtual void setAcceleationFilterWidth(uint32_t) = 0;
+ virtual uint32_t getAccelerationFilterWidth() const = 0;
+
+ // setup edge constraint solver iteration
+ virtual void setPhaseConfig(Range<const PhaseConfig> configs) = 0;
+
+ /* collision parameters */
+
+ virtual void setSpheres(Range<const PxVec4>, uint32_t first, uint32_t last) = 0;
+ virtual uint32_t getNumSpheres() const = 0;
+
+ virtual void setCapsules(Range<const uint32_t>, uint32_t first, uint32_t last) = 0;
+ virtual uint32_t getNumCapsules() const = 0;
+
+ virtual void setPlanes(Range<const PxVec4>, uint32_t first, uint32_t last) = 0;
+ virtual uint32_t getNumPlanes() const = 0;
+
+ virtual void setConvexes(Range<const uint32_t>, uint32_t first, uint32_t last) = 0;
+ virtual uint32_t getNumConvexes() const = 0;
+
+ virtual void setTriangles(Range<const PxVec3>, uint32_t first, uint32_t last) = 0;
+ virtual void setTriangles(Range<const PxVec3>, Range<const PxVec3>, uint32_t first) = 0;
+ virtual uint32_t getNumTriangles() const = 0;
+
+ // check if we use ccd or not
+ virtual bool isContinuousCollisionEnabled() const = 0;
+ // set if we use ccd or not (disabled by default)
+ virtual void enableContinuousCollision(bool) = 0;
+
+ // controls how quickly mass is increased during collisions
+ virtual float getCollisionMassScale() const = 0;
+ virtual void setCollisionMassScale(float) = 0;
+
+ // friction
+ virtual void setFriction(float) = 0;
+ virtual float getFriction() const = 0;
+
+ // set virtual particles for collision handling.
+ // each indices element consists of 3 particle
+ // indices and an index into the lerp weights array.
+ virtual void setVirtualParticles(Range<const uint32_t[4]> indices, Range<const PxVec3> weights) = 0;
+ virtual uint32_t getNumVirtualParticles() const = 0;
+ virtual uint32_t getNumVirtualParticleWeights() const = 0;
+
+ /* tether constraint parameters */
+
+ virtual void setTetherConstraintScale(float scale) = 0;
+ virtual float getTetherConstraintScale() const = 0;
+ virtual void setTetherConstraintStiffness(float stiffness) = 0;
+ virtual float getTetherConstraintStiffness() const = 0;
+
+ /* motion constraint parameters */
+
+ // return reference to motion constraints (position, radius)
+ // The entire range must be written after calling this function.
+ virtual Range<PxVec4> getMotionConstraints() = 0;
+ virtual void clearMotionConstraints() = 0;
+ virtual uint32_t getNumMotionConstraints() const = 0;
+ virtual void setMotionConstraintScaleBias(float scale, float bias) = 0;
+ virtual float getMotionConstraintScale() const = 0;
+ virtual float getMotionConstraintBias() const = 0;
+ virtual void setMotionConstraintStiffness(float stiffness) = 0;
+ virtual float getMotionConstraintStiffness() const = 0;
+
+ /* separation constraint parameters */
+
+ // return reference to separation constraints (position, radius)
+ // The entire range must be written after calling this function.
+ virtual Range<PxVec4> getSeparationConstraints() = 0;
+ virtual void clearSeparationConstraints() = 0;
+ virtual uint32_t getNumSeparationConstraints() const = 0;
+
+ /* clear interpolation */
+
+ // assign current to previous positions for
+ // collision spheres, motion, and separation constraints
+ virtual void clearInterpolation() = 0;
+
+ /* particle acceleration parameters */
+
+ // return reference to particle accelerations (in local coordinates)
+ // The entire range must be written after calling this function.
+ virtual Range<PxVec4> getParticleAccelerations() = 0;
+ virtual void clearParticleAccelerations() = 0;
+ virtual uint32_t getNumParticleAccelerations() const = 0;
+
+ /* wind */
+
+ // Set wind in global coordinates. Acts on the fabric's triangles
+ virtual void setWindVelocity(PxVec3) = 0;
+ virtual PxVec3 getWindVelocity() const = 0;
+ virtual void setDragCoefficient(float) = 0;
+ virtual float getDragCoefficient() const = 0;
+ virtual void setLiftCoefficient(float) = 0;
+ virtual float getLiftCoefficient() const = 0;
+
+ /* self collision */
+
+ virtual void setSelfCollisionDistance(float distance) = 0;
+ virtual float getSelfCollisionDistance() const = 0;
+ virtual void setSelfCollisionStiffness(float stiffness) = 0;
+ virtual float getSelfCollisionStiffness() const = 0;
+
+ virtual void setSelfCollisionIndices(Range<const uint32_t>) = 0;
+ virtual uint32_t getNumSelfCollisionIndices() const = 0;
+
+ /* rest positions */
+
+ // set rest particle positions used during self-collision
+ virtual void setRestPositions(Range<const PxVec4>) = 0;
+ virtual uint32_t getNumRestPositions() const = 0;
+
+ /* bounding box */
+
+ // current particle position bounds in local space
+ virtual const PxVec3& getBoundingBoxCenter() const = 0;
+ virtual const PxVec3& getBoundingBoxScale() const = 0;
+
+ /* sleeping (disabled by default) */
+
+ // max particle velocity (per axis) to pass sleep test
+ virtual void setSleepThreshold(float) = 0;
+ virtual float getSleepThreshold() const = 0;
+ // test sleep condition every nth millisecond
+ virtual void setSleepTestInterval(uint32_t) = 0;
+ virtual uint32_t getSleepTestInterval() const = 0;
+ // put cloth to sleep when n consecutive sleep tests pass
+ virtual void setSleepAfterCount(uint32_t) = 0;
+ virtual uint32_t getSleepAfterCount() const = 0;
+ virtual uint32_t getSleepPassCount() const = 0;
+ virtual bool isAsleep() const = 0;
+ virtual void putToSleep() = 0;
+ virtual void wakeUp() = 0;
+
+ virtual void setUserData(void*) = 0;
+ virtual void* getUserData() const = 0;
+};
+
+// wrappers to prevent non-const overload from marking particles dirty
+inline MappedRange<const PxVec4> readCurrentParticles(const Cloth& cloth)
+{
+ return cloth.getCurrentParticles();
+}
+inline MappedRange<const PxVec4> readPreviousParticles(const Cloth& cloth)
+{
+ return cloth.getPreviousParticles();
+}
+
+} // namespace cloth
+} // namespace physx
diff --git a/PhysX_3.4/Source/LowLevelCloth/include/Fabric.h b/PhysX_3.4/Source/LowLevelCloth/include/Fabric.h
new file mode 100644
index 00000000..473c60de
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelCloth/include/Fabric.h
@@ -0,0 +1,98 @@
+// 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.
+
+#pragma once
+
+#include "foundation/PxAssert.h"
+#include "Types.h"
+#include "Range.h"
+
+namespace physx
+{
+namespace cloth
+{
+
+class Factory;
+
+// abstract cloth constraints and triangle indices
+class Fabric
+{
+ protected:
+ Fabric(const Fabric&);
+ Fabric& operator=(const Fabric&);
+
+ protected:
+ Fabric() : mRefCount(0)
+ {
+ }
+
+ public:
+ virtual ~Fabric()
+ {
+ PX_ASSERT(!mRefCount);
+ }
+
+ virtual Factory& getFactory() const = 0;
+
+ virtual uint32_t getNumPhases() const = 0;
+ virtual uint32_t getNumRestvalues() const = 0;
+
+ virtual uint32_t getNumSets() const = 0;
+ virtual uint32_t getNumIndices() const = 0;
+
+ virtual uint32_t getNumParticles() const = 0;
+
+ virtual uint32_t getNumTethers() const = 0;
+
+ virtual uint32_t getNumTriangles() const = 0;
+
+ virtual void scaleRestvalues(float) = 0;
+ virtual void scaleTetherLengths(float) = 0;
+
+ uint16_t getRefCount() const
+ {
+ return mRefCount;
+ }
+ void incRefCount()
+ {
+ ++mRefCount;
+ PX_ASSERT(mRefCount > 0);
+ }
+ void decRefCount()
+ {
+ PX_ASSERT(mRefCount > 0);
+ --mRefCount;
+ }
+
+ protected:
+ uint16_t mRefCount;
+};
+
+} // namespace cloth
+} // namespace physx
diff --git a/PhysX_3.4/Source/LowLevelCloth/include/Factory.h b/PhysX_3.4/Source/LowLevelCloth/include/Factory.h
new file mode 100644
index 00000000..f6e51b6c
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelCloth/include/Factory.h
@@ -0,0 +1,196 @@
+// 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.
+
+#pragma once
+
+#include "Types.h"
+#include "Range.h"
+
+typedef struct CUstream_st* CUstream;
+
+namespace physx
+{
+
+class PxTaskManager;
+
+namespace profile
+{
+class PxProfileZone;
+}
+
+class PxCudaContextManager;
+}
+
+namespace physx
+{
+
+namespace cloth
+{
+
+class Fabric;
+class Cloth;
+class Solver;
+class Character;
+
+/// abstract factory to create context-specific simulation components
+/// such as cloth, solver, collision, etc.
+class Factory
+{
+ public:
+ enum Platform
+ {
+ CPU,
+ CUDA
+ };
+
+ protected:
+ Factory(Platform platform) : mPlatform(platform)
+ {
+ }
+ Factory(const Factory&);
+ Factory& operator=(const Factory&);
+
+ public:
+ static Factory* createFactory(Platform, void* = 0);
+
+ virtual ~Factory()
+ {
+ }
+
+ Platform getPlatform() const
+ {
+ return mPlatform;
+ }
+
+ /**
+ Create fabric data used to setup cloth object.
+ @param numParticles number of particles, must be larger than any particle index
+ @param phases map from phase to set index
+ @param sets inclusive prefix sum of restvalue count per set
+ @param restvalues array of constraint rest values
+ @param indices array of particle index pair per constraint
+ */
+ virtual Fabric* createFabric(uint32_t numParticles, Range<const uint32_t> phases, Range<const uint32_t> sets,
+ Range<const float> restvalues, Range<const uint32_t> indices,
+ Range<const uint32_t> anchors, Range<const float> tetherLengths,
+ Range<const uint32_t> triangles) = 0;
+
+ /**
+ Create cloth object.
+ @param particles initial particle positions.
+ @param fabric edge distance constraint structure
+ */
+ virtual Cloth* createCloth(Range<const PxVec4> particles, Fabric& fabric) = 0;
+
+ /**
+ Create cloth solver object.
+ @param taskMgr PxTaskManager used for simulation.
+ */
+ virtual Solver* createSolver(PxTaskManager* taskMgr) = 0;
+
+ /**
+ Create a copy of a cloth instance
+ @param cloth the instance to be cloned, need not match the factory type
+ */
+ virtual Cloth* clone(const Cloth& cloth) = 0;
+
+ /**
+ Extract original data from a fabric object
+ @param fabric to extract from, must match factory type
+ @param phases pre-allocated memory range to write phases
+ @param sets pre-allocated memory range to write sets
+ @param restvalues pre-allocated memory range to write restvalues
+ @param indices pre-allocated memory range to write indices
+ */
+ virtual void extractFabricData(const Fabric& fabric, Range<uint32_t> phases, Range<uint32_t> sets,
+ Range<float> restvalues, Range<uint32_t> indices, Range<uint32_t> anchors,
+ Range<float> tetherLengths, Range<uint32_t> triangles) const = 0;
+
+ /**
+ Extract current collision spheres and capsules from a cloth object
+ @param cloth the instance to extract from, must match factory type
+ @param spheres pre-allocated memory range to write spheres
+ @param capsules pre-allocated memory range to write capsules
+ @param planes pre-allocated memory range to write planes
+ @param convexes pre-allocated memory range to write convexes
+ @param triangles pre-allocated memory range to write triangles
+ */
+ virtual void extractCollisionData(const Cloth& cloth, Range<PxVec4> spheres, Range<uint32_t> capsules,
+ Range<PxVec4> planes, Range<uint32_t> convexes, Range<PxVec3> triangles) const = 0;
+
+ /**
+ Extract current motion constraints from a cloth object
+ @param cloth the instance to extract from, must match factory type
+ @param destConstraints pre-allocated memory range to write constraints
+ */
+ virtual void extractMotionConstraints(const Cloth& cloth, Range<PxVec4> destConstraints) const = 0;
+
+ /**
+ Extract current separation constraints from a cloth object
+ @param cloth the instance to extract from, must match factory type
+ @param destConstraints pre-allocated memory range to write constraints
+ */
+ virtual void extractSeparationConstraints(const Cloth& cloth, Range<PxVec4> destConstraints) const = 0;
+
+ /**
+ Extract current particle accelerations from a cloth object
+ @param cloth the instance to extract from, must match factory type
+ @param destAccelerations pre-allocated memory range to write accelerations
+ */
+ virtual void extractParticleAccelerations(const Cloth& cloth, Range<PxVec4> destAccelerations) const = 0;
+
+ /**
+ Extract virtual particles from a cloth object
+ @param cloth the instance to extract from, must match factory type
+ @param destIndices pre-allocated memory range to write indices
+ @param destWeights pre-allocated memory range to write weights
+ */
+ virtual void extractVirtualParticles(const Cloth& cloth, Range<uint32_t[4]> destIndices,
+ Range<PxVec3> destWeights) const = 0;
+
+ /**
+ Extract self collision indices from cloth object.
+ @param cloth the instance to extract from, must match factory type
+ @param destIndices pre-allocated memory range to write indices
+ */
+ virtual void extractSelfCollisionIndices(const Cloth& cloth, Range<uint32_t> destIndices) const = 0;
+
+ /**
+ Extract particle rest positions from cloth object.
+ @param cloth the instance to extract from, must match factory type
+ @param destRestPositions pre-allocated memory range to write rest positions
+ */
+ virtual void extractRestPositions(const Cloth& cloth, Range<PxVec4> destRestPositions) const = 0;
+
+ protected:
+ const Platform mPlatform;
+};
+
+} // namespace cloth
+} // namespace physx
diff --git a/PhysX_3.4/Source/LowLevelCloth/include/PhaseConfig.h b/PhysX_3.4/Source/LowLevelCloth/include/PhaseConfig.h
new file mode 100644
index 00000000..a25a82a0
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelCloth/include/PhaseConfig.h
@@ -0,0 +1,56 @@
+// 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.
+
+#pragma once
+
+#include "Types.h"
+
+namespace physx
+{
+namespace cloth
+{
+
+struct PhaseConfig
+{
+ PhaseConfig(uint16_t index = uint16_t(-1));
+
+ uint16_t mPhaseIndex;
+ uint16_t mPadding;
+
+ // target convergence rate per iteration (1/solverFrequency)
+ float mStiffness;
+
+ float mStiffnessMultiplier;
+
+ float mCompressionLimit;
+ float mStretchLimit;
+};
+
+} // namespace cloth
+} // namespace physx
diff --git a/PhysX_3.4/Source/LowLevelCloth/include/Range.h b/PhysX_3.4/Source/LowLevelCloth/include/Range.h
new file mode 100644
index 00000000..8f35f04b
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelCloth/include/Range.h
@@ -0,0 +1,148 @@
+// 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.
+
+#pragma once
+
+#include "foundation/PxAssert.h"
+#include "Types.h"
+
+namespace physx
+{
+namespace cloth
+{
+
+template <class T>
+struct Range
+{
+ Range();
+
+ Range(T* first, T* last);
+
+ template <typename S>
+ Range(const Range<S>& other);
+
+ uint32_t size() const;
+ bool empty() const;
+
+ void popFront();
+ void popBack();
+
+ T* begin() const;
+ T* end() const;
+
+ T& front() const;
+ T& back() const;
+
+ T& operator[](uint32_t i) const;
+
+ private:
+ T* mFirst;
+ T* mLast; // past last element
+};
+
+template <typename T>
+Range<T>::Range()
+: mFirst(0), mLast(0)
+{
+}
+
+template <typename T>
+Range<T>::Range(T* first, T* last)
+: mFirst(first), mLast(last)
+{
+}
+
+template <typename T>
+template <typename S>
+Range<T>::Range(const Range<S>& other)
+: mFirst(other.begin()), mLast(other.end())
+{
+}
+
+template <typename T>
+uint32_t Range<T>::size() const
+{
+ return uint32_t(mLast - mFirst);
+}
+
+template <typename T>
+bool Range<T>::empty() const
+{
+ return mFirst >= mLast;
+}
+
+template <typename T>
+void Range<T>::popFront()
+{
+ PX_ASSERT(mFirst < mLast);
+ ++mFirst;
+}
+
+template <typename T>
+void Range<T>::popBack()
+{
+ PX_ASSERT(mFirst < mLast);
+ --mLast;
+}
+
+template <typename T>
+T* Range<T>::begin() const
+{
+ return mFirst;
+}
+
+template <typename T>
+T* Range<T>::end() const
+{
+ return mLast;
+}
+
+template <typename T>
+T& Range<T>::front() const
+{
+ PX_ASSERT(mFirst < mLast);
+ return *mFirst;
+}
+
+template <typename T>
+T& Range<T>::back() const
+{
+ PX_ASSERT(mFirst < mLast);
+ return mLast[-1];
+}
+
+template <typename T>
+T& Range<T>::operator[](uint32_t i) const
+{
+ PX_ASSERT(mFirst + i < mLast);
+ return mFirst[i];
+}
+
+} // namespace cloth
+} // namespace physx
diff --git a/PhysX_3.4/Source/LowLevelCloth/include/Solver.h b/PhysX_3.4/Source/LowLevelCloth/include/Solver.h
new file mode 100644
index 00000000..0053f235
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelCloth/include/Solver.h
@@ -0,0 +1,87 @@
+// 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.
+
+#pragma once
+
+#include "Types.h"
+
+namespace physx
+{
+
+class PxBaseTask;
+
+namespace cloth
+{
+
+class Cloth;
+
+// called during inter-collision, user0 and user1 are the user data from each cloth
+typedef bool (*InterCollisionFilter)(void* user0, void* user1);
+
+/// base class for solvers
+class Solver
+{
+ protected:
+ Solver(const Solver&);
+ Solver& operator=(const Solver&);
+
+ protected:
+ Solver()
+ {
+ }
+
+ public:
+ virtual ~Solver()
+ {
+ }
+
+ /// add cloth object, returns true if successful
+ virtual void addCloth(Cloth*) = 0;
+
+ /// remove cloth object
+ virtual void removeCloth(Cloth*) = 0;
+
+ /// simulate one time step
+ virtual physx::PxBaseTask& simulate(float dt, physx::PxBaseTask&) = 0;
+
+ // inter-collision parameters
+ virtual void setInterCollisionDistance(float distance) = 0;
+ virtual float getInterCollisionDistance() const = 0;
+ virtual void setInterCollisionStiffness(float stiffness) = 0;
+ virtual float getInterCollisionStiffness() const = 0;
+ virtual void setInterCollisionNbIterations(uint32_t nbIterations) = 0;
+ virtual uint32_t getInterCollisionNbIterations() const = 0;
+ virtual void setInterCollisionFilter(InterCollisionFilter filter) = 0;
+
+ /// returns true if an unrecoverable error has occurred
+ virtual bool hasError() const = 0;
+};
+
+} // namespace cloth
+} // namespace physx
diff --git a/PhysX_3.4/Source/LowLevelCloth/include/Types.h b/PhysX_3.4/Source/LowLevelCloth/include/Types.h
new file mode 100644
index 00000000..0881b167
--- /dev/null
+++ b/PhysX_3.4/Source/LowLevelCloth/include/Types.h
@@ -0,0 +1,52 @@
+// 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.
+
+#pragma once
+
+#ifndef __CUDACC__
+#include "foundation/Px.h"
+#include "foundation/PxVec3.h"
+#include "foundation/PxVec4.h"
+#include "foundation/PxQuat.h"
+#endif
+
+#ifndef _MSC_VER
+#include <stdint.h>
+#else
+// typedef standard integer types
+typedef unsigned __int8 uint8_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
+typedef __int16 int16_t;
+typedef __int32 int32_t;
+#if _MSC_VER < 1600
+#define nullptr NULL
+#endif
+#endif