From 7115f60b91b5717d90f643fd692010905c7004db Mon Sep 17 00:00:00 2001 From: Bryan Galdrikian Date: Thu, 31 May 2018 11:36:08 -0700 Subject: Blast 1.1.3. See docs/release_notes.txt. --- .../physx/include/NvBlastExtCustomProfiler.h | 322 ++++++------- .../physx/include/NvBlastExtImpactDamageManager.h | 342 +++++++------- sdk/extensions/physx/include/NvBlastExtPx.h | 94 ++-- sdk/extensions/physx/include/NvBlastExtPxActor.h | 202 ++++---- sdk/extensions/physx/include/NvBlastExtPxAsset.h | 508 ++++++++++---------- sdk/extensions/physx/include/NvBlastExtPxFamily.h | 514 ++++++++++---------- .../physx/include/NvBlastExtPxListener.h | 146 +++--- sdk/extensions/physx/include/NvBlastExtPxManager.h | 526 ++++++++++----------- .../physx/include/NvBlastExtPxStressSolver.h | 196 ++++---- sdk/extensions/physx/include/NvBlastExtPxTask.h | 212 ++++----- sdk/extensions/physx/include/NvBlastExtSync.h | 462 +++++++++--------- sdk/extensions/physx/include/NvBlastPxCallbacks.h | 146 +++--- 12 files changed, 1835 insertions(+), 1835 deletions(-) mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtCustomProfiler.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtImpactDamageManager.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtPx.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtPxActor.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtPxAsset.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtPxFamily.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtPxListener.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtPxManager.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtPxStressSolver.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtPxTask.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastExtSync.h mode change 100644 => 100755 sdk/extensions/physx/include/NvBlastPxCallbacks.h (limited to 'sdk/extensions/physx/include') diff --git a/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h b/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h old mode 100644 new mode 100755 index 402509c..0fbd5cd --- a/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h +++ b/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h @@ -1,161 +1,161 @@ -// 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-2018 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 - - -/** -Implements Nv::Blast::ProfilerCallback to serve the physx::PxProfilerCallback set in PxFoundation -for PhysX Visual Debugger support and platform specific profilers like NVIDIA(R) NSight(TM). -*/ -class ExtCustomProfiler : public ProfilerCallback -{ -public: - /** - Construct an ExtCustomProfiler with platform specific profiler signals disabled. - */ - ExtCustomProfiler() : m_platformEnabled(false) {} - - - ////// ProfilerCallback interface ////// - - 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(); - } - } - - - ////// local interface ////// - - /** - Enable or disable platform specific profiler signals. Disabled by default. - - \param[in] enabled true enables, false disables platform profiler calls. - */ - void setPlatformEnabled(bool enabled) - { - m_platformEnabled = enabled; - } - -private: - bool m_platformEnabled; -}; - -} // namespace Blast -} // namespace Nv - - -#endif // NVBLASTDEFAULTPROFILER_H +// 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-2018 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 + + +/** +Implements Nv::Blast::ProfilerCallback to serve the physx::PxProfilerCallback set in PxFoundation +for PhysX Visual Debugger support and platform specific profilers like NVIDIA(R) NSight(TM). +*/ +class ExtCustomProfiler : public ProfilerCallback +{ +public: + /** + Construct an ExtCustomProfiler with platform specific profiler signals disabled. + */ + ExtCustomProfiler() : m_platformEnabled(false) {} + + + ////// ProfilerCallback interface ////// + + 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(); + } + } + + + ////// local interface ////// + + /** + Enable or disable platform specific profiler signals. Disabled by default. + + \param[in] enabled true enables, false disables platform profiler calls. + */ + void setPlatformEnabled(bool enabled) + { + m_platformEnabled = enabled; + } + +private: + bool m_platformEnabled; +}; + +} // namespace Blast +} // namespace Nv + + +#endif // NVBLASTDEFAULTPROFILER_H diff --git a/sdk/extensions/physx/include/NvBlastExtImpactDamageManager.h b/sdk/extensions/physx/include/NvBlastExtImpactDamageManager.h old mode 100644 new mode 100755 index ea059d8..769c125 --- a/sdk/extensions/physx/include/NvBlastExtImpactDamageManager.h +++ b/sdk/extensions/physx/include/NvBlastExtImpactDamageManager.h @@ -1,171 +1,171 @@ -// 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-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTIMPACTDAMAGEMANAGER_H -#define NVBLASTEXTIMPACTDAMAGEMANAGER_H - -#include "PxFiltering.h" -#include "NvPreprocessor.h" - -// Forward declarations -namespace physx -{ -struct PxContactPair; -struct PxContactPairHeader; -} - - -namespace Nv -{ -namespace Blast -{ - -// Forward declarations -class ExtPxActor; -class ExtPxManager; - - -/** -Custom Damage Function -*/ -typedef bool(*ExtImpactDamageFunction)(void* data, ExtPxActor* actor, physx::PxShape* shape, physx::PxVec3 worldPos, physx::PxVec3 worldForce); - - -/** -Impact Damage Manager Settings. -*/ -struct ExtImpactSettings -{ - bool isSelfCollissionEnabled; //!< family's self collision enabled. - bool shearDamage; //!< use shear damage program (otherwise simple radial damage is used) - float hardness; //!< hardness of material for impact damage. Damage = impulse / hardness . This damage is capped by the material's health. - float damageRadiusMax; //!< the maximum radius in which full damage is applied. - float damageThresholdMin; //!< minimum damage fraction threshold to be applied. Range [0, 1]. For example 0.1 filters all damage below 10% of health. - float damageThresholdMax; //!< maximum damage fraction threshold to be applied. Range [0, 1]. For example 0.8 won't allow more then 80% of health damage to be applied. - float damageFalloffRadiusFactor; //!< damage attenuation radius factor. Given a radius R for full damage, for [R, R * damageFalloffRadiusFactor] radius interval damage attenuates down to zero at the outer radius. - 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. - - - ExtImpactSettings() : - isSelfCollissionEnabled(false), - shearDamage(true), - hardness(10.0f), - damageRadiusMax(2.0f), - damageThresholdMin(0.1f), // to filter small damage events - damageThresholdMax(1.0f), - damageFalloffRadiusFactor(2.0f), - damageFunction(nullptr), - damageFunctionData(nullptr) - {} -}; - - -/** -Impact Damage Manager. - -Requires ExtPxManager. -Call onContact from PxSimulationEventCallback onContact to accumulate damage. -Call applyDamage to apply accumulated damage. -*/ -class NV_DLL_EXPORT ExtImpactDamageManager -{ -public: - //////// manager creation //////// - - /** - Create a new ExtImpactDamageManager. - - \param[in] pxManager The ExtPxManager instance to be used by impact damage manager. - \param[in] settings The settings to be set on ExtImpactDamageManager. - - \return the new ExtImpactDamageManager if successful, NULL otherwise. - */ - static ExtImpactDamageManager* create(ExtPxManager* pxManager, ExtImpactSettings settings = ExtImpactSettings()); - - /** - Release this manager. - */ - virtual void release() = 0; - - - //////// interface //////// - - /** - Set ExtImpactDamageManager settings. - - \param[in] settings The settings to be set on ExtImpactDamageManager. - */ - virtual void setSettings(const ExtImpactSettings& settings) = 0; - - /** - This method is equal to PxSimulationEventCallback::onContact. - - User should implement own PxSimulationEventCallback onContact and call this method in order ExtImpactDamageManager to work correctly. - - Contacts will be processed and impact damage will be accumulated. - - \param[in] pairHeader Information on the two actors whose shapes triggered a contact report. - \param[in] pairs The contact pairs of two actors for which contact reports have been requested. @see PxContactPair. - \param[in] nbPairs The number of provided contact pairs. - - @see PxSimulationEventCallback - */ - virtual void onContact(const physx::PxContactPairHeader& pairHeader, const physx::PxContactPair* pairs, uint32_t nbPairs) = 0; - - - /** - Apply accumulated impact damage. - */ - virtual void applyDamage() = 0; - - - //////// filter shader //////// - - /** - Custom implementation of PxSimulationFilterShader, enables necessary information to be passed in onContact(). - Set it in your PxScene PxSceneDesc in order to impact damage to work correctly or implement your own. - - @see PxSimulationFilterShader - */ - static physx::PxFilterFlags FilterShader( - physx::PxFilterObjectAttributes attributes0, - physx::PxFilterData filterData0, - physx::PxFilterObjectAttributes attributes1, - physx::PxFilterData filterData1, - physx::PxPairFlags& pairFlags, - const void* constantBlock, - uint32_t constantBlockSize); - -}; - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTEXTIMPACTDAMAGEMANAGER_H +// 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-2018 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTEXTIMPACTDAMAGEMANAGER_H +#define NVBLASTEXTIMPACTDAMAGEMANAGER_H + +#include "PxFiltering.h" +#include "NvPreprocessor.h" + +// Forward declarations +namespace physx +{ +struct PxContactPair; +struct PxContactPairHeader; +} + + +namespace Nv +{ +namespace Blast +{ + +// Forward declarations +class ExtPxActor; +class ExtPxManager; + + +/** +Custom Damage Function +*/ +typedef bool(*ExtImpactDamageFunction)(void* data, ExtPxActor* actor, physx::PxShape* shape, physx::PxVec3 worldPos, physx::PxVec3 worldForce); + + +/** +Impact Damage Manager Settings. +*/ +struct ExtImpactSettings +{ + bool isSelfCollissionEnabled; //!< family's self collision enabled. + bool shearDamage; //!< use shear damage program (otherwise simple radial damage is used) + float hardness; //!< hardness of material for impact damage. Damage = impulse / hardness . This damage is capped by the material's health. + float damageRadiusMax; //!< the maximum radius in which full damage is applied. + float damageThresholdMin; //!< minimum damage fraction threshold to be applied. Range [0, 1]. For example 0.1 filters all damage below 10% of health. + float damageThresholdMax; //!< maximum damage fraction threshold to be applied. Range [0, 1]. For example 0.8 won't allow more then 80% of health damage to be applied. + float damageFalloffRadiusFactor; //!< damage attenuation radius factor. Given a radius R for full damage, for [R, R * damageFalloffRadiusFactor] radius interval damage attenuates down to zero at the outer radius. + 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. + + + ExtImpactSettings() : + isSelfCollissionEnabled(false), + shearDamage(true), + hardness(10.0f), + damageRadiusMax(2.0f), + damageThresholdMin(0.1f), // to filter small damage events + damageThresholdMax(1.0f), + damageFalloffRadiusFactor(2.0f), + damageFunction(nullptr), + damageFunctionData(nullptr) + {} +}; + + +/** +Impact Damage Manager. + +Requires ExtPxManager. +Call onContact from PxSimulationEventCallback onContact to accumulate damage. +Call applyDamage to apply accumulated damage. +*/ +class NV_DLL_EXPORT ExtImpactDamageManager +{ +public: + //////// manager creation //////// + + /** + Create a new ExtImpactDamageManager. + + \param[in] pxManager The ExtPxManager instance to be used by impact damage manager. + \param[in] settings The settings to be set on ExtImpactDamageManager. + + \return the new ExtImpactDamageManager if successful, NULL otherwise. + */ + static ExtImpactDamageManager* create(ExtPxManager* pxManager, ExtImpactSettings settings = ExtImpactSettings()); + + /** + Release this manager. + */ + virtual void release() = 0; + + + //////// interface //////// + + /** + Set ExtImpactDamageManager settings. + + \param[in] settings The settings to be set on ExtImpactDamageManager. + */ + virtual void setSettings(const ExtImpactSettings& settings) = 0; + + /** + This method is equal to PxSimulationEventCallback::onContact. + + User should implement own PxSimulationEventCallback onContact and call this method in order ExtImpactDamageManager to work correctly. + + Contacts will be processed and impact damage will be accumulated. + + \param[in] pairHeader Information on the two actors whose shapes triggered a contact report. + \param[in] pairs The contact pairs of two actors for which contact reports have been requested. @see PxContactPair. + \param[in] nbPairs The number of provided contact pairs. + + @see PxSimulationEventCallback + */ + virtual void onContact(const physx::PxContactPairHeader& pairHeader, const physx::PxContactPair* pairs, uint32_t nbPairs) = 0; + + + /** + Apply accumulated impact damage. + */ + virtual void applyDamage() = 0; + + + //////// filter shader //////// + + /** + Custom implementation of PxSimulationFilterShader, enables necessary information to be passed in onContact(). + Set it in your PxScene PxSceneDesc in order to impact damage to work correctly or implement your own. + + @see PxSimulationFilterShader + */ + static physx::PxFilterFlags FilterShader( + physx::PxFilterObjectAttributes attributes0, + physx::PxFilterData filterData0, + physx::PxFilterObjectAttributes attributes1, + physx::PxFilterData filterData1, + physx::PxPairFlags& pairFlags, + const void* constantBlock, + uint32_t constantBlockSize); + +}; + +} // namespace Blast +} // namespace Nv + + +#endif // ifndef NVBLASTEXTIMPACTDAMAGEMANAGER_H diff --git a/sdk/extensions/physx/include/NvBlastExtPx.h b/sdk/extensions/physx/include/NvBlastExtPx.h old mode 100644 new mode 100755 index a458e15..de0ecac --- a/sdk/extensions/physx/include/NvBlastExtPx.h +++ b/sdk/extensions/physx/include/NvBlastExtPx.h @@ -1,47 +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) 2016-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTPX_H -#define NVBLASTEXTPX_H - - -/** -This is the main include header for the BlastExt Physics, for users who -want to use a single #include file. - -Alternatively, one can instead directly #include a subset of the below files. -*/ - -#include "NvBlastExtPxActor.h" -#include "NvBlastExtPxAsset.h" -#include "NvBlastExtPxFamily.h" -#include "NvBlastExtPxListener.h" -#include "NvBlastExtPxManager.h" - - -#endif // ifndef NVBLASTEXTPX_H +// 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-2018 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTEXTPX_H +#define NVBLASTEXTPX_H + + +/** +This is the main include header for the BlastExt Physics, for users who +want to use a single #include file. + +Alternatively, one can instead directly #include a subset of the below files. +*/ + +#include "NvBlastExtPxActor.h" +#include "NvBlastExtPxAsset.h" +#include "NvBlastExtPxFamily.h" +#include "NvBlastExtPxListener.h" +#include "NvBlastExtPxManager.h" + + +#endif // ifndef NVBLASTEXTPX_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxActor.h b/sdk/extensions/physx/include/NvBlastExtPxActor.h old mode 100644 new mode 100755 index 6cb1853..c0e6b5e --- a/sdk/extensions/physx/include/NvBlastExtPxActor.h +++ b/sdk/extensions/physx/include/NvBlastExtPxActor.h @@ -1,101 +1,101 @@ -// 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-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTPXACTOR_H -#define NVBLASTEXTPXACTOR_H - -#include "NvBlastTypes.h" - - -// Forward declarations -namespace physx -{ - class PxRigidDynamic; -} - - -namespace Nv -{ -namespace Blast -{ - -// Forward declarations -class ExtPxFamily; -class TkActor; - - -/** -Actor. - -Corresponds one to one to PxRigidDynamic and ExtActor. -*/ -class ExtPxActor -{ -public: - /** - Get the number of visible chunks for this actor. May be used in conjunction with getChunkIndices(). - - \return the number of visible chunk indices for the actor. - */ - virtual uint32_t getChunkCount() const = 0; - - /** - Access actor's array of chunk indices. Use getChunkCount() to get a size of this array. - - \return a pointer to an array of chunk indices of an actor. - */ - virtual const uint32_t* getChunkIndices() const = 0; - - /** - Every actor has corresponding PxActor. - - /return a pointer to PxRigidDynamic actor. - */ - virtual physx::PxRigidDynamic& getPhysXActor() const = 0; - - /** - Every actor has corresponding TkActor. - - /return a pointer to TkActor actor. - */ - virtual TkActor& getTkActor() const = 0; - - /** - Every actor has corresponding ExtPxFamily. - - /return a pointer to ExtPxFamily family. - */ - virtual ExtPxFamily& getFamily() const = 0; -}; - - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTEXTPXACTOR_H +// 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-2018 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTEXTPXACTOR_H +#define NVBLASTEXTPXACTOR_H + +#include "NvBlastTypes.h" + + +// Forward declarations +namespace physx +{ + class PxRigidDynamic; +} + + +namespace Nv +{ +namespace Blast +{ + +// Forward declarations +class ExtPxFamily; +class TkActor; + + +/** +Actor. + +Corresponds one to one to PxRigidDynamic and ExtActor. +*/ +class ExtPxActor +{ +public: + /** + Get the number of visible chunks for this actor. May be used in conjunction with getChunkIndices(). + + \return the number of visible chunk indices for the actor. + */ + virtual uint32_t getChunkCount() const = 0; + + /** + Access actor's array of chunk indices. Use getChunkCount() to get a size of this array. + + \return a pointer to an array of chunk indices of an actor. + */ + virtual const uint32_t* getChunkIndices() const = 0; + + /** + Every actor has corresponding PxActor. + + /return a pointer to PxRigidDynamic actor. + */ + virtual physx::PxRigidDynamic& getPhysXActor() const = 0; + + /** + Every actor has corresponding TkActor. + + /return a pointer to TkActor actor. + */ + virtual TkActor& getTkActor() const = 0; + + /** + Every actor has corresponding ExtPxFamily. + + /return a pointer to ExtPxFamily family. + */ + virtual ExtPxFamily& getFamily() const = 0; +}; + + +} // namespace Blast +} // namespace Nv + + +#endif // ifndef NVBLASTEXTPXACTOR_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxAsset.h b/sdk/extensions/physx/include/NvBlastExtPxAsset.h old mode 100644 new mode 100755 index 0796c7e..36b2a47 --- a/sdk/extensions/physx/include/NvBlastExtPxAsset.h +++ b/sdk/extensions/physx/include/NvBlastExtPxAsset.h @@ -1,254 +1,254 @@ -// 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-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTPXASSET_H -#define NVBLASTEXTPXASSET_H - -#include "NvBlastTkFramework.h" -#include "PxConvexMeshGeometry.h" -#include "PxTransform.h" -#include "NvBlastPreprocessor.h" - - -// Forward declarations -namespace physx -{ -class PxCooking; - -namespace general_PxIOStream2 -{ -class PxFileBuf; -} -} - -class NvBlastExtDamageAccelerator; - - -namespace Nv -{ -namespace Blast -{ - - -/** -Descriptor for PxAsset creation. - -PxAsset creates TkAsset internally, so TkAssetDesc must be filled. -In addition it needs physics chunks data. Every chunk can have any amount of Convexes (Subchunks). -*/ -struct ExtPxAssetDesc : public TkAssetDesc -{ - /** - Physics Subchunk. - - Represents convex and it's position. - */ - struct SubchunkDesc - { - physx::PxTransform transform; //!< convex local transform - physx::PxConvexMeshGeometry geometry; //!< convex geometry - }; - - /** - Physics Chunk. - - Contains any amount of subchunks. Empty subchunks array makes chunk invisible. - */ - struct ChunkDesc - { - SubchunkDesc* subchunks; //!< array of subchunks for chunk, can be empty - uint32_t subchunkCount; //!< size array of subchunks for chunk, can be 0 - bool isStatic; //!< is chunk static. Static chunk makes PxActor Kinematic. - }; - - ChunkDesc* pxChunks; //!< array of chunks in asset, should be of size chunkCount (@see NvBlastAssetDesc) -}; - - -/** -Physics Subchunk. - -Represents convex and it's local position. -*/ -struct ExtPxSubchunk -{ - physx::PxTransform transform; //!< convex local transform - physx::PxConvexMeshGeometry geometry; //!< convex geometry -}; - - -/** -Physics Chunk. - -Contains any amount of subchunks. -*/ -struct ExtPxChunk -{ - uint32_t firstSubchunkIndex; //!< first Subchunk index in Subchunk's array in ExtPhyicsAsset - uint32_t subchunkCount; //!< Subchunk count. Can be 0. - bool isStatic; //!< is chunk static (kinematic)?. -}; - - -/** -Asset. - -Keeps all the static data needed for physics. -*/ -class NV_DLL_EXPORT ExtPxAsset -{ -public: - - /** - 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 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 - - Doesn't specify chunks or subchunks as they'll be fed in during deserialization to avoid copying stuff around. - - */ - static ExtPxAsset* create(TkAsset* asset); - - /* - Create a new ExtPxAsset. - - \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 - - - \return the new ExtPxAsset if successful, NULL otherwise. - - */ - static ExtPxAsset* create(TkAsset* asset, ExtPxAssetDesc::ChunkDesc* chunks, uint32_t chunkCount); - - /** - Release this ExtPxAsset. - */ - virtual void release() = 0; - - /** - Every ExtPxAsset has corresponding TkAsset. - - /return a pointer to TkAsset actor. - */ - virtual const TkAsset& getTkAsset() const = 0; - - /** - Get the number of chunks for this asset. May be used in conjunction with getChunks(). - - \return the number of chunks for the asset. - */ - virtual uint32_t getChunkCount() const = 0; - - /** - Access asset's array of chunks. Use getChunkCount() to get the size of this array. - - \return a pointer to an array of chunk of an asset. - */ - virtual const ExtPxChunk* getChunks() const = 0; - - /** - Get the number of subchunks for this asset. May be used in conjunction with getSubchunks(). - Subchunk count is the maximum value of ExtPxChunk: (firstSubchunkIndex + subchunkCount). - - \return the number of subchunks for the asset. - */ - virtual uint32_t getSubchunkCount() const = 0; - - /** - Access asset's array of subchunks. Use getSubchunkCount() to get the size of this array. - - \return a pointer to an array of subchunks of an asset. - */ - 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; - - /** - Set damage accelerator associated with this asset. - */ - virtual void setAccelerator(NvBlastExtDamageAccelerator* accelerator) = 0; - - /** - Set damage accelerator associated with this asset. - */ - virtual NvBlastExtDamageAccelerator* getAccelerator() const = 0; - - /** - Pointer field available to the user. - */ - void* userData; -}; - - - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTEXTPXASSET_H +// 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-2018 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTEXTPXASSET_H +#define NVBLASTEXTPXASSET_H + +#include "NvBlastTkFramework.h" +#include "PxConvexMeshGeometry.h" +#include "PxTransform.h" +#include "NvBlastPreprocessor.h" + + +// Forward declarations +namespace physx +{ +class PxCooking; + +namespace general_PxIOStream2 +{ +class PxFileBuf; +} +} + +class NvBlastExtDamageAccelerator; + + +namespace Nv +{ +namespace Blast +{ + + +/** +Descriptor for PxAsset creation. + +PxAsset creates TkAsset internally, so TkAssetDesc must be filled. +In addition it needs physics chunks data. Every chunk can have any amount of Convexes (Subchunks). +*/ +struct ExtPxAssetDesc : public TkAssetDesc +{ + /** + Physics Subchunk. + + Represents convex and it's position. + */ + struct SubchunkDesc + { + physx::PxTransform transform; //!< convex local transform + physx::PxConvexMeshGeometry geometry; //!< convex geometry + }; + + /** + Physics Chunk. + + Contains any amount of subchunks. Empty subchunks array makes chunk invisible. + */ + struct ChunkDesc + { + SubchunkDesc* subchunks; //!< array of subchunks for chunk, can be empty + uint32_t subchunkCount; //!< size array of subchunks for chunk, can be 0 + bool isStatic; //!< is chunk static. Static chunk makes PxActor Kinematic. + }; + + ChunkDesc* pxChunks; //!< array of chunks in asset, should be of size chunkCount (@see NvBlastAssetDesc) +}; + + +/** +Physics Subchunk. + +Represents convex and it's local position. +*/ +struct ExtPxSubchunk +{ + physx::PxTransform transform; //!< convex local transform + physx::PxConvexMeshGeometry geometry; //!< convex geometry +}; + + +/** +Physics Chunk. + +Contains any amount of subchunks. +*/ +struct ExtPxChunk +{ + uint32_t firstSubchunkIndex; //!< first Subchunk index in Subchunk's array in ExtPhyicsAsset + uint32_t subchunkCount; //!< Subchunk count. Can be 0. + bool isStatic; //!< is chunk static (kinematic)?. +}; + + +/** +Asset. + +Keeps all the static data needed for physics. +*/ +class NV_DLL_EXPORT ExtPxAsset +{ +public: + + /** + 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 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 + + Doesn't specify chunks or subchunks as they'll be fed in during deserialization to avoid copying stuff around. + + */ + static ExtPxAsset* create(TkAsset* asset); + + /* + Create a new ExtPxAsset. + + \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 + + + \return the new ExtPxAsset if successful, NULL otherwise. + + */ + static ExtPxAsset* create(TkAsset* asset, ExtPxAssetDesc::ChunkDesc* chunks, uint32_t chunkCount); + + /** + Release this ExtPxAsset. + */ + virtual void release() = 0; + + /** + Every ExtPxAsset has corresponding TkAsset. + + /return a pointer to TkAsset actor. + */ + virtual const TkAsset& getTkAsset() const = 0; + + /** + Get the number of chunks for this asset. May be used in conjunction with getChunks(). + + \return the number of chunks for the asset. + */ + virtual uint32_t getChunkCount() const = 0; + + /** + Access asset's array of chunks. Use getChunkCount() to get the size of this array. + + \return a pointer to an array of chunk of an asset. + */ + virtual const ExtPxChunk* getChunks() const = 0; + + /** + Get the number of subchunks for this asset. May be used in conjunction with getSubchunks(). + Subchunk count is the maximum value of ExtPxChunk: (firstSubchunkIndex + subchunkCount). + + \return the number of subchunks for the asset. + */ + virtual uint32_t getSubchunkCount() const = 0; + + /** + Access asset's array of subchunks. Use getSubchunkCount() to get the size of this array. + + \return a pointer to an array of subchunks of an asset. + */ + 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; + + /** + Set damage accelerator associated with this asset. + */ + virtual void setAccelerator(NvBlastExtDamageAccelerator* accelerator) = 0; + + /** + Set damage accelerator associated with this asset. + */ + virtual NvBlastExtDamageAccelerator* getAccelerator() const = 0; + + /** + Pointer field available to the user. + */ + void* userData; +}; + + + +} // namespace Blast +} // namespace Nv + + +#endif // ifndef NVBLASTEXTPXASSET_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxFamily.h b/sdk/extensions/physx/include/NvBlastExtPxFamily.h old mode 100644 new mode 100755 index f2f14e4..56aa902 --- a/sdk/extensions/physx/include/NvBlastExtPxFamily.h +++ b/sdk/extensions/physx/include/NvBlastExtPxFamily.h @@ -1,257 +1,257 @@ -// 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-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTPXFAMILY_H -#define NVBLASTEXTPXFAMILY_H - -#include "PxFiltering.h" - - -// Forward declarations -namespace physx -{ -class PxRigidDynamic; -class PxMaterial; -class PxScene; -class PxTransform; -} - -struct NvBlastExtMaterial; - - -namespace Nv -{ -namespace Blast -{ - -// Forward declarations -class ExtPxActor; -class ExtPxAsset; -class ExtPxListener; -class TkFamily; - - -/** -PxShape Desc. - -Used to set settings for newly created PxShapes. - -@see PxShape -*/ -struct ExtPxShapeDescTemplate -{ - uint8_t flags; //!< PxShapeFlags flags - physx::PxFilterData simulationFilterData; //!< user definable collision filter data - physx::PxFilterData queryFilterData; //!< user definable query filter data. - float contactOffset; //!< contact offset - float restOffset; //!< rest offset -}; - - -/** -PxActor Desc. - -Used to set settings for newly created PxActors. -*/ -struct ExtPxActorDescTemplate -{ - uint8_t flags; //!< actor flags -}; - - -/** -Physics Spawn Settings. - -This Struct unifies setting to be used when PhysX actors are created. -*/ -struct ExtPxSpawnSettings -{ - physx::PxScene* scene; //!< PxScene for PxActors to be spawned - physx::PxMaterial* material; //!< default PxMaterial - float density; //!< default density for PhysX -}; - - -/** -PxFamily. - -A collection of actors. Maps 1 to 1 with TkFamily. -*/ -class ExtPxFamily -{ -public: - /** - Spawn ExtPxFamily. Can be called only once. Actual PhysX actors will created and placed in PxScene - - \param[in] pose World transform. - \param[in] scale Scale applied to spawned actors. - \param[in] settings Spawn settings. - - \return true if spawn was successful, false otherwise. - */ - virtual bool spawn(const physx::PxTransform& pose, const physx::PxVec3& scale, const ExtPxSpawnSettings& settings) = 0; - - - /** - Despawn this ExtPxFamily. This removes the PhysX actors from PxScene and deletes them, as well as - deleting the created ExtPxActors - - This does not call release() on the family. - - \returns true if successful. - */ - virtual bool despawn() = 0; - - - /** - The number of actors currently in this family. - - \return the number of ExtPxActor that currently exist in this family. - */ - virtual uint32_t getActorCount() const = 0; - - /** - Retrieve an array of pointers (into the user-supplied buffer) to actors. - - \param[out] buffer A user-supplied array of ExtPxActor pointers. - \param[in] bufferSize The number of elements available to write into buffer. - - \return the number of ExtPxActor pointers written to the buffer. - */ - virtual uint32_t getActors(ExtPxActor** buffer, uint32_t bufferSize) const = 0; - - /** - Every family has corresponding TkFamily. - - /return a pointer to TkFamily actor. - */ - virtual TkFamily& getTkFamily() const = 0; - - /** - Access an array of shapes of subchunks. The size of array is equal getPxAsset()->getSubchunkCount(). - For every corresponding subchunk it contains pointer to created PxShape or nullptr. - - \return the pointer to subchunk shapes array. - */ - virtual const physx::PxShape* const* getSubchunkShapes() const = 0; - - /** - Every family has an associated asset. - - \return a pointer to the (const) ExtPxAsset object. - */ - virtual ExtPxAsset& getPxAsset() const = 0; - - /** - Set the default material to be used for PxRigidDynamic creation. - - \param[in] material The material to be the new default. - */ - virtual void setMaterial(physx::PxMaterial& material) = 0; - - /* - Set ExtPxPxShapeDesc to be used on all newly created PxShapes. - - NOTE: Using it will override marking LEAF_CHUNK in simulationFilterData.word3 now. - - \param[in] pxShapeDesc The PxShape desc to be the new default. Can be nullptr. - */ - virtual void setPxShapeDescTemplate(const ExtPxShapeDescTemplate* pxShapeDesc) = 0; - - /** - Get the default ExtPxPxShapeDesc to be used on all newly created PxShapes. - - \return a pointer to the default PxShape desc. Can be nullptr. - */ - virtual const ExtPxShapeDescTemplate* getPxShapeDescTemplate() const = 0; - - /* - Set ExtPxPxActorDesc to be used on all newly created PxActors. - - \param[in] pxActorDesc The PxActor desc to be the new default. Can be nullptr. - */ - virtual void setPxActorDesc(const ExtPxActorDescTemplate* pxActorDesc) = 0; - - /** - Get the default ExtPxPxActorDesc to be used on all newly created PxActors. - - \return a pointer to the default PxActor desc. Can be nullptr. - */ - virtual const ExtPxActorDescTemplate* getPxActorDesc() const = 0; - - /** - The default material associated with this actor family. - - \return a pointer to the default material. - */ - virtual const NvBlastExtMaterial* getMaterial() const = 0; - - /** - Set the default material associated with this actor family. - - \param[in] material The material to be the new default. - */ - virtual void setMaterial(const NvBlastExtMaterial* material) = 0; - - /** - Add a user implementation of ExtPxListener to this family's list of listeners. - - \param[in] listener The event listener to add. - */ - virtual void subscribe(ExtPxListener& listener) = 0; - - /** - Remove a user implementation of ExtPxListener from this family's list of listeners. - - \param[in] listener The event listener to remove. - */ - virtual void unsubscribe(ExtPxListener& listener) = 0; - - /** - Call after split. - */ - virtual void postSplitUpdate() = 0; - - /** - Release this family. - */ - virtual void release() = 0; - - /** - UserData pointer. Free to be used by user in any way. - */ - void* userData; -}; - - - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTEXTPXFAMILY_H +// 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-2018 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTEXTPXFAMILY_H +#define NVBLASTEXTPXFAMILY_H + +#include "PxFiltering.h" + + +// Forward declarations +namespace physx +{ +class PxRigidDynamic; +class PxMaterial; +class PxScene; +class PxTransform; +} + +struct NvBlastExtMaterial; + + +namespace Nv +{ +namespace Blast +{ + +// Forward declarations +class ExtPxActor; +class ExtPxAsset; +class ExtPxListener; +class TkFamily; + + +/** +PxShape Desc. + +Used to set settings for newly created PxShapes. + +@see PxShape +*/ +struct ExtPxShapeDescTemplate +{ + uint8_t flags; //!< PxShapeFlags flags + physx::PxFilterData simulationFilterData; //!< user definable collision filter data + physx::PxFilterData queryFilterData; //!< user definable query filter data. + float contactOffset; //!< contact offset + float restOffset; //!< rest offset +}; + + +/** +PxActor Desc. + +Used to set settings for newly created PxActors. +*/ +struct ExtPxActorDescTemplate +{ + uint8_t flags; //!< actor flags +}; + + +/** +Physics Spawn Settings. + +This Struct unifies setting to be used when PhysX actors are created. +*/ +struct ExtPxSpawnSettings +{ + physx::PxScene* scene; //!< PxScene for PxActors to be spawned + physx::PxMaterial* material; //!< default PxMaterial + float density; //!< default density for PhysX +}; + + +/** +PxFamily. + +A collection of actors. Maps 1 to 1 with TkFamily. +*/ +class ExtPxFamily +{ +public: + /** + Spawn ExtPxFamily. Can be called only once. Actual PhysX actors will created and placed in PxScene + + \param[in] pose World transform. + \param[in] scale Scale applied to spawned actors. + \param[in] settings Spawn settings. + + \return true if spawn was successful, false otherwise. + */ + virtual bool spawn(const physx::PxTransform& pose, const physx::PxVec3& scale, const ExtPxSpawnSettings& settings) = 0; + + + /** + Despawn this ExtPxFamily. This removes the PhysX actors from PxScene and deletes them, as well as + deleting the created ExtPxActors + + This does not call release() on the family. + + \returns true if successful. + */ + virtual bool despawn() = 0; + + + /** + The number of actors currently in this family. + + \return the number of ExtPxActor that currently exist in this family. + */ + virtual uint32_t getActorCount() const = 0; + + /** + Retrieve an array of pointers (into the user-supplied buffer) to actors. + + \param[out] buffer A user-supplied array of ExtPxActor pointers. + \param[in] bufferSize The number of elements available to write into buffer. + + \return the number of ExtPxActor pointers written to the buffer. + */ + virtual uint32_t getActors(ExtPxActor** buffer, uint32_t bufferSize) const = 0; + + /** + Every family has corresponding TkFamily. + + /return a pointer to TkFamily actor. + */ + virtual TkFamily& getTkFamily() const = 0; + + /** + Access an array of shapes of subchunks. The size of array is equal getPxAsset()->getSubchunkCount(). + For every corresponding subchunk it contains pointer to created PxShape or nullptr. + + \return the pointer to subchunk shapes array. + */ + virtual const physx::PxShape* const* getSubchunkShapes() const = 0; + + /** + Every family has an associated asset. + + \return a pointer to the (const) ExtPxAsset object. + */ + virtual ExtPxAsset& getPxAsset() const = 0; + + /** + Set the default material to be used for PxRigidDynamic creation. + + \param[in] material The material to be the new default. + */ + virtual void setMaterial(physx::PxMaterial& material) = 0; + + /* + Set ExtPxPxShapeDesc to be used on all newly created PxShapes. + + NOTE: Using it will override marking LEAF_CHUNK in simulationFilterData.word3 now. + + \param[in] pxShapeDesc The PxShape desc to be the new default. Can be nullptr. + */ + virtual void setPxShapeDescTemplate(const ExtPxShapeDescTemplate* pxShapeDesc) = 0; + + /** + Get the default ExtPxPxShapeDesc to be used on all newly created PxShapes. + + \return a pointer to the default PxShape desc. Can be nullptr. + */ + virtual const ExtPxShapeDescTemplate* getPxShapeDescTemplate() const = 0; + + /* + Set ExtPxPxActorDesc to be used on all newly created PxActors. + + \param[in] pxActorDesc The PxActor desc to be the new default. Can be nullptr. + */ + virtual void setPxActorDesc(const ExtPxActorDescTemplate* pxActorDesc) = 0; + + /** + Get the default ExtPxPxActorDesc to be used on all newly created PxActors. + + \return a pointer to the default PxActor desc. Can be nullptr. + */ + virtual const ExtPxActorDescTemplate* getPxActorDesc() const = 0; + + /** + The default material associated with this actor family. + + \return a pointer to the default material. + */ + virtual const NvBlastExtMaterial* getMaterial() const = 0; + + /** + Set the default material associated with this actor family. + + \param[in] material The material to be the new default. + */ + virtual void setMaterial(const NvBlastExtMaterial* material) = 0; + + /** + Add a user implementation of ExtPxListener to this family's list of listeners. + + \param[in] listener The event listener to add. + */ + virtual void subscribe(ExtPxListener& listener) = 0; + + /** + Remove a user implementation of ExtPxListener from this family's list of listeners. + + \param[in] listener The event listener to remove. + */ + virtual void unsubscribe(ExtPxListener& listener) = 0; + + /** + Call after split. + */ + virtual void postSplitUpdate() = 0; + + /** + Release this family. + */ + virtual void release() = 0; + + /** + UserData pointer. Free to be used by user in any way. + */ + void* userData; +}; + + + +} // namespace Blast +} // namespace Nv + + +#endif // ifndef NVBLASTEXTPXFAMILY_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxListener.h b/sdk/extensions/physx/include/NvBlastExtPxListener.h old mode 100644 new mode 100755 index dd64159..e6793e6 --- a/sdk/extensions/physx/include/NvBlastExtPxListener.h +++ b/sdk/extensions/physx/include/NvBlastExtPxListener.h @@ -1,73 +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-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTPXLISTENER_H -#define NVBLASTEXTPXLISTENER_H - - -namespace Nv -{ -namespace Blast -{ - -// Forward declarations -class ExtPxFamily; -class ExtPxActor; - - -/** -Physics Listener Interface. - -Actor create/destroy events listener. -*/ -class ExtPxListener -{ -public: - /** - Interface to be implemented by the user. Will be called when ExtPxFamily creates new actor. - - \param[in] family Corresponding ExtPxFamily with new actor. - \param[in] actor The new actor. - */ - virtual void onActorCreated(ExtPxFamily& family, ExtPxActor& actor) = 0; - - /** - Interface to be implemented by the user. Will be called when ExtPxFamily destroy an actor. - - \param[in] family Corresponding ExtPxFamily. - \param[in] actor The actor to be destroyed. - */ - virtual void onActorDestroyed(ExtPxFamily& family, ExtPxActor& actor) = 0; -}; - - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTEXTPXLISTENER_H +// 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-2018 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTEXTPXLISTENER_H +#define NVBLASTEXTPXLISTENER_H + + +namespace Nv +{ +namespace Blast +{ + +// Forward declarations +class ExtPxFamily; +class ExtPxActor; + + +/** +Physics Listener Interface. + +Actor create/destroy events listener. +*/ +class ExtPxListener +{ +public: + /** + Interface to be implemented by the user. Will be called when ExtPxFamily creates new actor. + + \param[in] family Corresponding ExtPxFamily with new actor. + \param[in] actor The new actor. + */ + virtual void onActorCreated(ExtPxFamily& family, ExtPxActor& actor) = 0; + + /** + Interface to be implemented by the user. Will be called when ExtPxFamily destroy an actor. + + \param[in] family Corresponding ExtPxFamily. + \param[in] actor The actor to be destroyed. + */ + virtual void onActorDestroyed(ExtPxFamily& family, ExtPxActor& actor) = 0; +}; + + +} // namespace Blast +} // namespace Nv + + +#endif // ifndef NVBLASTEXTPXLISTENER_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxManager.h b/sdk/extensions/physx/include/NvBlastExtPxManager.h old mode 100644 new mode 100755 index 7fe6f50..1a6e5e3 --- a/sdk/extensions/physx/include/NvBlastExtPxManager.h +++ b/sdk/extensions/physx/include/NvBlastExtPxManager.h @@ -1,263 +1,263 @@ -// 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-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTPXMANAGER_H -#define NVBLASTEXTPXMANAGER_H - -#include "NvBlastTypes.h" -#include "PxConvexMeshGeometry.h" -#include "PxTransform.h" -#include "NvPreprocessor.h" - - -// Forward declarations -namespace physx -{ -class PxPhysics; -class PxRigidDynamic; -class PxJoint; - -namespace general_PxIOStream2 -{ -class PxFileBuf; -} -} - - -namespace Nv -{ -namespace Blast -{ - -// Forward declarations -class ExtPxActor; -class ExtPxAsset; -class ExtPxFamily; -class ExtPxListener; -class TkFamily; -class TkFramework; -class TkGroup; -class TkJoint; - - -/** -Family Desc. - -Used to create Physics Family. -*/ -struct ExtPxFamilyDesc -{ - 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 -}; - - -/** -Function pointer for PxJoint creation. - -It will be called when new joints are being created. It should return valid PxJoint pointer or nullptr. -*/ -typedef physx::PxJoint*(*ExtPxCreateJointFunction)(ExtPxActor* actor0, const physx::PxTransform& localFrame0, ExtPxActor* actor1, const physx::PxTransform& localFrame1, physx::PxPhysics& physics, TkJoint& joint); - - -/** -Physics Manager. - -Used to create and manage Physics Families. -*/ -class NV_DLL_EXPORT ExtPxManager -{ -public: - //////// manager creation //////// - - /** - Create a new ExtPxManager. - - \param[in] physics The PxPhysics instance to be used by ExtPxManager. - \param[in] framework The TkFramework instance to be used by ExtPxManager. - \param[in] createFn The function to be used when creating joints, can be nullptr. - \param[in] useUserData Flag if ExtPxManager is allowed to override PxActor's userData, it will store pointer to PxActor there. - It is recommended as fastest way. If set to 'false' HashMap will be used. - - \return the new ExtPxManager if successful, NULL otherwise. - */ - static ExtPxManager* create(physx::PxPhysics& physics, TkFramework& framework, ExtPxCreateJointFunction createFn = nullptr, bool useUserData = true); - - /** - Release this manager. - */ - virtual void release() = 0; - - - //////// impact //////// - - /** - Simulation Filter data to be set on leaf chunk actors - */ - enum FilterDataAttributes - { - LEAF_CHUNK = 1, - }; - - - //////// interface //////// - - /** - Create a px family from the given descriptor. - - \param[in] desc The family descriptor (see ExtPxFamilyDesc). - - \return the created family, if the descriptor was valid and memory was available for the operation. Otherwise, returns NULL. - */ - virtual ExtPxFamily* createFamily(const ExtPxFamilyDesc& desc) = 0; - - /** - Create a px joint associated with TkJoint. - - ExtPxCreateJointFunction will be called after this call. - ExtPxCreateJointFunction must be set, nothing will happen otherwise. - - \param[in] joint TkJoint to be used to create px joint. - - \return true iff Joint was created. - */ - virtual bool createJoint(TkJoint& joint) = 0; - - /** - Destroy a px joint associated with TkJoint. - - \param[in] joint TkJoint to be used to destroy px joint. - */ - virtual void destroyJoint(TkJoint& joint) = 0; - - /** - Set ExtPxCreateJointFunction to be used when new joints are being created.\ - - \param[in] createFn Create function pointer to set, can be nullptr. - */ - virtual void setCreateJointFunction(ExtPxCreateJointFunction createFn) = 0; - - /** - The number of families currently in this manager. - - \return the number of ExtPxFamily that currently exist in this manger. - */ - virtual uint32_t getFamilyCount() const = 0; - - /** - Retrieve an array of pointers (into the user-supplied buffer) to families. - - \param[out] buffer A user-supplied array of ExtPxFamily pointers. - \param[in] bufferSize The number of elements available to write into buffer. - - \return the number of ExtPxFamily pointers written to the buffer. - */ - virtual uint32_t getFamilies(ExtPxFamily** buffer, uint32_t bufferSize) const = 0; - - /** - Look up an associated ExtPxFamily by TkFamily pointer. - - \param[in] family The TkFamily pointer to look up. - - \return pointer to the ExtPxFamily object if it exists, NULL otherwise. - */ - virtual ExtPxFamily* getFamilyFromTkFamily(TkFamily& family) const = 0; - - /** - Look up an associated ExtPxActor by PxRigidDynamic pointer. - - \param[in] pxActor The PxRigidDynamic pointer to look up. - - \return pointer to the ExtPxActor object if it exists, NULL otherwise. - */ - virtual ExtPxActor* getActorFromPhysXActor(const physx::PxRigidDynamic& pxActor) const = 0; - - /** - Get a PxPhysics object pointer used upon manager creation. - - \return a pointer to the (const) PxPhysics object. - */ - virtual physx::PxPhysics& getPhysics() const = 0; - - /** - Get a TkFramework object pointer used upon manager creation. - - \return a pointer to the TkFramework object. - */ - virtual TkFramework& getFramework() const = 0; - - /** - Get if useUserData was set upon manager creation. - - \return true iff PxActor userData is used by manager. - */ - virtual bool isPxUserDataUsed() const = 0; - - /** - Limits the total number of actors that can exist at a given time. A value of zero disables this (gives no limit). - - \param[in] limit If not zero, the maximum number of actors that will be allowed to exist. - */ - virtual void setActorCountLimit(uint32_t limit) = 0; - - /** - Retrieve the limit to the total number of actors that can exist at a given time. A value of zero disables this (gives no limit). - - \return the limit to the total number of actors that can exist at a given time (or zero if there is no limit). - */ - virtual uint32_t getActorCountLimit() = 0; - - /** - The total number of PxActors generated by Blast. - - \return the total number of PxActors generated by Blast. - */ - virtual uint32_t getPxActorCount() const = 0; - - /** - Add a user implementation of ExtPxListener to this family's list of listeners. - - \param[in] listener The event listener to add. - */ - virtual void subscribe(ExtPxListener& listener) = 0; - - /** - Remove a user implementation of ExtPxListener from this family's list of listeners. - - \param[in] listener The event listener to remove. - */ - virtual void unsubscribe(ExtPxListener& listener) = 0; -}; - - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTEXTPXMANAGER_H +// 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-2018 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTEXTPXMANAGER_H +#define NVBLASTEXTPXMANAGER_H + +#include "NvBlastTypes.h" +#include "PxConvexMeshGeometry.h" +#include "PxTransform.h" +#include "NvPreprocessor.h" + + +// Forward declarations +namespace physx +{ +class PxPhysics; +class PxRigidDynamic; +class PxJoint; + +namespace general_PxIOStream2 +{ +class PxFileBuf; +} +} + + +namespace Nv +{ +namespace Blast +{ + +// Forward declarations +class ExtPxActor; +class ExtPxAsset; +class ExtPxFamily; +class ExtPxListener; +class TkFamily; +class TkFramework; +class TkGroup; +class TkJoint; + + +/** +Family Desc. + +Used to create Physics Family. +*/ +struct ExtPxFamilyDesc +{ + 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 +}; + + +/** +Function pointer for PxJoint creation. + +It will be called when new joints are being created. It should return valid PxJoint pointer or nullptr. +*/ +typedef physx::PxJoint*(*ExtPxCreateJointFunction)(ExtPxActor* actor0, const physx::PxTransform& localFrame0, ExtPxActor* actor1, const physx::PxTransform& localFrame1, physx::PxPhysics& physics, TkJoint& joint); + + +/** +Physics Manager. + +Used to create and manage Physics Families. +*/ +class NV_DLL_EXPORT ExtPxManager +{ +public: + //////// manager creation //////// + + /** + Create a new ExtPxManager. + + \param[in] physics The PxPhysics instance to be used by ExtPxManager. + \param[in] framework The TkFramework instance to be used by ExtPxManager. + \param[in] createFn The function to be used when creating joints, can be nullptr. + \param[in] useUserData Flag if ExtPxManager is allowed to override PxActor's userData, it will store pointer to PxActor there. + It is recommended as fastest way. If set to 'false' HashMap will be used. + + \return the new ExtPxManager if successful, NULL otherwise. + */ + static ExtPxManager* create(physx::PxPhysics& physics, TkFramework& framework, ExtPxCreateJointFunction createFn = nullptr, bool useUserData = true); + + /** + Release this manager. + */ + virtual void release() = 0; + + + //////// impact //////// + + /** + Simulation Filter data to be set on leaf chunk actors + */ + enum FilterDataAttributes + { + LEAF_CHUNK = 1, + }; + + + //////// interface //////// + + /** + Create a px family from the given descriptor. + + \param[in] desc The family descriptor (see ExtPxFamilyDesc). + + \return the created family, if the descriptor was valid and memory was available for the operation. Otherwise, returns NULL. + */ + virtual ExtPxFamily* createFamily(const ExtPxFamilyDesc& desc) = 0; + + /** + Create a px joint associated with TkJoint. + + ExtPxCreateJointFunction will be called after this call. + ExtPxCreateJointFunction must be set, nothing will happen otherwise. + + \param[in] joint TkJoint to be used to create px joint. + + \return true iff Joint was created. + */ + virtual bool createJoint(TkJoint& joint) = 0; + + /** + Destroy a px joint associated with TkJoint. + + \param[in] joint TkJoint to be used to destroy px joint. + */ + virtual void destroyJoint(TkJoint& joint) = 0; + + /** + Set ExtPxCreateJointFunction to be used when new joints are being created.\ + + \param[in] createFn Create function pointer to set, can be nullptr. + */ + virtual void setCreateJointFunction(ExtPxCreateJointFunction createFn) = 0; + + /** + The number of families currently in this manager. + + \return the number of ExtPxFamily that currently exist in this manger. + */ + virtual uint32_t getFamilyCount() const = 0; + + /** + Retrieve an array of pointers (into the user-supplied buffer) to families. + + \param[out] buffer A user-supplied array of ExtPxFamily pointers. + \param[in] bufferSize The number of elements available to write into buffer. + + \return the number of ExtPxFamily pointers written to the buffer. + */ + virtual uint32_t getFamilies(ExtPxFamily** buffer, uint32_t bufferSize) const = 0; + + /** + Look up an associated ExtPxFamily by TkFamily pointer. + + \param[in] family The TkFamily pointer to look up. + + \return pointer to the ExtPxFamily object if it exists, NULL otherwise. + */ + virtual ExtPxFamily* getFamilyFromTkFamily(TkFamily& family) const = 0; + + /** + Look up an associated ExtPxActor by PxRigidDynamic pointer. + + \param[in] pxActor The PxRigidDynamic pointer to look up. + + \return pointer to the ExtPxActor object if it exists, NULL otherwise. + */ + virtual ExtPxActor* getActorFromPhysXActor(const physx::PxRigidDynamic& pxActor) const = 0; + + /** + Get a PxPhysics object pointer used upon manager creation. + + \return a pointer to the (const) PxPhysics object. + */ + virtual physx::PxPhysics& getPhysics() const = 0; + + /** + Get a TkFramework object pointer used upon manager creation. + + \return a pointer to the TkFramework object. + */ + virtual TkFramework& getFramework() const = 0; + + /** + Get if useUserData was set upon manager creation. + + \return true iff PxActor userData is used by manager. + */ + virtual bool isPxUserDataUsed() const = 0; + + /** + Limits the total number of actors that can exist at a given time. A value of zero disables this (gives no limit). + + \param[in] limit If not zero, the maximum number of actors that will be allowed to exist. + */ + virtual void setActorCountLimit(uint32_t limit) = 0; + + /** + Retrieve the limit to the total number of actors that can exist at a given time. A value of zero disables this (gives no limit). + + \return the limit to the total number of actors that can exist at a given time (or zero if there is no limit). + */ + virtual uint32_t getActorCountLimit() = 0; + + /** + The total number of PxActors generated by Blast. + + \return the total number of PxActors generated by Blast. + */ + virtual uint32_t getPxActorCount() const = 0; + + /** + Add a user implementation of ExtPxListener to this family's list of listeners. + + \param[in] listener The event listener to add. + */ + virtual void subscribe(ExtPxListener& listener) = 0; + + /** + Remove a user implementation of ExtPxListener from this family's list of listeners. + + \param[in] listener The event listener to remove. + */ + virtual void unsubscribe(ExtPxListener& listener) = 0; +}; + + +} // namespace Blast +} // namespace Nv + + +#endif // ifndef NVBLASTEXTPXMANAGER_H diff --git a/sdk/extensions/physx/include/NvBlastExtPxStressSolver.h b/sdk/extensions/physx/include/NvBlastExtPxStressSolver.h old mode 100644 new mode 100755 index b5fe5ef..dee2c1e --- a/sdk/extensions/physx/include/NvBlastExtPxStressSolver.h +++ b/sdk/extensions/physx/include/NvBlastExtPxStressSolver.h @@ -1,98 +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-2018 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 +// 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-2018 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 old mode 100644 new mode 100755 index 99636d9..066613d --- a/sdk/extensions/physx/include/NvBlastExtPxTask.h +++ b/sdk/extensions/physx/include/NvBlastExtPxTask.h @@ -1,106 +1,106 @@ -// 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-2018 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: - /** - Construct using existing physx::PxTaskManager and TkGroup. The TkGroup can be set later with setGroup(). - */ - static ExtGroupTaskManager* create(physx::PxTaskManager&, TkGroup* = nullptr); - - /** - Set the group to process. Cannot be changed while a 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. - If 0, processing did not start and wait() will never return true. - */ - virtual uint32_t process(uint32_t workerCount = 0) = 0; - - /** - Wait for the group to end processing. When processing has finished, TkGroup::endProcess is executed. - - \param[in] block true: does not return until the group has been processed. - false: return immediately if workers are still processing the group. - - \return true if group processing was completed (and the group was actually processing) - */ - virtual bool wait(bool block = true) = 0; - - /** - Release this object. - */ - virtual void release() = 0; -}; - - -} // namespace Blast -} // namespace Nv - -#endif // NVBLASTEXTPXTASK_H +// 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-2018 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: + /** + Construct using existing physx::PxTaskManager and TkGroup. The TkGroup can be set later with setGroup(). + */ + static ExtGroupTaskManager* create(physx::PxTaskManager&, TkGroup* = nullptr); + + /** + Set the group to process. Cannot be changed while a 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. + If 0, processing did not start and wait() will never return true. + */ + virtual uint32_t process(uint32_t workerCount = 0) = 0; + + /** + Wait for the group to end processing. When processing has finished, TkGroup::endProcess is executed. + + \param[in] block true: does not return until the group has been processed. + false: return immediately if workers are still processing the group. + + \return true if group processing was completed (and the group was actually 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/NvBlastExtSync.h b/sdk/extensions/physx/include/NvBlastExtSync.h old mode 100644 new mode 100755 index cbb0648..1956f98 --- a/sdk/extensions/physx/include/NvBlastExtSync.h +++ b/sdk/extensions/physx/include/NvBlastExtSync.h @@ -1,231 +1,231 @@ -// 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-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTSYNC_H -#define NVBLASTEXTSYNC_H - -#include "NvBlastTk.h" -#include "foundation/PxTransform.h" -#include "NvPreprocessor.h" -#include "NvBlastGlobals.h" - - -namespace Nv -{ -namespace Blast -{ - -class ExtPxFamily; -class ExtPxManager; - - -/** -Sync Event types -*/ -struct ExtSyncEventType -{ - enum Enum - { - Fracture = 0, //!< Contains Fracture commands - FamilySync, //!< Contains full family Family blob - Physics, //!< Contains actor's physical info, like transforms - - Count - }; -}; - - -/** -Generic Sync Event -*/ -struct NV_DLL_EXPORT ExtSyncEvent -{ - ExtSyncEvent(ExtSyncEventType::Enum t) : type(t) {} - virtual ~ExtSyncEvent() {} - - template - const T* getEvent() const { return reinterpret_cast(this); } - - /** - Any Event can be copied (cloned). - - \return the pointer to the new copy of event. - */ - virtual ExtSyncEvent* clone() const = 0; - - void release(); - - ExtSyncEventType::Enum type; //!< Event type - uint64_t timestamp; //!< Event timestamp - NvBlastID familyID; //!< TkFamily ID -}; - - -/** -Generic CRTP for Sync Events -*/ -template -struct ExtSyncEventInstance : public ExtSyncEvent -{ - ExtSyncEventInstance() : ExtSyncEvent(eventType) {} - - static const ExtSyncEventType::Enum EVENT_TYPE = eventType; - - ExtSyncEvent* clone() const override - { - return NVBLAST_NEW (T) (*(T*)this); - } -}; - - -/** -Fracture Sync Event -*/ -struct ExtSyncEventFracture : public ExtSyncEventInstance -{ - std::vector bondFractures; //!< bond fracture data - std::vector chunkFractures; //!< chunk fracture data -}; - - -/** -Family Sync Event -*/ -struct ExtSyncEventFamilySync : public ExtSyncEventInstance -{ - std::vector family; //!< family binary blob -}; - - -/** -Physics Sync Event -*/ -struct ExtSyncEventPhysicsSync : public ExtSyncEventInstance -{ - struct ActorData - { - uint32_t actorIndex; //!< actor index in family - physx::PxTransform transform; //!< actor world transform - }; - - std::vector data; //!< actors data -}; - - -/** -Sync Manager. - -Implements TkEventListener interface. It can be directly subscribed to listen for family events. -*/ -class NV_DLL_EXPORT ExtSync : public TkEventListener -{ -public: - //////// creation //////// - - /** - Create a new ExtSync. - - \return the new ExtSync if successful, NULL otherwise. - */ - static ExtSync* create(); - - - //////// common interface //////// - - /** - Release Sync manager. - */ - virtual void release() = 0; - - - //////// server-side interface //////// - - /** - TkEventListener interface. - - \param[in] events The array of events being dispatched. - \param[in] eventCount The number of events in the array. - */ - virtual void receive(const TkEvent* events, uint32_t eventCount) = 0; - - /** - Sync family state. Writes to internal sync buffer. - - \param[in] family The TkFamily to sync - */ - virtual void syncFamily(const TkFamily& family) = 0; - - /** - Sync PxFamily state. Writes to internal sync buffer. - - \param[in] family The ExtPxFamily to sync - */ - virtual void syncFamily(const ExtPxFamily& family) = 0; - - /** - The size of internal sync buffer (events count). - - \return the number of events in internal sync buffer. - */ - virtual uint32_t getSyncBufferSize() const = 0; - - /** - Acquire internal sync buffer. - - \param[in] buffer Reference to sync event buffer pointer to be set. - \param[in] size Reference to the size of the buffer array to be set. - */ - virtual void acquireSyncBuffer(const ExtSyncEvent*const*& buffer, uint32_t& size) const = 0; - - /** - Clear internal sync buffer. - */ - virtual void releaseSyncBuffer() = 0; - - - //////// client-side interface //////// - - /** - Apply external sync buffer on TkFramework and possibly ExtPxManager. This function call will result in - respective families/actors changes in order to synchronize state. - - \param[in] framework The TkFramework instance to be used. - \param[in] buffer Sync buffer array pointer. - \param[in] size Sync buffer array size. - \param[in] groupForNewActors TkGroup to be used for newly created actors. Can be nullptr. - \param[in] manager The ExtPxManager instance to be used. Can be nullptr, physics sync events will be ignored in that case. - */ - virtual void applySyncBuffer(TkFramework& framework, const ExtSyncEvent** buffer, uint32_t size, TkGroup* groupForNewActors, ExtPxManager* manager = nullptr) = 0; - -}; - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTEXTSYNC_H +// 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-2018 NVIDIA Corporation. All rights reserved. + + +#ifndef NVBLASTEXTSYNC_H +#define NVBLASTEXTSYNC_H + +#include "NvBlastTk.h" +#include "foundation/PxTransform.h" +#include "NvPreprocessor.h" +#include "NvBlastGlobals.h" + + +namespace Nv +{ +namespace Blast +{ + +class ExtPxFamily; +class ExtPxManager; + + +/** +Sync Event types +*/ +struct ExtSyncEventType +{ + enum Enum + { + Fracture = 0, //!< Contains Fracture commands + FamilySync, //!< Contains full family Family blob + Physics, //!< Contains actor's physical info, like transforms + + Count + }; +}; + + +/** +Generic Sync Event +*/ +struct NV_DLL_EXPORT ExtSyncEvent +{ + ExtSyncEvent(ExtSyncEventType::Enum t) : type(t) {} + virtual ~ExtSyncEvent() {} + + template + const T* getEvent() const { return reinterpret_cast(this); } + + /** + Any Event can be copied (cloned). + + \return the pointer to the new copy of event. + */ + virtual ExtSyncEvent* clone() const = 0; + + void release(); + + ExtSyncEventType::Enum type; //!< Event type + uint64_t timestamp; //!< Event timestamp + NvBlastID familyID; //!< TkFamily ID +}; + + +/** +Generic CRTP for Sync Events +*/ +template +struct ExtSyncEventInstance : public ExtSyncEvent +{ + ExtSyncEventInstance() : ExtSyncEvent(eventType) {} + + static const ExtSyncEventType::Enum EVENT_TYPE = eventType; + + ExtSyncEvent* clone() const override + { + return NVBLAST_NEW (T) (*(T*)this); + } +}; + + +/** +Fracture Sync Event +*/ +struct ExtSyncEventFracture : public ExtSyncEventInstance +{ + std::vector bondFractures; //!< bond fracture data + std::vector chunkFractures; //!< chunk fracture data +}; + + +/** +Family Sync Event +*/ +struct ExtSyncEventFamilySync : public ExtSyncEventInstance +{ + std::vector family; //!< family binary blob +}; + + +/** +Physics Sync Event +*/ +struct ExtSyncEventPhysicsSync : public ExtSyncEventInstance +{ + struct ActorData + { + uint32_t actorIndex; //!< actor index in family + physx::PxTransform transform; //!< actor world transform + }; + + std::vector data; //!< actors data +}; + + +/** +Sync Manager. + +Implements TkEventListener interface. It can be directly subscribed to listen for family events. +*/ +class NV_DLL_EXPORT ExtSync : public TkEventListener +{ +public: + //////// creation //////// + + /** + Create a new ExtSync. + + \return the new ExtSync if successful, NULL otherwise. + */ + static ExtSync* create(); + + + //////// common interface //////// + + /** + Release Sync manager. + */ + virtual void release() = 0; + + + //////// server-side interface //////// + + /** + TkEventListener interface. + + \param[in] events The array of events being dispatched. + \param[in] eventCount The number of events in the array. + */ + virtual void receive(const TkEvent* events, uint32_t eventCount) = 0; + + /** + Sync family state. Writes to internal sync buffer. + + \param[in] family The TkFamily to sync + */ + virtual void syncFamily(const TkFamily& family) = 0; + + /** + Sync PxFamily state. Writes to internal sync buffer. + + \param[in] family The ExtPxFamily to sync + */ + virtual void syncFamily(const ExtPxFamily& family) = 0; + + /** + The size of internal sync buffer (events count). + + \return the number of events in internal sync buffer. + */ + virtual uint32_t getSyncBufferSize() const = 0; + + /** + Acquire internal sync buffer. + + \param[in] buffer Reference to sync event buffer pointer to be set. + \param[in] size Reference to the size of the buffer array to be set. + */ + virtual void acquireSyncBuffer(const ExtSyncEvent*const*& buffer, uint32_t& size) const = 0; + + /** + Clear internal sync buffer. + */ + virtual void releaseSyncBuffer() = 0; + + + //////// client-side interface //////// + + /** + Apply external sync buffer on TkFramework and possibly ExtPxManager. This function call will result in + respective families/actors changes in order to synchronize state. + + \param[in] framework The TkFramework instance to be used. + \param[in] buffer Sync buffer array pointer. + \param[in] size Sync buffer array size. + \param[in] groupForNewActors TkGroup to be used for newly created actors. Can be nullptr. + \param[in] manager The ExtPxManager instance to be used. Can be nullptr, physics sync events will be ignored in that case. + */ + virtual void applySyncBuffer(TkFramework& framework, const ExtSyncEvent** buffer, uint32_t size, TkGroup* groupForNewActors, ExtPxManager* manager = nullptr) = 0; + +}; + +} // namespace Blast +} // namespace Nv + + +#endif // ifndef NVBLASTEXTSYNC_H diff --git a/sdk/extensions/physx/include/NvBlastPxCallbacks.h b/sdk/extensions/physx/include/NvBlastPxCallbacks.h old mode 100644 new mode 100755 index b8a8b0d..1dd3d80 --- a/sdk/extensions/physx/include/NvBlastPxCallbacks.h +++ b/sdk/extensions/physx/include/NvBlastPxCallbacks.h @@ -1,73 +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-2018 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 +// 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-2018 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 -- cgit v1.2.3