Upgrade to PhysX 5.1.3

This commit is contained in:
Wojtek Figat
2023-03-03 17:13:46 +01:00
parent 0112f70c05
commit a26d0d03eb
452 changed files with 58188 additions and 8646 deletions

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,19 +22,17 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 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 PX_PHYSICS_NXMATERIAL
#define PX_PHYSICS_NXMATERIAL
#ifndef PX_MATERIAL_H
#define PX_MATERIAL_H
/** \addtogroup physics
@{
*/
#include "PxPhysXConfig.h"
#include "common/PxBase.h"
#include "PxBaseMaterial.h"
#if !PX_DOXYGEN
namespace physx
@@ -55,11 +52,12 @@ struct PxMaterialFlag
{
/**
If this flag is set, friction computations are always skipped between shapes with this material and any other shape.
\brief If this flag is set, friction computations are always skipped between shapes with this material and any other shape.
*/
eDISABLE_FRICTION = 1 << 0,
/**
\brief Whether to use strong friction.
The difference between "normal" and "strong" friction is that the strong friction feature
remembers the "friction error" between simulation steps. The friction is a force trying to
hold objects in place (or slow them down) and this is handled in the solver. But since the
@@ -71,7 +69,7 @@ struct PxMaterialFlag
However, in some cases the strong friction could cause problems, and this is why it is
possible to disable the strong friction feature by setting this flag. One example is
raycast vehicles, that are sliding fast across the surface, but still need a precise
raycast vehicles that are sliding fast across the surface, but still need a precise
steering behavior. It may be a good idea to reenable the strong friction when objects
are coming to a rest, to prevent them from slowly creeping down inclines.
@@ -80,6 +78,7 @@ struct PxMaterialFlag
eDISABLE_STRONG_FRICTION = 1 << 1,
/**
\brief Whether to use the patch friction model.
This flag only has an effect if PxFrictionType::ePATCH friction model is used.
When using the patch friction model, up to 2 friction anchors are generated per patch. As the number of friction anchors
@@ -88,9 +87,15 @@ struct PxMaterialFlag
as analytical models suggest).
This flag causes the normal force to be distributed between the friction anchors such that the total amount of friction applied does not
exceed the analyical results.
exceed the analytical results.
*/
eIMPROVED_PATCH_FRICTION = 1 << 2
eIMPROVED_PATCH_FRICTION = 1 << 2,
/**
\brief This flag has the effect of enabling an implicit spring model for the normal force computation.
@see PxMaterial.setRestitution, PxMaterial.setDamping
*/
eCOMPLIANT_CONTACT = 1 << 3
};
};
@@ -104,7 +109,7 @@ PX_FLAGS_OPERATORS(PxMaterialFlag::Enum,PxU16)
/**
\brief enumeration that determines the way in which two material properties will be combined to yield a friction or restitution coefficient for a collision.
\brief Enumeration that determines the way in which two material properties will be combined to yield a friction or restitution coefficient for a collision.
When two actors come in contact with each other, they each have materials with various coefficients, but we only need a single set of coefficients for the pair.
@@ -140,34 +145,10 @@ struct PxCombineMode
@see PxPhysics.createMaterial
*/
class PxMaterial : public PxBase
class PxMaterial : public PxBaseMaterial
{
public:
/**
\brief Decrements the reference count of a material and releases it if the new reference count is zero.
@see PxPhysics.createMaterial()
*/
virtual void release() = 0;
/**
\brief Returns the reference count of the material.
At creation, the reference count of the material is 1. Every shape referencing this material increments the
count by 1. When the reference count reaches 0, and only then, the material gets destroyed automatically.
\return the current reference count.
*/
virtual PxU32 getReferenceCount() const = 0;
/**
\brief Acquires a counted reference to a material.
This method increases the reference count of the material by 1. Decrement the reference count by calling release()
*/
virtual void acquireReference() = 0;
/**
\brief Sets the coefficient of dynamic friction.
@@ -179,7 +160,7 @@ public:
@see getDynamicFriction()
*/
virtual void setDynamicFriction(PxReal coef) = 0;
virtual void setDynamicFriction(PxReal coef) = 0;
/**
\brief Retrieves the DynamicFriction value.
@@ -188,7 +169,7 @@ public:
@see setDynamicFriction
*/
virtual PxReal getDynamicFriction() const = 0;
virtual PxReal getDynamicFriction() const = 0;
/**
\brief Sets the coefficient of static friction
@@ -201,7 +182,7 @@ public:
@see getStaticFriction()
*/
virtual void setStaticFriction(PxReal coef) = 0;
virtual void setStaticFriction(PxReal coef) = 0;
/**
\brief Retrieves the coefficient of static friction.
@@ -209,20 +190,24 @@ public:
@see setStaticFriction
*/
virtual PxReal getStaticFriction() const = 0;
virtual PxReal getStaticFriction() const = 0;
/**
\brief Sets the coefficient of restitution
A coefficient of 0 makes the object bounce as little as possible, higher values up to 1.0 result in more bounce.
This property is overloaded when PxMaterialFlag::eCOMPLIANT_CONTACT flag is enabled. This permits negative values for restitution to be provided.
The negative values are converted into spring stiffness terms for an implicit spring simulated at the contact site, with the spring positional error defined by
the contact separation value. Higher stiffness terms produce stiffer springs that behave more like a rigid contact.
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
\param[in] rest Coefficient of restitution. <b>Range:</b> [0,1]
\param[in] rest Coefficient of restitution. <b>Range:</b> [-INF,1]
@see getRestitution()
*/
virtual void setRestitution(PxReal rest) = 0;
virtual void setRestitution(PxReal rest) = 0;
/**
\brief Retrieves the coefficient of restitution.
@@ -233,31 +218,65 @@ public:
@see setRestitution()
*/
virtual PxReal getRestitution() const = 0;
virtual PxReal getRestitution() const = 0;
/**
\brief Sets the coefficient of damping
This property only affects the simulation if PxMaterialFlag::eCOMPLIANT_CONTACT is raised.
Damping works together with spring stiffness (set through a negative restitution value). Spring stiffness corrects positional error while
damping resists relative velocity. Setting a high damping coefficient can produce spongy contacts.
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
\param[in] damping Coefficient of damping. <b>Range:</b> [0,INF]
@see getDamping()
*/
virtual void setDamping(PxReal damping) = 0;
/**
\brief Retrieves the coefficient of damping.
See #setDamping.
\return The coefficient of damping.
@see setDamping()
*/
virtual PxReal getDamping() const = 0;
/**
\brief Raises or clears a particular material flag.
See the list of flags #PxMaterialFlag
<b>Default:</b> eIMPROVED_PATCH_FRICTION
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
\param[in] flag The PxMaterial flag to raise(set) or clear.
\param[in] flag The PxMaterial flag to raise(set) or clear.
\param[in] b New state of the flag
@see getFlags() PxMaterialFlag
@see getFlags() setFlags() PxMaterialFlag
*/
virtual void setFlag(PxMaterialFlag::Enum flag, bool) = 0;
virtual void setFlag(PxMaterialFlag::Enum flag, bool b) = 0;
/**
\brief sets all the material flags.
See the list of flags #PxMaterialFlag
<b>Default:</b> eIMPROVED_PATCH_FRICTION
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
\param[in] flags All PxMaterial flags
@see getFlags() setFlag() PxMaterialFlag
*/
virtual void setFlags( PxMaterialFlags inFlags ) = 0;
virtual void setFlags(PxMaterialFlags flags) = 0;
/**
\brief Retrieves the flags. See #PxMaterialFlag.
@@ -273,13 +292,15 @@ public:
See the enum ::PxCombineMode .
<b>Default:</b> PxCombineMode::eAVERAGE
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
\param[in] combMode Friction combine mode to set for this material. See #PxCombineMode.
@see PxCombineMode getFrictionCombineMode setStaticFriction() setDynamicFriction()
*/
virtual void setFrictionCombineMode(PxCombineMode::Enum combMode) = 0;
virtual void setFrictionCombineMode(PxCombineMode::Enum combMode) = 0;
/**
\brief Retrieves the friction combine mode.
@@ -297,13 +318,15 @@ public:
See the enum ::PxCombineMode .
<b>Default:</b> PxCombineMode::eAVERAGE
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
\param[in] combMode Restitution combine mode for this material. See #PxCombineMode.
@see PxCombineMode getRestitutionCombineMode() setRestitution()
*/
virtual void setRestitutionCombineMode(PxCombineMode::Enum combMode) = 0;
virtual void setRestitutionCombineMode(PxCombineMode::Enum combMode) = 0;
/**
\brief Retrieves the restitution combine mode.
@@ -316,17 +339,15 @@ public:
*/
virtual PxCombineMode::Enum getRestitutionCombineMode() const = 0;
//public variables:
void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object.
virtual const char* getConcreteTypeName() const { return "PxMaterial"; }
// PxBase
virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxMaterial"; }
//~PxBase
protected:
PX_INLINE PxMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
PX_INLINE PxMaterial(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
virtual ~PxMaterial() {}
virtual bool isKindOf(const char* name) const { return !::strcmp("PxMaterial", name) || PxBase::isKindOf(name); }
PX_INLINE PxMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxBaseMaterial(concreteType, baseFlags) {}
PX_INLINE PxMaterial(PxBaseFlags baseFlags) : PxBaseMaterial(baseFlags) {}
virtual ~PxMaterial() {}
virtual bool isKindOf(const char* name) const { return !::strcmp("PxMaterial", name) || PxBaseMaterial::isKindOf(name); }
};
#if !PX_DOXYGEN