Cramming PhysX in there

More PhysX work

More PhysX work
This commit is contained in:
2025-07-06 23:58:40 +02:00
parent c3a1686325
commit 84350b85ab
3257 changed files with 587241 additions and 66 deletions

View File

@@ -0,0 +1,106 @@
#include "characterkinematic/PxController.h"
namespace physx {
/**
\brief Descriptor for a box character controller.
@see PxBoxController PxControllerDesc
*/
class PxBoxControllerDesc : public PxControllerDesc
{
public:
/**
\brief constructor sets to default.
*/
PX_INLINE PxBoxControllerDesc();
PX_INLINE virtual ~PxBoxControllerDesc() {}
/**
\brief copy constructor.
*/
PX_INLINE PxBoxControllerDesc(const PxBoxControllerDesc&);
/**
\brief assignment operator.
*/
PX_INLINE PxBoxControllerDesc& operator=(const PxBoxControllerDesc&);
/**
\brief (re)sets the structure to the default.
*/
PX_INLINE virtual void setToDefault();
/**
\brief returns true if the current settings are valid
\return True if the descriptor is valid.
*/
PX_INLINE virtual bool isValid() const;
/**
\brief Half height
<b>Default:</b> 1.0
*/
PxF32 halfHeight; // Half-height in the "up" direction
/**
\brief Half side extent
<b>Default:</b> 0.5
*/
PxF32 halfSideExtent; // Half-extent in the "side" direction
/**
\brief Half forward extent
<b>Default:</b> 0.5
*/
PxF32 halfForwardExtent; // Half-extent in the "forward" direction
protected:
PX_INLINE void copy(const PxBoxControllerDesc&);
};
PX_INLINE PxBoxControllerDesc::PxBoxControllerDesc() :
PxControllerDesc (PxControllerShapeType::eBOX),
halfHeight (1.0f),
halfSideExtent (0.5f),
halfForwardExtent (0.5f)
{
}
PX_INLINE PxBoxControllerDesc::PxBoxControllerDesc(const PxBoxControllerDesc& other) : PxControllerDesc(other)
{
copy(other);
}
PX_INLINE PxBoxControllerDesc& PxBoxControllerDesc::operator=(const PxBoxControllerDesc& other)
{
PxControllerDesc::operator=(other);
copy(other);
return *this;
}
PX_INLINE void PxBoxControllerDesc::copy(const PxBoxControllerDesc& other)
{
halfHeight = other.halfHeight;
halfSideExtent = other.halfSideExtent;
halfForwardExtent = other.halfForwardExtent;
}
PX_INLINE void PxBoxControllerDesc::setToDefault()
{
*this = PxBoxControllerDesc();
}
PX_INLINE bool PxBoxControllerDesc::isValid() const
{
if(!PxControllerDesc::isValid()) return false;
if(halfHeight<=0.0f) return false;
if(halfSideExtent<=0.0f) return false;
if(halfForwardExtent<=0.0f) return false;
if(stepOffset>2.0f*halfHeight) return false; // Prevents obvious mistakes
return true;
}
}

View File

@@ -0,0 +1,79 @@
#include "common/PxBase.h"
#include "foundation/PxMath.h"
namespace physx {
class PxJointLimitParameters
{
public:
PxReal restitution;
PxReal bounceThreshold;
PxReal stiffness;
PxReal damping;
PxReal contactDistance_deprecated;
PxJointLimitParameters() :
restitution (0.0f),
bounceThreshold (0.0f),
stiffness (0.0f),
damping (0.0f),
contactDistance_deprecated (0.0f)
{
}
PxJointLimitParameters(const PxJointLimitParameters& p) :
restitution (p.restitution),
bounceThreshold (p.bounceThreshold),
stiffness (p.stiffness),
damping (p.damping),
contactDistance_deprecated (p.contactDistance_deprecated)
{
}
/**
\brief Returns true if the current settings are valid.
\return true if the current settings are valid
*/
PX_INLINE bool isValid() const
{
return PxIsFinite(restitution) && restitution >= 0 && restitution <= 1 &&
PxIsFinite(stiffness) && stiffness >= 0 &&
PxIsFinite(damping) && damping >= 0 &&
PxIsFinite(bounceThreshold) && bounceThreshold >= 0 &&
PxIsFinite(contactDistance_deprecated) && contactDistance_deprecated >= 0;
}
PX_INLINE bool isSoft() const
{
return damping>0 || stiffness>0;
}
protected:
~PxJointLimitParameters() {}
};
class PxJointAngularLimitPair : public PxJointLimitParameters
{
public:
PxReal upper, lower;
PxJointAngularLimitPair(PxReal lowerLimit, PxReal upperLimit, PxReal contactDist_deprecated = -1.0f) :
upper(upperLimit),
lower(lowerLimit)
{
PxJointLimitParameters::contactDistance_deprecated = contactDist_deprecated ==-1.0f ? PxMin(0.1f, 0.49f*(upperLimit-lowerLimit)) : contactDist_deprecated;
bounceThreshold = 0.5f;
}
/**
\brief Returns true if the limit is valid.
\return true if the current settings are valid
*/
PX_INLINE bool isValid() const
{
return PxJointLimitParameters::isValid() &&
PxIsFinite(upper) && PxIsFinite(lower) && upper >= lower;
}
};
}

View File

@@ -0,0 +1 @@
#include "PxPhysics.h"

View File

@@ -0,0 +1 @@
#include "PxShape.h"