diff options
| author | Anton Novoselov <[email protected]> | 2017-08-01 12:53:38 +0300 |
|---|---|---|
| committer | Anton Novoselov <[email protected]> | 2017-08-01 12:53:38 +0300 |
| commit | 236f03c0b9a4982328ed1201978f7f69d192d9b2 (patch) | |
| tree | e486f2fa39dba203563895541e92c60ed3e25759 /sdk/extensions/physx/include | |
| parent | Added screens to welcome page (diff) | |
| download | blast-236f03c0b9a4982328ed1201978f7f69d192d9b2.tar.xz blast-236f03c0b9a4982328ed1201978f7f69d192d9b2.zip | |
Blast 1.1 release (windows / linux)
see docs/release_notes.txt for details
Diffstat (limited to 'sdk/extensions/physx/include')
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtCustomProfiler.h | 143 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtImpactDamageManager.h | 57 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtPx.h | 36 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtPxActor.h | 36 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtPxAsset.h | 93 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtPxFamily.h | 36 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtPxListener.h | 36 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtPxManager.h | 42 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtPxStressSolver.h | 98 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtPxTask.h | 97 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtStressSolver.h | 209 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastExtSync.h | 40 | ||||
| -rw-r--r-- | sdk/extensions/physx/include/NvBlastPxCallbacks.h | 73 |
13 files changed, 688 insertions, 308 deletions
diff --git a/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h b/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h new file mode 100644 index 0000000..4130964 --- /dev/null +++ b/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h @@ -0,0 +1,143 @@ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTDEFAULTPROFILER_H +#define NVBLASTDEFAULTPROFILER_H + +#include "NvBlastProfiler.h" +#include "PxProfiler.h" + +#if NV_NVTX +#include "nvToolsExt.h" +NV_INLINE void platformZoneStart(const char* name) { nvtxRangePushA(name); } +NV_INLINE void platformZoneEnd() { nvtxRangePop(); } + +#elif NV_XBOXONE +#include "xboxone/NvBlastProfilerXB1.h" + +#elif NV_PS4 +#include "ps4/NvBlastProfilerPS4.h" + +#else +NV_INLINE void platformZoneStart(const char*) { } +NV_INLINE void platformZoneEnd() { } + +#endif + +#define SUPPORTS_THREAD_LOCAL (!NV_VC || NV_VC > 12) + +namespace Nv +{ +namespace Blast +{ + +struct ExtProfileData +{ + const char* name; + void* data; +}; + +#if SUPPORTS_THREAD_LOCAL +static const int32_t PROFILER_MAX_NESTED_DEPTH = 64; +static thread_local ExtProfileData th_ProfileData[PROFILER_MAX_NESTED_DEPTH]; +static thread_local int32_t th_depth = 0; +#endif + +class ExtCustomProfiler : public ProfilerCallback +{ +public: + ExtCustomProfiler() : m_platformEnabled(false) {} + + virtual void zoneStart(const char* name) override + { + +#if SUPPORTS_THREAD_LOCAL + if (PxGetProfilerCallback()) + { + void* data = PxGetProfilerCallback()->zoneStart(name, false, 0xb1a57); + + if (th_depth < PROFILER_MAX_NESTED_DEPTH && th_depth >= 0) + { + th_ProfileData[th_depth].name = name; + th_ProfileData[th_depth].data = data; + th_depth++; + } + else + { + assert(th_depth < PROFILER_MAX_NESTED_DEPTH && th_depth >= 0); + } + } +#endif + + if (m_platformEnabled) + { + platformZoneStart(name); + } + } + + virtual void zoneEnd() override + { + +#if SUPPORTS_THREAD_LOCAL + if (PxGetProfilerCallback()) + { + th_depth--; + + if (th_depth >= 0) + { + ExtProfileData& pd = th_ProfileData[th_depth]; + PxGetProfilerCallback()->zoneEnd(pd.data, pd.name, false, 0xb1a57); + } + else + { + assert(th_depth >= 0); + } + } +#endif + + if (m_platformEnabled) + { + platformZoneEnd(); + } + } + + + void setPlatformEnabled(bool enabled) + { + m_platformEnabled = enabled; + } + +private: + bool m_platformEnabled; +}; + +} // namespace Blast +} // namespace Nv + + +#endif diff --git a/sdk/extensions/physx/include/NvBlastExtImpactDamageManager.h b/sdk/extensions/physx/include/NvBlastExtImpactDamageManager.h index ac3576d..28d0947 100644 --- a/sdk/extensions/physx/include/NvBlastExtImpactDamageManager.h +++ b/sdk/extensions/physx/include/NvBlastExtImpactDamageManager.h @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, 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. -*/ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + #ifndef NVBLASTEXTIMPACTDAMAGEMANAGER_H #define NVBLASTEXTIMPACTDAMAGEMANAGER_H @@ -43,16 +61,27 @@ Impact Damage Manager Settings. */ struct ExtImpactSettings { - bool isSelfCollissionEnabled; //!< family's self collision enabled - float fragility; //!< global fragility factor + bool isSelfCollissionEnabled; //!< family's self collision enabled. + bool shearDamage; //!< use shear damage program (otherwise simple radial damage is used) + float impulseMinThreshold; //!< min impulse value to apply impact damage. + float impulseMaxThreshold; //!< max impulse value, damage is interpolated value between min and max impulses. + float damageMax; //!< max damage to be applied (if impulse is >= impulseMaxThreshold). + float damageRadiusMax; //!< max penetration depth (if impulse is >= impulseMaxThreshold). + float damageAttenuation; //!< penetration attenuation ([0..1], where 1 means damage attenuates linearly from 0 to max penetration depth). ExtImpactDamageFunction damageFunction; //!< custom damage function, can be nullptr, default internal one will be used in that case. - void* damageFunctionData; //!< data to be passed in custom damage function + void* damageFunctionData; //!< data to be passed in custom damage function. ExtImpactSettings() : isSelfCollissionEnabled(false), - fragility(1.0f), - damageFunction(nullptr) + shearDamage(true), + impulseMinThreshold(0.0f), + impulseMaxThreshold(1000000.0f), + damageMax(100.f), + damageRadiusMax(5.0f), + damageAttenuation(1.f), + damageFunction(nullptr), + damageFunctionData(nullptr) {} }; diff --git a/sdk/extensions/physx/include/NvBlastExtPx.h b/sdk/extensions/physx/include/NvBlastExtPx.h index b2d938b..a34182a 100644 --- a/sdk/extensions/physx/include/NvBlastExtPx.h +++ b/sdk/extensions/physx/include/NvBlastExtPx.h @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, 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. -*/ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + #ifndef NVBLASTEXTPX_H #define NVBLASTEXTPX_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxActor.h b/sdk/extensions/physx/include/NvBlastExtPxActor.h index 994ace7..79d6404 100644 --- a/sdk/extensions/physx/include/NvBlastExtPxActor.h +++ b/sdk/extensions/physx/include/NvBlastExtPxActor.h @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, 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. -*/ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + #ifndef NVBLASTEXTPXACTOR_H #define NVBLASTEXTPXACTOR_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxAsset.h b/sdk/extensions/physx/include/NvBlastExtPxAsset.h index a4dbe0e..136f0d2 100644 --- a/sdk/extensions/physx/include/NvBlastExtPxAsset.h +++ b/sdk/extensions/physx/include/NvBlastExtPxAsset.h @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, 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. -*/ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + #ifndef NVBLASTEXTPXASSET_H #define NVBLASTEXTPXASSET_H @@ -114,6 +132,16 @@ public: */ static ExtPxAsset* create(const ExtPxAssetDesc& desc, TkFramework& framework); + /** + Create a new ExtPxAsset. + + \param[in] desc The ExtPxAssetDesc descriptor to be used, @see ExtPxAssetDesc. + \param[in] framework The TkFramework instance to be used to create TkAsset. + + \return the new ExtPxAsset if successful, NULL otherwise. + */ + static ExtPxAsset* create(const TkAssetDesc& desc, ExtPxChunk* pxChunks, ExtPxSubchunk* pxSubchunks, TkFramework& framework); + /* Factory method for deserialization @@ -123,17 +151,18 @@ public: */ static ExtPxAsset* create(TkAsset* asset); + /* + Create a new ExtPxAsset. - /** - Deserialize an ExtPxAsset object from the given stream. + \param[in] asset TkAsset from which ExtPxAsset will be created + \param[in] chunks Array of physics chunks descriptors + \param[in] chunkCount Size of chunks descriptors array - \param[in] stream User-defined stream object. - \param[in] framework The TkFramework instance to be used to deserialize TkAsset. - \param[in] physics The PxPhysics instance to be to deserialize PxConvexMesh(s). - \return pointer the deserialized ExtPxAsset object if successful, or NULL if unsuccessful. + \return the new ExtPxAsset if successful, NULL otherwise. + */ - static ExtPxAsset* deserialize(physx::general_PxIOStream2::PxFileBuf& stream, TkFramework& framework, physx::PxPhysics& physics); + static ExtPxAsset* create(TkAsset* asset, ExtPxAssetDesc::ChunkDesc* chunks, uint32_t chunkCount); /** Release this ExtPxAsset. @@ -141,16 +170,6 @@ public: virtual void release() = 0; /** - Write the asset's data to the user-defined PxFileBuf stream. Underlying TkAsset would be also serialized. - - \param[in] stream User-defined stream object. - \param[in] cooking The PxCooking instance to be used to serialize PxConvexMesh(s). - - \return true if serialization was successful, false otherwise. - */ - virtual bool serialize(physx::general_PxIOStream2::PxFileBuf& stream, physx::PxCooking& cooking) const = 0; - - /** Every ExtPxAsset has corresponding TkAsset. /return a pointer to TkAsset actor. @@ -187,6 +206,28 @@ public: virtual const ExtPxSubchunk* getSubchunks() const = 0; /** + Get the default NvBlastActorDesc to be used when creating family from this asset. It is called 'default', + because it can be overwritten in ExtPxManager::createFamily(...) function. + + Initially default NvBlastActorDesc contains only uniform health values, and 'nullptr' is set in arrays of health. + Call setUniformHealth(false) in order to set health per bond/chunk. You can then access directly values stored in NvBlastActorDesc, + change them and they will be serialized/deserialized as withing asset itself. + + NOTE: do not change actual pointers in NvBlastActorDesc: initialBondHealths and initialSupportChunkHealths. You can change actual values + in those arrays or if they are 'nullptr' call setUniformHealth(false) before. Or call setUniformHealth(true) to make them 'nullptr'. + + \return the default NvBlastActorDesc. + */ + virtual NvBlastActorDesc& getDefaultActorDesc() = 0; + + virtual const NvBlastActorDesc& getDefaultActorDesc() const = 0; + + /** + Set if uniform health values should be used in NvBlastActorDesc or per bond/chunk ones. @see getDefaultActorDesc. + */ + virtual void setUniformHealth(bool enabled) = 0; + + /** Pointer field available to the user. */ void* userData; diff --git a/sdk/extensions/physx/include/NvBlastExtPxFamily.h b/sdk/extensions/physx/include/NvBlastExtPxFamily.h index 7805c15..ae48769 100644 --- a/sdk/extensions/physx/include/NvBlastExtPxFamily.h +++ b/sdk/extensions/physx/include/NvBlastExtPxFamily.h @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, 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. -*/ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + #ifndef NVBLASTEXTPXFAMILY_H #define NVBLASTEXTPXFAMILY_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxListener.h b/sdk/extensions/physx/include/NvBlastExtPxListener.h index 4c43283..f3a52a3 100644 --- a/sdk/extensions/physx/include/NvBlastExtPxListener.h +++ b/sdk/extensions/physx/include/NvBlastExtPxListener.h @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, 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. -*/ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + #ifndef NVBLASTEXTPXLISTENER_H #define NVBLASTEXTPXLISTENER_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxManager.h b/sdk/extensions/physx/include/NvBlastExtPxManager.h index 9d73898..d4dd50c 100644 --- a/sdk/extensions/physx/include/NvBlastExtPxManager.h +++ b/sdk/extensions/physx/include/NvBlastExtPxManager.h @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, 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. -*/ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + #ifndef NVBLASTEXTPXMANAGER_H #define NVBLASTEXTPXMANAGER_H @@ -54,9 +72,9 @@ Used to create Physics Family. */ struct ExtPxFamilyDesc { - const ExtPxAsset* pxAsset; //!< px asset to create from, pointer will be stored in family. - NvBlastActorDesc actorDesc; //!< actor descriptor to be used when creating TkActor. - TkGroup* group; //!< if not nullptr, created TkActor will be placed in group + const ExtPxAsset* pxAsset; //!< px asset to create from, pointer will be stored in family. + const NvBlastActorDesc* actorDesc; //!< actor descriptor to be used when creating TkActor. If nullptr, default NvBlastActorDesc from ExtPxAsset will be used. + TkGroup* group; //!< if not nullptr, created TkActor will be placed in group }; diff --git a/sdk/extensions/physx/include/NvBlastExtPxStressSolver.h b/sdk/extensions/physx/include/NvBlastExtPxStressSolver.h new file mode 100644 index 0000000..fcf4d85 --- /dev/null +++ b/sdk/extensions/physx/include/NvBlastExtPxStressSolver.h @@ -0,0 +1,98 @@ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTEXTPXSTRESSSOLVER_H +#define NVBLASTEXTPXSTRESSSOLVER_H + +#include "NvBlastExtStressSolver.h" +#include "common/PxRenderBuffer.h" + + +namespace Nv +{ +namespace Blast +{ + +// forward declarations +class ExtPxFamily; + + +/** +Px Stress Solver. Px wrapper over ExtStressSolver. + +Uses ExtPxFamily and ExtStressSolver. see #ExtStressSolver for more details. +Works on both dynamic and static actor's within family. +For static actors it applies gravity. +For dynamic actors it applies centrifugal force. +*/ +class NV_DLL_EXPORT ExtPxStressSolver +{ +public: + //////// creation //////// + + /** + Create a new ExtStressSolver. + + \param[in] family The ExtPxFamily instance to calculate stress on. + \param[in] settings The settings to be set on ExtStressSolver. + + \return the new ExtStressSolver if successful, NULL otherwise. + */ + static ExtPxStressSolver* create(ExtPxFamily& family, ExtStressSolverSettings settings = ExtStressSolverSettings()); + + + //////// interface //////// + + /** + Release this stress solver. + */ + virtual void release() = 0; + + /** + Get actual ExtStressSolver used. + + \return the pointer to ExtStressSolver used internally. + */ + virtual ExtStressSolver& getSolver() const = 0; + + /** + Update stress solver. + + Calculate stress and optionally apply damage. + + \param[in] doDamage If 'true' damage will be applied after stress solver. + */ + virtual void update(bool doDamage = true) = 0; +}; + + +} // namespace Blast +} // namespace Nv + + +#endif // ifndef NVBLASTEXTPXSTRESSSOLVER_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxTask.h b/sdk/extensions/physx/include/NvBlastExtPxTask.h new file mode 100644 index 0000000..b692ce8 --- /dev/null +++ b/sdk/extensions/physx/include/NvBlastExtPxTask.h @@ -0,0 +1,97 @@ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTEXTPXTASK_H +#define NVBLASTEXTPXTASK_H + +#include "NvBlastTypes.h" + + +// Forward declarations +namespace physx +{ +class PxTaskManager; +} + + +namespace Nv +{ +namespace Blast +{ + + +// Forward declarations +class TkGroup; + + +/** +Uses a physx::PxTaskManager to process a TkGroup concurrently. +*/ +class NV_DLL_EXPORT ExtGroupTaskManager +{ +protected: + virtual ~ExtGroupTaskManager() {} + +public: + static ExtGroupTaskManager* create(physx::PxTaskManager&); + static ExtGroupTaskManager* create(physx::PxTaskManager&, TkGroup&); + + /** + Change the group to process. Cannot be changed while the group being processed. + */ + virtual void setGroup(TkGroup*) = 0; + + /** + Start processing the group. + The parallelizing strategy is to have all worker tasks running concurrently. + The number of started tasks may be smaller than the requested value, + when the task manager's dispatcher thread count or the number of group jobs are + smaller. + + \param[in] workerCount The number of worker tasks to start, + 0 uses the dispatcher's worker thread count. + \return The number of worker tasks started. + */ + virtual uint32_t process(uint32_t workerCount = 0) = 0; + + /** + Wait for the group to end processing. + */ + virtual bool wait(bool block = true) = 0; + + /** + Release this object. + */ + virtual void release() = 0; +}; + + +} // namespace Blast +} // namespace Nv + +#endif // NVBLASTEXTPXTASK_H diff --git a/sdk/extensions/physx/include/NvBlastExtStressSolver.h b/sdk/extensions/physx/include/NvBlastExtStressSolver.h deleted file mode 100644 index 2fd389d..0000000 --- a/sdk/extensions/physx/include/NvBlastExtStressSolver.h +++ /dev/null @@ -1,209 +0,0 @@ -/* -* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, 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. -*/ - -#ifndef NVBLASTEXTSTRESSSOLVER_H -#define NVBLASTEXTSTRESSSOLVER_H - -#include "common/PxRenderBuffer.h" -#include <vector> -#include "NvPreprocessor.h" - - -namespace Nv -{ -namespace Blast -{ - -// forward declarations -class ExtPxFamily; -class ExtPxActor; - -/** -Stress Solver Settings - -Stress on every bond is calculated as -stress = bond.linearStress * stressLinearFactor + bond.angularStress * stressAngularFactor -where: -bond.linearStress - is linear stress force on particular bond -bond.angularStress - is angular stress force on particular bond -stressLinearFactor, stressAngularFactor - are a multiplier parameter set by this struct - -Support graph reduction: -2 ^ reduction level = max node count to be aggregated during graph reduction, so 0 is 2 % 0 = 1, basically use support graph. -So N nodes graph will be simplified to contain ~ N / (2 ^ reduction level) -*/ -struct ExtStressSolverSettings -{ - float stressLinearFactor; //!< linear stress on bond multiplier - float stressAngularFactor; //!< angular stress on bond multiplier - uint32_t bondIterationsPerFrame; //!< number of bond iterations to perform per frame, @see getIterationsPerFrame() below - uint32_t graphReductionLevel; //!< graph reduction level - - ExtStressSolverSettings() : - stressLinearFactor(0.00004f), - stressAngularFactor(0.00007f), - bondIterationsPerFrame(18000), - graphReductionLevel(3) - {} -}; - - -/** -Stress Solver. - -Uses ExtPxFamily, allocates and prepares it's graph once when it's created. Then it's being quickly updated on every -actor split. -Works on both dynamic and static actor's within family. -For static actors it applies gravity. -For dynamic actors it applies centrifugal force. -Additionally applyImpulse() method can be used to apply external impulse (like impact damage). -*/ -class NV_DLL_EXPORT ExtStressSolver -{ -public: - //////// creation //////// - - /** - Create a new ExtStressSolver. - - \param[in] family The ExtPxFamily instance to calculate stress on. - \param[in] settings The settings to be set on ExtStressSolver. - - \return the new ExtStressSolver if successful, NULL otherwise. - */ - static ExtStressSolver* create(ExtPxFamily& family, ExtStressSolverSettings settings = ExtStressSolverSettings()); - - - //////// interface //////// - - /** - Release this stress solver. - */ - virtual void release() = 0; - - /** - Set stress solver settings. - Changing graph reduction level will lead to graph being rebuilt (which is fast, but still not recommended). - All other settings are applied instantly and can be changed every frame. - - \param[in] settings The settings to be set on ExtStressSolver. - */ - virtual void setSettings(const ExtStressSolverSettings& settings) = 0; - - /** - Get stress solver settings. - - \return the pointer to stress solver settings currently set. - */ - virtual const ExtStressSolverSettings& getSettings() const = 0; - - /** - Apply external impulse on particular actor of family - - \param[in] actor The ExtPxActor to apply impulse on. - \param[in] position Local position in actor's coordinates to apply impulse on. - \param[in] force Impulse to apply (kg * m / s). - */ - virtual void applyImpulse(ExtPxActor& actor, physx::PxVec3 position, physx::PxVec3 force) = 0; - - /** - Update stress solver. - - Calculate stress and optionally apply damage. - - \param[in] doDamage If 'true' damage will be applied after stress solver. - */ - virtual void update(bool doDamage = true) = 0; - - /** - Reset stress solver. - - Stress solver uses warm start internally, calling this function will flush all previous data calculated and also zeros frame count. - This function is to be used for debug purposes. - */ - virtual void reset() = 0; - - /** - Debug Render Mode - */ - enum DebugRenderMode - { - STRESS_GRAPH = 0, //!< render only stress graph - STRESS_GRAPH_NODES_IMPULSES = 1, //!< render stress graph + nodes impulses after solving stress - STRESS_GRAPH_BONDS_IMPULSES = 2 //!< render stress graph + bonds impulses after solving stress - }; - - /** - Fill debug render for passed array of support graph nodes. - - \param[in] nodes Node indices of support graph to debug render for. - \param[out] lines Lines array to fill. - \param[in] mode Debug render mode. - \param[in] scale Scale to be applied on impulses. - */ - virtual void fillDebugRender(const std::vector<uint32_t>& nodes, std::vector<physx::PxDebugLine>& lines, DebugRenderMode mode, float scale = 1.0f) = 0; - - /** - Get stress solver linear error. - - \return the total linear error of stress calculation. - */ - virtual float getStressErrorLinear() const = 0; - - /** - Get stress solver angular error. - - \return the total angular error of stress calculation. - */ - virtual float getStressErrorAngular() const = 0; - - /** - Get stress solver total iterations count since it was created (or reset). - - \return the iterations count. - */ - virtual uint32_t getIterationCount() const = 0; - - /** - Get stress solver total frames count (update() calls) since it was created (or reset). - - \return the frames count. - */ - virtual uint32_t getFrameCount() const = 0; - - /** - Get stress solver bonds count, after graph reduction was applied. - - \return the bonds count. - */ - virtual uint32_t getBondCount() const = 0; - - - //////// helpers //////// - - /** - Get iteration per frame (update() call). - - Helper method to know how many solver iterations are made per frame. - - \return the iterations per frame count. - */ - uint32_t getIterationsPerFrame() const - { - uint32_t perFrame = getSettings().bondIterationsPerFrame / (getBondCount() + 1); - return perFrame > 0 ? perFrame : 1; - } -}; - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTEXTSTRESSSOLVER_H diff --git a/sdk/extensions/physx/include/NvBlastExtSync.h b/sdk/extensions/physx/include/NvBlastExtSync.h index 805378a..170a386 100644 --- a/sdk/extensions/physx/include/NvBlastExtSync.h +++ b/sdk/extensions/physx/include/NvBlastExtSync.h @@ -1,20 +1,38 @@ -/* -* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, 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. -*/ +// 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) 2016-2017 NVIDIA Corporation. All rights reserved. + #ifndef NVBLASTEXTSYNC_H #define NVBLASTEXTSYNC_H #include "NvBlastTk.h" #include "foundation/PxTransform.h" -#include "foundation/PxAllocatorCallback.h" #include "NvPreprocessor.h" +#include "NvBlastGlobals.h" namespace Nv @@ -80,7 +98,7 @@ struct ExtSyncEventInstance : public ExtSyncEvent ExtSyncEvent* clone() const override { - return new (NvBlastTkFrameworkGet()->getAllocatorCallback().allocate(sizeof(T), nullptr, __FILE__, __LINE__)) T(*(T*)this); + return NVBLAST_NEW (T) (*(T*)this); } }; diff --git a/sdk/extensions/physx/include/NvBlastPxCallbacks.h b/sdk/extensions/physx/include/NvBlastPxCallbacks.h new file mode 100644 index 0000000..323f298 --- /dev/null +++ b/sdk/extensions/physx/include/NvBlastPxCallbacks.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) 2016-2017 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTPXCALLBACKS_H +#define NVBLASTPXCALLBACKS_H + +#include "NvBlastGlobals.h" +#include "PxErrorCallback.h" +#include "PxAllocatorCallback.h" + +/** +This file contains helper functions to get PxShared compatible versions of global AllocatorCallback and ErrorCallback. +*/ + + +NV_INLINE physx::PxErrorCallback& NvBlastGetPxErrorCallback() +{ + class PxErrorCallbackWrapper : public physx::PxErrorCallback + { + virtual void reportError(physx::PxErrorCode::Enum code, const char* message, const char* file, int line) override + { + NvBlastGlobalGetErrorCallback()->reportError((Nv::Blast::ErrorCode::Enum)code, message, file, line); + } + }; + static PxErrorCallbackWrapper wrapper; + return wrapper; +} + +NV_INLINE physx::PxAllocatorCallback& NvBlastGetPxAllocatorCallback() +{ + class PxAllocatorCallbackWrapper : public physx::PxAllocatorCallback + { + virtual void* allocate(size_t size, const char* typeName, const char* filename, int line) override + { + return NvBlastGlobalGetAllocatorCallback()->allocate(size, typeName, filename, line); + } + + virtual void deallocate(void* ptr) override + { + NvBlastGlobalGetAllocatorCallback()->deallocate(ptr); + } + }; + static PxAllocatorCallbackWrapper wrapper; + return wrapper; +} + + +#endif // #ifndef NVBLASTPXCALLBACKS_H |