feat(physics): wire physx sdk into build
This commit is contained in:
67
engine/third_party/physx/source/lowlevel/api/include/PxsDeformableSurfaceMaterialCore.h
vendored
Normal file
67
engine/third_party/physx/source/lowlevel/api/include/PxsDeformableSurfaceMaterialCore.h
vendored
Normal 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 PXS_DEFORMABLE_SURFACE_MATERIAL_CORE_H
|
||||
#define PXS_DEFORMABLE_SURFACE_MATERIAL_CORE_H
|
||||
|
||||
#include "PxDeformableSurfaceMaterial.h"
|
||||
#include "PxsMaterialShared.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct PxsDeformableSurfaceMaterialData
|
||||
{
|
||||
PxReal youngs; //4
|
||||
PxReal poissons; //8
|
||||
PxReal dynamicFriction; //12
|
||||
PxReal thickness; //16
|
||||
PxReal bendingStiffness; //20
|
||||
PxReal elasticityDamping; //24
|
||||
PxReal bendingDamping; //28
|
||||
PxReal padding[1]; //32, 4 bytes padding to make the total size 32 bytes
|
||||
|
||||
PX_CUDA_CALLABLE PxsDeformableSurfaceMaterialData()
|
||||
: youngs(1.e+6f)
|
||||
, poissons(0.45f)
|
||||
, dynamicFriction(0.0f)
|
||||
, thickness(0.0f)
|
||||
, bendingStiffness(0.0f)
|
||||
, elasticityDamping(0.0f)
|
||||
, bendingDamping(0.0f)
|
||||
{}
|
||||
|
||||
PxsDeformableSurfaceMaterialData(const PxEMPTY) {}
|
||||
}
|
||||
PX_ALIGN_SUFFIX(16);
|
||||
|
||||
typedef MaterialCoreT<PxsDeformableSurfaceMaterialData, PxDeformableSurfaceMaterial> PxsDeformableSurfaceMaterialCore;
|
||||
|
||||
} //namespace phyxs
|
||||
|
||||
#endif // PXS_DEFORMABLE_SURFACE_MATERIAL_CORE_H
|
||||
82
engine/third_party/physx/source/lowlevel/api/include/PxsDeformableVolumeMaterialCore.h
vendored
Normal file
82
engine/third_party/physx/source/lowlevel/api/include/PxsDeformableVolumeMaterialCore.h
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// 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 PXS_DEFORMABLE_VOLUME_MATERIAL_CORE_H
|
||||
#define PXS_DEFORMABLE_VOLUME_MATERIAL_CORE_H
|
||||
|
||||
#include "PxDeformableVolumeMaterial.h"
|
||||
#include "PxsMaterialShared.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
|
||||
PX_FORCE_INLINE PX_CUDA_CALLABLE PxU16 toUniformU16(PxReal f)
|
||||
{
|
||||
f = PxClamp(f, 0.0f, 1.0f);
|
||||
return PxU16(f * 65535.0f);
|
||||
}
|
||||
|
||||
PX_FORCE_INLINE PX_CUDA_CALLABLE PxReal toUniformReal(PxU16 v)
|
||||
{
|
||||
return PxReal(v) * (1.0f / 65535.0f);
|
||||
}
|
||||
|
||||
|
||||
PX_ALIGN_PREFIX(16) struct PxsDeformableVolumeMaterialData
|
||||
{
|
||||
PxReal youngs; //4
|
||||
PxReal poissons; //8
|
||||
PxReal dynamicFriction; //12
|
||||
PxReal elasticityDamping; // 16
|
||||
PxU16 dampingScale; //20, known to be in the range of 0...1. Mapped to integer range 0...65535
|
||||
PxU16 materialModel; //22
|
||||
PxReal deformThreshold; //24
|
||||
PxReal deformLowLimitRatio; //28
|
||||
PxReal deformHighLimitRatio; //32
|
||||
|
||||
PX_CUDA_CALLABLE PxsDeformableVolumeMaterialData() :
|
||||
youngs (1.e+6f),
|
||||
poissons (0.45f),
|
||||
dynamicFriction (0.0f),
|
||||
elasticityDamping (0.0f),
|
||||
//dampingScale (0),
|
||||
materialModel (PxDeformableVolumeMaterialModel::eCO_ROTATIONAL),
|
||||
deformThreshold (PX_MAX_F32),
|
||||
deformLowLimitRatio (1.0f),
|
||||
deformHighLimitRatio(1.0f)
|
||||
{}
|
||||
|
||||
PxsDeformableVolumeMaterialData(const PxEMPTY) {}
|
||||
|
||||
}PX_ALIGN_SUFFIX(16);
|
||||
|
||||
typedef MaterialCoreT<PxsDeformableVolumeMaterialData, PxDeformableVolumeMaterial> PxsDeformableVolumeMaterialCore;
|
||||
|
||||
} //namespace phyxs
|
||||
|
||||
#endif // PXS_DEFORMABLE_VOLUME_MATERIAL_CORE_H
|
||||
74
engine/third_party/physx/source/lowlevel/api/include/PxsMaterialCore.h
vendored
Normal file
74
engine/third_party/physx/source/lowlevel/api/include/PxsMaterialCore.h
vendored
Normal 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 PXS_MATERIAL_CORE_H
|
||||
#define PXS_MATERIAL_CORE_H
|
||||
|
||||
#include "PxMaterial.h"
|
||||
#include "foundation/PxUtilities.h"
|
||||
#include "PxsMaterialShared.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
|
||||
struct PxsMaterialData
|
||||
{
|
||||
PxReal dynamicFriction;
|
||||
PxReal staticFriction;
|
||||
PxReal restitution;
|
||||
PxReal damping;
|
||||
PxMaterialFlags flags;
|
||||
PxU8 fricCombineMode; // PxCombineMode::Enum
|
||||
PxU8 restCombineMode; // PxCombineMode::Enum
|
||||
PxU8 dampingCombineMode; // PxCombineMode::Enum
|
||||
|
||||
PxsMaterialData() :
|
||||
dynamicFriction (0.0f),
|
||||
staticFriction (0.0f),
|
||||
restitution (0.0f),
|
||||
damping (0.0f),
|
||||
fricCombineMode (PxCombineMode::eAVERAGE),
|
||||
restCombineMode (PxCombineMode::eAVERAGE),
|
||||
dampingCombineMode(PxCombineMode::eAVERAGE)
|
||||
{}
|
||||
|
||||
PxsMaterialData(const PxEMPTY) {}
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxCombineMode::Enum getFrictionCombineMode() const { return PxCombineMode::Enum(fricCombineMode); }
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxCombineMode::Enum getRestitutionCombineMode() const { return PxCombineMode::Enum(restCombineMode); }
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxCombineMode::Enum getDampingCombineMode() const { return PxCombineMode::Enum(dampingCombineMode); }
|
||||
PX_FORCE_INLINE void setFrictionCombineMode(PxCombineMode::Enum combineMode) { fricCombineMode = PxTo8(combineMode); }
|
||||
PX_FORCE_INLINE void setRestitutionCombineMode(PxCombineMode::Enum combineMode) { restCombineMode = PxTo8(combineMode); }
|
||||
PX_FORCE_INLINE void setDampingCombineMode(PxCombineMode::Enum combineMode) { dampingCombineMode = PxTo8(combineMode); }
|
||||
};
|
||||
|
||||
typedef MaterialCoreT<PxsMaterialData, PxMaterial> PxsMaterialCore;
|
||||
|
||||
} //namespace phyxs
|
||||
|
||||
#endif
|
||||
169
engine/third_party/physx/source/lowlevel/api/include/PxsMaterialManager.h
vendored
Normal file
169
engine/third_party/physx/source/lowlevel/api/include/PxsMaterialManager.h
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
// 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 PXS_MATERIAL_MANAGER_H
|
||||
#define PXS_MATERIAL_MANAGER_H
|
||||
|
||||
#include "PxsMaterialCore.h"
|
||||
#include "PxsDeformableSurfaceMaterialCore.h"
|
||||
#include "PxsDeformableVolumeMaterialCore.h"
|
||||
#include "PxsPBDMaterialCore.h"
|
||||
#include "foundation/PxAlignedMalloc.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
struct PxsMaterialInfo
|
||||
{
|
||||
PxU16 mMaterialIndex0;
|
||||
PxU16 mMaterialIndex1;
|
||||
};
|
||||
|
||||
template<class MaterialCore>
|
||||
class PxsMaterialManagerT
|
||||
{
|
||||
public:
|
||||
PxsMaterialManagerT()
|
||||
{
|
||||
const PxU32 matCount = 128;
|
||||
materials = reinterpret_cast<MaterialCore*>(physx::PxAlignedAllocator<16>().allocate(sizeof(MaterialCore)*matCount, PX_FL));
|
||||
maxMaterials = matCount;
|
||||
for(PxU32 i=0; i<matCount; ++i)
|
||||
{
|
||||
materials[i].mMaterialIndex = MATERIAL_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
~PxsMaterialManagerT()
|
||||
{
|
||||
physx::PxAlignedAllocator<16>().deallocate(materials);
|
||||
}
|
||||
|
||||
void setMaterial(MaterialCore* mat)
|
||||
{
|
||||
const PxU16 materialIndex = mat->mMaterialIndex;
|
||||
resize(PxU32(materialIndex) + 1);
|
||||
materials[materialIndex] = *mat;
|
||||
}
|
||||
|
||||
void updateMaterial(MaterialCore* mat)
|
||||
{
|
||||
materials[mat->mMaterialIndex] =*mat;
|
||||
}
|
||||
|
||||
void removeMaterial(MaterialCore* mat)
|
||||
{
|
||||
mat->mMaterialIndex = MATERIAL_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
PX_FORCE_INLINE MaterialCore* getMaterial(const PxU32 index)const
|
||||
{
|
||||
PX_ASSERT(index < maxMaterials);
|
||||
return &materials[index];
|
||||
}
|
||||
|
||||
PxU32 getMaxSize()const
|
||||
{
|
||||
return maxMaterials;
|
||||
}
|
||||
|
||||
void resize(PxU32 minValueForMax)
|
||||
{
|
||||
if(maxMaterials>=minValueForMax)
|
||||
return;
|
||||
|
||||
const PxU32 numMaterials = maxMaterials;
|
||||
|
||||
maxMaterials = (minValueForMax+31)&~31;
|
||||
MaterialCore* mat = reinterpret_cast<MaterialCore*>(physx::PxAlignedAllocator<16>().allocate(sizeof(MaterialCore)*maxMaterials, PX_FL));
|
||||
for(PxU32 i=0; i<numMaterials; ++i)
|
||||
mat[i] = materials[i];
|
||||
|
||||
for(PxU32 i = numMaterials; i < maxMaterials; ++i)
|
||||
mat[i].mMaterialIndex = MATERIAL_INVALID_HANDLE;
|
||||
|
||||
physx::PxAlignedAllocator<16>().deallocate(materials);
|
||||
|
||||
materials = mat;
|
||||
}
|
||||
|
||||
MaterialCore* materials;//make sure materials's start address is 16 bytes align
|
||||
PxU32 maxMaterials;
|
||||
PxU32 mPad;
|
||||
#if !PX_P64_FAMILY
|
||||
PxU32 mPad2;
|
||||
#endif
|
||||
};
|
||||
|
||||
//This class is used for forward declaration
|
||||
class PxsMaterialManager : public PxsMaterialManagerT<PxsMaterialCore>
|
||||
{
|
||||
};
|
||||
|
||||
class PxsDeformableSurfaceMaterialManager : public PxsMaterialManagerT<PxsDeformableSurfaceMaterialCore>
|
||||
{
|
||||
};
|
||||
|
||||
class PxsDeformableVolumeMaterialManager : public PxsMaterialManagerT<PxsDeformableVolumeMaterialCore>
|
||||
{
|
||||
};
|
||||
|
||||
class PxsPBDMaterialManager : public PxsMaterialManagerT<PxsPBDMaterialCore>
|
||||
{
|
||||
};
|
||||
|
||||
template<class MaterialCore>
|
||||
class PxsMaterialManagerIterator
|
||||
{
|
||||
|
||||
public:
|
||||
PxsMaterialManagerIterator(PxsMaterialManagerT<MaterialCore>& manager) : mManager(manager), mIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool getNextMaterial(MaterialCore*& materialCore)
|
||||
{
|
||||
const PxU32 maxSize = mManager.getMaxSize();
|
||||
PxU32 index = mIndex;
|
||||
while(index < maxSize && mManager.getMaterial(index)->mMaterialIndex == MATERIAL_INVALID_HANDLE)
|
||||
index++;
|
||||
materialCore = NULL;
|
||||
if(index < maxSize)
|
||||
materialCore = mManager.getMaterial(index++);
|
||||
mIndex = index;
|
||||
return materialCore!=NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
PxsMaterialManagerIterator& operator=(const PxsMaterialManagerIterator&);
|
||||
PxsMaterialManagerT<MaterialCore>& mManager;
|
||||
PxU32 mIndex;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
56
engine/third_party/physx/source/lowlevel/api/include/PxsMaterialShared.h
vendored
Normal file
56
engine/third_party/physx/source/lowlevel/api/include/PxsMaterialShared.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
// 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 PXS_MATERIAL_SHARED_H
|
||||
#define PXS_MATERIAL_SHARED_H
|
||||
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
#define MATERIAL_INVALID_HANDLE 0xffff
|
||||
|
||||
class PxOutputStream;
|
||||
|
||||
template<class MaterialDataT, class PxMaterialT>
|
||||
class MaterialCoreT : public MaterialDataT
|
||||
{
|
||||
public:
|
||||
MaterialCoreT(const MaterialDataT& desc) : MaterialDataT(desc), mMaterial(NULL), mMaterialIndex(MATERIAL_INVALID_HANDLE) {}
|
||||
MaterialCoreT() : mMaterial(NULL), mMaterialIndex(MATERIAL_INVALID_HANDLE) {}
|
||||
|
||||
MaterialCoreT(const PxEMPTY) : MaterialDataT(PxEmpty) {}
|
||||
~MaterialCoreT() {}
|
||||
|
||||
PxMaterialT* mMaterial; // PT: TODO: eventually this could just be a base PxBaseMaterial class instead of a templated param
|
||||
PxU16 mMaterialIndex; //handle assign by the handle manager
|
||||
};
|
||||
|
||||
} //namespace phyxs
|
||||
|
||||
#endif
|
||||
58
engine/third_party/physx/source/lowlevel/api/include/PxsPBDMaterialCore.h
vendored
Normal file
58
engine/third_party/physx/source/lowlevel/api/include/PxsPBDMaterialCore.h
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// 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 PXS_PBD_MATERIAL_CORE_H
|
||||
#define PXS_PBD_MATERIAL_CORE_H
|
||||
|
||||
#include "PxParticleGpu.h"
|
||||
#include "PxsMaterialShared.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
struct PxsPBDMaterialData : public PxsParticleMaterialData
|
||||
{
|
||||
PxsPBDMaterialData() {} // PT: TODO: ctor leaves things uninitialized, is that by design?
|
||||
PxsPBDMaterialData(const PxEMPTY) {}
|
||||
|
||||
PxU32 flags; //24
|
||||
PxReal viscosity; //28
|
||||
PxReal vorticityConfinement; //32
|
||||
PxReal surfaceTension; //36
|
||||
PxReal cohesion; //40
|
||||
PxReal lift; //44
|
||||
PxReal drag; //48
|
||||
PxReal cflCoefficient; //52
|
||||
PxReal particleFrictionScale; //56
|
||||
PxReal particleAdhesionScale; //60
|
||||
};
|
||||
|
||||
typedef MaterialCoreT<PxsPBDMaterialData, PxPBDMaterial> PxsPBDMaterialCore;
|
||||
|
||||
} //namespace phyxs
|
||||
|
||||
#endif
|
||||
44
engine/third_party/physx/source/lowlevel/api/include/PxvConfig.h
vendored
Normal file
44
engine/third_party/physx/source/lowlevel/api/include/PxvConfig.h
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// 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 PXV_CONFIG_H
|
||||
#define PXV_CONFIG_H
|
||||
|
||||
/*! \file internal top level include file for lowlevel. */
|
||||
|
||||
#include "PxPhysXConfig.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* Compiler workarounds */
|
||||
/************************************************************************/
|
||||
#if PX_VC
|
||||
#pragma warning(disable: 4355 ) // "this" used in base member initializer list
|
||||
#pragma warning(disable: 4146 ) // unary minus operator applied to unsigned type.
|
||||
#endif
|
||||
|
||||
#endif
|
||||
172
engine/third_party/physx/source/lowlevel/api/include/PxvDynamics.h
vendored
Normal file
172
engine/third_party/physx/source/lowlevel/api/include/PxvDynamics.h
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
// 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 PXV_DYNAMICS_H
|
||||
#define PXV_DYNAMICS_H
|
||||
|
||||
#include "foundation/PxVec3.h"
|
||||
#include "foundation/PxQuat.h"
|
||||
#include "foundation/PxTransform.h"
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
#include "foundation/PxIntrinsics.h"
|
||||
#include "PxRigidDynamic.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
|
||||
/*!
|
||||
\file
|
||||
Dynamics interface.
|
||||
*/
|
||||
|
||||
struct PxsRigidCore
|
||||
{
|
||||
PxsRigidCore() : mFlags(0), solverIterationCounts(0) {}
|
||||
PxsRigidCore(const PxEMPTY) : mFlags(PxEmpty) {}
|
||||
|
||||
PX_ALIGN_PREFIX(16)
|
||||
PxTransform body2World PX_ALIGN_SUFFIX(16);
|
||||
PxRigidBodyFlags mFlags; // API body flags
|
||||
PxU16 solverIterationCounts; // vel iters are in low word and pos iters in high word.
|
||||
|
||||
PX_FORCE_INLINE PxU32 isKinematic() const { return mFlags & PxRigidBodyFlag::eKINEMATIC; }
|
||||
PX_FORCE_INLINE PxU32 hasCCD() const { return mFlags & PxRigidBodyFlag::eENABLE_CCD; }
|
||||
PX_FORCE_INLINE PxU32 hasCCDFriction() const { return mFlags & PxRigidBodyFlag::eENABLE_CCD_FRICTION; }
|
||||
PX_FORCE_INLINE PxU32 hasIdtBody2Actor() const { return mFlags & PxRigidBodyFlag::eRESERVED; }
|
||||
};
|
||||
PX_COMPILE_TIME_ASSERT(sizeof(PxsRigidCore) == 32);
|
||||
|
||||
#define PXV_CONTACT_REPORT_DISABLED PX_MAX_F32
|
||||
|
||||
struct PxsBodyCore : public PxsRigidCore
|
||||
{
|
||||
PxsBodyCore() : PxsRigidCore() { fixedBaseLink = PxU8(0); }
|
||||
PxsBodyCore(const PxEMPTY) : PxsRigidCore(PxEmpty) {}
|
||||
|
||||
PX_FORCE_INLINE const PxTransform& getBody2Actor() const { return body2Actor; }
|
||||
PX_FORCE_INLINE void setBody2Actor(const PxTransform& t)
|
||||
{
|
||||
if(t.p.isZero() && t.q.isIdentity())
|
||||
mFlags.raise(PxRigidBodyFlag::eRESERVED);
|
||||
else
|
||||
mFlags.clear(PxRigidBodyFlag::eRESERVED);
|
||||
|
||||
body2Actor = t;
|
||||
}
|
||||
protected:
|
||||
PxTransform body2Actor;
|
||||
public:
|
||||
PxReal ccdAdvanceCoefficient; //64
|
||||
|
||||
PxVec3 linearVelocity;
|
||||
PxReal maxPenBias;
|
||||
|
||||
PxVec3 angularVelocity;
|
||||
PxReal contactReportThreshold; //96
|
||||
|
||||
PxReal maxAngularVelocitySq;
|
||||
PxReal maxLinearVelocitySq;
|
||||
PxReal linearDamping;
|
||||
PxReal angularDamping; //112
|
||||
|
||||
PxVec3 inverseInertia;
|
||||
PxReal inverseMass; //128
|
||||
|
||||
PxReal maxContactImpulse;
|
||||
PxReal sleepThreshold;
|
||||
union
|
||||
{
|
||||
PxReal freezeThreshold;
|
||||
PxReal cfmScale;
|
||||
};
|
||||
|
||||
PxReal wakeCounter; //144 this is authoritative wakeCounter
|
||||
|
||||
PxReal solverWakeCounter; //this is calculated by the solver when it performs sleepCheck. It is committed to wakeCounter in ScAfterIntegrationTask if the body is still awake.
|
||||
PxU32 numCountedInteractions;
|
||||
PxReal offsetSlop; //Slop value used to snap contact line of action back in-line with the COM
|
||||
PxU8 isFastMoving; //This could be a single bit but it's a u8 at the moment for simplicity's sake
|
||||
PxU8 disableGravity; //This could be a single bit but it's a u8 at the moment for simplicity's sake
|
||||
PxRigidDynamicLockFlags lockFlags; //This is u8.
|
||||
PxU8 fixedBaseLink; //160 This indicates whether the articulation link has PxArticulationFlag::eFIX_BASE. All fits into 16 byte alignment
|
||||
|
||||
// PT: moved from Sc::BodyCore ctor - we don't want to duplicate all this in immediate mode
|
||||
PX_FORCE_INLINE void init( const PxTransform& bodyPose,
|
||||
const PxVec3& inverseInertia_, PxReal inverseMass_,
|
||||
PxReal wakeCounter_, PxReal scaleSpeed,
|
||||
PxReal linearDamping_, PxReal angularDamping_,
|
||||
PxReal maxLinearVelocitySq_, PxReal maxAngularVelocitySq_,
|
||||
PxActorType::Enum type)
|
||||
{
|
||||
PX_ASSERT(bodyPose.p.isFinite());
|
||||
PX_ASSERT(bodyPose.q.isFinite());
|
||||
|
||||
// PT: TODO: unify naming convention
|
||||
|
||||
// From PxsRigidCore
|
||||
body2World = bodyPose;
|
||||
mFlags = PxRigidBodyFlags();
|
||||
solverIterationCounts = (1 << 8) | 4;
|
||||
|
||||
setBody2Actor(PxTransform(PxIdentity));
|
||||
|
||||
ccdAdvanceCoefficient = 0.15f;
|
||||
linearVelocity = PxVec3(0.0f);
|
||||
maxPenBias = -1e32f;//-PX_MAX_F32;
|
||||
angularVelocity = PxVec3(0.0f);
|
||||
contactReportThreshold = PXV_CONTACT_REPORT_DISABLED;
|
||||
maxAngularVelocitySq = maxAngularVelocitySq_;
|
||||
maxLinearVelocitySq = maxLinearVelocitySq_;
|
||||
linearDamping = linearDamping_;
|
||||
angularDamping = angularDamping_;
|
||||
inverseInertia = inverseInertia_;
|
||||
inverseMass = inverseMass_;
|
||||
maxContactImpulse = 1e32f;// PX_MAX_F32;
|
||||
sleepThreshold = 5e-5f * scaleSpeed * scaleSpeed;
|
||||
if(type == PxActorType::eARTICULATION_LINK)
|
||||
cfmScale = 0.025f;
|
||||
else
|
||||
freezeThreshold = 2.5e-5f * scaleSpeed * scaleSpeed;
|
||||
wakeCounter = wakeCounter_;
|
||||
offsetSlop = 0.f;
|
||||
// PT: this one is not initialized?
|
||||
//solverWakeCounter
|
||||
// PT: these are initialized in BodySim ctor
|
||||
//numCountedInteractions;
|
||||
//numBodyInteractions;
|
||||
isFastMoving = false;
|
||||
disableGravity = false;
|
||||
lockFlags = PxRigidDynamicLockFlags(0);
|
||||
}
|
||||
};
|
||||
|
||||
PX_COMPILE_TIME_ASSERT(sizeof(PxsBodyCore) == 160);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
260
engine/third_party/physx/source/lowlevel/api/include/PxvGeometry.h
vendored
Normal file
260
engine/third_party/physx/source/lowlevel/api/include/PxvGeometry.h
vendored
Normal file
@@ -0,0 +1,260 @@
|
||||
// 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 PXV_GEOMETRY_H
|
||||
#define PXV_GEOMETRY_H
|
||||
|
||||
#include "foundation/PxTransform.h"
|
||||
#include "PxvConfig.h"
|
||||
|
||||
/*!
|
||||
\file
|
||||
Geometry interface
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* Shapes */
|
||||
/************************************************************************/
|
||||
|
||||
#include "GuGeometryChecks.h"
|
||||
#include "CmUtils.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
|
||||
//
|
||||
// Summary of our material approach:
|
||||
//
|
||||
// On the API level, materials are accessed via pointer. Internally we store indices into the material table.
|
||||
// The material table is stored in the SDK and the materials are shared among scenes. To make this threadsafe,
|
||||
// we have the following approach:
|
||||
//
|
||||
// - Every scene has a copy of the SDK master material table
|
||||
// - At the beginning of a simulation step, the scene material table gets synced to the master material table.
|
||||
// - While the simulation is running, the scene table does not get touched.
|
||||
// - Each shape stores the indices of its material(s). When the simulation is not running and a user requests the
|
||||
// materials of the shape, the indices are used to fetch the material from the master material table. When the
|
||||
// the simulation is running then the same indices are used internally to fetch the materials from the scene
|
||||
// material table.
|
||||
// - This whole scheme only works as long as the position of a material in the material table does not change
|
||||
// when other materials get deleted/inserted. The data structure of the material table makes sure that is the case.
|
||||
//
|
||||
|
||||
struct MaterialIndicesStruct
|
||||
{
|
||||
// PX_SERIALIZATION
|
||||
MaterialIndicesStruct(const PxEMPTY) {}
|
||||
//~PX_SERIALIZATION
|
||||
|
||||
MaterialIndicesStruct()
|
||||
: indices(NULL)
|
||||
, numIndices(0)
|
||||
, pad(PX_PADDING_16)
|
||||
, gpuRemapId(0)
|
||||
{
|
||||
}
|
||||
|
||||
~MaterialIndicesStruct()
|
||||
{
|
||||
}
|
||||
|
||||
void allocate(PxU16 size)
|
||||
{
|
||||
indices = PX_ALLOCATE(PxU16, size, "MaterialIndicesStruct::allocate");
|
||||
numIndices = size;
|
||||
}
|
||||
|
||||
void deallocate()
|
||||
{
|
||||
PX_FREE(indices);
|
||||
numIndices = 0;
|
||||
}
|
||||
PxU16* indices; // the remap table for material index
|
||||
PxU16 numIndices; // the size of the remap table
|
||||
PxU16 pad; // pad for serialization
|
||||
PxU32 gpuRemapId; // PT: using padding bytes on x64
|
||||
};
|
||||
|
||||
struct PxConvexMeshGeometryLL: public PxConvexMeshGeometry
|
||||
{
|
||||
bool gpuCompatible; // PT: TODO: remove?
|
||||
};
|
||||
|
||||
struct PxTriangleMeshGeometryLL: public PxTriangleMeshGeometry
|
||||
{
|
||||
MaterialIndicesStruct materialsLL;
|
||||
};
|
||||
|
||||
struct PxParticleSystemGeometryLL : public PxParticleSystemGeometry
|
||||
{
|
||||
MaterialIndicesStruct materialsLL;
|
||||
};
|
||||
|
||||
struct PxTetrahedronMeshGeometryLL : public PxTetrahedronMeshGeometry
|
||||
{
|
||||
MaterialIndicesStruct materialsLL;
|
||||
};
|
||||
|
||||
struct PxHeightFieldGeometryLL : public PxHeightFieldGeometry
|
||||
{
|
||||
MaterialIndicesStruct materialsLL;
|
||||
};
|
||||
|
||||
template <> struct PxcGeometryTraits<PxParticleSystemGeometryLL> { enum { TypeID = PxGeometryType::ePARTICLESYSTEM}; };
|
||||
template <> struct PxcGeometryTraits<PxConvexMeshGeometryLL> { enum { TypeID = PxGeometryType::eCONVEXMESH }; };
|
||||
template <> struct PxcGeometryTraits<PxTriangleMeshGeometryLL> { enum { TypeID = PxGeometryType::eTRIANGLEMESH }; };
|
||||
template <> struct PxcGeometryTraits<PxTetrahedronMeshGeometryLL> { enum { TypeID = PxGeometryType::eTETRAHEDRONMESH }; };
|
||||
template <> struct PxcGeometryTraits<PxHeightFieldGeometryLL> { enum { TypeID = PxGeometryType::eHEIGHTFIELD }; };
|
||||
|
||||
class InvalidGeometry : public PxGeometry
|
||||
{
|
||||
public:
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE InvalidGeometry() : PxGeometry(PxGeometryType::eINVALID) {}
|
||||
};
|
||||
|
||||
class GeometryUnion
|
||||
{
|
||||
public:
|
||||
// PX_SERIALIZATION
|
||||
GeometryUnion(const PxEMPTY) {}
|
||||
//~PX_SERIALIZATION
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE GeometryUnion() { reinterpret_cast<InvalidGeometry&>(mGeometry) = InvalidGeometry(); }
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE GeometryUnion(const PxGeometry& g) { set(g); }
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxGeometry& getGeometry() const { return reinterpret_cast<const PxGeometry&>(mGeometry); }
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxGeometryType::Enum getType() const { return reinterpret_cast<const PxGeometry&>(mGeometry).getType(); }
|
||||
|
||||
PX_CUDA_CALLABLE void set(const PxGeometry& g);
|
||||
|
||||
template<class Geom> PX_CUDA_CALLABLE PX_FORCE_INLINE Geom& get()
|
||||
{
|
||||
checkType<Geom>(getGeometry());
|
||||
return reinterpret_cast<Geom&>(mGeometry);
|
||||
}
|
||||
|
||||
template<class Geom> PX_CUDA_CALLABLE PX_FORCE_INLINE const Geom& get() const
|
||||
{
|
||||
checkType<Geom>(getGeometry());
|
||||
return reinterpret_cast<const Geom&>(mGeometry);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
union {
|
||||
void* alignment; // PT: Makes sure the class is at least aligned to pointer size. See DE6803.
|
||||
PxU8 box[sizeof(PxBoxGeometry)];
|
||||
PxU8 sphere[sizeof(PxSphereGeometry)];
|
||||
PxU8 capsule[sizeof(PxCapsuleGeometry)];
|
||||
PxU8 plane[sizeof(PxPlaneGeometry)];
|
||||
PxU8 convexCore[sizeof(PxConvexCoreGeometry)];
|
||||
PxU8 convex[sizeof(PxConvexMeshGeometryLL)];
|
||||
PxU8 particleSystem[sizeof(PxParticleSystemGeometryLL)];
|
||||
PxU8 mesh[sizeof(PxTriangleMeshGeometryLL)];
|
||||
PxU8 tetMesh[sizeof(PxTetrahedronMeshGeometryLL)];
|
||||
PxU8 heightfield[sizeof(PxHeightFieldGeometryLL)];
|
||||
PxU8 custom[sizeof(PxCustomGeometry)];
|
||||
PxU8 invalid[sizeof(InvalidGeometry)];
|
||||
} mGeometry;
|
||||
};
|
||||
|
||||
struct PxShapeCoreFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eOWNS_MATERIAL_IDX_MEMORY = (1<<0), // PT: for de-serialization to avoid deallocating material index list. Moved there from Sc::ShapeCore (since one byte was free).
|
||||
eIS_EXCLUSIVE = (1<<1), // PT: shape's exclusive flag
|
||||
eIDT_TRANSFORM = (1<<2), // PT: true if PxsShapeCore::transform is identity
|
||||
eDEFORMABLE_SURFACE_SHAPE = (1<<3), // True if this shape is a deformable surface shape
|
||||
eDEFORMABLE_VOLUME_SHAPE = (1<<4) // True if this shape is a deformable volume shape
|
||||
};
|
||||
};
|
||||
|
||||
typedef PxFlags<PxShapeCoreFlag::Enum,PxU8> PxShapeCoreFlags;
|
||||
PX_FLAGS_OPERATORS(PxShapeCoreFlag::Enum,PxU8)
|
||||
|
||||
struct PxsShapeCore
|
||||
{
|
||||
PxsShapeCore()
|
||||
{
|
||||
setDensityForFluid(800.0f);
|
||||
}
|
||||
|
||||
// PX_SERIALIZATION
|
||||
PxsShapeCore(const PxEMPTY) : mShapeCoreFlags(PxEmpty), mGeometry(PxEmpty) {}
|
||||
//~PX_SERIALIZATION
|
||||
|
||||
#if PX_WINDOWS_FAMILY // PT: to avoid "error: offset of on non-standard-layout type" on Linux
|
||||
protected:
|
||||
#endif
|
||||
PX_ALIGN_PREFIX(16)
|
||||
PxTransform mTransform PX_ALIGN_SUFFIX(16); // PT: Offset 0
|
||||
#if PX_WINDOWS_FAMILY // PT: to avoid "error: offset of on non-standard-layout type" on Linux
|
||||
public:
|
||||
#endif
|
||||
PX_FORCE_INLINE const PxTransform& getTransform() const
|
||||
{
|
||||
return mTransform;
|
||||
}
|
||||
|
||||
PX_FORCE_INLINE void setTransform(const PxTransform& t)
|
||||
{
|
||||
mTransform = t;
|
||||
if(t.p.isZero() && t.q.isIdentity())
|
||||
mShapeCoreFlags.raise(PxShapeCoreFlag::eIDT_TRANSFORM);
|
||||
else
|
||||
mShapeCoreFlags.clear(PxShapeCoreFlag::eIDT_TRANSFORM);
|
||||
}
|
||||
|
||||
PxReal mContactOffset; // PT: Offset 28
|
||||
PxU8 mShapeFlags; // PT: Offset 32 !< API shape flags // PT: TODO: use PxShapeFlags here. Needs to move flags to separate file.
|
||||
PxShapeCoreFlags mShapeCoreFlags; // PT: Offset 33
|
||||
PxU16 mMaterialIndex; // PT: Offset 34
|
||||
PxReal mRestOffset; // PT: Offset 36 - same as the API property of the same name - PT: moved from Sc::ShapeCore to fill padding bytes
|
||||
GeometryUnion mGeometry; // PT: Offset 40
|
||||
PxReal mTorsionalRadius; // PT: Offset 104 - PT: moved from Sc::ShapeCore to fill padding bytes
|
||||
PxReal mMinTorsionalPatchRadius; // PT: Offset 108 - PT: moved from Sc::ShapeCore to fill padding bytes
|
||||
|
||||
PX_FORCE_INLINE float getDensityForFluid() const
|
||||
{
|
||||
return mGeometry.getGeometry().mTypePadding;
|
||||
}
|
||||
|
||||
PX_FORCE_INLINE void setDensityForFluid(float density)
|
||||
{
|
||||
const_cast<PxGeometry&>(mGeometry.getGeometry()).mTypePadding = density;
|
||||
}
|
||||
};
|
||||
|
||||
PX_COMPILE_TIME_ASSERT( sizeof(GeometryUnion) <= 64); // PT: if you break this one I will not be happy
|
||||
|
||||
PX_COMPILE_TIME_ASSERT( (sizeof(PxsShapeCore)&0xf) == 0);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
107
engine/third_party/physx/source/lowlevel/api/include/PxvGlobals.h
vendored
Normal file
107
engine/third_party/physx/source/lowlevel/api/include/PxvGlobals.h
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
// 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 PXV_GLOBALS_H
|
||||
#define PXV_GLOBALS_H
|
||||
|
||||
#include "PxvConfig.h"
|
||||
#include "foundation/PxBasicTemplates.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
|
||||
/*!
|
||||
\file
|
||||
PhysX Low-level, Memory management
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* Error Handling */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
enum PxvErrorCode
|
||||
{
|
||||
PXD_ERROR_NO_ERROR = 0,
|
||||
PXD_ERROR_INVALID_PARAMETER,
|
||||
PXD_ERROR_INVALID_PARAMETER_SIZE,
|
||||
PXD_ERROR_INTERNAL_ERROR,
|
||||
PXD_ERROR_NOT_IMPLEMENTED,
|
||||
PXD_ERROR_NO_CONTEXT,
|
||||
PXD_ERROR_NO_TASK_MANAGER,
|
||||
PXD_ERROR_WARNING
|
||||
};
|
||||
|
||||
class PxShape;
|
||||
class PxRigidActor;
|
||||
struct PxsShapeCore;
|
||||
struct PxsRigidCore;
|
||||
|
||||
struct PxvOffsetTable
|
||||
{
|
||||
PX_FORCE_INLINE PxvOffsetTable() {}
|
||||
|
||||
PX_FORCE_INLINE const PxShape* convertPxsShape2Px(const PxsShapeCore* pxs) const
|
||||
{
|
||||
return PxPointerOffset<const PxShape*>(pxs, pxsShapeCore2PxShape);
|
||||
}
|
||||
|
||||
PX_FORCE_INLINE const PxRigidActor* convertPxsRigidCore2PxRigidBody(const PxsRigidCore* pxs) const
|
||||
{
|
||||
return PxPointerOffset<const PxRigidActor*>(pxs, pxsRigidCore2PxRigidBody);
|
||||
}
|
||||
|
||||
PX_FORCE_INLINE const PxRigidActor* convertPxsRigidCore2PxRigidStatic(const PxsRigidCore* pxs) const
|
||||
{
|
||||
return PxPointerOffset<const PxRigidActor*>(pxs, pxsRigidCore2PxRigidStatic);
|
||||
}
|
||||
|
||||
ptrdiff_t pxsShapeCore2PxShape;
|
||||
ptrdiff_t pxsRigidCore2PxRigidBody;
|
||||
ptrdiff_t pxsRigidCore2PxRigidStatic;
|
||||
};
|
||||
extern PxvOffsetTable gPxvOffsetTable;
|
||||
|
||||
/*!
|
||||
Initialize low-level implementation.
|
||||
*/
|
||||
void PxvInit(const PxvOffsetTable& offsetTable);
|
||||
|
||||
/*!
|
||||
Shut down low-level implementation.
|
||||
*/
|
||||
void PxvTerm();
|
||||
|
||||
#if PX_SUPPORT_GPU_PHYSX
|
||||
class PxPhysXGpu* PxvGetPhysXGpu(bool createIfNeeded);
|
||||
void PxvReleasePhysXGpu(PxPhysXGpu*);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
214
engine/third_party/physx/source/lowlevel/api/include/PxvManager.h
vendored
Normal file
214
engine/third_party/physx/source/lowlevel/api/include/PxvManager.h
vendored
Normal file
@@ -0,0 +1,214 @@
|
||||
// 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 PXV_MANAGER_H
|
||||
#define PXV_MANAGER_H
|
||||
|
||||
#include "foundation/PxVec3.h"
|
||||
#include "foundation/PxQuat.h"
|
||||
#include "foundation/PxTransform.h"
|
||||
#include "foundation/PxMemory.h"
|
||||
#include "PxvConfig.h"
|
||||
#include "PxvGeometry.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
|
||||
/*!
|
||||
\file
|
||||
Manager interface
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* Managers */
|
||||
/************************************************************************/
|
||||
|
||||
class PxsContactManager;
|
||||
|
||||
struct PxsRigidCore;
|
||||
struct PxsShapeCore;
|
||||
class PxsRigidBody;
|
||||
|
||||
/*!
|
||||
Type of PXD_MANAGER_CCD_MODE property
|
||||
*/
|
||||
enum PxvContactManagerCCDMode
|
||||
{
|
||||
PXD_MANAGER_CCD_NONE,
|
||||
PXD_MANAGER_CCD_LINEAR
|
||||
};
|
||||
|
||||
/*!
|
||||
Manager descriptor
|
||||
*/
|
||||
struct PxvManagerDescRigidRigid
|
||||
{
|
||||
/*!
|
||||
Manager user data
|
||||
|
||||
\sa PXD_MANAGER_USER_DATA
|
||||
*/
|
||||
//void* userData;
|
||||
|
||||
/*!
|
||||
Dominance setting for one way interactions.
|
||||
A dominance of 0 means the corresp. body will
|
||||
not be pushable by the other body in the constraint.
|
||||
\sa PXD_MANAGER_DOMINANCE0
|
||||
*/
|
||||
PxU8 dominance0;
|
||||
|
||||
/*!
|
||||
Dominance setting for one way interactions.
|
||||
A dominance of 0 means the corresp. body will
|
||||
not be pushable by the other body in the constraint.
|
||||
\sa PXD_MANAGER_DOMINANCE1
|
||||
*/
|
||||
PxU8 dominance1;
|
||||
|
||||
/*!
|
||||
PxsRigidBodies
|
||||
*/
|
||||
PxsRigidBody* rigidBody0;
|
||||
PxsRigidBody* rigidBody1;
|
||||
|
||||
/*!
|
||||
Shape Core structures
|
||||
*/
|
||||
const PxsShapeCore* shapeCore0;
|
||||
const PxsShapeCore* shapeCore1;
|
||||
|
||||
/*!
|
||||
Body Core structures
|
||||
*/
|
||||
PxsRigidCore* rigidCore0;
|
||||
PxsRigidCore* rigidCore1;
|
||||
|
||||
/*!
|
||||
Enable contact information reporting.
|
||||
*/
|
||||
int reportContactInfo;
|
||||
|
||||
/*!
|
||||
Enable contact impulse threshold reporting.
|
||||
*/
|
||||
int hasForceThreshold;
|
||||
|
||||
/*!
|
||||
Enable generated contacts to be changeable
|
||||
*/
|
||||
int contactChangeable;
|
||||
|
||||
/*!
|
||||
Disable strong friction
|
||||
*/
|
||||
//int disableStrongFriction;
|
||||
|
||||
/*!
|
||||
Contact resolution rest distance.
|
||||
*/
|
||||
PxReal restDistance;
|
||||
|
||||
/*!
|
||||
Disable contact response
|
||||
*/
|
||||
int disableResponse;
|
||||
|
||||
/*!
|
||||
Disable discrete contact generation
|
||||
*/
|
||||
int disableDiscreteContact;
|
||||
|
||||
/*!
|
||||
Disable CCD contact generation
|
||||
*/
|
||||
int disableCCDContact;
|
||||
|
||||
/*!
|
||||
Is connected to an articulation (1 - first body, 2 - second body)
|
||||
*/
|
||||
int hasArticulations;
|
||||
|
||||
/*!
|
||||
is connected to a dynamic (1 - first body, 2 - second body)
|
||||
*/
|
||||
int hasDynamics;
|
||||
|
||||
/*!
|
||||
Is the pair touching? Use when re-creating the manager with prior knowledge about touch status.
|
||||
|
||||
positive: pair is touching
|
||||
0: touch state unknown (this is a new pair)
|
||||
negative: pair is not touching
|
||||
|
||||
Default is 0
|
||||
*/
|
||||
int hasTouch;
|
||||
|
||||
/*!
|
||||
Identifies whether body 1 is kinematic. We can treat kinematics as statics and embed velocity into constraint
|
||||
because kinematic bodies' velocities will not change
|
||||
*/
|
||||
bool body1Kinematic;
|
||||
|
||||
/*
|
||||
Index entries into the transform cache for shape 0
|
||||
*/
|
||||
PxU32 transformCache0;
|
||||
|
||||
/*
|
||||
Index entries into the transform cache for shape 1
|
||||
*/
|
||||
PxU32 transformCache1;
|
||||
|
||||
PxvManagerDescRigidRigid()
|
||||
{
|
||||
PxMemSet(this, 0, sizeof(PxvManagerDescRigidRigid));
|
||||
|
||||
dominance0 = 1u;
|
||||
dominance1 = 1u;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
Report struct for contact manager touch reports
|
||||
*/
|
||||
struct PxvContactManagerTouchEvent
|
||||
{
|
||||
void* userData;
|
||||
|
||||
// PT: only useful to search for places where we get/set this specific user data
|
||||
PX_FORCE_INLINE void setCMTouchEventUserData(void* ud) { userData = ud; }
|
||||
PX_FORCE_INLINE void* getCMTouchEventUserData() const { return userData; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
124
engine/third_party/physx/source/lowlevel/api/include/PxvSimStats.h
vendored
Normal file
124
engine/third_party/physx/source/lowlevel/api/include/PxvSimStats.h
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
// 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 PXV_SIM_STATS_H
|
||||
#define PXV_SIM_STATS_H
|
||||
|
||||
#include "foundation/PxAssert.h"
|
||||
#include "foundation/PxMemory.h"
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
#include "geometry/PxGeometry.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
|
||||
/*!
|
||||
\file
|
||||
Context handling
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* Context handling, types */
|
||||
/************************************************************************/
|
||||
|
||||
/*!
|
||||
Description: contains statistics for the simulation.
|
||||
*/
|
||||
struct PxvSimStats
|
||||
{
|
||||
PxvSimStats() { clearAll(); }
|
||||
void clearAll() { PxMemZero(this, sizeof(PxvSimStats)); } // set counters to zero
|
||||
|
||||
PX_FORCE_INLINE void incCCDPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1)
|
||||
{
|
||||
PX_ASSERT(g0 <= g1); // That's how they should be sorted
|
||||
mNbCCDPairs[g0][g1]++;
|
||||
}
|
||||
|
||||
PX_FORCE_INLINE void decCCDPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1)
|
||||
{
|
||||
PX_ASSERT(g0 <= g1); // That's how they should be sorted
|
||||
PX_ASSERT(mNbCCDPairs[g0][g1]);
|
||||
mNbCCDPairs[g0][g1]--;
|
||||
}
|
||||
|
||||
PX_FORCE_INLINE void incModifiedContactPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1)
|
||||
{
|
||||
PX_ASSERT(g0 <= g1); // That's how they should be sorted
|
||||
mNbModifiedContactPairs[g0][g1]++;
|
||||
}
|
||||
|
||||
PX_FORCE_INLINE void decModifiedContactPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1)
|
||||
{
|
||||
PX_ASSERT(g0 <= g1); // That's how they should be sorted
|
||||
PX_ASSERT(mNbModifiedContactPairs[g0][g1]);
|
||||
mNbModifiedContactPairs[g0][g1]--;
|
||||
}
|
||||
|
||||
// PT: those guys are now persistent and shouldn't be cleared each frame
|
||||
PxU32 mNbDiscreteContactPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
|
||||
PxU32 mNbCCDPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
|
||||
|
||||
PxU32 mNbModifiedContactPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
|
||||
|
||||
PxU32 mNbDiscreteContactPairsTotal; // PT: sum of mNbDiscreteContactPairs, i.e. number of pairs reaching narrow phase
|
||||
PxU32 mNbDiscreteContactPairsWithCacheHits;
|
||||
PxU32 mNbDiscreteContactPairsWithContacts;
|
||||
PxU32 mNbActiveConstraints;
|
||||
PxU32 mNbActiveDynamicBodies;
|
||||
PxU32 mNbActiveKinematicBodies;
|
||||
|
||||
PxU32 mNbAxisSolverConstraints;
|
||||
PxU32 mTotalCompressedContactSize;
|
||||
PxU32 mTotalConstraintSize;
|
||||
PxU32 mPeakConstraintBlockAllocations;
|
||||
|
||||
PxU32 mNbNewPairs;
|
||||
PxU32 mNbLostPairs;
|
||||
|
||||
PxU32 mNbNewTouches;
|
||||
PxU32 mNbLostTouches;
|
||||
|
||||
PxU32 mNbPartitions;
|
||||
|
||||
PxU64 mGpuDynamicsTempBufferCapacity;
|
||||
PxU32 mGpuDynamicsRigidContactCount;
|
||||
PxU32 mGpuDynamicsRigidPatchCount;
|
||||
PxU32 mGpuDynamicsFoundLostPairs;
|
||||
PxU32 mGpuDynamicsFoundLostAggregatePairs;
|
||||
PxU32 mGpuDynamicsTotalAggregatePairs;
|
||||
PxU32 mGpuDynamicsDeformableSurfaceContacts;
|
||||
PxU32 mGpuDynamicsDeformableVolumeContacts;
|
||||
PxU32 mGpuDynamicsParticleContacts; // not implemented
|
||||
PxU32 mGpuDynamicsCollisionStackSize;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user