diff options
| author | git perforce import user <a@b> | 2016-10-25 12:29:14 -0600 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees> | 2016-10-25 18:56:37 -0500 |
| commit | 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch) | |
| tree | fa6485c169e50d7415a651bf838f5bcd0fd3bfbd /PhysX_3.4/Source/LowLevel/API/include | |
| download | physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip | |
Initial commit:
PhysX 3.4.0 Update @ 21294896
APEX 1.4.0 Update @ 21275617
[CL 21300167]
Diffstat (limited to 'PhysX_3.4/Source/LowLevel/API/include')
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/API/include/PxsMaterialCore.h | 166 | ||||
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/API/include/PxsMaterialManager.h | 149 | ||||
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/API/include/PxvConfig.h | 47 | ||||
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/API/include/PxvContext.h | 73 | ||||
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/API/include/PxvDynamics.h | 157 | ||||
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/API/include/PxvGeometry.h | 94 | ||||
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/API/include/PxvGlobals.h | 118 | ||||
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/API/include/PxvManager.h | 239 | ||||
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/API/include/PxvSimStats.h | 114 |
9 files changed, 1157 insertions, 0 deletions
diff --git a/PhysX_3.4/Source/LowLevel/API/include/PxsMaterialCore.h b/PhysX_3.4/Source/LowLevel/API/include/PxsMaterialCore.h new file mode 100644 index 00000000..20562783 --- /dev/null +++ b/PhysX_3.4/Source/LowLevel/API/include/PxsMaterialCore.h @@ -0,0 +1,166 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 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_H +#define PXS_MATERIAL_H + +#include "foundation/PxVec3.h" +#include "PxMaterial.h" +#include "PsUserAllocated.h" +#include "CmPhysXCommon.h" +#include "PxMetaData.h" +#include "PsUtilities.h" + +namespace physx +{ + +#define MATERIAL_INVALID_HANDLE 0xffffffff + + //PX_ALIGN_PREFIX(16) struct PxsMaterialData + //{ + // PxReal dynamicFriction; + // PxReal staticFriction; + // PxReal restitution; + // PxReal dynamicFrictionV; + // PxReal staticFrictionV; + // PxVec3 dirOfAnisotropy;//might need to get rid of this + // PxCombineMode::Enum frictionCombineMode; + // PxCombineMode::Enum restitutionCombineMode; + + // PxMaterialFlags flags; + // PxU8 paddingFromFlags[2]; + // PxU32 pads; + + // PxsMaterialData() + // : dynamicFriction(0.0) + // , staticFriction(0.0f) + // , restitution(0.0f) + // , dynamicFrictionV(0.0f) + // , staticFrictionV(0.0f) + // , dirOfAnisotropy(1,0,0) + // , frictionCombineMode(PxCombineMode::eAVERAGE) + // , restitutionCombineMode(PxCombineMode::eAVERAGE) + // {} + + // PX_FORCE_INLINE PxCombineMode::Enum getFrictionCombineMode() const + // { + // return frictionCombineMode; + // } + + // + // PX_FORCE_INLINE PxCombineMode::Enum getRestitutionCombineMode() const + // { + // return restitutionCombineMode; + // } + + // PX_FORCE_INLINE void setFrictionCombineMode(PxCombineMode::Enum frictionFlags) + // { + // frictionCombineMode = frictionFlags; + // } + + // PX_FORCE_INLINE void setRestitutionCombineMode(PxCombineMode::Enum restitutionFlags) + // { + // restitutionCombineMode = restitutionFlags; + // } + + //}PX_ALIGN_SUFFIX(16); + + PX_ALIGN_PREFIX(16) struct PxsMaterialData + { + PxReal dynamicFriction; //4 + PxReal staticFriction; //8 + PxReal restitution; //12 + PxMaterialFlags flags; //14 + PxU8 fricRestCombineMode; //15 + PxU8 padding; //16 + + PxsMaterialData() + : dynamicFriction(0.0) + , staticFriction(0.0f) + , restitution(0.0f) + , fricRestCombineMode((PxCombineMode::eAVERAGE << 4) | PxCombineMode::eAVERAGE) + {} + + PxsMaterialData(const PxEMPTY) {} + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxCombineMode::Enum getFrictionCombineMode() const + { + return PxCombineMode::Enum(fricRestCombineMode >> 4); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxCombineMode::Enum getRestitutionCombineMode() const + { + return PxCombineMode::Enum(fricRestCombineMode & 0xf); + } + + PX_FORCE_INLINE void setFrictionCombineMode(PxCombineMode::Enum frictionFlags) + { + fricRestCombineMode = Ps::to8((fricRestCombineMode & 0xf) | (frictionFlags << 4)); + } + + PX_FORCE_INLINE void setRestitutionCombineMode(PxCombineMode::Enum restitutionFlags) + { + fricRestCombineMode = Ps::to8((fricRestCombineMode & 0xf0) | (restitutionFlags)); + } + + }PX_ALIGN_SUFFIX(16); + + + class PxsMaterialCore : public PxsMaterialData, public Ps::UserAllocated + { + public: + + PxsMaterialCore(const PxsMaterialData& desc): PxsMaterialData(desc), mNxMaterial(0), mMaterialIndex(MATERIAL_INVALID_HANDLE) + { + } + + PxsMaterialCore(): mNxMaterial(0), mMaterialIndex(MATERIAL_INVALID_HANDLE) + { + } + + PxsMaterialCore(const PxEMPTY) : PxsMaterialData(PxEmpty) {} + + ~PxsMaterialCore() + { + } + + PX_FORCE_INLINE void setNxMaterial(PxMaterial* m) { mNxMaterial = m; } + PX_FORCE_INLINE PxMaterial* getNxMaterial() const { return mNxMaterial; } + PX_FORCE_INLINE void setMaterialIndex(const PxU32 materialIndex) { mMaterialIndex = materialIndex; } + PX_FORCE_INLINE PxU32 getMaterialIndex() const { return mMaterialIndex; } + + protected: + PxMaterial* mNxMaterial; + PxU32 mMaterialIndex; //handle assign by the handle manager + }; + +} //namespace phyxs + +#endif diff --git a/PhysX_3.4/Source/LowLevel/API/include/PxsMaterialManager.h b/PhysX_3.4/Source/LowLevel/API/include/PxsMaterialManager.h new file mode 100644 index 00000000..c3e6bd9e --- /dev/null +++ b/PhysX_3.4/Source/LowLevel/API/include/PxsMaterialManager.h @@ -0,0 +1,149 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 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_MATERIALMANAGER +#define PXS_MATERIALMANAGER + +#include "PxsMaterialCore.h" +#include "PsAlignedMalloc.h" + +namespace physx +{ + struct PxsMaterialInfo + { + PxU16 mMaterialIndex0; + PxU16 mMaterialIndex1; + }; + + class PxsMaterialManager + { + public: + PxsMaterialManager() + { + const PxU32 matCount = 128; + materials = reinterpret_cast<PxsMaterialCore*>(physx::shdfnd::AlignedAllocator<16>().allocate(sizeof(PxsMaterialCore)*matCount, __FILE__, __LINE__)); + maxMaterials = matCount; + for(PxU32 i=0; i<matCount; ++i) + { + materials[i].setMaterialIndex(MATERIAL_INVALID_HANDLE); + } + } + + ~PxsMaterialManager() + { + physx::shdfnd::AlignedAllocator<16>().deallocate(materials); + } + + void setMaterial(PxsMaterialCore* mat) + { + const PxU32 materialIndex = mat->getMaterialIndex(); + resize(materialIndex+1); + materials[materialIndex] = *mat; + } + + void updateMaterial(PxsMaterialCore* mat) + { + materials[mat->getMaterialIndex()] =*mat; + } + + void removeMaterial(PxsMaterialCore* mat) + { + mat->setMaterialIndex(MATERIAL_INVALID_HANDLE); + } + + PX_FORCE_INLINE PxsMaterialCore* 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; + PxsMaterialCore* mat = reinterpret_cast<PxsMaterialCore*>(physx::shdfnd::AlignedAllocator<16>().allocate(sizeof(PxsMaterialCore)*maxMaterials, __FILE__, __LINE__)); + for(PxU32 i=0; i<numMaterials; ++i) + { + mat[i] = materials[i]; + } + for(PxU32 i = numMaterials; i < maxMaterials; ++i) + { + mat[i].setMaterialIndex(MATERIAL_INVALID_HANDLE); + } + + physx::shdfnd::AlignedAllocator<16>().deallocate(materials); + + materials = mat; + } + + PxsMaterialCore* materials;//make sure materials's start address is 16 bytes align + PxU32 maxMaterials; + PxU32 mPad[2]; + }; + + class PxsMaterialManagerIterator + { + + public: + PxsMaterialManagerIterator(PxsMaterialManager& manager) : mManager(manager), mIndex(0) + { + } + + bool getNextMaterial(PxsMaterialCore*& materialCore) + { + const PxU32 maxSize = mManager.getMaxSize(); + PxU32 index = mIndex; + while(index < maxSize && mManager.getMaterial(index)->getMaterialIndex() == MATERIAL_INVALID_HANDLE) + index++; + materialCore = NULL; + if(index < maxSize) + materialCore = mManager.getMaterial(index++); + mIndex = index; + return materialCore!=NULL; + } + + private: + PxsMaterialManagerIterator& operator=(const PxsMaterialManagerIterator&); + PxsMaterialManager& mManager; + PxU32 mIndex; + }; + +} + +#endif diff --git a/PhysX_3.4/Source/LowLevel/API/include/PxvConfig.h b/PhysX_3.4/Source/LowLevel/API/include/PxvConfig.h new file mode 100644 index 00000000..cbac7a7c --- /dev/null +++ b/PhysX_3.4/Source/LowLevel/API/include/PxvConfig.h @@ -0,0 +1,47 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 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 PXD_CONFIG_H +#define PXD_CONFIG_H + +/*! \file internal top level include file for lowlevel. */ + +#include "CmPhysXCommon.h" +#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 diff --git a/PhysX_3.4/Source/LowLevel/API/include/PxvContext.h b/PhysX_3.4/Source/LowLevel/API/include/PxvContext.h new file mode 100644 index 00000000..b37dbaf3 --- /dev/null +++ b/PhysX_3.4/Source/LowLevel/API/include/PxvContext.h @@ -0,0 +1,73 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 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_CONTEXT_H +#define PXV_CONTEXT_H + +#include "task/PxTask.h" +#include "PxvGlobals.h" +#include "PxvSimStats.h" + +namespace physx +{ + +class PxsContext; + +class PxContactModifyCallback; +class PxsRigidBody; +struct PxsBodyCore; +class PxvParticleSystemSim; +class BroadPhase; + +class PxsContactManager; +struct PxvManagerDescRigidRigid; +struct PxvContactManagerTouchEvent; + +/*! +\file +Context handling +*/ + +/************************************************************************/ +/* Context handling, types */ +/************************************************************************/ + +enum PxvContextProperty +{ + /** + Float value for sweep epsilon distance. Default is 0. (not a good idea to leave unchanged) + */ + PXD_CONTEXT_SWEEP_EPSILON_DISTANCE + +}; + +} + +#endif diff --git a/PhysX_3.4/Source/LowLevel/API/include/PxvDynamics.h b/PhysX_3.4/Source/LowLevel/API/include/PxvDynamics.h new file mode 100644 index 00000000..a5085994 --- /dev/null +++ b/PhysX_3.4/Source/LowLevel/API/include/PxvDynamics.h @@ -0,0 +1,157 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 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 "PsIntrinsics.h" +#include "PxRigidDynamic.h" + +namespace physx +{ + +/*! +\file +Dynamics interface. +*/ + +/************************************************************************/ +/* Atoms */ +/************************************************************************/ + +class PxsContext; +class PxsRigidBody; +class PxShape; +class PxGeometry; +struct PxsShapeCore; + + +struct PxsRigidCore +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + + PxsRigidCore() : mFlags(0), mIdtBody2Actor(0) {} + PxsRigidCore(const PxEMPTY) : mFlags(PxEmpty) {} + + PX_ALIGN_PREFIX(16) + PxTransform body2World PX_ALIGN_SUFFIX(16); + PxRigidBodyFlags mFlags; // API body flags + PxU8 mIdtBody2Actor; // PT: true if PxsBodyCore::body2Actor is identity + 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_COMPILE_TIME_ASSERT(sizeof(PxsRigidCore) == 32); + + +struct PxsBodyCore: public PxsRigidCore +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + + PxsBodyCore() : PxsRigidCore() {} + PxsBodyCore(const PxEMPTY) : PxsRigidCore(PxEmpty) {} + + PX_FORCE_INLINE const PxTransform& getBody2Actor() const { return body2Actor; } + PX_FORCE_INLINE void setBody2Actor(const PxTransform& t) + { + mIdtBody2Actor = PxU8(t.p.isZero() && t.q.isIdentity()); + + 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; + PxReal freezeThreshold; + 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; + PxU32 numBodyInteractions; //Used by adaptive force to keep track of the total number of body interactions + PxU16 isFastMoving; //This could be a single bit but it's a u32 at the moment for simplicity's sake + PxRigidDynamicLockFlags lockFlags; //160 This could be a u8 but it is a u32 for simplicity's sake. All fits into 16 byte alignment + + PX_FORCE_INLINE bool shouldCreateContactReports() const + { + const PxU32* binary = reinterpret_cast<const PxU32*>(&contactReportThreshold); + return *binary != 0x7f7fffff; // PX_MAX_REAL + } +}; + +PX_COMPILE_TIME_ASSERT(sizeof(PxsBodyCore) == 160); + + +} + +#endif diff --git a/PhysX_3.4/Source/LowLevel/API/include/PxvGeometry.h b/PhysX_3.4/Source/LowLevel/API/include/PxvGeometry.h new file mode 100644 index 00000000..5ddf3ab8 --- /dev/null +++ b/PhysX_3.4/Source/LowLevel/API/include/PxvGeometry.h @@ -0,0 +1,94 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 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" + +namespace physx +{ + +class PxsRigidBody; +class PxvParticleSystem; + +namespace Gu +{ + struct ConvexHullData; + class TriangleMesh; + struct HeightFieldData; +} + +} + +/*! +\file +Geometry interface +*/ + +/************************************************************************/ +/* Shapes */ +/************************************************************************/ + +// moved to +#include "GuGeometryUnion.h" + +namespace physx +{ + +struct PxsShapeCore +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + +// PX_SERIALIZATION + PxsShapeCore() {} + PxsShapeCore(const PxEMPTY) : geometry(PxEmpty) {} +//~PX_SERIALIZATION + + PX_ALIGN_PREFIX(16) + PxTransform transform PX_ALIGN_SUFFIX(16); + PxReal contactOffset; + PxU8 mShapeFlags; // !< API shape flags // PT: TODO: use PxShapeFlags here. Needs to move flags to separate file. + PxU8 mOwnsMaterialIdxMemory; // PT: for de-serialization to avoid deallocating material index list. Moved there from Sc::ShapeCore (since one byte was free). + PxU16 materialIndex; + Gu::GeometryUnion geometry; +}; + +PX_COMPILE_TIME_ASSERT( (sizeof(PxsShapeCore)&0xf) == 0); + +} + +#endif diff --git a/PhysX_3.4/Source/LowLevel/API/include/PxvGlobals.h b/PhysX_3.4/Source/LowLevel/API/include/PxvGlobals.h new file mode 100644 index 00000000..43353965 --- /dev/null +++ b/PhysX_3.4/Source/LowLevel/API/include/PxvGlobals.h @@ -0,0 +1,118 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 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 PXD_INIT_H +#define PXD_INIT_H + +#include "PxvConfig.h" +#include "PsBasicTemplates.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 shdfnd::pointerOffset<const PxShape*>(pxs, pxsShapeCore2PxShape); + } + + PX_FORCE_INLINE const PxRigidActor* convertPxsRigidCore2PxRigidBody(const PxsRigidCore* pxs) const + { + return shdfnd::pointerOffset<const PxRigidActor*>(pxs, pxsRigidCore2PxRigidBody); + } + + PX_FORCE_INLINE const PxRigidActor* convertPxsRigidCore2PxRigidStatic(const PxsRigidCore* pxs) const + { + return shdfnd::pointerOffset<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(); + +/*! +Initialize low-level implementation. +*/ + +void PxvRegisterHeightFields(); + +void PxvRegisterLegacyHeightFields(); + +#if PX_SUPPORT_GPU_PHYSX +class PxPhysXGpu* PxvGetPhysXGpu(bool createIfNeeded); +#endif + +} + +#endif diff --git a/PhysX_3.4/Source/LowLevel/API/include/PxvManager.h b/PhysX_3.4/Source/LowLevel/API/include/PxvManager.h new file mode 100644 index 00000000..da8750be --- /dev/null +++ b/PhysX_3.4/Source/LowLevel/API/include/PxvManager.h @@ -0,0 +1,239 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 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 +{ + +class PxvContact; + +/*! +\file +Manager interface +*/ + +/************************************************************************/ +/* Managers */ +/************************************************************************/ + +class PxsContactManager; +class PxsContext; + +struct PxsRigidCore; +struct PxsShapeCore; + + + +/*! +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 +{ + /*! + Manager handle + */ + PxsContactManager* manager; + + /*! + Manager userdata + */ + void* userData; +}; + +} + +#endif + diff --git a/PhysX_3.4/Source/LowLevel/API/include/PxvSimStats.h b/PhysX_3.4/Source/LowLevel/API/include/PxvSimStats.h new file mode 100644 index 00000000..4fba92f1 --- /dev/null +++ b/PhysX_3.4/Source/LowLevel/API/include/PxvSimStats.h @@ -0,0 +1,114 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 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 "CmPhysXCommon.h" +#include "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; +}; + +} + +#endif |