Upgrade to PhysX 5.1.3

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

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_PX_BASE
#define PX_PHYSICS_PX_BASE
#ifndef PX_BASE_H
#define PX_BASE_H
/** \addtogroup common
@{
@@ -40,6 +38,7 @@
#include "common/PxCollection.h"
#include "common/PxTypeInfo.h"
#include <string.h> // For strcmp
#include "foundation/PxAssert.h"
#if !PX_DOXYGEN
namespace physx
@@ -55,8 +54,8 @@ struct PxBaseFlag
{
enum Enum
{
eOWNS_MEMORY = (1<<0),
eIS_RELEASABLE = (1<<1)
eOWNS_MEMORY = (1<<0),
eIS_RELEASABLE = (1<<1)
};
};
@@ -82,13 +81,13 @@ public:
/**
\brief Releases the PxBase instance, please check documentation of release in derived class.
*/
virtual void release() = 0;
virtual void release() = 0;
/**
\brief Returns string name of dynamic type.
\return Class name of most derived type of this object.
*/
virtual const char* getConcreteTypeName() const = 0;
virtual const char* getConcreteTypeName() const = 0;
/* brief Implements dynamic cast functionality.
@@ -98,7 +97,7 @@ public:
\return A pointer to the specified type if object matches, otherwise NULL
*/
template<class T> T* is() { return typeMatch<T>() ? static_cast<T*>(this) : NULL; }
template<class T> T* is() { return typeMatch<T>() ? static_cast<T*>(this) : NULL; }
/* brief Implements dynamic cast functionality for const objects.
@@ -108,7 +107,7 @@ public:
\return A pointer to the specified type if object matches, otherwise NULL
*/
template<class T> const T* is() const { return typeMatch<T>() ? static_cast<const T*>(this) : NULL; }
template<class T> const T* is() const { return typeMatch<T>() ? static_cast<const T*>(this) : NULL; }
/**
\brief Returns concrete type of object.
@@ -116,7 +115,7 @@ public:
@see PxConcreteType
*/
PX_FORCE_INLINE PxType getConcreteType() const { return mConcreteType; }
PX_FORCE_INLINE PxType getConcreteType() const { return mConcreteType; }
/**
\brief Set PxBaseFlag
@@ -124,7 +123,7 @@ public:
\param[in] flag The flag to be set
\param[in] value The flags new value
*/
PX_FORCE_INLINE void setBaseFlag(PxBaseFlag::Enum flag, bool value) { mBaseFlags = value ? mBaseFlags|flag : mBaseFlags&~flag; }
PX_FORCE_INLINE void setBaseFlag(PxBaseFlag::Enum flag, bool value) { mBaseFlags = value ? mBaseFlags|flag : mBaseFlags&~flag; }
/**
\brief Set PxBaseFlags
@@ -133,7 +132,7 @@ public:
@see PxBaseFlags
*/
PX_FORCE_INLINE void setBaseFlags(PxBaseFlags inFlags) { mBaseFlags = inFlags; }
PX_FORCE_INLINE void setBaseFlags(PxBaseFlags inFlags) { mBaseFlags = inFlags; }
/**
\brief Returns PxBaseFlags
@@ -142,7 +141,7 @@ public:
@see PxBaseFlags
*/
PX_FORCE_INLINE PxBaseFlags getBaseFlags() const { return mBaseFlags; }
PX_FORCE_INLINE PxBaseFlags getBaseFlags() const { return mBaseFlags; }
/**
\brief Whether the object is subordinate.
@@ -153,44 +152,83 @@ public:
@see PxSerialization::isSerializable
*/
virtual bool isReleasable() const { return mBaseFlags & PxBaseFlag::eIS_RELEASABLE; }
virtual bool isReleasable() const { return mBaseFlags & PxBaseFlag::eIS_RELEASABLE; }
protected:
/**
\brief Constructor setting concrete type and base flags.
*/
PX_INLINE PxBase(PxType concreteType, PxBaseFlags baseFlags)
: mConcreteType(concreteType), mBaseFlags(baseFlags) {}
PX_INLINE PxBase(PxType concreteType, PxBaseFlags baseFlags)
: mConcreteType(concreteType), mBaseFlags(baseFlags), mBuiltInRefCount(1) {}
/**
\brief Deserialization constructor setting base flags.
*/
PX_INLINE PxBase(PxBaseFlags baseFlags) : mBaseFlags(baseFlags) {}
PX_INLINE PxBase(PxBaseFlags baseFlags) : mBaseFlags(baseFlags)
{
PX_ASSERT(mBuiltInRefCount == 1);
}
/**
\brief Destructor.
*/
virtual ~PxBase() {}
virtual ~PxBase() {}
/**
\brief Returns whether a given type name matches with the type of this instance
*/
virtual bool isKindOf(const char* superClass) const { return !::strcmp(superClass, "PxBase"); }
template<class T> bool typeMatch() const
{
return PxU32(PxTypeInfo<T>::eFastTypeId)!=PxU32(PxConcreteType::eUNDEFINED) ?
PxU32(getConcreteType()) == PxU32(PxTypeInfo<T>::eFastTypeId) : isKindOf(PxTypeInfo<T>::name());
}
virtual bool isKindOf(const char* superClass) const { return !::strcmp(superClass, "PxBase"); }
template<class T> bool typeMatch() const
{
return PxU32(PxTypeInfo<T>::eFastTypeId)!=PxU32(PxConcreteType::eUNDEFINED) ?
PxU32(getConcreteType()) == PxU32(PxTypeInfo<T>::eFastTypeId) : isKindOf(PxTypeInfo<T>::name());
}
private:
friend void getBinaryMetaData_PxBase(PxOutputStream& stream);
friend void getBinaryMetaData_PxBase(PxOutputStream& stream);
protected:
PxType mConcreteType; // concrete type identifier - see PxConcreteType.
PxBaseFlags mBaseFlags; // internal flags
PxType mConcreteType; // concrete type identifier - see PxConcreteType.
PxBaseFlags mBaseFlags; // internal flags
PxU32 mBuiltInRefCount;
};
/**
\brief Base class for ref-counted objects.
*/
class PxRefCounted : public PxBase
{
public:
/**
\brief Decrements the reference count of the object and releases it if the new reference count is zero.
*/
virtual void release() = 0;
/**
\brief Returns the reference count of the object.
At creation, the reference count of the object is 1. Every other object referencing this object increments the
count by 1. When the reference count reaches 0, and only then, the object gets destroyed automatically.
\return the current reference count.
*/
virtual PxU32 getReferenceCount() const = 0;
/**
\brief Acquires a counted reference to this object.
This method increases the reference count of the object by 1. Decrement the reference count by calling release()
*/
virtual void acquireReference() = 0;
protected:
virtual void onRefCountZero() { delete this; }
PX_INLINE PxRefCounted(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {}
PX_INLINE PxRefCounted(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
virtual ~PxRefCounted() {}
virtual bool isKindOf(const char* name) const { return !::strcmp("PxRefCounted", name) || PxBase::isKindOf(name); }
};
#if !PX_DOXYGEN

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_PX_COLLECTION
#define PX_PHYSICS_PX_COLLECTION
#ifndef PX_COLLECTION_H
#define PX_COLLECTION_H
#include "common/PxSerialFramework.h"
@@ -272,7 +270,7 @@ For deserialization, the system gives back a collection of deserialized objects
@see PxCollection, PxCollection::release()
*/
PX_PHYSX_COMMON_API physx::PxCollection* PX_CALL_CONV PxCreateCollection();
PX_C_EXPORT PX_PHYSX_COMMON_API physx::PxCollection* PX_CALL_CONV PxCreateCollection();
/** @} */

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_CORE_UTILTY_TYPES_H
#define PX_CORE_UTILTY_TYPES_H
#ifndef PX_CORE_UTILITY_TYPES_H
#define PX_CORE_UTILITY_TYPES_H
/** \addtogroup common
@{
*/
@@ -78,6 +76,20 @@ struct PxTypedStridedData
{
}
PxTypedStridedData(const TDataType* data_, PxU32 stride_ = 0)
: stride(stride_)
, data(data_)
{
}
PX_INLINE const TDataType& at(PxU32 idx) const
{
PxU32 theStride(stride);
if (theStride == 0)
theStride = sizeof(TDataType);
PxU32 offset(theStride * idx);
return *(reinterpret_cast<const TDataType*>(reinterpret_cast<const PxU8*>(data) + offset));
}
};
struct PxBoundedData : public PxStridedData
@@ -183,7 +195,7 @@ public:
void clear()
{
memset(mDataPairs, 0, NB_ELEMENTS*2*sizeof(PxReal));
PxMemSet(mDataPairs, 0, NB_ELEMENTS*2*sizeof(PxReal));
mNbDataPairs = 0;
}

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_PX_PHYSICS_INSERTION_CALLBACK
#define PX_PHYSICS_PX_PHYSICS_INSERTION_CALLBACK
#ifndef PX_INSERTION_CALLBACK_H
#define PX_INSERTION_CALLBACK_H
#include "common/PxBase.h"
@@ -43,27 +41,25 @@ namespace physx
#endif
/**
\brief Callback interface that permits PxCooking to insert a
TriangleMesh, HeightfieldMesh or ConvexMesh directly into PxPhysics without the need to store
the cooking results into a stream.
\brief Callback interface that permits TriangleMesh, Heightfield, ConvexMesh or BVH to be used
directly without the need to store the cooking results into a stream.
Using this is advised only if real-time cooking is required; using "offline" cooking and
streams is otherwise preferred.
The default PxPhysicsInsertionCallback implementation must be used. The PxPhysics
The default PxInsertionCallback implementations must be used. The PxPhysics
default callback can be obtained using the PxPhysics::getPhysicsInsertionCallback().
The PxCooking default callback can be obtained using the PxCooking::getStandaloneInsertionCallback().
@see PxCooking PxPhysics
*/
class PxPhysicsInsertionCallback
class PxInsertionCallback
{
public:
PxPhysicsInsertionCallback() {}
PxInsertionCallback() {}
/**
\brief Builds object (TriangleMesh, HeightfieldMesh or ConvexMesh) from given data in PxPhysics.
\brief Builds object (TriangleMesh, Heightfield, ConvexMesh or BVH) from given data in PxPhysics.
\param type Object type to build.
\param data Object data
@@ -72,9 +68,10 @@ namespace physx
virtual PxBase* buildObjectFromData(PxConcreteType::Enum type, void* data) = 0;
protected:
virtual ~PxPhysicsInsertionCallback() {}
virtual ~PxInsertionCallback() {}
};
typedef PxInsertionCallback PxPhysicsInsertionCallback;
#if !PX_DOXYGEN
} // namespace physx

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_METADATA_H
#define PX_PHYSICS_METADATA_H
#ifndef PX_METADATA_H
#define PX_METADATA_H
/** \addtogroup physics
@{
*/

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_METADATA_FLAGS
#define PX_PHYSICS_METADATA_FLAGS
#ifndef PX_METADATA_FLAGS_H
#define PX_METADATA_FLAGS_H
#include "foundation/Px.h"

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_COMMON_NX
#define PX_PHYSICS_COMMON_NX
#ifndef PX_PHYSX_COMMON_CONFIG_H
#define PX_PHYSX_COMMON_CONFIG_H
/** \addtogroup common
@{ */
@@ -47,7 +45,7 @@ https://developercommunity.visualstudio.com/content/problem/66047/possible-compi
#if defined PX_PHYSX_STATIC_LIB
#define PX_PHYSX_CORE_API
#else
#if (PX_WINDOWS_FAMILY || PX_XBOXONE || PX_PS4)
#if (PX_WINDOWS_FAMILY || PX_PS4 || PX_PS5)
#if defined PX_PHYSX_CORE_EXPORTS
#define PX_PHYSX_CORE_API __declspec(dllexport)
#else
@@ -85,7 +83,7 @@ https://developercommunity.visualstudio.com/content/problem/66047/possible-compi
#if defined PX_PHYSX_STATIC_LIB
#define PX_PHYSX_COMMON_API
#else
#if (PX_WINDOWS_FAMILY || PX_XBOXONE || PX_PS4) && !defined(__CUDACC__)
#if (PX_WINDOWS_FAMILY || PX_PS4 || PX_PS5) && !defined(__CUDACC__)
#if defined PX_PHYSX_COMMON_EXPORTS
#define PX_PHYSX_COMMON_API __declspec(dllexport)
#else
@@ -98,23 +96,27 @@ https://developercommunity.visualstudio.com/content/problem/66047/possible-compi
#endif
#endif
// PT: typical "invalid" value in various CD algorithms
#define PX_INVALID_U32 0xffffffff
#define PX_INVALID_U16 0xffff
// Changing these parameters requires recompilation of the SDK
// Enable debug visualization
#define PX_ENABLE_DEBUG_VISUALIZATION 1
#define PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION
// Enable simulation statistics generation
#define PX_ENABLE_SIM_STATS 1
#define PX_CATCH_UNDEFINED_ENABLE_SIM_STATS
#if !PX_DOXYGEN
namespace physx
{
#endif
class PxCollection;
class PxBase;
class PxHeightField;
class PxHeightFieldDesc;
class PxTriangleMesh;
class PxConvexMesh;
typedef PxU32 PxTriangleID;
typedef PxU16 PxMaterialTableIndex;
typedef PxU16 PxFEMMaterialTableIndex;
#if !PX_DOXYGEN
} // namespace physx

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PXFOUNDATION_PXPROFILEZONE_H
#define PXFOUNDATION_PXPROFILEZONE_H
#ifndef PX_PROFILE_ZONE_H
#define PX_PROFILE_ZONE_H
#include "foundation/PxProfiler.h"
#include "PxFoundation.h"
#include "foundation/PxFoundation.h"
#if PX_DEBUG || PX_CHECKED || PX_PROFILE
#define PX_PROFILE_ZONE(x, y) \
@@ -48,4 +47,4 @@
#define PX_PROFILE_POINTER_TO_U64(pointer) static_cast<uint64_t>(reinterpret_cast<size_t>(pointer))
#endif // PXFOUNDATION_PXPROFILEZONE_H
#endif

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_FOUNDATION_PXRENDERBUFFER_H
#define PX_FOUNDATION_PXRENDERBUFFER_H
#ifndef PX_RENDER_BUFFER_H
#define PX_RENDER_BUFFER_H
/** \addtogroup common
@{
@@ -61,12 +59,13 @@ struct PxDebugColor
eARGB_CYAN = 0xff00ffff,
eARGB_WHITE = 0xffffffff,
eARGB_GREY = 0xff808080,
eARGB_DARKRED = 0x88880000,
eARGB_DARKGREEN = 0x88008800,
eARGB_DARKBLUE = 0x88000088
eARGB_DARKRED = 0xff880000,
eARGB_DARKGREEN = 0xff008800,
eARGB_DARKBLUE = 0xff000088
};
};
/**
\brief Used to store a single point and colour for debug rendering.
*/
@@ -114,17 +113,22 @@ struct PxDebugTriangle
*/
struct PxDebugText
{
PxDebugText() : string(0) {}
PxDebugText() : string(0)
{
}
PxDebugText(const PxVec3& p, const PxReal& s, const PxU32& c, const char* str)
: position(p), size(s), color(c), string(str) {}
PxDebugText(const PxVec3& pos, const PxReal& sz, const PxU32& clr, const char* str)
: position(pos), size(sz), color(clr), string(str)
{
}
PxVec3 position;
PxReal size;
PxU32 color;
const char* string;
PxVec3 position;
PxReal size;
PxU32 color;
const char* string;
};
/**
\brief Interface for points, lines, triangles, and text buffer.
*/
@@ -135,18 +139,24 @@ public:
virtual PxU32 getNbPoints() const = 0;
virtual const PxDebugPoint* getPoints() const = 0;
virtual void addPoint(const PxDebugPoint& point) = 0;
virtual PxU32 getNbLines() const = 0;
virtual const PxDebugLine* getLines() const = 0;
virtual void addLine(const PxDebugLine& line) = 0;
virtual PxDebugLine* reserveLines(const PxU32 nbLines) = 0;
virtual PxDebugPoint* reservePoints(const PxU32 nbLines) = 0;
virtual PxU32 getNbTriangles() const = 0;
virtual const PxDebugTriangle* getTriangles() const = 0;
virtual PxU32 getNbTexts() const = 0;
virtual const PxDebugText* getTexts() const = 0;
virtual void addTriangle(const PxDebugTriangle& triangle) = 0;
virtual void append(const PxRenderBuffer& other) = 0;
virtual void clear() = 0;
virtual void shift(const PxVec3& delta) = 0;
virtual bool empty() const = 0;
};
#if !PX_DOXYGEN

View File

@@ -0,0 +1,404 @@
// 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-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_RENDER_OUTPUT_H
#define PX_RENDER_OUTPUT_H
#include "foundation/PxMat44.h"
#include "foundation/PxBasicTemplates.h"
#include "PxRenderBuffer.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
#if PX_VC
#pragma warning(push)
#pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class
#endif
/**
Output stream to fill RenderBuffer
*/
class PX_PHYSX_COMMON_API PxRenderOutput
{
public:
enum Primitive
{
POINTS,
LINES,
LINESTRIP,
TRIANGLES,
TRIANGLESTRIP
};
PxRenderOutput(PxRenderBuffer& buffer)
: mPrim(POINTS),
mColor(0),
mVertex0(0.0f),
mVertex1(0.0f),
mVertexCount(0),
mTransform(PxIdentity),
mBuffer(buffer)
{
}
PX_INLINE PxRenderOutput& operator<<(Primitive prim);
PX_INLINE PxRenderOutput& operator<<(PxU32 color) ;
PX_INLINE PxRenderOutput& operator<<(const PxMat44& transform);
PX_INLINE PxRenderOutput& operator<<(const PxTransform& t);
PX_INLINE PxRenderOutput& operator<<(const PxVec3& vertex); //AM: Don't use this! Slow! Deprecated!
PX_INLINE PxDebugLine* reserveSegments(PxU32 nbSegments);
PX_INLINE PxDebugPoint* reservePoints(PxU32 nbSegments);
PX_INLINE void outputSegment(const PxVec3& v0, const PxVec3& v1);
PX_INLINE PxRenderOutput& outputCapsule(PxF32 radius, PxF32 halfHeight, const PxMat44& absPose);
private:
PxRenderOutput& operator=(const PxRenderOutput&);
Primitive mPrim;
PxU32 mColor;
PxVec3 mVertex0, mVertex1;
PxU32 mVertexCount;
PxMat44 mTransform;
PxRenderBuffer& mBuffer;
};
struct PxDebugBox
{
explicit PxDebugBox(const PxVec3& extents, bool wireframe_ = true)
: minimum(-extents), maximum(extents), wireframe(wireframe_) {}
explicit PxDebugBox(const PxVec3& pos, const PxVec3& extents, bool wireframe_ = true)
: minimum(pos - extents), maximum(pos + extents), wireframe(wireframe_) {}
explicit PxDebugBox(const PxBounds3& bounds, bool wireframe_ = true)
: minimum(bounds.minimum), maximum(bounds.maximum), wireframe(wireframe_) {}
PxVec3 minimum, maximum;
bool wireframe;
};
PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugBox& box)
{
if (box.wireframe)
{
out << PxRenderOutput::LINESTRIP;
out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z);
out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z);
out << PxVec3(box.maximum.x, box.maximum.y, box.minimum.z);
out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z);
out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z);
out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z);
out << PxVec3(box.maximum.x, box.minimum.y, box.maximum.z);
out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z);
out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z);
out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z);
out << PxRenderOutput::LINES;
out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z);
out << PxVec3(box.maximum.x, box.minimum.y, box.maximum.z);
out << PxVec3(box.maximum.x, box.maximum.y, box.minimum.z);
out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z);
out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z);
out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z);
}
else
{
out << PxRenderOutput::TRIANGLESTRIP;
out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z); // 0
out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z); // 2
out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z); // 1
out << PxVec3(box.maximum.x, box.maximum.y, box.minimum.z); // 3
out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z); // 7
out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z); // 2
out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z); // 6
out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z); // 0
out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z); // 4
out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z); // 1
out << PxVec3(box.maximum.x, box.minimum.y, box.maximum.z); // 5
out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z); // 7
out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z); // 4
out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z); // 6
}
return out;
}
struct PxDebugArrow
{
PxDebugArrow(const PxVec3& pos, const PxVec3& vec)
: base(pos), tip(pos + vec), headLength(vec.magnitude()*0.15f) {}
PxDebugArrow(const PxVec3& pos, const PxVec3& vec, PxReal headLength_)
: base(pos), tip(pos + vec), headLength(headLength_) {}
PxVec3 base, tip;
PxReal headLength;
};
PX_FORCE_INLINE void normalToTangents(const PxVec3& normal, PxVec3& tangent0, PxVec3& tangent1)
{
tangent0 = PxAbs(normal.x) < 0.70710678f ? PxVec3(0, -normal.z, normal.y) : PxVec3(-normal.y, normal.x, 0);
tangent0.normalize();
tangent1 = normal.cross(tangent0);
}
PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugArrow& arrow)
{
PxVec3 t0 = arrow.tip - arrow.base, t1, t2;
t0.normalize();
normalToTangents(t0, t1, t2);
const PxReal tipAngle = 0.25f;
t1 *= arrow.headLength * tipAngle;
t2 *= arrow.headLength * tipAngle * PxSqrt(3.0f);
PxVec3 headBase = arrow.tip - t0 * arrow.headLength;
out << PxRenderOutput::LINES;
out << arrow.base << arrow.tip;
out << PxRenderOutput::TRIANGLESTRIP;
out << arrow.tip;
out << headBase + t1 + t1;
out << headBase - t1 - t2;
out << headBase - t1 + t2;
out << arrow.tip;
out << headBase + t1 + t1;
return out;
}
struct PxDebugBasis
{
PxDebugBasis(const PxVec3& ext, PxU32 cX = PxU32(PxDebugColor::eARGB_RED),
PxU32 cY = PxU32(PxDebugColor::eARGB_GREEN), PxU32 cZ = PxU32(PxDebugColor::eARGB_BLUE))
: extends(ext), colorX(cX), colorY(cY), colorZ(cZ) {}
PxVec3 extends;
PxU32 colorX, colorY, colorZ;
};
PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugBasis& basis)
{
const PxReal headLength = basis.extends.magnitude() * 0.15f;
out << basis.colorX << PxDebugArrow(PxVec3(0.0f), PxVec3(basis.extends.x, 0, 0), headLength);
out << basis.colorY << PxDebugArrow(PxVec3(0.0f), PxVec3(0, basis.extends.y, 0), headLength);
out << basis.colorZ << PxDebugArrow(PxVec3(0.0f), PxVec3(0, 0, basis.extends.z), headLength);
return out;
}
struct PxDebugCircle
{
PxDebugCircle(PxU32 s, PxReal r)
: nSegments(s), radius(r) {}
PxU32 nSegments;
PxReal radius;
};
PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugCircle& circle)
{
const PxF32 step = PxTwoPi / circle.nSegments;
PxF32 angle = 0;
out << PxRenderOutput::LINESTRIP;
for (PxU32 i = 0; i < circle.nSegments; i++, angle += step)
out << PxVec3(circle.radius * PxSin(angle), circle.radius * PxCos(angle), 0);
out << PxVec3(0, circle.radius, 0);
return out;
}
struct PxDebugArc
{
PxDebugArc(PxU32 s, PxReal r, PxReal minAng, PxReal maxAng)
: nSegments(s), radius(r), minAngle(minAng), maxAngle(maxAng) {}
PxU32 nSegments;
PxReal radius;
PxReal minAngle, maxAngle;
};
PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugArc& arc)
{
const PxF32 step = (arc.maxAngle - arc.minAngle) / arc.nSegments;
PxF32 angle = arc.minAngle;
out << PxRenderOutput::LINESTRIP;
for (PxU32 i = 0; i < arc.nSegments; i++, angle += step)
out << PxVec3(arc.radius * PxSin(angle), arc.radius * PxCos(angle), 0);
out << PxVec3(arc.radius * PxSin(arc.maxAngle), arc.radius * PxCos(arc.maxAngle), 0);
return out;
}
PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(Primitive prim)
{
mPrim = prim;
mVertexCount = 0;
return *this;
}
PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(PxU32 color)
{
mColor = color;
return *this;
}
PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(const PxMat44& transform)
{
mTransform = transform;
return *this;
}
PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(const PxTransform& t)
{
mTransform = PxMat44(t);
return *this;
}
PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(const PxVec3& vertexIn)
{
// apply transformation
const PxVec3 vertex = mTransform.transform(vertexIn);
++mVertexCount;
// add primitive to render buffer
switch (mPrim)
{
case POINTS:
mBuffer.addPoint(PxDebugPoint(vertex, mColor)); break;
case LINES:
if (mVertexCount == 2)
{
mBuffer.addLine(PxDebugLine(mVertex0, vertex, mColor));
mVertexCount = 0;
}
break;
case LINESTRIP:
if (mVertexCount >= 2)
mBuffer.addLine(PxDebugLine(mVertex0, vertex, mColor));
break;
case TRIANGLES:
if (mVertexCount == 3)
{
mBuffer.addTriangle(PxDebugTriangle(mVertex1, mVertex0, vertex, mColor));
mVertexCount = 0;
}
break;
case TRIANGLESTRIP:
if (mVertexCount >= 3)
mBuffer.addTriangle(PxDebugTriangle(
(mVertexCount & 0x1) ? mVertex0 : mVertex1,
(mVertexCount & 0x1) ? mVertex1 : mVertex0, vertex, mColor));
break;
}
// cache the last 2 vertices (for strips)
if (1 < mVertexCount)
{
mVertex1 = mVertex0;
mVertex0 = vertex;
}
else
{
mVertex0 = vertex;
}
return *this;
}
PX_INLINE PxDebugLine* PxRenderOutput::reserveSegments(PxU32 nbSegments)
{
return mBuffer.reserveLines(nbSegments);
}
PX_INLINE PxDebugPoint* PxRenderOutput::reservePoints(PxU32 nbPoints)
{
return mBuffer.reservePoints(nbPoints);
}
// PT: using the operators is just too slow.
PX_INLINE void PxRenderOutput::outputSegment(const PxVec3& v0, const PxVec3& v1)
{
PxDebugLine* segment = mBuffer.reserveLines(1);
segment->pos0 = v0;
segment->pos1 = v1;
segment->color0 = segment->color1 = mColor;
}
PX_INLINE PxRenderOutput& PxRenderOutput::outputCapsule(PxF32 radius, PxF32 halfHeight, const PxMat44& absPose)
{
PxRenderOutput& out = *this;
const PxVec3 vleft2(-halfHeight, 0.0f, 0.0f);
PxMat44 left2 = absPose;
left2.column3 += PxVec4(left2.rotate(vleft2), 0.0f);
out << left2 << PxDebugArc(100, radius, PxPi, PxTwoPi);
PxMat44 rotPose = left2;
PxSwap(rotPose.column1, rotPose.column2);
rotPose.column1 = -rotPose.column1;
out << rotPose << PxDebugArc(100, radius, PxPi, PxTwoPi);
PxSwap(rotPose.column0, rotPose.column2);
rotPose.column0 = -rotPose.column0;
out << rotPose << PxDebugCircle(100, radius);
const PxVec3 vright2(halfHeight, 0.0f, 0.0f);
PxMat44 right2 = absPose;
right2.column3 += PxVec4(right2.rotate(vright2), 0.0f);
out << right2 << PxDebugArc(100, radius, 0.0f, PxPi);
rotPose = right2;
PxSwap(rotPose.column1, rotPose.column2);
rotPose.column1 = -rotPose.column1;
out << rotPose << PxDebugArc(100, radius, 0.0f, PxPi);
PxSwap(rotPose.column0, rotPose.column2);
rotPose.column0 = -rotPose.column0;
out << rotPose << PxDebugCircle(100, radius);
out << absPose;
out.outputSegment(absPose.transform(PxVec3(-halfHeight, radius, 0)),
absPose.transform(PxVec3(halfHeight, radius, 0)));
out.outputSegment(absPose.transform(PxVec3(-halfHeight, -radius, 0)),
absPose.transform(PxVec3(halfHeight, -radius, 0)));
out.outputSegment(absPose.transform(PxVec3(-halfHeight, 0, radius)),
absPose.transform(PxVec3(halfHeight, 0, radius)));
out.outputSegment(absPose.transform(PxVec3(-halfHeight, 0, -radius)),
absPose.transform(PxVec3(halfHeight, 0, -radius)));
return *this;
}
#if PX_VC
#pragma warning(pop)
#endif
#if !PX_DOXYGEN
} // namespace physx
#endif
#endif

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_COMMON_NX_SERIAL_FRAMEWORK
#define PX_PHYSICS_COMMON_NX_SERIAL_FRAMEWORK
#ifndef PX_SERIAL_FRAMEWORK_H
#define PX_SERIAL_FRAMEWORK_H
/** \addtogroup common
@{
@@ -48,6 +46,7 @@ class PxSerializationContext;
class PxRepXSerializer;
class PxSerializer;
class PxPhysics;
class PxCollection;
//! Default serialization alignment
#define PX_SERIAL_ALIGN 16
@@ -256,7 +255,7 @@ public:
*/
PX_INLINE void alignExtraData(PxU32 alignment = PX_SERIAL_ALIGN)
{
size_t addr = reinterpret_cast<size_t>(mExtraDataAddress);
size_t addr = size_t(mExtraDataAddress);
addr = (addr+alignment-1)&~size_t(alignment-1);
mExtraDataAddress = reinterpret_cast<PxU8*>(addr);
}
@@ -271,11 +270,13 @@ protected:
/**
\brief Callback type for exporting binary meta data for a serializable type.
\deprecated Binary conversion and binary meta data are deprecated.
@see PxSerializationRegistry::registerBinaryMetaDataCallback
\param stream Stream to store binary meta data.
*/
typedef void (*PxBinaryMetaDataCallback)(PxOutputStream& stream);
typedef PX_DEPRECATED void (*PxBinaryMetaDataCallback)(PxOutputStream& stream);
/**
\brief Class serving as a registry for XML (RepX) and binary serializable types.
@@ -319,13 +320,15 @@ public:
/**
\brief Register binary meta data callback
\deprecated Binary conversion and binary meta data are deprecated.
The callback is executed when calling PxSerialization::dumpBinaryMetaData.
\param callback PxBinaryMetaDataCallback to be registered.
@see PxBinaryMetaDataCallback, PxSerialization::dumpBinaryMetaData
*/
virtual void registerBinaryMetaDataCallback(PxBinaryMetaDataCallback callback) = 0;
PX_DEPRECATED virtual void registerBinaryMetaDataCallback(PxBinaryMetaDataCallback callback) = 0;
/**
\brief Returns PxSerializer corresponding to type

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,11 +22,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_SERIALIZER_H
#define PX_SERIALIZER_H
/** \addtogroup extensions
@@ -36,9 +34,9 @@
#include "foundation/PxAssert.h"
#include "foundation/PxAllocatorCallback.h"
#include "foundation/PxFoundation.h"
#include "common/PxSerialFramework.h"
#include "common/PxCollection.h"
#include "PxFoundation.h"
#if !PX_DOXYGEN
@@ -193,7 +191,7 @@ public:
virtual void exportData(PxBase& obj, PxSerializationContext& s) const
{
PxAllocatorCallback& allocator = PxGetFoundation().getAllocatorCallback();
PxAllocatorCallback& allocator = *PxGetAllocatorCallback();
T* copy = reinterpret_cast<T*>(allocator.allocate(sizeof(T), "TmpAllocExportData", __FILE__, __LINE__));
PxMemCopy(copy, &obj, sizeof(T));
copy->preExportDataReset();
@@ -248,14 +246,14 @@ private:
Note: that the allocator used for creation needs to match with the one used in PX_DELETE_SERIALIZER_ADAPTER.
*/
#define PX_NEW_SERIALIZER_ADAPTER(x) \
*new( PxGetFoundation().getAllocatorCallback().allocate(sizeof(PxSerializerDefaultAdapter<x>), \
*new( PxGetAllocatorCallback()->allocate(sizeof(PxSerializerDefaultAdapter<x>), \
"PxSerializerDefaultAdapter", __FILE__, __LINE__ )) PxSerializerDefaultAdapter<x>(#x)
/**
\brief Preprocessor Macro to simplify adapter deletion.
*/
#define PX_DELETE_SERIALIZER_ADAPTER(x) \
{ PxSerializer* s = x; if (s) { s->~PxSerializer(); PxGetFoundation().getAllocatorCallback().deallocate(s); } }
{ PxSerializer* s = x; if (s) { s->~PxSerializer(); PxGetAllocatorCallback()->deallocate(s); } }
#if !PX_DOXYGEN
} // namespace physx

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,11 +22,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_STRING_TABLE_H
#define PX_STRING_TABLE_H

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_SCALE_H
#define PX_SCALE_H
#ifndef PX_TOLERANCES_SCALE_H
#define PX_TOLERANCES_SCALE_H
/** \addtogroup common
@{
@@ -42,13 +40,11 @@ namespace physx
{
#endif
class PxPhysics;
/**
\brief Class to define the scale at which simulation runs. Most simulation tolerances are
calculated in terms of the values here.
\note if you change the simulation scale, you will probablly also wish to change the scene's
\note if you change the simulation scale, you will probably also wish to change the scene's
default value of gravity, and stable simulation will probably require changes to the scene's
bounceThreshold also.
*/
@@ -57,8 +53,8 @@ class PxTolerancesScale
{
public:
/** brief
The approximate size of objects in the simulation.
/**
\brief The approximate size of objects in the simulation.
For simulating roughly human-sized in metric units, 1 is a good choice.
If simulation is done in centimetres, use 100 instead. This is used to
@@ -66,8 +62,8 @@ public:
*/
PxReal length;
/** brief
The typical magnitude of velocities of objects in simulation. This is used to estimate
/**
\brief The typical magnitude of velocities of objects in simulation. This is used to estimate
whether a contact should be treated as bouncing or resting based on its impact velocity,
and a kinetic energy threshold below which the simulation may put objects to sleep.
@@ -78,8 +74,11 @@ public:
/**
\brief constructor sets to default
\param[in] defaultLength Default length
\param[in] defaultSpeed Default speed
*/
PX_INLINE PxTolerancesScale();
PX_INLINE PxTolerancesScale(float defaultLength=1.0f, float defaultSpeed=10.0f);
/**
\brief Returns true if the descriptor is valid.
@@ -89,9 +88,9 @@ public:
};
PX_INLINE PxTolerancesScale::PxTolerancesScale():
length(1.0f),
speed(10.0f)
PX_INLINE PxTolerancesScale::PxTolerancesScale(float defaultLength, float defaultSpeed) :
length (defaultLength),
speed (defaultSpeed)
{
}

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,12 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_COMMON_PX_TYPEINFO
#define PX_PHYSICS_COMMON_PX_TYPEINFO
#ifndef PX_TYPE_INFO_H
#define PX_TYPE_INFO_H
/** \addtogroup common
@{
@@ -58,22 +57,45 @@ struct PxConcreteType
eHEIGHTFIELD,
eCONVEX_MESH,
eTRIANGLE_MESH_BVH33,
eTRIANGLE_MESH_BVH33, // PX_DEPRECATED
eTRIANGLE_MESH_BVH34,
eTETRAHEDRON_MESH,
eSOFTBODY_MESH,
eRIGID_DYNAMIC,
eRIGID_STATIC,
eSHAPE,
eMATERIAL,
eSOFTBODY_MATERIAL,
eCLOTH_MATERIAL,
ePBD_MATERIAL,
eFLIP_MATERIAL,
eMPM_MATERIAL,
eCUSTOM_MATERIAL,
eCONSTRAINT,
eAGGREGATE,
eARTICULATION,
eARTICULATION_REDUCED_COORDINATE,
eARTICULATION_LINK,
eARTICULATION_JOINT,
eARTICULATION_JOINT_REDUCED_COORDINATE,
eARTICULATION_SENSOR,
eARTICULATION_SPATIAL_TENDON,
eARTICULATION_FIXED_TENDON,
eARTICULATION_ATTACHMENT,
eARTICULATION_TENDON_JOINT,
ePRUNING_STRUCTURE,
eBVH_STRUCTURE,
eBVH,
eSOFT_BODY,
eSOFT_BODY_STATE,
ePBD_PARTICLESYSTEM,
eFLIP_PARTICLESYSTEM,
eMPM_PARTICLESYSTEM,
eCUSTOM_PARTICLESYSTEM,
eFEM_CLOTH,
eHAIR_SYSTEM,
ePARTICLE_BUFFER,
ePARTICLE_DIFFUSE_BUFFER,
ePARTICLE_CLOTH_BUFFER,
ePARTICLE_RIGID_BUFFER,
ePHYSX_CORE_COUNT,
eFIRST_PHYSX_EXTENSION = 256,
@@ -100,10 +122,17 @@ template<typename T> struct PxTypeInfo {};
PX_DEFINE_TYPEINFO(PxBase, PxConcreteType::eUNDEFINED)
PX_DEFINE_TYPEINFO(PxMaterial, PxConcreteType::eMATERIAL)
PX_DEFINE_TYPEINFO(PxFEMSoftBodyMaterial, PxConcreteType::eSOFTBODY_MATERIAL)
PX_DEFINE_TYPEINFO(PxFEMClothMaterial, PxConcreteType::eCLOTH_MATERIAL)
PX_DEFINE_TYPEINFO(PxPBDMaterial, PxConcreteType::ePBD_MATERIAL)
PX_DEFINE_TYPEINFO(PxFLIPMaterial, PxConcreteType::eFLIP_MATERIAL)
PX_DEFINE_TYPEINFO(PxMPMMaterial, PxConcreteType::eMPM_MATERIAL)
PX_DEFINE_TYPEINFO(PxCustomMaterial, PxConcreteType::eCUSTOM_MATERIAL)
PX_DEFINE_TYPEINFO(PxConvexMesh, PxConcreteType::eCONVEX_MESH)
PX_DEFINE_TYPEINFO(PxTriangleMesh, PxConcreteType::eUNDEFINED)
PX_DEFINE_TYPEINFO(PxBVH33TriangleMesh, PxConcreteType::eTRIANGLE_MESH_BVH33)
PX_DEFINE_TYPEINFO(PxBVH34TriangleMesh, PxConcreteType::eTRIANGLE_MESH_BVH34)
PX_DEFINE_TYPEINFO(PxTetrahedronMesh, PxConcreteType::eTETRAHEDRON_MESH)
PX_DEFINE_TYPEINFO(PxHeightField, PxConcreteType::eHEIGHTFIELD)
PX_DEFINE_TYPEINFO(PxActor, PxConcreteType::eUNDEFINED)
PX_DEFINE_TYPEINFO(PxRigidActor, PxConcreteType::eUNDEFINED)
@@ -111,14 +140,24 @@ PX_DEFINE_TYPEINFO(PxRigidBody, PxConcreteType::eUNDEFINED)
PX_DEFINE_TYPEINFO(PxRigidDynamic, PxConcreteType::eRIGID_DYNAMIC)
PX_DEFINE_TYPEINFO(PxRigidStatic, PxConcreteType::eRIGID_STATIC)
PX_DEFINE_TYPEINFO(PxArticulationLink, PxConcreteType::eARTICULATION_LINK)
PX_DEFINE_TYPEINFO(PxArticulationJoint, PxConcreteType::eARTICULATION_JOINT)
PX_DEFINE_TYPEINFO(PxArticulationJointReducedCoordinate, PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE)
PX_DEFINE_TYPEINFO(PxArticulation, PxConcreteType::eARTICULATION)
PX_DEFINE_TYPEINFO(PxArticulationReducedCoordinate, PxConcreteType::eARTICULATION_REDUCED_COORDINATE)
PX_DEFINE_TYPEINFO(PxAggregate, PxConcreteType::eAGGREGATE)
PX_DEFINE_TYPEINFO(PxConstraint, PxConcreteType::eCONSTRAINT)
PX_DEFINE_TYPEINFO(PxShape, PxConcreteType::eSHAPE)
PX_DEFINE_TYPEINFO(PxPruningStructure, PxConcreteType::ePRUNING_STRUCTURE)
PX_DEFINE_TYPEINFO(PxParticleSystem, PxConcreteType::eUNDEFINED)
PX_DEFINE_TYPEINFO(PxPBDParticleSystem, PxConcreteType::ePBD_PARTICLESYSTEM)
PX_DEFINE_TYPEINFO(PxFLIPParticleSystem, PxConcreteType::eFLIP_PARTICLESYSTEM)
PX_DEFINE_TYPEINFO(PxMPMParticleSystem, PxConcreteType::eMPM_PARTICLESYSTEM)
PX_DEFINE_TYPEINFO(PxCustomParticleSystem, PxConcreteType::eCUSTOM_PARTICLESYSTEM)
PX_DEFINE_TYPEINFO(PxSoftBody, PxConcreteType::eSOFT_BODY)
PX_DEFINE_TYPEINFO(PxFEMCloth, PxConcreteType::eFEM_CLOTH)
PX_DEFINE_TYPEINFO(PxHairSystem, PxConcreteType::eHAIR_SYSTEM)
PX_DEFINE_TYPEINFO(PxParticleBuffer, PxConcreteType::ePARTICLE_BUFFER)
PX_DEFINE_TYPEINFO(PxParticleAndDiffuseBuffer, PxConcreteType::ePARTICLE_DIFFUSE_BUFFER)
PX_DEFINE_TYPEINFO(PxParticleClothBuffer, PxConcreteType::ePARTICLE_CLOTH_BUFFER)
PX_DEFINE_TYPEINFO(PxParticleRigidBuffer, PxConcreteType::ePARTICLE_RIGID_BUFFER)
#if !PX_DOXYGEN
} // namespace physx

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -23,13 +22,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_DELAY_LOAD_HOOK
#define PX_PHYSICS_DELAY_LOAD_HOOK
#ifndef PX_WINDOWS_DELAY_LOAD_HOOK_H
#define PX_WINDOWS_DELAY_LOAD_HOOK_H
#include "foundation/PxPreprocessor.h"
#include "common/PxPhysXCommonConfig.h"