aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Include
diff options
context:
space:
mode:
authorsschirm <[email protected]>2016-12-23 14:20:36 +0100
committersschirm <[email protected]>2016-12-23 14:56:17 +0100
commitef6937e69e8ee3f409cf9d460d5ad300a65d5924 (patch)
tree710426e8daa605551ce3f34b581897011101c30f /PhysX_3.4/Include
parentInitial commit: (diff)
downloadphysx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.tar.xz
physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.zip
PhysX 3.4 / APEX 1.4 release candidate @21506124
Diffstat (limited to 'PhysX_3.4/Include')
-rw-r--r--PhysX_3.4/Include/PxPhysics.h2
-rw-r--r--PhysX_3.4/Include/PxRigidDynamic.h2
-rw-r--r--PhysX_3.4/Include/PxScene.h2
-rw-r--r--PhysX_3.4/Include/PxSceneDesc.h26
-rw-r--r--PhysX_3.4/Include/collision/PxCollisionDefs.h2
-rw-r--r--PhysX_3.4/Include/common/PxCoreUtilityTypes.h7
-rw-r--r--PhysX_3.4/Include/extensions/PxMassProperties.h17
-rw-r--r--PhysX_3.4/Include/gpu/PxGpu.h35
-rw-r--r--PhysX_3.4/Include/pvd/PxPvdSceneClient.h8
-rw-r--r--PhysX_3.4/Include/solver/PxSolverDefs.h4
10 files changed, 70 insertions, 35 deletions
diff --git a/PhysX_3.4/Include/PxPhysics.h b/PhysX_3.4/Include/PxPhysics.h
index 197fbe6a..8943a390 100644
--- a/PhysX_3.4/Include/PxPhysics.h
+++ b/PhysX_3.4/Include/PxPhysics.h
@@ -661,7 +661,7 @@ public:
/**
\brief Gets PxPhysics object insertion interface.
- The insertion interface is needed ie. for PxCooking::createTriangleMesh, this allows runtime mesh creation. This is not adviced to do, please
+ The insertion interface is needed ie. for PxCooking::createTriangleMesh, this allows runtime mesh creation. This is not advised to do, please
use offline cooking if possible.
@see PxCooking::createTriangleMesh PxCooking::createHeightfield
diff --git a/PhysX_3.4/Include/PxRigidDynamic.h b/PhysX_3.4/Include/PxRigidDynamic.h
index 4e5577b8..7df1cf9c 100644
--- a/PhysX_3.4/Include/PxRigidDynamic.h
+++ b/PhysX_3.4/Include/PxRigidDynamic.h
@@ -125,7 +125,7 @@ public:
@see setKinematicTarget() PxRigidBodyFlag setRigidBodyFlag()
*/
- virtual bool getKinematicTarget(PxTransform& target) = 0;
+ virtual bool getKinematicTarget(PxTransform& target) const = 0;
/************************************************************************************************/
/** @name Damping
diff --git a/PhysX_3.4/Include/PxScene.h b/PhysX_3.4/Include/PxScene.h
index e535a125..46f5bb8d 100644
--- a/PhysX_3.4/Include/PxScene.h
+++ b/PhysX_3.4/Include/PxScene.h
@@ -1295,7 +1295,7 @@ class PxScene
\return the box to which the geometry will be culled.
@see setVisualizationParameter setVisualizationCullingBox
*/
- virtual const PxBounds3& getVisualizationCullingBox() const = 0;
+ virtual PxBounds3 getVisualizationCullingBox() const = 0;
/**
\brief Retrieves the render buffer.
diff --git a/PhysX_3.4/Include/PxSceneDesc.h b/PhysX_3.4/Include/PxSceneDesc.h
index 1060fcb8..56b13ed7 100644
--- a/PhysX_3.4/Include/PxSceneDesc.h
+++ b/PhysX_3.4/Include/PxSceneDesc.h
@@ -457,7 +457,6 @@ struct PxgDynamicsMemoryConfig
PxU32 heapCapacity; //!< Initial capacity of the GPU and pinned host memory heaps. Additional memory will be allocated if more memory is required.
PxU32 foundLostPairsCapacity; //!< Capacity of found and lost buffers allocated in GPU global memory. This is used for the found/lost pair reports in the BP.
-
PxgDynamicsMemoryConfig() :
constraintBufferCapacity(32 * 1024 * 1024),
contactBufferCapacity(24 * 1024 * 1024),
@@ -595,7 +594,6 @@ public:
*/
PxSceneLimits limits;
-
/**
\brief Selects the friction algorithm to use for simulation.
@@ -784,7 +782,6 @@ public:
*/
PxU32 ccdMaxPasses;
-
/**
\brief The wake counter reset value
@@ -797,7 +794,6 @@ public:
*/
PxReal wakeCounterResetValue;
-
/**
\brief The bounds used to sanity check user-set positions of actors and articulation links
@@ -809,18 +805,15 @@ public:
*/
PxBounds3 sanityBounds;
-
/**
\brief The pre-allocations performed in the GPU dynamics pipeline.
*/
-
PxgDynamicsMemoryConfig gpuDynamicsConfig;
/**
\brief Limitation for the partitions in the GPU dynamics pipeline.
This variable must be power of 2.
*/
-
PxU32 gpuMaxNumPartitions;
/**
@@ -828,8 +821,6 @@ public:
*/
PxU32 gpuComputeVersion;
-
-
private:
/**
\cond
@@ -914,8 +905,7 @@ PX_INLINE PxSceneDesc::PxSceneDesc(const PxTolerancesScale& scale):
contactReportStreamBufferSize (8192),
ccdMaxPasses (1),
wakeCounterResetValue (20.0f*0.02f),
- sanityBounds (PxBounds3(PxVec3(-PX_MAX_BOUNDS_EXTENTS, -PX_MAX_BOUNDS_EXTENTS, -PX_MAX_BOUNDS_EXTENTS),
- PxVec3(PX_MAX_BOUNDS_EXTENTS, PX_MAX_BOUNDS_EXTENTS, PX_MAX_BOUNDS_EXTENTS))),
+ sanityBounds (PxBounds3(PxVec3(-PX_MAX_BOUNDS_EXTENTS), PxVec3(PX_MAX_BOUNDS_EXTENTS))),
#if PX_SUPPORT_GPU_PHYSX
gpuMaxNumPartitions (8),
gpuComputeVersion (0),
@@ -931,7 +921,7 @@ PX_INLINE void PxSceneDesc::setToDefault(const PxTolerancesScale& scale)
PX_INLINE bool PxSceneDesc::isValid() const
{
- if(filterShader == NULL)
+ if(!filterShader)
return false;
if( ((filterShaderDataSize == 0) && (filterShaderData != NULL)) ||
@@ -949,21 +939,21 @@ PX_INLINE bool PxSceneDesc::isValid() const
if(bounceThresholdVelocity < 0.0f)
return false;
- if(frictionOffsetThreshold < 0.f)
+ if(frictionOffsetThreshold < 0.0f)
return false;
- if (ccdMaxSeparation < 0.f)
+ if(ccdMaxSeparation < 0.0f)
return false;
- if(cpuDispatcher == NULL)
+ if(!cpuDispatcher)
return false;
- if(contactReportStreamBufferSize == 0)
+ if(!contactReportStreamBufferSize)
return false;
if(maxNbContactDataBlocks < nbContactDataBlocks)
return false;
- if (wakeCounterResetValue <= 0.0f)
+ if(wakeCounterResetValue <= 0.0f)
return false;
//Adaptive force and stabilization are incompatible. You can only have one or the other
@@ -975,7 +965,7 @@ PX_INLINE bool PxSceneDesc::isValid() const
#if PX_SUPPORT_GPU_PHYSX
//gpuMaxNumPartitions must be power of 2
- if ((gpuMaxNumPartitions&(gpuMaxNumPartitions - 1)) != 0)
+ if((gpuMaxNumPartitions&(gpuMaxNumPartitions - 1)) != 0)
return false;
#endif
diff --git a/PhysX_3.4/Include/collision/PxCollisionDefs.h b/PhysX_3.4/Include/collision/PxCollisionDefs.h
index a15fa033..ae33d346 100644
--- a/PhysX_3.4/Include/collision/PxCollisionDefs.h
+++ b/PhysX_3.4/Include/collision/PxCollisionDefs.h
@@ -70,7 +70,7 @@ namespace physx
for a given pair to improve contact generation performance. It is the application's responsibility to release this memory appropriately. If the memory is released, the application must ensure that
this memory is no longer referenced by any PxCache objects passed to PxGenerateContacts.
\param byteSize The size of the allocation in bytes
- \return the newly-allocated memory
+ \return the newly-allocated memory. The returned address must be 16-byte aligned.
*/
virtual PxU8* allocateCacheData(const PxU32 byteSize) = 0;
diff --git a/PhysX_3.4/Include/common/PxCoreUtilityTypes.h b/PhysX_3.4/Include/common/PxCoreUtilityTypes.h
index b8ca488d..8ce1a211 100644
--- a/PhysX_3.4/Include/common/PxCoreUtilityTypes.h
+++ b/PhysX_3.4/Include/common/PxCoreUtilityTypes.h
@@ -35,6 +35,7 @@
*/
#include "foundation/PxAssert.h"
+#include "foundation/PxMemory.h"
#if !PX_DOXYGEN
namespace physx
@@ -115,13 +116,13 @@ public:
PxFixedSizeLookupTable(const PxReal* dataPairs, const PxU32 numDataPairs)
{
- memcpy(mDataPairs,dataPairs,sizeof(PxReal)*2*numDataPairs);
+ PxMemCopy(mDataPairs,dataPairs,sizeof(PxReal)*2*numDataPairs);
mNbDataPairs=numDataPairs;
}
PxFixedSizeLookupTable(const PxFixedSizeLookupTable& src)
{
- memcpy(mDataPairs,src.mDataPairs,sizeof(PxReal)*2*src.mNbDataPairs);
+ PxMemCopy(mDataPairs,src.mDataPairs,sizeof(PxReal)*2*src.mNbDataPairs);
mNbDataPairs=src.mNbDataPairs;
}
@@ -131,7 +132,7 @@ public:
PxFixedSizeLookupTable& operator=(const PxFixedSizeLookupTable& src)
{
- memcpy(mDataPairs,src.mDataPairs,sizeof(PxReal)*2*src.mNbDataPairs);
+ PxMemCopy(mDataPairs,src.mDataPairs,sizeof(PxReal)*2*src.mNbDataPairs);
mNbDataPairs=src.mNbDataPairs;
return *this;
}
diff --git a/PhysX_3.4/Include/extensions/PxMassProperties.h b/PhysX_3.4/Include/extensions/PxMassProperties.h
index db978b39..87f823b6 100644
--- a/PhysX_3.4/Include/extensions/PxMassProperties.h
+++ b/PhysX_3.4/Include/extensions/PxMassProperties.h
@@ -98,7 +98,7 @@ public:
const PxBoxGeometry& b = static_cast<const PxBoxGeometry&>(geometry);
mass = b.halfExtents.x * b.halfExtents.y * b.halfExtents.z * 8.0f;
PxVec3 d2 = b.halfExtents.multiply(b.halfExtents);
- inertiaTensor = PxMat33::createDiagonal(PxVec3(d2.y + d2.z, d2.x + d2.z, d2.x + d2.y)) * (mass * 2.0f / 3.0f);
+ inertiaTensor = PxMat33::createDiagonal(PxVec3(d2.y + d2.z, d2.x + d2.z, d2.x + d2.y)) * (mass * 1.0f / 3.0f);
centerOfMass = PxVec3(0.0f);
}
break;
@@ -120,14 +120,23 @@ public:
{
const PxConvexMeshGeometry& c = static_cast<const PxConvexMeshGeometry&>(geometry);
PxVec3 unscaledCoM;
- PxMat33 unscaledInertiaTensor;
+ PxMat33 unscaledInertiaTensorNonCOM; // inertia tensor of convex mesh in mesh local space
+ PxMat33 unscaledInertiaTensorCOM;
PxReal unscaledMass;
- c.convexMesh->getMassInformation(unscaledMass, unscaledInertiaTensor, unscaledCoM);
+ c.convexMesh->getMassInformation(unscaledMass, unscaledInertiaTensorNonCOM, unscaledCoM);
+
+ // inertia tensor relative to center of mass
+ unscaledInertiaTensorCOM[0][0] = unscaledInertiaTensorNonCOM[0][0] - unscaledMass*PxReal((unscaledCoM.y*unscaledCoM.y+unscaledCoM.z*unscaledCoM.z));
+ unscaledInertiaTensorCOM[1][1] = unscaledInertiaTensorNonCOM[1][1] - unscaledMass*PxReal((unscaledCoM.z*unscaledCoM.z+unscaledCoM.x*unscaledCoM.x));
+ unscaledInertiaTensorCOM[2][2] = unscaledInertiaTensorNonCOM[2][2] - unscaledMass*PxReal((unscaledCoM.x*unscaledCoM.x+unscaledCoM.y*unscaledCoM.y));
+ unscaledInertiaTensorCOM[0][1] = unscaledInertiaTensorCOM[1][0] = (unscaledInertiaTensorNonCOM[0][1] + unscaledMass*PxReal(unscaledCoM.x*unscaledCoM.y));
+ unscaledInertiaTensorCOM[1][2] = unscaledInertiaTensorCOM[2][1] = (unscaledInertiaTensorNonCOM[1][2] + unscaledMass*PxReal(unscaledCoM.y*unscaledCoM.z));
+ unscaledInertiaTensorCOM[0][2] = unscaledInertiaTensorCOM[2][0] = (unscaledInertiaTensorNonCOM[0][2] + unscaledMass*PxReal(unscaledCoM.z*unscaledCoM.x));
const PxMeshScale& s = c.scale;
mass = unscaledMass * s.scale.x * s.scale.y * s.scale.z;
centerOfMass = s.rotation.rotate(s.scale.multiply(s.rotation.rotateInv(unscaledCoM)));
- inertiaTensor = scaleInertia(unscaledInertiaTensor, s.rotation, s.scale);
+ inertiaTensor = scaleInertia(unscaledInertiaTensorCOM, s.rotation, s.scale);
}
break;
diff --git a/PhysX_3.4/Include/gpu/PxGpu.h b/PhysX_3.4/Include/gpu/PxGpu.h
index 0b8bf758..7efe3fe8 100644
--- a/PhysX_3.4/Include/gpu/PxGpu.h
+++ b/PhysX_3.4/Include/gpu/PxGpu.h
@@ -42,6 +42,41 @@
#include "foundation/PxFoundation.h"
/**
+\brief PxGpuLoadHook
+
+This is a helper class for loading the PhysXGpu dll.
+If a PhysXGpu dll with a non-default file name needs to be loaded,
+PxGpuLoadHook can be sub-classed to provide the custom filenames.
+
+Once the names are set, the instance must be set for use by PhysX.dll using PxSetPhysXGpuLoadHook(),
+
+@see PxSetPhysXGpuLoadHook()
+*/
+class PxGpuLoadHook
+{
+public:
+ PxGpuLoadHook() {}
+ virtual ~PxGpuLoadHook() {}
+
+ virtual const char* getPhysXGpuDEBUGDllName() const = 0;
+ virtual const char* getPhysXGpuCHECKEDDllName() const = 0;
+ virtual const char* getPhysXGpuPROFILEDllName() const = 0;
+ virtual const char* getPhysXGpuDllName() const = 0;
+
+protected:
+private:
+};
+
+/**
+\brief Sets GPU load hook instance for PhysX dll.
+
+\param[in] hook GPU load hook.
+
+@see PxGpuLoadHook
+*/
+PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxSetPhysXGpuLoadHook(const PxGpuLoadHook* hook);
+
+/**
* \brief Ask the NVIDIA control panel which GPU has been selected for use by
* PhysX. Returns -1 if no PhysX capable GPU is found or GPU PhysX has
* been disabled.
diff --git a/PhysX_3.4/Include/pvd/PxPvdSceneClient.h b/PhysX_3.4/Include/pvd/PxPvdSceneClient.h
index 37eadc5b..b7e24143 100644
--- a/PhysX_3.4/Include/pvd/PxPvdSceneClient.h
+++ b/PhysX_3.4/Include/pvd/PxPvdSceneClient.h
@@ -54,15 +54,15 @@ namespace physx
#endif
/**
-\brief PVD scene Flags.
+\brief PVD scene Flags. They are disabled by default, and only works if PxPvdInstrumentationFlag::eDEBUG is set.
*/
struct PxPvdSceneFlag
{
enum Enum
{
- eTRANSMIT_CONTACTS = (1 << 0), //! Transmits contact stream to PVD. Disabled by default.
- eTRANSMIT_SCENEQUERIES = (1 << 1), //! Transmits scene query stream to PVD. Disabled by default.
- eTRANSMIT_CONSTRAINTS = (1 << 2) //! Transmits constraints visualize stream to PVD. Disabled by default.
+ eTRANSMIT_CONTACTS = (1 << 0), //! Transmits contact stream to PVD.
+ eTRANSMIT_SCENEQUERIES = (1 << 1), //! Transmits scene query stream to PVD.
+ eTRANSMIT_CONSTRAINTS = (1 << 2) //! Transmits constraints visualize stream to PVD.
};
};
diff --git a/PhysX_3.4/Include/solver/PxSolverDefs.h b/PhysX_3.4/Include/solver/PxSolverDefs.h
index 670ca855..0b6b1c31 100644
--- a/PhysX_3.4/Include/solver/PxSolverDefs.h
+++ b/PhysX_3.4/Include/solver/PxSolverDefs.h
@@ -230,14 +230,14 @@ public:
/**
\brief Allocates constraint data. It is the application's responsibility to release this memory after PxSolveConstraints has completed.
\param[in] byteSize Allocation size in bytes
- \return the allocated memory
+ \return the allocated memory. This address must be 16-byte aligned.
*/
virtual PxU8* reserveConstraintData(const PxU32 byteSize) = 0;
/**
\brief Allocates friction data. Friction data can be retained by the application for a given pair and provided as an input to PxSolverContactDesc to improve simulation stability.
It is the application's responsibility to release this memory. If this memory is released, the application should ensure it does not pass pointers to this memory to PxSolverContactDesc.
\param[in] byteSize Allocation size in bytes
- \return the allocated memory
+ \return the allocated memory. This address must be 4-byte aligned.
*/
virtual PxU8* reserveFrictionData(const PxU32 byteSize) = 0;