feat(physics): wire physx sdk into build

This commit is contained in:
2026-04-15 12:22:15 +08:00
parent 5bf258df6d
commit 31f40e2cbb
2044 changed files with 752623 additions and 1 deletions

View File

@@ -0,0 +1,137 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_ACTOR_CORE_H
#define SC_ACTOR_CORE_H
#include "foundation/PxBitAndData.h"
#include "PxActor.h"
#define SC_FILTERING_ID_SHIFT_BIT 24
#define SC_FILTERING_ID_MAX (1<<SC_FILTERING_ID_SHIFT_BIT)
#define SC_FILTERING_ID_MASK 0x00ffffff
namespace physx
{
namespace Sc
{
class ActorSim;
class ActorCore
{
public:
// PX_SERIALIZATION
ActorCore(const PxEMPTY) : mSim(NULL), mActorFlags(PxEmpty)
{
}
//~PX_SERIALIZATION
ActorCore(PxActorType::Enum actorType, PxU8 actorFlags, PxClientID owner, PxDominanceGroup dominanceGroup);
~ActorCore();
PX_FORCE_INLINE ActorSim* getSim() const { return mSim; }
PX_FORCE_INLINE void setSim(ActorSim* sim)
{
PX_ASSERT((sim==NULL) ^ (mSim==NULL));
mSim = sim;
}
PX_FORCE_INLINE PxActorFlags getActorFlags() const { return mActorFlags; }
void setActorFlags(PxActorFlags af);
PX_FORCE_INLINE PxDominanceGroup getDominanceGroup() const
{
return PxDominanceGroup(mDominanceGroup);
}
void setDominanceGroup(PxDominanceGroup g);
PX_FORCE_INLINE void setOwnerClient(PxClientID inId)
{
const PxU32 id = mPackedIDs & SC_FILTERING_ID_MASK;
mPackedIDs = (PxU32(inId)<<SC_FILTERING_ID_SHIFT_BIT) | id;
}
PX_FORCE_INLINE PxClientID getOwnerClient() const
{
return mPackedIDs>>SC_FILTERING_ID_SHIFT_BIT;
}
PX_FORCE_INLINE PxActorType::Enum getActorCoreType() const { return PxActorType::Enum(mActorType); }
void reinsertShapes();
void setAggregateID(PxU32 id);
PX_FORCE_INLINE PxU8 hasAggregateID() const { return mDominanceGroup.isBitSet(); }
PX_FORCE_INLINE PxU32 getAggregateID() const
{
if(!hasAggregateID())
return PX_INVALID_U32;
return mPackedIDs & SC_FILTERING_ID_MASK;
}
void setEnvID(PxU32 id);
PX_FORCE_INLINE PxU32 getEnvID() const
{
if(hasAggregateID())
return PX_INVALID_U32;
const PxU32 id = mPackedIDs & SC_FILTERING_ID_MASK;
return id == SC_FILTERING_ID_MASK ? PX_INVALID_U32 : id;
}
private:
ActorSim* mSim;
PxU32 mPackedIDs; // PxClientID (8bit) | aggregate / env ID (24bit)
// PT: TODO: the remaining members could be packed into just a 16bit mask
PxActorFlags mActorFlags; // PxActor's flags (PxU8) => only 4 bits used
PxU8 mActorType; // Actor type (8 bits, but 3 would be enough)
PxBitAndByte mDominanceGroup; // Aggregate bit | dominance group (7 bits, but 5 would be enough because "must be < 32")
PX_FORCE_INLINE void setID(PxU32 id)
{
const PxU32 ownerClient = mPackedIDs & (~SC_FILTERING_ID_MASK);
mPackedIDs = (id & SC_FILTERING_ID_MASK) | ownerClient;
}
PX_FORCE_INLINE void resetID()
{
mPackedIDs |= SC_FILTERING_ID_MASK;
}
};
#if PX_P64_FAMILY
PX_COMPILE_TIME_ASSERT(sizeof(Sc::ActorCore)==16);
#else
PX_COMPILE_TIME_ASSERT(sizeof(Sc::ActorCore)==12);
#endif
} // namespace Sc
}
//////////////////////////////////////////////////////////////////////////
#endif

View File

@@ -0,0 +1,67 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_ATTACHMENT_CORE_H
#define SC_ATTACHMENT_CORE_H
#include "foundation/PxVec3.h"
namespace physx
{
namespace Sc
{
class ArticulationAttachmentCore
{
public:
// PX_SERIALIZATION
ArticulationAttachmentCore(const PxEMPTY) : mTendonSim(NULL) {}
void preExportDataReset() { }
//~PX_SERIALIZATION
ArticulationAttachmentCore() : mLowLimit(PX_MAX_F32), mHighLimit(-PX_MAX_F32), mRestLength(0.f)
{
}
PxVec3 mRelativeOffset; //relative offset to the link(in link space)
ArticulationAttachmentCore* mParent;
PxReal mLowLimit;
PxReal mHighLimit;
PxReal mRestLength;
PxReal mCoefficient;
PxU32 mLLLinkIndex;
PxU32 mAttachmentIndex;
Sc::ArticulationSpatialTendonSim* mTendonSim;
};
}//namespace Sc
}//namespace physx
#endif

View File

@@ -0,0 +1,162 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_ARTICULATION_CORE_H
#define SC_ARTICULATION_CORE_H
#include "ScActorCore.h"
#include "DyFeatherstoneArticulation.h"
namespace physx
{
class PxNodeIndex;
namespace Sc
{
class ArticulationSim;
class ArticulationCore
{
//---------------------------------------------------------------------------------
// Construction, destruction & initialization
//---------------------------------------------------------------------------------
// PX_SERIALIZATION
public:
ArticulationCore(const PxEMPTY) : mSim(NULL), mCore(PxEmpty) {}
//~PX_SERIALIZATION
ArticulationCore();
~ArticulationCore();
//---------------------------------------------------------------------------------
// External API
//---------------------------------------------------------------------------------
PX_FORCE_INLINE PxReal getSleepThreshold() const { return mCore.sleepThreshold; }
PX_FORCE_INLINE void setSleepThreshold(const PxReal v) { mCore.sleepThreshold = v; }
PX_FORCE_INLINE PxReal getFreezeThreshold() const { return mCore.freezeThreshold; }
PX_FORCE_INLINE void setFreezeThreshold(const PxReal v) { mCore.freezeThreshold = v; }
PX_FORCE_INLINE PxU16 getSolverIterationCounts() const { return mCore.solverIterationCounts; }
PX_FORCE_INLINE void setSolverIterationCounts(PxU16 c) { mCore.solverIterationCounts = c; }
PX_FORCE_INLINE PxReal getWakeCounter() const { return mCore.wakeCounter; }
PX_FORCE_INLINE void setWakeCounterInternal(const PxReal v) { mCore.wakeCounter = v; }
void setWakeCounter(const PxReal v);
bool isSleeping() const;
void wakeUp(PxReal wakeCounter);
void putToSleep();
//---------------------------------------------------------------------------------
// external reduced coordinate API
//---------------------------------------------------------------------------------
void setArticulationFlags(PxArticulationFlags flags);
PxArticulationFlags getArticulationFlags() const { return mCore.flags; }
PxU32 getDofs() const;
PxArticulationCache* createCache() const;
PxU32 getCacheDataSize() const;
void zeroCache(PxArticulationCache& cache) const;
bool applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag)const;
void copyInternalStateToCache
(PxArticulationCache& cache, const PxArticulationCacheFlags flag, const bool isGpuSimEnabled) const;
void packJointData(const PxReal* maximum, PxReal* reduced) const;
void unpackJointData(const PxReal* reduced, PxReal* maximum) const;
void commonInit() const;
void computeGeneralizedGravityForce(PxArticulationCache& cache, const bool rootMotion) const;
void computeCoriolisAndCentrifugalForce(PxArticulationCache& cache, const bool rootMotion) const;
void computeGeneralizedExternalForce(PxArticulationCache& cache) const;
void computeJointAcceleration(PxArticulationCache& cache) const;
void computeJointForce(PxArticulationCache& cache) const;
void computeDenseJacobian(PxArticulationCache& cache, PxU32& nRows, PxU32& nCols) const;
void computeCoefficientMatrix(PxArticulationCache& cache) const;
bool computeLambda(PxArticulationCache& cache, PxArticulationCache& rollBackCache, const PxReal* const jointTorque, const PxVec3 gravity, const PxU32 maxIter) const;
void computeGeneralizedMassMatrix(PxArticulationCache& cache, const bool rootMotion) const;
PxVec3 computeArticulationCOM(const bool rootFrame) const;
void computeCentroidalMomentumMatrix(PxArticulationCache& cache) const;
PxU32 getCoefficientMatrixSize() const;
PxSpatialVelocity getLinkAcceleration(const PxU32 linkId, const bool isGpuSimEnabled) const;
PxU32 getGpuArticulationIndex() const;
void updateKinematic(PxArticulationKinematicFlags flags);
//---------------------------------------------------------------------------------
// Internal API
//---------------------------------------------------------------------------------
public:
PX_FORCE_INLINE void setSim(ArticulationSim* sim)
{
PX_ASSERT((sim==0) ^ (mSim == 0));
mSim = sim;
}
PX_FORCE_INLINE ArticulationSim* getSim() const { return mSim; }
PX_FORCE_INLINE Dy::ArticulationCore& getCore() { return mCore; }
static PX_FORCE_INLINE ArticulationCore& getArticulationCore(ArticulationCore& core)
{
const size_t offset = PX_OFFSET_OF(ArticulationCore, mCore);
return *reinterpret_cast<ArticulationCore*>(reinterpret_cast<PxU8*>(&core) - offset);
}
PxNodeIndex getIslandNodeIndex() const;
void setGlobalPose();
private:
ArticulationSim* mSim;
Dy::ArticulationCore mCore;
};
} // namespace Sc
}
#endif

View File

@@ -0,0 +1,147 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_ARTICULATION_JOINT_CORE_H
#define SC_ARTICULATION_JOINT_CORE_H
#include "foundation/PxTransform.h"
#include "DyVArticulation.h"
namespace physx
{
namespace Sc
{
class BodyCore;
class ArticulationJointSim;
class ArticulationCore;
class ArticulationJointDesc
{
public:
BodyCore* parent;
BodyCore* child;
PxTransform parentPose;
PxTransform childPose;
};
class ArticulationJointCore
{
public:
// PX_SERIALIZATION
ArticulationJointCore(const PxEMPTY) : mCore(PxEmpty), mSim(NULL) {}
void preExportDataReset() { mCore.jCalcUpdateFrames = true; }
//~PX_SERIALIZATION
ArticulationJointCore(const PxTransform& parentFrame, const PxTransform& childFrame);
~ArticulationJointCore();
//Those methods are not allowed while the articulation are in the scene
PX_FORCE_INLINE const PxTransform& getParentPose() const { return mCore.parentPose; }
void setParentPose(const PxTransform&);
PX_FORCE_INLINE const PxTransform& getChildPose() const { return mCore.childPose; }
void setChildPose(const PxTransform&);
//Those functions doesn't change the articulation configuration so the application is allowed to change those value in run-time
PX_FORCE_INLINE PxArticulationLimit getLimit(PxArticulationAxis::Enum axis) const { return mCore.limits[axis]; }
void setLimit(PxArticulationAxis::Enum axis, const PxArticulationLimit& limit);
PX_FORCE_INLINE PxArticulationDrive getDrive(PxArticulationAxis::Enum axis) const { return mCore.drives[axis]; }
void setDrive(PxArticulationAxis::Enum axis, const PxArticulationDrive& drive);
void setTargetP(PxArticulationAxis::Enum axis, PxReal targetP);
PX_FORCE_INLINE PxReal getTargetP(PxArticulationAxis::Enum axis) const { return mCore.targetP[axis]; }
void setTargetV(PxArticulationAxis::Enum axis, PxReal targetV);
PX_FORCE_INLINE PxReal getTargetV(PxArticulationAxis::Enum axis) const { return mCore.targetV[axis]; }
void setArmature(PxArticulationAxis::Enum axis, PxReal armature);
PX_FORCE_INLINE PxReal getArmature(PxArticulationAxis::Enum axis) const { return mCore.armature[axis]; }
void setJointPosition(PxArticulationAxis::Enum axis, const PxReal jointPos);
PxReal getJointPosition(PxArticulationAxis::Enum axis) const;
void setJointVelocity(PxArticulationAxis::Enum axis, const PxReal jointVel);
PxReal getJointVelocity(PxArticulationAxis::Enum axis) const;
void setMaxJointVelocity(PxReal maxJointV);
PX_FORCE_INLINE PxReal getMaxJointVelocity() const { return mCore.maxJointVelocity[0]; }
void setMaxJointVelocity(PxArticulationAxis::Enum axis, PxReal maxJointV);
PX_FORCE_INLINE PxReal getMaxJointVelocity(PxArticulationAxis::Enum axis) const { return mCore.maxJointVelocity[axis]; }
PX_FORCE_INLINE void setMotion(PxArticulationAxis::Enum axis, PxArticulationMotion::Enum motion) { mCore.motion[axis] = PxU8(motion); }
PX_FORCE_INLINE PxArticulationMotion::Enum getMotion(PxArticulationAxis::Enum axis) const { return PxArticulationMotion::Enum(mCore.motion[axis]); }
PX_FORCE_INLINE void setJointType(PxArticulationJointType::Enum type) { mCore.setJointType(type); }
PX_FORCE_INLINE PxArticulationJointType::Enum getJointType() const { return PxArticulationJointType::Enum(mCore.jointType); }
void setFrictionCoefficient(const PxReal coefficient);
PX_FORCE_INLINE PxReal getFrictionCoefficient() const { return mCore.frictionCoefficient; }
void setFrictionParams(PxArticulationAxis::Enum axis, const PxJointFrictionParams& jointFrictionParams);
PX_FORCE_INLINE PxJointFrictionParams getFrictionParams(PxArticulationAxis::Enum axis) const { return mCore.frictionParams[axis]; }
PX_FORCE_INLINE ArticulationJointSim* getSim() const { return mSim; }
PX_FORCE_INLINE void setSim(ArticulationJointSim* sim)
{
PX_ASSERT((sim==0) ^ (mSim == 0));
mSim = sim;
}
PX_FORCE_INLINE Dy::ArticulationJointCore& getCore() { return mCore; }
PX_FORCE_INLINE void setArticulation(ArticulationCore* articulation) { mArticulation = articulation; }
PX_FORCE_INLINE const ArticulationCore* getArticulation() const { return mArticulation; }
PX_FORCE_INLINE void setRoot(PxArticulationJointReducedCoordinate* base) { mRootType = base; }
PX_FORCE_INLINE PxArticulationJointReducedCoordinate* getRoot() const { return mRootType; }
PX_FORCE_INLINE void setLLIndex(const PxU32 llLinkIndex) { mLLLinkIndex = llLinkIndex; }
private:
void setSimDirty();
PX_FORCE_INLINE void setDirty()
{
mCore.jCalcUpdateFrames = true;
setSimDirty();
}
Dy::ArticulationJointCore mCore;
ArticulationJointSim* mSim;
ArticulationCore* mArticulation;
PxArticulationJointReducedCoordinate* mRootType;
PxU32 mLLLinkIndex;
#if PX_P64_FAMILY
PxU32 pad;
#endif
};
} // namespace Sc
}
#endif

View File

@@ -0,0 +1,74 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_ARTICULATION_MIMIC_JOINT_CORE
#define SC_ARTICULATION_MIMIC_JOINT_CORE
#include "foundation/PxVec3.h"
#include "foundation/PxTransform.h"
namespace physx
{
namespace Sc
{
class ArticulationCore;
class ArticulationMimicJointSim;
class ArticulationMimicJointCore
{
public:
// PX_SERIALIZATION
ArticulationMimicJointCore(const PxEMPTY) :mSim(NULL) {}
//~PX_SERIALIZATION
ArticulationMimicJointCore() : mSim(NULL) {}
PX_FORCE_INLINE void setSim(ArticulationMimicJointSim* sim)
{
PX_ASSERT((sim == 0) ^ (mSim == 0));
mSim = sim;
}
PX_FORCE_INLINE ArticulationMimicJointSim* getSim() const { return mSim; }
ArticulationMimicJointSim* mSim;
PxU32 mAxisA;
PxU32 mAxisB;
PxReal mGearRatio;
PxReal mOffset;
PxReal mNaturalFrequency;
PxReal mDampingRatio;
};
}//namespace Sc
}//namespace physx
#endif //SC_ARTICULATION_MIMIC_JOINT_CORE

View File

@@ -0,0 +1,147 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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_SCP_ARTICULATION_TENDON_CORE
#define PX_PHYSICS_SCP_ARTICULATION_TENDON_CORE
#include "DyArticulationTendon.h"
namespace physx
{
namespace Sc
{
class ArticulationSpatialTendonSim;
class ArticulationFixedTendonSim;
class ArticulationTendonCore
{
public:
// PX_SERIALIZATION
ArticulationTendonCore(const PxEMPTY) {}
void preExportDataReset() { }
//~PX_SERIALIZATION
ArticulationTendonCore() : mStiffness(0.f), mDamping(0.f), mOffset(0.f), mLimitStiffness(0.f)
{
}
PxReal mStiffness;
PxReal mDamping;
PxReal mOffset;
PxReal mLimitStiffness;
};
class ArticulationSpatialTendonCore : public ArticulationTendonCore
{
public:
// PX_SERIALIZATION
ArticulationSpatialTendonCore(const PxEMPTY) : ArticulationTendonCore(PxEmpty), mSim(NULL) {}
void preExportDataReset() { }
//~PX_SERIALIZATION
ArticulationSpatialTendonCore() : ArticulationTendonCore() { mSim = NULL; }
~ArticulationSpatialTendonCore() {}
void setStiffness(const PxReal stiffness);
PxReal getStiffness() const;
void setDamping(const PxReal damping);
PxReal getDamping() const;
void setLimitStiffness(const PxReal stiffness);
PxReal getLimitStiffness() const;
void setOffset(const PxReal offset);
PxReal getOffset() const;
PX_FORCE_INLINE void setSim(ArticulationSpatialTendonSim* sim)
{
PX_ASSERT((sim == 0) ^ (mSim == 0));
mSim = sim;
}
PX_FORCE_INLINE ArticulationSpatialTendonSim* getSim() const { return mSim; }
ArticulationSpatialTendonSim* mSim;
};
class ArticulationFixedTendonCore : public ArticulationTendonCore
{
public:
// PX_SERIALIZATION
ArticulationFixedTendonCore(const PxEMPTY) : ArticulationTendonCore(PxEmpty), mSim(NULL) {}
void preExportDataReset() {}
//~PX_SERIALIZATION
ArticulationFixedTendonCore() : ArticulationTendonCore(), mLowLimit(PX_MAX_F32), mHighLimit(-PX_MAX_F32), mRestLength(0.f)
{ mSim = NULL; }
~ArticulationFixedTendonCore() {}
void setStiffness(const PxReal stiffness);
PxReal getStiffness() const;
void setDamping(const PxReal damping);
PxReal getDamping() const;
void setLimitStiffness(const PxReal stiffness);
PxReal getLimitStiffness() const;
void setOffset(const PxReal offset);
PxReal getOffset() const;
void setSpringRestLength(const PxReal restLength);
PxReal getSpringRestLength() const;
void setLimitRange(const PxReal lowLimit, const PxReal highLimit);
void getLimitRange(PxReal& lowLimit, PxReal& highLimit) const;
PX_FORCE_INLINE void setSim(ArticulationFixedTendonSim* sim)
{
PX_ASSERT((sim == 0) ^ (mSim == 0));
mSim = sim;
}
PX_FORCE_INLINE ArticulationFixedTendonSim* getSim() const { return mSim; }
PxReal mLowLimit;
PxReal mHighLimit;
PxReal mRestLength;
ArticulationFixedTendonSim* mSim;
};
}//namespace Sc
} //namespace physx
#endif

View File

@@ -0,0 +1,83 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_TENDON_JOINT_CORE_H
#define SC_TENDON_JOINT_CORE_H
#include "foundation/PxVec3.h"
#include "solver/PxSolverDefs.h"
namespace physx
{
namespace Sc
{
class ArticulationFixedTendonSim;
class ArticulationTendonJointCore
{
public:
// PX_SERIALIZATION
ArticulationTendonJointCore(const PxEMPTY) : mTendonSim(NULL) {}
void preExportDataReset() { }
//~PX_SERIALIZATION
ArticulationTendonJointCore()
{
coefficient = PX_MAX_F32;
recipCoefficient = PX_MAX_F32;
}
PX_FORCE_INLINE PxArticulationAxis::Enum getAxis()
{
return axis;
}
PX_FORCE_INLINE void getCoefficient(PxArticulationAxis::Enum& axis_, PxReal& coefficient_, PxReal& recipCoefficient_) const
{
axis_ = axis;
coefficient_ = coefficient;
recipCoefficient_ = recipCoefficient;
}
void setCoefficient(PxArticulationAxis::Enum axis_, const PxReal coefficient_, const PxReal recipCoefficient_);
PxArticulationAxis::Enum axis;
PxReal coefficient;
PxReal recipCoefficient;
PxU32 mLLLinkIndex;
ArticulationTendonJointCore* mParent;
PxU32 mLLTendonJointIndex;
Sc::ArticulationFixedTendonSim* mTendonSim;
};
}//namespace Sc
}//namespace physx
#endif

View File

@@ -0,0 +1,188 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_BODY_CORE_H
#define SC_BODY_CORE_H
#include "foundation/PxTransform.h"
#include "ScRigidCore.h"
#include "PxRigidDynamic.h"
#include "PxvDynamics.h"
#include "PxvConfig.h"
namespace physx
{
namespace Sc
{
class BodySim;
class BodyCore : public RigidCore
{
public:
// PX_SERIALIZATION
BodyCore(const PxEMPTY) : RigidCore(PxEmpty), mCore(PxEmpty) {}
void restoreDynamicData();
//~PX_SERIALIZATION
BodyCore(PxActorType::Enum type, const PxTransform& bodyPose);
~BodyCore();
//---------------------------------------------------------------------------------
// External API
//---------------------------------------------------------------------------------
PX_FORCE_INLINE const PxTransform& getBody2World() const { return mCore.body2World; }
void setBody2World(const PxTransform& p);
void setCMassLocalPose(const PxTransform& body2Actor);
PX_FORCE_INLINE const PxVec3& getLinearVelocity() const { return mCore.linearVelocity; }
void setLinearVelocity(const PxVec3& v, bool skipBodySimUpdate=false);
PX_FORCE_INLINE const PxVec3& getAngularVelocity() const { return mCore.angularVelocity; }
void setAngularVelocity(const PxVec3& v, bool skipBodySimUpdate=false);
PX_FORCE_INLINE PxReal getCfmScale() const { return mCore.cfmScale; }
void setCfmScale(PxReal d);
PX_FORCE_INLINE void updateVelocities(const PxVec3& linearVelModPerStep, const PxVec3& angularVelModPerStep)
{
mCore.linearVelocity += linearVelModPerStep;
mCore.angularVelocity += angularVelModPerStep;
}
PX_FORCE_INLINE const PxTransform& getBody2Actor() const { return mCore.getBody2Actor(); }
void setBody2Actor(const PxTransform& p);
void addSpatialAcceleration(const PxVec3* linAcc, const PxVec3* angAcc);
void setSpatialAcceleration(const PxVec3* linAcc, const PxVec3* angAcc);
void clearSpatialAcceleration(bool force, bool torque);
void addSpatialVelocity(const PxVec3* linVelDelta, const PxVec3* angVelDelta);
void clearSpatialVelocity(bool force, bool torque);
PX_FORCE_INLINE PxReal getMaxPenetrationBias() const { return mCore.maxPenBias; }
PX_FORCE_INLINE void setMaxPenetrationBias(PxReal p) { mCore.maxPenBias = p; }
PxReal getInverseMass() const;
void setInverseMass(PxReal m);
const PxVec3& getInverseInertia() const;
void setInverseInertia(const PxVec3& i);
PxReal getLinearDamping() const;
void setLinearDamping(PxReal d);
PxReal getAngularDamping() const;
void setAngularDamping(PxReal d);
PX_FORCE_INLINE PxRigidBodyFlags getFlags() const { return mCore.mFlags; }
void setFlags(PxRigidBodyFlags f);
PX_FORCE_INLINE PxRigidDynamicLockFlags getRigidDynamicLockFlags() const { return mCore.lockFlags; }
PX_FORCE_INLINE void setRigidDynamicLockFlags(PxRigidDynamicLockFlags flags) { mCore.lockFlags = flags; }
PX_FORCE_INLINE PxReal getSleepThreshold() const { return mCore.sleepThreshold; }
void setSleepThreshold(PxReal t);
PX_FORCE_INLINE PxReal getFreezeThreshold() const { return mCore.freezeThreshold; }
void setFreezeThreshold(PxReal t);
PX_FORCE_INLINE PxReal getMaxContactImpulse() const { return mCore.maxContactImpulse; }
void setMaxContactImpulse(PxReal m);
PX_FORCE_INLINE PxReal getOffsetSlop() const { return mCore.offsetSlop; }
void setOffsetSlop(PxReal slop);
PxNodeIndex getInternalIslandNodeIndex() const;
PX_FORCE_INLINE PxReal getWakeCounter() const { return mCore.wakeCounter; }
void setWakeCounter(PxReal wakeCounter, bool forceWakeUp=false);
bool isSleeping() const;
PX_FORCE_INLINE void wakeUp(PxReal wakeCounter) { setWakeCounter(wakeCounter, true); }
void putToSleep();
PxReal getMaxAngVelSq() const;
void setMaxAngVelSq(PxReal v);
PxReal getMaxLinVelSq() const;
void setMaxLinVelSq(PxReal v);
PX_FORCE_INLINE PxU16 getSolverIterationCounts() const { return mCore.solverIterationCounts; }
void setSolverIterationCounts(PxU16 c);
bool getKinematicTarget(PxTransform& p) const;
bool getHasValidKinematicTarget() const;
void setKinematicTarget(const PxTransform& p, PxReal wakeCounter);
void invalidateKinematicTarget();
PX_FORCE_INLINE PxReal getContactReportThreshold() const { return mCore.contactReportThreshold; }
void setContactReportThreshold(PxReal t) { mCore.contactReportThreshold = t; }
void onOriginShift(const PxVec3& shift);
//---------------------------------------------------------------------------------
// Internal API
//---------------------------------------------------------------------------------
PX_FORCE_INLINE void setLinearVelocityInternal(const PxVec3& v) { mCore.linearVelocity = v; }
PX_FORCE_INLINE void setAngularVelocityInternal(const PxVec3& v) { mCore.angularVelocity = v; }
PX_FORCE_INLINE void setWakeCounterFromSim(PxReal c) { mCore.wakeCounter = c; }
BodySim* getSim() const;
PX_FORCE_INLINE PxsBodyCore& getCore() { return mCore; }
PX_FORCE_INLINE const PxsBodyCore& getCore() const { return mCore; }
static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(BodyCore, mCore); }
PX_FORCE_INLINE PxReal getCCDAdvanceCoefficient() const { return mCore.ccdAdvanceCoefficient; }
PX_FORCE_INLINE void setCCDAdvanceCoefficient(PxReal c) { mCore.ccdAdvanceCoefficient = c; }
void onRemoveKinematicFromScene();
PxIntBool isFrozen() const;
static PX_FORCE_INLINE BodyCore& getCore(PxsBodyCore& core)
{
return *reinterpret_cast<BodyCore*>(reinterpret_cast<PxU8*>(&core) - getCoreOffset());
}
static PX_FORCE_INLINE BodyCore& getCore(const PxsBodyCore& core)
{
return *reinterpret_cast<BodyCore*>(reinterpret_cast<PxU8*>(&const_cast<PxsBodyCore&>(core)) - getCoreOffset());
}
void setFixedBaseLink(bool value);
private:
PX_ALIGN_PREFIX(16) PxsBodyCore mCore PX_ALIGN_SUFFIX(16);
};
} // namespace Sc
}
#endif

View File

@@ -0,0 +1,71 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_BROADPHASE_H
#define SC_BROADPHASE_H
#include "PxvConfig.h"
#include "foundation/PxArray.h"
// PT: this class captures parts of the Sc::Scene that deals with broadphase matters.
namespace physx
{
class PxBroadPhaseCallback;
namespace Bp
{
class AABBManagerBase;
}
namespace Sc
{
class ObjectIDTracker;
class BroadphaseManager
{
public:
BroadphaseManager();
~BroadphaseManager();
PX_FORCE_INLINE void setBroadPhaseCallback(PxBroadPhaseCallback* callback) { mBroadPhaseCallback = callback; }
PX_FORCE_INLINE PxBroadPhaseCallback* getBroadPhaseCallback() const { return mBroadPhaseCallback; }
void prepareOutOfBoundsCallbacks(Bp::AABBManagerBase* aabbManager);
bool fireOutOfBoundsCallbacks(Bp::AABBManagerBase* aabbManager, const ObjectIDTracker& tracker, PxU64 contextID);
void flush(Bp::AABBManagerBase* aabbManager);
PxBroadPhaseCallback* mBroadPhaseCallback;
PxArray<PxU32> mOutOfBoundsIDs;
};
}
}
#endif

View File

@@ -0,0 +1,122 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_CONSTRAINT_CORE_H
#define SC_CONSTRAINT_CORE_H
#include "PxConstraint.h"
namespace physx
{
namespace Sc
{
class ConstraintSim;
class RigidCore;
class ConstraintCore
{
public:
// PX_SERIALIZATION
ConstraintCore(const PxEMPTY) : mFlags(PxEmpty), mConnector(NULL), mSim(NULL), mResidual() {}
PX_FORCE_INLINE void setConstraintFunctions(PxConstraintConnector& n, const PxConstraintShaderTable& shaders)
{
mConnector = &n;
mSolverPrep = shaders.solverPrep;
mVisualize = shaders.visualize;
}
//~PX_SERIALIZATION
ConstraintCore(PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize);
~ConstraintCore() {}
void setBodies(RigidCore* r0v, RigidCore* r1v);
PxConstraint* getPxConstraint();
const PxConstraint* getPxConstraint() const;
PX_FORCE_INLINE PxConstraintConnector* getPxConnector() const { return mConnector; }
PX_FORCE_INLINE PxConstraintFlags getFlags() const { return mFlags; }
void setFlags(PxConstraintFlags flags);
void getForce(PxVec3& force, PxVec3& torque) const;
void setBreakForce(PxReal linear, PxReal angular);
PX_FORCE_INLINE void getBreakForce(PxReal& linear, PxReal& angular) const
{
linear = mLinearBreakForce;
angular = mAngularBreakForce;
}
void setMinResponseThreshold(PxReal threshold);
PX_FORCE_INLINE PxReal getMinResponseThreshold() const { return mMinResponseThreshold; }
void breakApart();
PX_FORCE_INLINE PxConstraintVisualize getVisualize() const { return mVisualize; }
PX_FORCE_INLINE PxConstraintSolverPrep getSolverPrep() const { return mSolverPrep; }
PX_FORCE_INLINE PxU32 getConstantBlockSize() const { return mDataSize; }
PX_FORCE_INLINE void setSim(ConstraintSim* sim)
{
PX_ASSERT((sim==0) ^ (mSim == 0));
mSim = sim;
}
PX_FORCE_INLINE ConstraintSim* getSim() const { return mSim; }
PX_FORCE_INLINE bool isDirty() const { return mIsDirty ? true : false; }
PX_FORCE_INLINE void setDirty() { mIsDirty = 1; }
PX_FORCE_INLINE void clearDirty() { mIsDirty = 0; }
PX_FORCE_INLINE PxConstraintResidual getSolverResidual() const { return mResidual; }
PX_FORCE_INLINE void setSolverResidual(const PxConstraintResidual& residual) { mResidual = residual; }
private:
PxConstraintFlags mFlags;
//In order to support O(1) insert/remove mIsDirty really wants to be an index into NpScene's dirty joint array
PxU8 mIsDirty;
PxU8 mPadding;
PxVec3 mAppliedForce;
PxVec3 mAppliedTorque;
PxConstraintConnector* mConnector;
PxConstraintSolverPrep mSolverPrep;
PxConstraintVisualize mVisualize;
PxU32 mDataSize;
PxReal mLinearBreakForce;
PxReal mAngularBreakForce;
PxReal mMinResponseThreshold;
ConstraintSim* mSim;
PxConstraintResidual mResidual;
};
} // namespace Sc
}
#endif

View File

@@ -0,0 +1,160 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_DEFORMABLE_SURFACE_CORE
#define SC_DEFORMABLE_SURFACE_CORE
#include "foundation/PxPreprocessor.h"
#if PX_SUPPORT_GPU_PHYSX
#include "PxDeformableSurface.h"
#include "../../lowleveldynamics/include/DyDeformableSurfaceCore.h"
#include "foundation/PxAssert.h"
#include "ScActorCore.h"
#include "ScShapeCore.h"
#include "PxFiltering.h"
#include "ScRigidCore.h" //KS - required for ShapeChangeNotifyFlags. Ideally, we should move that to a separate shared file
#include "PxConeLimitedConstraint.h"
namespace physx
{
namespace Sc
{
class DeformableSurfaceSim;
class DeformableSurfaceCore : public ActorCore
{
public:
// PX_SERIALIZATION
DeformableSurfaceCore(const PxEMPTY) : ActorCore(PxEmpty) {}
//~PX_SERIALIZATION
DeformableSurfaceCore();
~DeformableSurfaceCore();
//---------------------------------------------------------------------------------
// PxActor API
//---------------------------------------------------------------------------------
void setActorFlags(PxActorFlags flags);
PxActorFlags getActorFlags() const { return mCore.actorFlags; }
//---------------------------------------------------------------------------------
// PxDeformableBody API
//---------------------------------------------------------------------------------
void setBodyFlags(PxDeformableBodyFlags flags);
PxDeformableBodyFlags getBodyFlags() const { return mCore.bodyFlags; }
void setLinearDamping(const PxReal linearDamping);
PxReal getLinearDamping() const { return mCore.linearDamping; }
void setMaxLinearVelocity(const PxReal maxLinearVelocity);
PxReal getMaxLinearVelocity() const { return mCore.maxLinearVelocity; }
void setMaxPenetrationBias(const PxReal maxPenetrationBias);
PxReal getMaxPenetrationBias() const { return mCore.maxPenetrationBias; }
void setSolverIterationCounts(PxU16 c);
PxU16 getSolverIterationCounts() const { return mCore.solverIterationCounts; }
void setSleepThreshold(const PxReal sleepThreshold);
PxReal getSleepThreshold() const { return mCore.sleepThreshold; }
void setSettlingThreshold(const PxReal settlingThreshold);
PxReal getSettlingThreshold() const { return mCore.settlingThreshold; }
void setSettlingDamping(const PxReal linearDamping);
PxReal getSettlingDamping() const { return mCore.settlingDamping; }
void setSelfCollisionFilterDistance(const PxReal selfCollisionFilterDistance);
PxReal getSelfCollisionFilterDistance() const { return mCore.selfCollisionFilterDistance; }
//deprecated
void setSelfCollisionStressTolerance(const PxReal selfCollisionStressTolerance);
PxReal getSelfCollisionStressTolerance() const { return mCore.selfCollisionStressTolerance; }
void setWakeCounter(const PxReal v);
void setWakeCounterInternal(const PxReal v);
PxReal getWakeCounter() const { return mCore.wakeCounter; }
//---------------------------------------------------------------------------------
// PxDeformableBody API
//---------------------------------------------------------------------------------
void setSurfaceFlags(PxDeformableSurfaceFlags flags);
PxDeformableSurfaceFlags getSurfaceFlags() const { return mCore.surfaceFlags; }
void setNbCollisionPairUpdatesPerTimestep(const PxU32 frequency);
PxU32 getNbCollisionPairUpdatesPerTimestep() const { return mCore.nbCollisionPairUpdatesPerTimestep; }
void setNbCollisionSubsteps(const PxU32 frequency);
PxU32 getNbCollisionSubsteps() const { return mCore.nbCollisionSubsteps; }
//---------------------------------------------------------------------------------
// Internal API
//---------------------------------------------------------------------------------
PxU32 addRigidAttachment(Sc::BodyCore* core, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint);
void removeRigidAttachment(Sc::BodyCore* core, PxU32 handle);
void addTriRigidFilter(Sc::BodyCore* core, PxU32 triIdx);
void removeTriRigidFilter(Sc::BodyCore* core, PxU32 triIdx);
PxU32 addTriRigidAttachment(Sc::BodyCore* core, PxU32 triIdx, const PxVec4& barycentric,
const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint);
void removeTriRigidAttachment(Sc::BodyCore* core, PxU32 handle);
void addClothFilter(Sc::DeformableSurfaceCore* otherCore, PxU32 otherTriIdx, PxU32 triIdx);
void removeClothFilter(Sc::DeformableSurfaceCore* otherCore, PxU32 otherTriIdx0, PxU32 triIdx);
PxU32 addClothAttachment(Sc::DeformableSurfaceCore* otherCore, PxU32 otherTriIdx, const PxVec4& otherTriBarycentric, PxU32 triIdx,
const PxVec4& triBarycentric);
void removeClothAttachment(Sc::DeformableSurfaceCore* otherCore, PxU32 handle);
void addMaterial(const PxU16 handle);
void clearMaterials();
PxActor* getPxActor() const;
void attachShapeCore(ShapeCore* shapeCore);
void onShapeChange(ShapeCore& shape, ShapeChangeNotifyFlags notifyFlags);
PX_FORCE_INLINE PxU64& getGpuMemStat() { return mGpuMemStat; }
DeformableSurfaceSim* getSim() const;
PX_FORCE_INLINE const Dy::DeformableSurfaceCore& getCore() const { return mCore; }
PX_FORCE_INLINE Dy::DeformableSurfaceCore& getCore() { return mCore; }
private:
Dy::DeformableSurfaceCore mCore;
PxU64 mGpuMemStat;
};
} // namespace Sc
} // namespace physx
#endif // PX_SUPPORT_GPU_PHYSX
#endif // SC_DEFORMABLE_SURFACE_CORE

View File

@@ -0,0 +1,176 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_DEFORMABLE_VOLUME_CORE_H
#define SC_DEFORMABLE_VOLUME_CORE_H
#include "foundation/PxPreprocessor.h"
#if PX_SUPPORT_GPU_PHYSX
#include "PxDeformableVolume.h"
#include "DyDeformableVolumeCore.h"
#include "foundation/PxAssert.h"
#include "ScActorCore.h"
#include "ScShapeCore.h"
#include "PxFiltering.h"
#include "ScRigidCore.h" //KS - needed for ShapeChangeNotifyFlags. Move to a shared header
namespace physx
{
namespace Sc
{
class DeformableVolumeSim;
class BodyCore;
class DeformableSurfaceCore;
class ParticleSystemCore;
class DeformableVolumeCore : public ActorCore
{
public:
// PX_SERIALIZATION
DeformableVolumeCore(const PxEMPTY) : ActorCore(PxEmpty){}
//~PX_SERIALIZATION
DeformableVolumeCore();
~DeformableVolumeCore();
//---------------------------------------------------------------------------------
// PxActor API
//---------------------------------------------------------------------------------
void setActorFlags(PxActorFlags flags);
PxActorFlags getActorFlags() const { return mCore.actorFlags; }
//---------------------------------------------------------------------------------
// PxDeformableBody API
//---------------------------------------------------------------------------------
void setBodyFlags(PxDeformableBodyFlags flags);
PxDeformableBodyFlags getBodyFlags() const { return mCore.bodyFlags; }
void setLinearDamping(const PxReal linearDamping);
PxReal getLinearDamping() const { return mCore.linearDamping; }
void setMaxLinearVelocity(const PxReal maxLinearVelocity);
PxReal getMaxLinearVelocity() const { return mCore.maxLinearVelocity; }
void setMaxPenetrationBias(const PxReal maxPenetrationBias);
PxReal getMaxPenetrationBias() const { return mCore.maxPenetrationBias; }
void setSolverIterationCounts(PxU16 c);
PxU16 getSolverIterationCounts() const { return mCore.solverIterationCounts; }
void setSleepThreshold(const PxReal sleepThreshold);
PxReal getSleepThreshold() const { return mCore.sleepThreshold; }
void setSettlingThreshold(const PxReal settlingThreshold);
PxReal getSettlingThreshold() const { return mCore.settlingThreshold; }
void setSettlingDamping(const PxReal linearDamping);
PxReal getSettlingDamping() const { return mCore.settlingDamping; }
void setSelfCollisionFilterDistance(const PxReal selfCollisionFilterDistance);
PxReal getSelfCollisionFilterDistance() const { return mCore.selfCollisionFilterDistance; }
void setWakeCounter(const PxReal v);
void setWakeCounterInternal(const PxReal v);
PxReal getWakeCounter() const { return mCore.wakeCounter; }
//---------------------------------------------------------------------------------
// PxDeformableBody API
//---------------------------------------------------------------------------------
void setVolumeFlags(PxDeformableVolumeFlags flags);
PxDeformableVolumeFlags getVolumeFlags() const { return mCore.volumeFlags; }
void setSelfCollisionStressTolerance(const PxReal selfCollisionStressTolerance);
PxReal getSelfCollisionStressTolerance() const { return mCore.selfCollisionStressTolerance; }
void setKinematicTargets(const PxVec4* positions);
PxU32 getGpuIndex() const;
void addParticleFilter(Sc::ParticleSystemCore* core, PxU32 particleId, PxU32 userBufferId, PxU32 tetId);
void removeParticleFilter(Sc::ParticleSystemCore* core, PxU32 particleId, PxU32 userBufferId, PxU32 tetId);
PxU32 addParticleAttachment(Sc::ParticleSystemCore* core, PxU32 particleId, PxU32 userBufferId, PxU32 tetId, const PxVec4& barycentric);
void removeParticleAttachment(Sc::ParticleSystemCore* core, PxU32 handle);
void addRigidFilter(Sc::BodyCore* core, PxU32 vertId);
void removeRigidFilter(Sc::BodyCore* core, PxU32 vertId);
PxU32 addRigidAttachment(Sc::BodyCore* core, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint, bool doConversion);
void removeRigidAttachment(Sc::BodyCore* core, PxU32 handle);
void addTetRigidFilter(Sc::BodyCore* core, PxU32 tetIdx);
void removeTetRigidFilter(Sc::BodyCore* core, PxU32 tetIdx);
PxU32 addTetRigidAttachment(Sc::BodyCore* core, PxU32 tetIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose,
PxConeLimitedConstraint* constraint, bool doConversion);
void addSoftBodyFilter(Sc::DeformableVolumeCore& core, PxU32 tetIdx0, PxU32 tetIdx1);
void removeSoftBodyFilter(Sc::DeformableVolumeCore& core, PxU32 tetIdx0, PxU32 tetIdx1);
void addSoftBodyFilters(Sc::DeformableVolumeCore& core, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize);
void removeSoftBodyFilters(Sc::DeformableVolumeCore& core, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize);
PxU32 addSoftBodyAttachment(Sc::DeformableVolumeCore& core, PxU32 tetIdx0, const PxVec4& triBarycentric0, PxU32 tetIdx1, const PxVec4& tetBarycentric1,
PxConeLimitedConstraint* constraint, PxReal constraintOffset, bool doConversion);
void removeSoftBodyAttachment(Sc::DeformableVolumeCore& core, PxU32 handle);
void addClothFilter(Sc::DeformableSurfaceCore& core, PxU32 triIdx, PxU32 tetIdx);
void removeClothFilter(Sc::DeformableSurfaceCore& core, PxU32 triIdx, PxU32 tetIdx);
PxU32 addClothAttachment(Sc::DeformableSurfaceCore& core, PxU32 triIdx, const PxVec4& triBarycentric, PxU32 tetIdx, const PxVec4& tetBarycentric,
PxConeLimitedConstraint* constraint, PxReal constraintOffset, bool doConversion);
void removeClothAttachment(Sc::DeformableSurfaceCore& core, PxU32 handle);
//---------------------------------------------------------------------------------
// Internal API
//---------------------------------------------------------------------------------
void addMaterial(const PxU16 handle);
void clearMaterials();
PxActor* getPxActor() const;
void attachShapeCore(ShapeCore* shapeCore);
void attachSimulationMesh(PxTetrahedronMesh* simulationMesh, PxDeformableVolumeAuxData* simulationState);
void onShapeChange(ShapeCore& shape, ShapeChangeNotifyFlags notifyFlags);
PX_FORCE_INLINE PxU64& getGpuMemStat() { return mGpuMemStat; }
DeformableVolumeSim* getSim() const;
PX_FORCE_INLINE const Dy::DeformableVolumeCore& getCore() const { return mCore; }
PX_FORCE_INLINE Dy::DeformableVolumeCore& getCore() { return mCore; }
private:
Dy::DeformableVolumeCore mCore;
PxU64 mGpuMemStat;
};
} // namespace Sc
} // namespace physx
#endif // PX_SUPPORT_GPU_PHYSX
#endif // SC_DEFORMABLE_VOLUME_CORE_H

View File

@@ -0,0 +1,123 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_ITERATORS_H
#define SC_ITERATORS_H
#include "foundation/PxVec3.h"
#include "PxContact.h"
namespace physx
{
class PxShape;
class PxsContactManagerOutputIterator;
namespace Sc
{
class ShapeSimBase;
class ElementSimInteraction;
class ActorSim;
struct Contact
{
Contact()
: normal(0.0f)
, point(0.0f)
, separation(0.0f)
, normalForce(0.0f)
{}
PxVec3 normal;
PxVec3 point;
PxShape* shape0;
PxShape* shape1;
PxReal separation;
PxReal normalForce;
PxU32 faceIndex0; // these are the external indices
PxU32 faceIndex1;
bool normalForceAvailable;
};
struct FrictionAnchor
{
PxVec3 normal;
PxVec3 point;
PxVec3 impulse;
};
class ContactIterator
{
public:
class Pair
{
public:
Pair() : mIter(NULL, NULL, NULL, 0, 0), mAnchorIter(NULL, NULL, 0) {}
Pair(const void*& contactPatches, const void*& contactPoints, const void*& frictionPatches, const PxU32 /*contactDataSize*/, const PxReal*& forces, PxU32 numContacts, PxU32 numPatches, ShapeSimBase& shape0, ShapeSimBase& shape1, ActorSim* actor0, ActorSim* actor1);
Contact* getNextContact();
FrictionAnchor* getNextFrictionAnchor();
PxActor* getActor0() { return mActor0; }
PxActor* getActor1() { return mActor1; }
private:
PxU32 mIndex;
PxU32 mNumContacts;
PxContactStreamIterator mIter;
PxFrictionAnchorStreamIterator mAnchorIter;
const PxReal* mForces;
Contact mCurrentContact;
FrictionAnchor mCurrentAnchor;
PxActor* mActor0;
PxActor* mActor1;
};
ContactIterator() {}
explicit ContactIterator(ElementSimInteraction** first, ElementSimInteraction** last, PxsContactManagerOutputIterator& outputs): mCurrent(first), mLast(last), mOffset(0), mOutputs(&outputs)
{
if ((!first) || (!last) || (first == last))
{
mCurrent = NULL;
mLast = NULL;
}
}
Pair* getNextPair();
private:
ElementSimInteraction** mCurrent;
ElementSimInteraction** mLast;
Pair mCurrentPair;
PxU32 mOffset;
PxsContactManagerOutputIterator* mOutputs;
private:
};
} // namespace Sc
}
#endif

View File

@@ -0,0 +1,154 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_PARTICLESYSTEM_CORE_H
#define SC_PARTICLESYSTEM_CORE_H
#include "foundation/PxPreprocessor.h"
#if PX_SUPPORT_GPU_PHYSX
#include "PxParticleSystem.h"
#include "foundation/PxAssert.h"
#include "ScActorCore.h"
#include "ScShapeCore.h"
#include "PxFiltering.h"
#include "DyParticleSystem.h"
#include "ScParticleSystemShapeCore.h"
namespace physx
{
namespace Sc
{
class ParticleSystemSim;
class BodyCore;
class ParticleSystemCore : public ActorCore
{
// PX_SERIALIZATION
public:
ParticleSystemCore(const PxEMPTY) : ActorCore(PxEmpty) {}
//~PX_SERIALIZATION
ParticleSystemCore(PxActorType::Enum actorType);
~ParticleSystemCore();
//---------------------------------------------------------------------------------
// External API
//---------------------------------------------------------------------------------
PxReal getSleepThreshold() const;
void setSleepThreshold(const PxReal v);
PxReal getRestOffset() const;
void setRestOffset(const PxReal v);
PxReal getContactOffset() const;
void setContactOffset(const PxReal v);
PxReal getParticleContactOffset() const;
void setParticleContactOffset(const PxReal v);
PxReal getSolidRestOffset() const;
void setSolidRestOffset(const PxReal v);
PxReal getFluidRestOffset() const;
void setFluidRestOffset(const PxReal v);
PxReal getMaxDepenetrationVelocity() const;
void setMaxDepenetrationVelocity(const PxReal v);
PxReal getMaxVelocity() const;
void setMaxVelocity(const PxReal v);
PxParticleSystemCallback* getParticleSystemCallback() const;
void setParticleSystemCallback(PxParticleSystemCallback* callback);
PxReal getFluidBoundaryDensityScale() const;
void setFluidBoundaryDensityScale(const PxReal v);
PxU32 getGridSizeX() const;
void setGridSizeX(const PxU32 v);
PxU32 getGridSizeY() const;
void setGridSizeY(const PxU32 v);
PxU32 getGridSizeZ() const;
void setGridSizeZ(const PxU32 v);
PxU16 getSolverIterationCounts() const { return mShapeCore.getLLCore().solverIterationCounts; }
void setSolverIterationCounts(PxU16 c);
PxReal getWakeCounter() const;
void setWakeCounter(const PxReal v);
void setWakeCounterInternal(const PxReal v);
bool isSleeping() const;
void wakeUp(PxReal wakeCounter);
void putToSleep();
PxActor* getPxActor() const;
PxParticleFlags getFlags() const { return mShapeCore.getLLCore().mFlags; }
void setFlags(PxParticleFlags flags);
PxParticleLockFlags getLockFlags() const { return mShapeCore.getLLCore().mLockFlags; }
void setLockFlags(PxParticleLockFlags lockFlags) { mShapeCore.getLLCore().mLockFlags = lockFlags; }
void setWind(const PxVec3& wind) {mShapeCore.getLLCore().mWind = wind;}
PxVec3 getWind() const { return mShapeCore.getLLCore().mWind; }
PxSparseGridParams getSparseGridParams() const { return mShapeCore.getLLCore().sparseGridParams; }
void setSparseGridParams(const PxSparseGridParams& params) { mShapeCore.getLLCore().sparseGridParams = params; }
void addRigidAttachment(Sc::BodyCore* core);
void removeRigidAttachment(Sc::BodyCore* core);
//---------------------------------------------------------------------------------
// Internal API
//---------------------------------------------------------------------------------
public:
ParticleSystemSim* getSim() const;
PX_FORCE_INLINE const ParticleSystemShapeCore& getShapeCore() const { return mShapeCore; }
PX_FORCE_INLINE ParticleSystemShapeCore& getShapeCore() { return mShapeCore; }
void setDirty(const bool dirty);
private:
//ParticleSystemSim* mSim;
ParticleSystemShapeCore mShapeCore;
};
} // namespace Sc
}
#endif
#endif

View File

@@ -0,0 +1,127 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_PHYSICS_H
#define SC_PHYSICS_H
#include "PxPhysics.h"
#include "PxScene.h"
#include "foundation/PxUserAllocated.h"
#include "foundation/PxBasicTemplates.h"
#include "PxActor.h"
namespace physx
{
class PxMaterial;
class PxTolerancesScale;
struct PxvOffsetTable;
#if PX_SUPPORT_GPU_PHYSX
class PxPhysXGpu;
#endif
namespace Sc
{
class Scene;
class StaticCore;
class RigidCore;
class BodyCore;
class ArticulationCore;
class ArticulationJointCore;
class ConstraintCore;
class ShapeCore;
struct OffsetTable
{
PX_FORCE_INLINE OffsetTable() {}
PX_FORCE_INLINE PxShape* convertScShape2Px(ShapeCore* sc) const { return PxPointerOffset<PxShape*>(sc, scShape2Px); }
PX_FORCE_INLINE const PxShape* convertScShape2Px(const ShapeCore* sc) const { return PxPointerOffset<const PxShape*>(sc, scShape2Px); }
PX_FORCE_INLINE PxConstraint* convertScConstraint2Px(ConstraintCore* sc) const { return PxPointerOffset<PxConstraint*>(sc, scConstraint2Px); }
PX_FORCE_INLINE const PxConstraint* convertScConstraint2Px(const ConstraintCore* sc) const { return PxPointerOffset<const PxConstraint*>(sc, scConstraint2Px); }
PX_FORCE_INLINE PxArticulationReducedCoordinate* convertScArticulation2Px(ArticulationCore* sc) const
{
return PxPointerOffset<PxArticulationReducedCoordinate*>(sc, scArticulationRC2Px);
}
PX_FORCE_INLINE const PxArticulationReducedCoordinate* convertScArticulation2Px(const ArticulationCore* sc) const
{
return PxPointerOffset<const PxArticulationReducedCoordinate*>(sc, scArticulationRC2Px);
}
PX_FORCE_INLINE PxArticulationJointReducedCoordinate* convertScArticulationJoint2Px(ArticulationJointCore* sc) const
{
return PxPointerOffset<PxArticulationJointReducedCoordinate*>(sc, scArticulationJointRC2Px);
}
PX_FORCE_INLINE const PxArticulationJointReducedCoordinate* convertScArticulationJoint2Px(const ArticulationJointCore* sc) const
{
return PxPointerOffset<const PxArticulationJointReducedCoordinate*>(sc, scArticulationJointRC2Px);
}
ptrdiff_t scRigidStatic2PxActor;
ptrdiff_t scRigidDynamic2PxActor;
ptrdiff_t scArticulationLink2PxActor;
ptrdiff_t scDeformableSurface2PxActor;
ptrdiff_t scDeformableVolume2PxActor;
ptrdiff_t scPBDParticleSystem2PxActor;
ptrdiff_t scShape2Px;
ptrdiff_t scArticulationRC2Px;
ptrdiff_t scArticulationJointRC2Px;
ptrdiff_t scConstraint2Px;
ptrdiff_t scCore2PxActor[PxActorType::eACTOR_COUNT];
};
extern OffsetTable gOffsetTable;
class Physics : public PxUserAllocated
{
public:
PX_FORCE_INLINE static Physics& getInstance() { return *mInstance; }
Physics(const PxTolerancesScale&, const PxvOffsetTable& pxvOffsetTable);
~Physics();
PX_FORCE_INLINE const PxTolerancesScale& getTolerancesScale() const { return mScale; }
private:
PxTolerancesScale mScale;
static Physics* mInstance;
public:
static const PxReal sWakeCounterOnCreation;
};
} // namespace Sc
}
#endif

View File

@@ -0,0 +1,88 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_RIGID_CORE_H
#define SC_RIGID_CORE_H
#include "ScActorCore.h"
#include "ScPhysics.h"
#include "PxvDynamics.h"
#include "PxShape.h"
namespace physx
{
namespace Sc
{
class RigidSim;
class ShapeCore;
struct ShapeChangeNotifyFlag
{
enum Enum
{
eGEOMETRY = 1<<0,
eSHAPE2BODY = 1<<1,
eFILTERDATA = 1<<2,
eCONTACTOFFSET = 1<<3,
eRESTOFFSET = 1<<4,
eRESET_FILTERING = 1<<5
};
};
typedef PxFlags<ShapeChangeNotifyFlag::Enum, PxU32> ShapeChangeNotifyFlags;
PX_FLAGS_OPERATORS(ShapeChangeNotifyFlag::Enum,PxU32)
class RigidCore : public ActorCore
{
public:
PX_FORCE_INLINE PxActor* getPxActor() const
{
return PxPointerOffset<PxActor*>(const_cast<RigidCore*>(this), gOffsetTable.scCore2PxActor[getActorCoreType()]);
}
void addShapeToScene(ShapeCore& shape);
void removeShapeFromScene(ShapeCore& shape, bool wakeOnLostTouch);
void onShapeChange(ShapeCore& shape, ShapeChangeNotifyFlags notifyFlags);
void onShapeFlagsChange(ShapeCore& shape, PxShapeFlags oldShapeFlags);
void unregisterShapeFromNphase(ShapeCore& shapeCore);
void registerShapeInNphase(ShapeCore& shapeCore);
RigidSim* getSim() const;
PxU32 getRigidID() const;
protected:
RigidCore(const PxEMPTY) : ActorCore(PxEmpty) {}
RigidCore(PxActorType::Enum type);
~RigidCore();
};
} // namespace Sc
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,132 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_SHAPE_CORE_H
#define SC_SHAPE_CORE_H
#include "foundation/PxUtilities.h"
#include "PxvGeometry.h"
#include "PxFiltering.h"
#include "PxShape.h"
namespace physx
{
class PxShape; // PT: TODO: fw decl of higher-level class isn't great
namespace Sc
{
class ShapeSim;
class ShapeCore
{
public:
// PX_SERIALIZATION
ShapeCore(const PxEMPTY);
void exportExtraData(PxSerializationContext& stream);
void importExtraData(PxDeserializationContext& context);
void resolveReferences(PxDeserializationContext& context);
void resolveMaterialReference(PxU32 materialTableIndex, PxU16 materialIndex);
//~PX_SERIALIZATION
ShapeCore( const PxGeometry& geometry, PxShapeFlags shapeFlags,
const PxU16* materialIndices, PxU16 materialCount, bool isExclusive,
PxShapeCoreFlag::Enum coreFlags = PxShapeCoreFlag::Enum(0));
~ShapeCore();
PX_FORCE_INLINE PxGeometryType::Enum getGeometryType() const { return mCore.mGeometry.getType(); }
PxShape* getPxShape();
const PxShape* getPxShape() const;
PX_FORCE_INLINE const GeometryUnion& getGeometryUnion() const { return mCore.mGeometry; }
PX_FORCE_INLINE const PxGeometry& getGeometry() const { return mCore.mGeometry.getGeometry(); }
void setGeometry(const PxGeometry& geom);
PxU16 getNbMaterialIndices() const;
const PxU16* getMaterialIndices() const;
void setMaterialIndices(const PxU16* materialIndices, PxU16 materialIndexCount);
PX_FORCE_INLINE const PxTransform& getShape2Actor() const { return mCore.getTransform(); }
PX_FORCE_INLINE void setShape2Actor(const PxTransform& s2b) { mCore.setTransform(s2b); }
PX_FORCE_INLINE const PxFilterData& getSimulationFilterData() const { return mSimulationFilterData; }
PX_FORCE_INLINE void setSimulationFilterData(const PxFilterData& data) { mSimulationFilterData = data; }
PX_FORCE_INLINE PxReal getContactOffset() const { return mCore.mContactOffset; }
void setContactOffset(PxReal offset);
PX_FORCE_INLINE PxReal getRestOffset() const { return mCore.mRestOffset; }
PX_FORCE_INLINE void setRestOffset(PxReal offset) { mCore.mRestOffset = offset; }
PX_FORCE_INLINE PxReal getDensityForFluid() const { return mCore.getDensityForFluid(); }
PX_FORCE_INLINE void setDensityForFluid(PxReal densityForFluid) { mCore.setDensityForFluid(densityForFluid); }
PX_FORCE_INLINE PxReal getTorsionalPatchRadius() const { return mCore.mTorsionalRadius; }
PX_FORCE_INLINE void setTorsionalPatchRadius(PxReal tpr) { mCore.mTorsionalRadius = tpr; }
PX_FORCE_INLINE PxReal getMinTorsionalPatchRadius() const {return mCore.mMinTorsionalPatchRadius; }
PX_FORCE_INLINE void setMinTorsionalPatchRadius(PxReal radius) { mCore.mMinTorsionalPatchRadius = radius; }
PX_FORCE_INLINE PxShapeFlags getFlags() const { return PxShapeFlags(mCore.mShapeFlags); }
PX_FORCE_INLINE void setFlags(PxShapeFlags f) { mCore.mShapeFlags = f; }
PX_FORCE_INLINE const PxsShapeCore& getCore() const { return mCore; }
static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF(ShapeCore, mCore); }
static PX_FORCE_INLINE ShapeCore& getCore(PxsShapeCore& core)
{
return *reinterpret_cast<ShapeCore*>(reinterpret_cast<PxU8*>(&core) - getCoreOffset());
}
PX_FORCE_INLINE ShapeSim* getExclusiveSim() const
{
return mExclusiveSim;
}
PX_FORCE_INLINE void setExclusiveSim(ShapeSim* sim)
{
if(!sim || mCore.mShapeCoreFlags.isSet(PxShapeCoreFlag::eIS_EXCLUSIVE))
mExclusiveSim = sim;
}
#if PX_WINDOWS_FAMILY // PT: to avoid "error: offset of on non-standard-layout type" on Linux
protected:
#endif
PxFilterData mSimulationFilterData; // Simulation filter data
PxsShapeCore PX_ALIGN(16, mCore);
ShapeSim* mExclusiveSim; //only set if shape is exclusive
#if PX_WINDOWS_FAMILY // PT: to avoid "error: offset of on non-standard-layout type" on Linux
public:
#endif
const char* mName; // PT: moved here from NpShape to fill padding bytes
};
} // namespace Sc
}
#endif

View File

@@ -0,0 +1,65 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_SQ_BOUNDS_SYNC_H
#define SC_SQ_BOUNDS_SYNC_H
#include "foundation/PxSimpleTypes.h"
#include "foundation/PxBitMap.h"
#include "PxSceneQuerySystem.h"
namespace physx
{
class PxBounds3;
class PxRigidBody;
class PxShape;
typedef PxSQPrunerHandle ScPrunerHandle;
namespace Sc
{
// PT: TODO: revisit the need for a virtual interface
struct SqRefFinder
{
virtual ScPrunerHandle find(const PxRigidBody* body, const PxShape* shape, PxU32& prunerIndex) = 0;
virtual ~SqRefFinder() {}
};
// PT: TODO: revisit the need for a virtual interface
struct SqBoundsSync
{
virtual void sync(PxU32 prunerIndex, const ScPrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices) = 0;
virtual ~SqBoundsSync() {}
};
}
}
#endif

View File

@@ -0,0 +1,70 @@
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// 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
// 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
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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-2025 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 SC_STATIC_CORE_H
#define SC_STATIC_CORE_H
#include "ScRigidCore.h"
#include "PxvDynamics.h"
namespace physx
{
namespace Sc
{
class StaticSim;
class StaticCore : public RigidCore
{
public:
StaticCore(const PxTransform& actor2World): RigidCore(PxActorType::eRIGID_STATIC)
{
mCore.body2World = actor2World;
mCore.mFlags = PxRigidBodyFlags();
}
PX_FORCE_INLINE const PxTransform& getActor2World() const { return mCore.body2World; }
void setActor2World(const PxTransform& actor2World);
PX_FORCE_INLINE PxsRigidCore& getCore() { return mCore; }
static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(StaticCore, mCore);}
StaticCore(const PxEMPTY) : RigidCore(PxEmpty), mCore(PxEmpty) {}
StaticSim* getSim() const;
PX_FORCE_INLINE void onOriginShift(const PxVec3& shift) { mCore.body2World.p -= shift; }
private:
PxsRigidCore mCore;
};
} // namespace Sc
}
#endif