diff --git a/physx/CHANGELOG.md b/physx/CHANGELOG.md index 05bb40fe2..67651fd6a 100644 --- a/physx/CHANGELOG.md +++ b/physx/CHANGELOG.md @@ -1,3 +1,43 @@ +# v5.1.1 + +## General + +### Changed: + +* Be aware that due to reorganization of some virtual functions in the public interface the binary data layout has changed from v5.1.0. Linking code that includes the headers of v5.1.1 against binaries that have been built with an older version will likely cause problems. + +### Added: + +* Support for spatial and fixed tendon serialization. + +### Fixed: + +* Binary serialization of articulations had a bug, which got fixed. +* Includes [PR #8: Download bootstrap packages using TLS](https://github.com/NVIDIA-Omniverse/PhysX/pull/8/) + +## Rigid Body + +### Fixed + +* A crash when colliding an SDF mesh against a sphere + +## Particle Systems + +### Fixed + +* Particle systems now support is<> type conversion. + +### Removed + +* The PxParticlePhase class has been removed. It was unused. + +## Vehicles2 + +### Changed: + +* SnippetVehicle2Multithreading is now using custom profiling code to provide timings in release builds too. + + # v5.1.0 ## Supported Platforms diff --git a/physx/README.md b/physx/README.md index d5e80a21a..89f00c8d3 100644 --- a/physx/README.md +++ b/physx/README.md @@ -37,7 +37,7 @@ Please see [Release Notes](./CHANGELOG.md) for updates pertaining to the latest ## User Guide and API Documentation -The user guide and API documentation are available on [GitHub Pages](https://nvidia-omniverse.github.io/PhysX/physx). Please create an [Issue](https://github.com/NVIDIA-Omniverse/PhysX/issues/) if you find a documentation issue. +The user guide and API documentation are available on [GitHub Pages](https://nvidia-omniverse.github.io/PhysX/physx/index.html). Please create an [Issue](https://github.com/NVIDIA-Omniverse/PhysX/issues/) if you find a documentation issue. ## Quick Start Instructions diff --git a/physx/buildtools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd b/physx/buildtools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd index 4339bdc34..d9b732afa 100644 --- a/physx/buildtools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd +++ b/physx/buildtools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd @@ -20,7 +20,7 @@ @echo Fetching %PACKAGE_NAME% ... @powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0download_file_from_url.ps1" ^ - -source "http://bootstrap.packman.nvidia.com/%PACKAGE_NAME%" -output %TARGET_PATH% + -source "https://bootstrap.packman.nvidia.com/%PACKAGE_NAME%" -output %TARGET_PATH% :: A bug in powershell prevents the errorlevel code from being set when using the -File execution option :: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes: @if not exist %TARGET_PATH% goto ERROR_DOWNLOAD_FAILED diff --git a/physx/buildtools/packman/packman b/physx/buildtools/packman/packman index f481b87fe..ac13e801a 100755 --- a/physx/buildtools/packman/packman +++ b/physx/buildtools/packman/packman @@ -62,7 +62,7 @@ fi fetch_file_from_s3() { SOURCE=$1 - SOURCE_URL=http://bootstrap.packman.nvidia.com/$SOURCE + SOURCE_URL=https://bootstrap.packman.nvidia.com/$SOURCE TARGET=$2 echo "Fetching $SOURCE from bootstrap.packman.nvidia.com ..." if command -v wget >/dev/null 2>&1; then diff --git a/physx/dependencies.xml b/physx/dependencies.xml index 7404a0d7e..81ee270f8 100644 --- a/physx/dependencies.xml +++ b/physx/dependencies.xml @@ -20,7 +20,7 @@ - + diff --git a/physx/documentation/platformreadme/linux/README_LINUX.md b/physx/documentation/platformreadme/linux/README_LINUX.md index b8eeb646d..44b27506d 100644 --- a/physx/documentation/platformreadme/linux/README_LINUX.md +++ b/physx/documentation/platformreadme/linux/README_LINUX.md @@ -9,10 +9,14 @@ * CMake, minimum version 3.14 * Python, minimum version 3.5 -* Clang, min version 3.8 -* Gcc for aarch64, min version 5.3 * curl +Compilers: + * For linux x86-64 builds we support Ubuntu LTS releases with their respective default compiler versions: + * Ubuntu 20.04 LTS with gcc 9 or clang 10 + * Ubuntu 22.04 LTS with gcc 11 or clang 14 + * For linux aarch64 builds we support gcc version 9 + ## Generating Makefiles: diff --git a/physx/include/PxArticulationTendon.h b/physx/include/PxArticulationTendon.h index 6da632da5..c723c3e06 100644 --- a/physx/include/PxArticulationTendon.h +++ b/physx/include/PxArticulationTendon.h @@ -56,7 +56,7 @@ namespace physx /** \brief Defines a spatial tendon attachment point on a link. */ - class PxArticulationAttachment + class PxArticulationAttachment : public PxBase { public: @@ -180,14 +180,26 @@ namespace physx */ virtual void release() = 0; - void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + + /** + \brief Returns the string name of the dynamic type. + + \return The string name. + */ + virtual const char* getConcreteTypeName() const { return "PxArticulationAttachment"; } + + protected: + + PX_INLINE PxArticulationAttachment(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxArticulationAttachment(PxBaseFlags baseFlags) : PxBase(baseFlags) {} }; /** \brief Defines a fixed-tendon joint on an articulation joint degree of freedom. */ - class PxArticulationTendonJoint + class PxArticulationTendonJoint : public PxBase { public: @@ -253,6 +265,18 @@ namespace physx virtual void release() = 0; void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + + /** + \brief Returns the string name of the dynamic type. + + \return The string name. + */ + virtual const char* getConcreteTypeName() const { return "PxArticulationTendonJoint"; } + + protected: + + PX_INLINE PxArticulationTendonJoint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxArticulationTendonJoint(PxBaseFlags baseFlags) : PxBase(baseFlags) {} }; diff --git a/physx/include/PxFEMClothFlags.h b/physx/include/PxFEMClothFlags.h new file mode 100644 index 000000000..366a7c70b --- /dev/null +++ b/physx/include/PxFEMClothFlags.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PHYSICS_FEM_CLOTH_FLAGS_H +#define PX_PHYSICS_FEM_CLOTH_FLAGS_H + +#include "foundation/PxFlags.h" +#include "foundation/PxSimpleTypes.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Identifies input and output buffers for PxFEMCloth. +@see PxFEMClothData::readData(), PxFEMClothData::writeData(), PxBuffer. +*/ +struct PxFEMClothData +{ + enum Enum + { + eNONE = 0, + ePOSITION_INVMASS = 1 << 0, + eVELOCITY = 1 << 1, + eREST_POSITION = 1 << 2, + eALL = ePOSITION_INVMASS | eVELOCITY | eREST_POSITION + }; +}; + +typedef PxFlags PxFEMClothDataFlags; + +struct PxFEMClothFlag +{ + enum Enum + { + eDISABLE_SELF_COLLISION = 1 << 0, + eUSE_ISOTROPIC_CLOTH = 1 << 1, // 0: use anistropic model + eUSE_REST_POSITION_FOR_BENDING = 1 << 2 // 0: use zero bending angle + }; +}; + +typedef PxFlags PxFEMClothFlags; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/physx/include/PxPBDMaterial.h b/physx/include/PxPBDMaterial.h index b2ff38e03..a5d8bff0c 100644 --- a/physx/include/PxPBDMaterial.h +++ b/physx/include/PxPBDMaterial.h @@ -70,7 +70,7 @@ namespace physx /** \brief Sets material vorticity confinement coefficient - \param[in] vorticityConfinement Material vorticity confinement coefficient. + \param[in] vorticityConfinement Material vorticity confinement coefficient. Range: [0, PX_MAX_F32) @see #getVorticityConfinement() */ @@ -87,7 +87,7 @@ namespace physx /** \brief Sets material surface tension coefficient - \param[in] surfaceTension Material surface tension coefficient. + \param[in] surfaceTension Material surface tension coefficient. Range: [0, PX_MAX_F32) @see #getSurfaceTension() */ @@ -104,7 +104,7 @@ namespace physx /** \brief Sets material cohesion coefficient - \param[in] cohesion Material cohesion coefficient. + \param[in] cohesion Material cohesion coefficient. Range: [0, PX_MAX_F32) @see #getCohesion() */ @@ -121,7 +121,7 @@ namespace physx /** \brief Sets material lift coefficient - \param[in] lift Material lift coefficient. + \param[in] lift Material lift coefficient. Range: [0, PX_MAX_F32) @see #getLift() */ @@ -138,7 +138,7 @@ namespace physx /** \brief Sets material drag coefficient - \param[in] drag Material drag coefficient. + \param[in] drag Material drag coefficient. Range: [0, PX_MAX_F32) @see #getDrag() */ @@ -171,7 +171,7 @@ namespace physx \brief Sets material particle friction scale. This allows the application to scale up/down the frictional effect between particles independent of the friction coefficient, which also defines frictional behavior between the particle and rigid bodies/soft bodies/cloth etc. - \param[in] scale particle friction scale + \param[in] scale particle friction scale. Range: [0, PX_MAX_F32) @see #getParticleFrictionScale() */ @@ -188,7 +188,7 @@ namespace physx /** \brief Sets material particle adhesion scale value. This is the adhesive value between particles defined as a scaled multiple of the adhesion parameter. - \param[in] adhesion particle adhesion scale value + \param[in] adhesion particle adhesion scale value. Range: [0, PX_MAX_F32) @see #getParticleAdhesionScale() */ diff --git a/physx/include/PxPBDParticleSystem.h b/physx/include/PxPBDParticleSystem.h index 9b13c3b16..326a506b8 100644 --- a/physx/include/PxPBDParticleSystem.h +++ b/physx/include/PxPBDParticleSystem.h @@ -35,7 +35,6 @@ #include "foundation/PxVec3.h" #include "PxParticleSystem.h" -#include "PxParticlePhase.h" #if !PX_DOXYGEN namespace physx @@ -58,21 +57,21 @@ class PxPBDParticleSystem : public PxParticleSystem { public: - virtual ~PxPBDParticleSystem() {} + virtual ~PxPBDParticleSystem() {} /** \brief Set wind direction and intensity \param[in] wind The wind direction and intensity */ - virtual void setWind(const PxVec3& wind) = 0; + virtual void setWind(const PxVec3& wind) = 0; /** \brief Retrieves the wind direction and intensity. \return The wind direction and intensity */ - virtual PxVec3 getWind() const = 0; + virtual PxVec3 getWind() const = 0; /** \brief Set the fluid boundary density scale @@ -81,7 +80,7 @@ class PxPBDParticleSystem : public PxParticleSystem \param[in] fluidBoundaryDensityScale Range: (0.0, 1.0) */ - virtual void setFluidBoundaryDensityScale(PxReal fluidBoundaryDensityScale) = 0; + virtual void setFluidBoundaryDensityScale(PxReal fluidBoundaryDensityScale) = 0; /** \brief Return the fluid boundary density scale @@ -89,7 +88,7 @@ class PxPBDParticleSystem : public PxParticleSystem See #setFluidBoundaryDensityScale() */ - virtual PxReal getFluidBoundaryDensityScale() const = 0; + virtual PxReal getFluidBoundaryDensityScale() const = 0; /** \brief Set the fluid rest offset @@ -98,7 +97,7 @@ class PxPBDParticleSystem : public PxParticleSystem \param[in] fluidRestOffset Range: (0, particleContactOffset) */ - virtual void setFluidRestOffset(PxReal fluidRestOffset) = 0; + virtual void setFluidRestOffset(PxReal fluidRestOffset) = 0; /** \brief Return the fluid rest offset @@ -106,31 +105,35 @@ class PxPBDParticleSystem : public PxParticleSystem See #setFluidRestOffset() */ - virtual PxReal getFluidRestOffset() const = 0; + virtual PxReal getFluidRestOffset() const = 0; /** \brief Set the particle system grid size x dimension \param[in] gridSizeX x dimension in the particle grid */ - virtual void setGridSizeX(PxU32 gridSizeX) = 0; + virtual void setGridSizeX(PxU32 gridSizeX) = 0; /** \brief Set the particle system grid size y dimension \param[in] gridSizeY y dimension in the particle grid */ - virtual void setGridSizeY(PxU32 gridSizeY) = 0; + virtual void setGridSizeY(PxU32 gridSizeY) = 0; /** \brief Set the particle system grid size z dimension \param[in] gridSizeZ z dimension in the particle grid */ - virtual void setGridSizeZ(PxU32 gridSizeZ) = 0; + virtual void setGridSizeZ(PxU32 gridSizeZ) = 0; - PX_INLINE PxPBDParticleSystem(PxType concreteType, PxBaseFlags baseFlags) : PxParticleSystem(concreteType, baseFlags) {} - PX_INLINE PxPBDParticleSystem(PxBaseFlags baseFlags) : PxParticleSystem(baseFlags) {} + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxPBDParticleSystem"; } + +protected: + PX_INLINE PxPBDParticleSystem(PxType concreteType, PxBaseFlags baseFlags) : PxParticleSystem(concreteType, baseFlags) {} + PX_INLINE PxPBDParticleSystem(PxBaseFlags baseFlags) : PxParticleSystem(baseFlags) {} + virtual bool isKindOf(const char* name) const PX_OVERRIDE { return !::strcmp("PxPBDParticleSystem", name) || PxParticleSystem::isKindOf(name); } }; #if PX_VC diff --git a/physx/include/PxParticleGpu.h b/physx/include/PxParticleGpu.h index b1fcc832f..fe78b1026 100644 --- a/physx/include/PxParticleGpu.h +++ b/physx/include/PxParticleGpu.h @@ -35,7 +35,6 @@ #include "foundation/PxVec3.h" #include "PxParticleSystem.h" -#include "PxParticlePhase.h" #if !PX_DOXYGEN namespace physx diff --git a/physx/include/PxParticleMaterial.h b/physx/include/PxParticleMaterial.h index 0d675d85f..b6b5c76c3 100644 --- a/physx/include/PxParticleMaterial.h +++ b/physx/include/PxParticleMaterial.h @@ -71,7 +71,7 @@ class PxParticleMaterial : public PxBaseMaterial /** \brief Sets velocity damping term - \param[in] damping Velocity damping term. + \param[in] damping Velocity damping term. Range: [0, PX_MAX_F32) @see #getDamping */ @@ -88,7 +88,7 @@ class PxParticleMaterial : public PxBaseMaterial /** \brief Sets adhesion term - \param[in] adhesion adhesion coefficient. + \param[in] adhesion adhesion coefficient. Range: [0, PX_MAX_F32) @see #getAdhesion */ @@ -105,7 +105,7 @@ class PxParticleMaterial : public PxBaseMaterial /** \brief Sets gravity scale term - \param[in] scale gravity scale coefficient. + \param[in] scale gravity scale coefficient. Range: (-PX_MAX_F32, PX_MAX_F32) @see #getAdhesion */ @@ -123,7 +123,7 @@ class PxParticleMaterial : public PxBaseMaterial \brief Sets material adhesion radius scale. This is multiplied by the particle rest offset to compute the fall-off distance at which point adhesion ceases to operate. - \param[in] scale Material adhesion radius scale. + \param[in] scale Material adhesion radius scale. Range: [0, PX_MAX_F32) @see #getAdhesionRadiusScale */ diff --git a/physx/include/PxParticlePhase.h b/physx/include/PxParticlePhase.h deleted file mode 100644 index 67a2d2407..000000000 --- a/physx/include/PxParticlePhase.h +++ /dev/null @@ -1,137 +0,0 @@ -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of NVIDIA CORPORATION nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PX_PARTICLE_PHASE_H -#define PX_PARTICLE_PHASE_H -/** \addtogroup physics -@{ */ - -#include "foundation/PxFlags.h" -#include "foundation/PxSimpleTypes.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -#if PX_VC -#pragma warning(push) -#pragma warning(disable : 4435) -#endif - -class PxParticleMaterial; - -/** -\brief Identifies per-particle behavior for a PxParticleSystem. - -See #PxParticleSystem::createPhase(). -*/ -struct PxParticlePhaseFlag -{ - enum Enum - { - eParticlePhaseGroupMask = 0x000fffff, //!< Bits [ 0, 19] represent the particle group for controlling collisions - eParticlePhaseFlagsMask = 0xfff00000, //!< Bits [20, 23] hold flags about how the particle behave - - eParticlePhaseSelfCollide = 1 << 20, //!< If set this particle will interact with particles of the same group - eParticlePhaseSelfCollideFilter = 1 << 21, //!< If set this particle will ignore collisions with particles closer than the radius in the rest pose, this flag should not be specified unless valid rest positions have been specified using setRestParticles() - eParticlePhaseFluid = 1 << 22 //!< If set this particle will generate fluid density constraints for its overlapping neighbors - }; -}; - -typedef PxFlags PxParticlePhaseFlags; - -/** -\brief A per particle identifier to define the particles behavior, its group and to reference a material -*/ -class PxParticlePhase -{ -public: - /** - \brief Set phase flags - - Allows to control self collision, etc. - - \param[in] flags The filter flags - */ - virtual void setFlags(PxParticlePhaseFlags flags) = 0; - - /** - \brief Set phase flag - - Allows to control self collision etc. - - \param[in] flag The flag to set - \param[in] enabled The new value of the flag - */ - virtual void setFlag(PxParticlePhaseFlag::Enum flag, bool enabled) = 0; - - /** - \brief Retrieves the phase flags - - \return The phase flags - */ - virtual PxParticlePhaseFlags getFlags() const = 0; - - /** - \brief Returns the group id - - \return The group id - */ - virtual PxU32 getGroupId() const = 0; - - /** - \brief Returns the pointer to the material used by this phase - - \return The material pointer - */ - virtual PxParticleMaterial* getMaterial() const = 0; - - /** - \brief Sets the material associated referenced by this phase - - \param[in] material The pointer to the material that should be used by this phase - */ - virtual void setMaterial(PxParticleMaterial* material) = 0; - -protected: - - virtual ~PxParticlePhase() {} -}; - -#if PX_VC -#pragma warning(pop) -#endif - - -#if !PX_DOXYGEN -} // namespace physx -#endif - - /** @} */ -#endif diff --git a/physx/include/PxParticleSystem.h b/physx/include/PxParticleSystem.h index e6bb8d8b2..9b37e53a9 100644 --- a/physx/include/PxParticleSystem.h +++ b/physx/include/PxParticleSystem.h @@ -35,7 +35,7 @@ #include "PxActor.h" #include "PxFiltering.h" -#include "PxParticlePhase.h" +#include "PxParticleSystemFlag.h" #include "cudamanager/PxCudaTypes.h" @@ -155,21 +155,21 @@ class PxParticleSystem : public PxActor See #getSolverIterationCounts() */ - virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0; + virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0; /** \brief Retrieves the solver iteration counts. See #setSolverIterationCounts() */ - virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0; + virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0; /** \brief Retrieves the collision filter settings. \return The filter data */ - virtual PxFilterData getSimulationFilterData() const = 0; + virtual PxFilterData getSimulationFilterData() const = 0; /** \brief Set collision filter settings @@ -178,7 +178,7 @@ class PxParticleSystem : public PxActor \param[in] data The filter data */ - virtual void setSimulationFilterData(const PxFilterData& data) = 0; + virtual void setSimulationFilterData(const PxFilterData& data) = 0; /** \brief Set particle flag @@ -188,7 +188,7 @@ class PxParticleSystem : public PxActor \param[in] flag The flag to set \param[in] val The new value of the flag */ - virtual void setParticleFlag(PxParticleFlag::Enum flag, bool val) = 0; + virtual void setParticleFlag(PxParticleFlag::Enum flag, bool val) = 0; /** \brief Set particle flags @@ -197,14 +197,14 @@ class PxParticleSystem : public PxActor \param[in] flags The flags to set */ - virtual void setParticleFlags(PxParticleFlags flags) = 0; + virtual void setParticleFlags(PxParticleFlags flags) = 0; /** \brief Retrieves the particle flags. \return The particle flags */ - virtual PxParticleFlags getParticleFlags() const = 0; + virtual PxParticleFlags getParticleFlags() const = 0; /** \brief Set the maximal depenetration velocity particles can reach @@ -213,14 +213,14 @@ class PxParticleSystem : public PxActor \param[in] maxDepenetrationVelocity The maximal depenetration velocity */ - virtual void setMaxDepenetrationVelocity(PxReal maxDepenetrationVelocity) = 0; + virtual void setMaxDepenetrationVelocity(PxReal maxDepenetrationVelocity) = 0; /** \brief Retrieves maximal depenetration velocity a particle can have. \return The maximal depenetration velocity */ - virtual PxReal getMaxDepenetrationVelocity() = 0; + virtual PxReal getMaxDepenetrationVelocity() = 0; /** \brief Set the maximal velocity particles can reach @@ -229,14 +229,14 @@ class PxParticleSystem : public PxActor \param[in] maxVelocity The maximal velocity */ - virtual void setMaxVelocity(PxReal maxVelocity) = 0; + virtual void setMaxVelocity(PxReal maxVelocity) = 0; /** \brief Retrieves maximal velocity a particle can have. \return The maximal velocity */ - virtual PxReal getMaxVelocity() = 0; + virtual PxReal getMaxVelocity() = 0; /** @@ -244,7 +244,7 @@ class PxParticleSystem : public PxActor \return The cuda context manager */ - virtual PxCudaContextManager* getCudaContextManager() const = 0; + virtual PxCudaContextManager* getCudaContextManager() const = 0; /** \brief Set the rest offset for the collision between particles and rigids or soft bodies. @@ -253,7 +253,7 @@ class PxParticleSystem : public PxActor \param[in] restOffset Range: (0, contactOffset) */ - virtual void setRestOffset(PxReal restOffset) = 0; + virtual void setRestOffset(PxReal restOffset) = 0; /** \brief Return the rest offset @@ -261,7 +261,7 @@ class PxParticleSystem : public PxActor See #setRestOffset() */ - virtual PxReal getRestOffset() const = 0; + virtual PxReal getRestOffset() const = 0; /** \brief Set the contact offset for the collision between particles and rigids or soft bodies @@ -271,7 +271,7 @@ class PxParticleSystem : public PxActor \param[in] contactOffset Range: (restOffset, PX_MAX_F32) */ - virtual void setContactOffset(PxReal contactOffset) = 0; + virtual void setContactOffset(PxReal contactOffset) = 0; /** \brief Return the contact offset @@ -279,7 +279,7 @@ class PxParticleSystem : public PxActor See #setContactOffset() */ - virtual PxReal getContactOffset() const = 0; + virtual PxReal getContactOffset() const = 0; /** \brief Set the contact offset for the interactions between particles @@ -289,7 +289,7 @@ class PxParticleSystem : public PxActor \param[in] particleContactOffset Range: (Max(solidRestOffset, fluidRestOffset), PX_MAX_F32) */ - virtual void setParticleContactOffset(PxReal particleContactOffset) = 0; + virtual void setParticleContactOffset(PxReal particleContactOffset) = 0; /** \brief Return the particle contact offset @@ -297,7 +297,7 @@ class PxParticleSystem : public PxActor See #setParticleContactOffset() */ - virtual PxReal getParticleContactOffset() const = 0; + virtual PxReal getParticleContactOffset() const = 0; /** \brief Set the solid rest offset @@ -306,7 +306,7 @@ class PxParticleSystem : public PxActor \param[in] solidRestOffset Range: (0, particleContactOffset) */ - virtual void setSolidRestOffset(PxReal solidRestOffset) = 0; + virtual void setSolidRestOffset(PxReal solidRestOffset) = 0; /** \brief Return the solid rest offset @@ -314,7 +314,7 @@ class PxParticleSystem : public PxActor See #setSolidRestOffset() */ - virtual PxReal getSolidRestOffset() const = 0; + virtual PxReal getSolidRestOffset() const = 0; /** @@ -328,7 +328,7 @@ class PxParticleSystem : public PxActor \param[in] actor The rigid actor used for the attachment */ - virtual void addRigidAttachment(PxRigidActor* actor) = 0; + virtual void addRigidAttachment(PxRigidActor* actor) = 0; /** \brief Removes a rigid attachment between a particle and a rigid body. @@ -340,7 +340,7 @@ class PxParticleSystem : public PxActor \param[in] actor The rigid body actor used for the attachment */ - virtual void removeRigidAttachment(PxRigidActor* actor) = 0; + virtual void removeRigidAttachment(PxRigidActor* actor) = 0; /** @@ -348,7 +348,7 @@ class PxParticleSystem : public PxActor \param[in] enable Boolean indicates whether continuous collision detection is enabled. */ - virtual void enableCCD(bool enable) = 0; + virtual void enableCCD(bool enable) = 0; /** @@ -360,14 +360,14 @@ class PxParticleSystem : public PxActor See #PxParticlePhaseFlag */ - virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) = 0; + virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) = 0; /** \brief Returns number of particle materials \return The number of particle materials */ - virtual PxU32 getNbParticleMaterials() const = 0; + virtual PxU32 getNbParticleMaterials() const = 0; /** @@ -380,7 +380,7 @@ class PxParticleSystem : public PxActor See #PxParticleSystemCallback, #getParticleSystemCallback() */ - virtual void setParticleSystemCallback(PxParticleSystemCallback* callback) = 0; + virtual void setParticleSystemCallback(PxParticleSystemCallback* callback) = 0; /** \brief Retrieves the simulationEventCallback pointer set with setSimulationEventCallback(). @@ -388,7 +388,7 @@ class PxParticleSystem : public PxActor See #PxParticleSystemCallback, #setParticleSystemCallback() */ - virtual PxParticleSystemCallback* getParticleSystemCallback() const = 0; + virtual PxParticleSystemCallback* getParticleSystemCallback() const = 0; /** \brief Sets periodic boundary wrap value @@ -396,7 +396,7 @@ class PxParticleSystem : public PxActor See #getPeriodicBoundary() */ - virtual void setPeriodicBoundary(const PxVec3& boundary) = 0; + virtual void setPeriodicBoundary(const PxVec3& boundary) = 0; /** \brief Gets periodic boundary wrap value @@ -404,7 +404,7 @@ class PxParticleSystem : public PxActor See #setPeriodicBoundary() */ - virtual PxVec3 getPeriodicBoundary() const = 0; + virtual PxVec3 getPeriodicBoundary() const = 0; /** \brief Add an existing particle buffer to the particle system. @@ -412,7 +412,7 @@ class PxParticleSystem : public PxActor See #PxParticleBuffer. */ - virtual void addParticleBuffer(PxParticleBuffer* particleBuffer) = 0; + virtual void addParticleBuffer(PxParticleBuffer* particleBuffer) = 0; /** \brief Remove particle buffer from the particle system. @@ -420,20 +420,21 @@ class PxParticleSystem : public PxActor See #PxParticleBuffer. */ - virtual void removeParticleBuffer(PxParticleBuffer* particleBuffer) = 0; + virtual void removeParticleBuffer(PxParticleBuffer* particleBuffer) = 0; /** \brief Returns the GPU particle system index. \return The GPU index, if the particle system is in a scene and PxSceneFlag::eSUPPRESS_READBACK is set, or 0xFFFFFFFF otherwise. */ - virtual PxU32 getGpuParticleSystemIndex() = 0; + virtual PxU32 getGpuParticleSystemIndex() = 0; protected: - virtual ~PxParticleSystem() {} + virtual ~PxParticleSystem() {} - PX_INLINE PxParticleSystem(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {} - PX_INLINE PxParticleSystem(PxBaseFlags baseFlags) : PxActor(baseFlags) {} + PX_INLINE PxParticleSystem(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {} + PX_INLINE PxParticleSystem(PxBaseFlags baseFlags) : PxActor(baseFlags) {} + virtual bool isKindOf(const char* name) const PX_OVERRIDE { return !::strcmp("PxParticleSystem", name) || PxActor::isKindOf(name); } }; diff --git a/physx/include/PxParticleSystemFlag.h b/physx/include/PxParticleSystemFlag.h index e77379a98..da904a2ab 100644 --- a/physx/include/PxParticleSystemFlag.h +++ b/physx/include/PxParticleSystemFlag.h @@ -73,6 +73,26 @@ struct PxGpuParticleBufferIndexPair PxU32 systemIndex; // gpu particle system index PxU32 bufferIndex; // particle buffer unique id }; + +/** +\brief Identifies per-particle behavior for a PxParticleSystem. + +See #PxParticleSystem::createPhase(). +*/ +struct PxParticlePhaseFlag +{ + enum Enum + { + eParticlePhaseGroupMask = 0x000fffff, //!< Bits [ 0, 19] represent the particle group for controlling collisions + eParticlePhaseFlagsMask = 0xfff00000, //!< Bits [20, 23] hold flags about how the particle behave + + eParticlePhaseSelfCollide = 1 << 20, //!< If set this particle will interact with particles of the same group + eParticlePhaseSelfCollideFilter = 1 << 21, //!< If set this particle will ignore collisions with particles closer than the radius in the rest pose, this flag should not be specified unless valid rest positions have been specified using setRestParticles() + eParticlePhaseFluid = 1 << 22 //!< If set this particle will generate fluid density constraints for its overlapping neighbors + }; +}; + +typedef PxFlags PxParticlePhaseFlags; #if !PX_DOXYGEN } // namespace physx diff --git a/physx/include/PxPhysics.h b/physx/include/PxPhysics.h index 5fd589a67..0875e7f98 100644 --- a/physx/include/PxPhysics.h +++ b/physx/include/PxPhysics.h @@ -518,6 +518,21 @@ class PxPhysics return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags); } + /** + \brief Creates a shape which may be attached to one or more softbody actors + + The shape will be created with a reference count of 1. + + \param [in] geometry The geometry for the shape + \param [in] material The material for the shape + \param [in] isExclusive Whether this shape is exclusive to a single actor or maybe be shared + \param [in] shapeFlags The PxShapeFlags to be set + \return The shape + + \note Shared shapes are not mutable when they are attached to an actor + + @see PxShape + */ PX_FORCE_INLINE PxShape* createShape( const PxGeometry& geometry, const PxFEMSoftBodyMaterial& material, bool isExclusive = false, @@ -528,6 +543,21 @@ class PxPhysics } #if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + /** + \brief Creates a shape which may be attached to one or more FEMCloth actors + + The shape will be created with a reference count of 1. + + \param [in] geometry The geometry for the shape + \param [in] material The material for the shape + \param [in] isExclusive Whether this shape is exclusive to a single actor or maybe be shared + \param [in] shapeFlags The PxShapeFlags to be set + \return The shape + + \note Shared shapes are not mutable when they are attached to an actor + + @see PxShape + */ PX_FORCE_INLINE PxShape* createShape( const PxGeometry& geometry, const PxFEMClothMaterial& material, bool isExclusive = false, @@ -567,13 +597,11 @@ class PxPhysics bool isExclusive = false, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual PxShape* createShape( const PxGeometry& geometry, PxFEMClothMaterial*const * materials, PxU16 materialCount, bool isExclusive = false, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0; -#endif /** \brief Return the number of shapes that currently exist. @@ -633,9 +661,9 @@ class PxPhysics virtual PxArticulationReducedCoordinate* createArticulationReducedCoordinate() = 0; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION /** \brief Creates a FEM-based cloth with all fields initialized to their default values. + \warning Feature under development, only for internal usage. \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. \return the new FEM-cloth @@ -643,7 +671,6 @@ class PxPhysics @see PxFEMCloth */ virtual PxFEMCloth* createFEMCloth(PxCudaContextManager& cudaContextManager) = 0; -#endif /** \brief Creates a FEM-based soft body with all fields initialized to their default values. @@ -655,9 +682,9 @@ class PxPhysics */ virtual PxSoftBody* createSoftBody(PxCudaContextManager& cudaContextManager) = 0; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION /** \brief Creates a hair system with all fields initialized to their default values. + \warning Feature under development, only for internal usage. \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. \return the new hair system @@ -665,8 +692,6 @@ class PxPhysics @see PxHairSystem */ virtual PxHairSystem* createHairSystem(PxCudaContextManager& cudaContextManager) = 0; -#endif - /** \brief Creates a particle system with a position-based dynamics (PBD) solver. @@ -682,9 +707,9 @@ class PxPhysics */ virtual PxPBDParticleSystem* createPBDParticleSystem(PxCudaContextManager& cudaContextManager, PxU32 maxNeighborhood = 96) = 0; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION /** \brief Creates a particle system with a fluid-implicit particle solver (FLIP). + \warning Feature under development, only for internal usage. \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. \return the new particle system @@ -695,6 +720,7 @@ class PxPhysics /** \brief Creates a particle system with a material-point-method solver (MPM). + \warning Feature under development, only for internal usage. A MPM particle system can be used to simulate fluid dynamics and deformable body effects using particles. @@ -707,6 +733,7 @@ class PxPhysics /** \brief Creates a customizable particle system to simulate effects that are not supported by PhysX natively (e.g. molecular dynamics). + \warning Feature under development, only for internal usage. \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. \param[in] maxNeighborhood The maximum number of particles considered in neighborhood-based particle interaction calculations (e.g. fluid density constraints). @@ -715,7 +742,7 @@ class PxPhysics @see PxCustomParticleSystem */ virtual PxCustomParticleSystem* createCustomParticleSystem(PxCudaContextManager& cudaContextManager, PxU32 maxNeighborhood) = 0; -#endif + /** \brief Create a buffer for reading and writing data across host and device memory spaces. @@ -863,9 +890,9 @@ class PxPhysics */ virtual PxU32 getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION /** \brief Creates a new FEM cloth material with certain default properties. + \warning Feature under development, only for internal usage. \return The new FEM material. @@ -876,7 +903,6 @@ class PxPhysics @see PxFEMClothMaterial */ virtual PxFEMClothMaterial* createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) = 0; -#endif /** \brief Return the number of FEM cloth materials that currently exist. @@ -948,9 +974,9 @@ class PxPhysics */ virtual PxU32 getPBDMaterials(PxPBDMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION /** \brief Creates a new FLIP material with certain default properties. + \warning Feature under development, only for internal usage. \param [in] friction The friction parameter \param [in] damping The velocity damping parameter @@ -965,6 +991,7 @@ class PxPhysics /** \brief Return the number of FLIP materials that currently exist. + \warning Feature under development, only for internal usage. \return Number of FLIP materials. @@ -974,6 +1001,7 @@ class PxPhysics /** \brief Writes the array of FLIP material pointers to a user buffer. + \warning Feature under development, only for internal usage. Returns the number of pointers written. @@ -990,6 +1018,7 @@ class PxPhysics /** \brief Creates a new MPM material with certain default properties. + \warning Feature under development, only for internal usage. \param [in] friction The friction parameter \param [in] damping The velocity damping parameter @@ -1012,6 +1041,7 @@ class PxPhysics /** \brief Return the number of MPM materials that currently exist. + \warning Feature under development, only for internal usage. \return Number of MPM materials. @@ -1021,6 +1051,7 @@ class PxPhysics /** \brief Writes the array of MPM material pointers to a user buffer. + \warning Feature under development, only for internal usage. Returns the number of pointers written. @@ -1037,12 +1068,40 @@ class PxPhysics /** \brief Creates a new material for custom particle systems. + \warning Feature under development, only for internal usage. \param[in] gpuBuffer A pointer to a GPU buffer containing material parameters. \return the new material. */ virtual PxCustomMaterial* createCustomMaterial(void* gpuBuffer) = 0; -#endif + + /** + \brief Return the number of custom materials that currently exist. + \warning Feature under development, only for internal usage. + + \return Number of custom materials. + + @see getCustomMaterials() + */ + virtual PxU32 getNbCustomMaterials() const = 0; + + /** + \brief Writes the array of custom material pointers to a user buffer. + \warning Feature under development, only for internal usage. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbCustomMaterials() PxCustomMaterial + */ + virtual PxU32 getCustomMaterials(PxCustomMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + //@} /** @name Deletion Listeners diff --git a/physx/include/PxPhysicsAPI.h b/physx/include/PxPhysicsAPI.h index 363ccdd09..06d49b7ff 100644 --- a/physx/include/PxPhysicsAPI.h +++ b/physx/include/PxPhysicsAPI.h @@ -169,7 +169,6 @@ Alternatively, one can instead directly #include a subset of the below files. #include "PxLockedData.h" #include "PxMaterial.h" #include "PxParticleBuffer.h" -#include "PxParticlePhase.h" #include "PxParticleSystem.h" #include "PxPBDParticleSystem.h" #include "PxPBDMaterial.h" diff --git a/physx/include/PxScene.h b/physx/include/PxScene.h index 259b83863..ee2954f6b 100644 --- a/physx/include/PxScene.h +++ b/physx/include/PxScene.h @@ -68,10 +68,8 @@ typedef PxU8 PxDominanceGroup; class PxPvdSceneClient; class PxSoftBody; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION - class PxFEMCloth; - class PxHairSystem; -#endif +class PxFEMCloth; +class PxHairSystem; /** \brief Expresses the dominance relationship of a contact. @@ -537,11 +535,9 @@ class PxScene : public PxSceneSQSystem */ virtual PxU32 getParticleSystems(PxParticleSolverType::Enum type, PxParticleSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; - -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION - /** \brief Retrieve the number of FEM cloths in the scene. + \warning Feature under development, only for internal usage. \return the number of FEM cloths. @@ -551,6 +547,7 @@ class PxScene : public PxSceneSQSystem /** \brief Retrieve an array of all the FEM cloths in the scene. + \warning Feature under development, only for internal usage. \param[out] userBuffer The buffer to write the FEM cloth pointers to \param[in] bufferSize Size of the provided user buffer @@ -561,6 +558,7 @@ class PxScene : public PxSceneSQSystem /** \brief Retrieve the number of hair systems in the scene. + \warning Feature under development, only for internal usage. \return the number of hair systems @see getActors() */ @@ -568,6 +566,7 @@ class PxScene : public PxSceneSQSystem /** \brief Retrieve an array of all the hair systems in the scene. + \warning Feature under development, only for internal usage. \param[out] userBuffer The buffer to write the actor pointers to \param[in] bufferSize Size of the provided user buffer @@ -575,7 +574,6 @@ class PxScene : public PxSceneSQSystem \return Number of actors written to the buffer */ virtual PxU32 getHairSystems(PxHairSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; -#endif /** \brief Returns the number of articulations in the scene. diff --git a/physx/include/PxShape.h b/physx/include/PxShape.h index ceb21f687..d805bc6d0 100644 --- a/physx/include/PxShape.h +++ b/physx/include/PxShape.h @@ -478,10 +478,10 @@ class PxShape : public PxRefCounted @see PxPhysics.createFEMSoftBodyMaterial() getSoftBodyMaterials() */ virtual void setSoftBodyMaterials(PxFEMSoftBodyMaterial*const* materials, PxU16 materialCount) = 0; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION /** \brief Assigns FEM cloth material(s) to the shape. Will remove existing materials from the shape. + \warning Feature under development, only for internal usage. Sleeping: Does NOT wake the associated actor up automatically. @@ -491,7 +491,7 @@ class PxShape : public PxRefCounted @see PxPhysics.createFEMClothMaterial() getClothMaterials() */ virtual void setClothMaterials(PxFEMClothMaterial*const* materials, PxU16 materialCount) = 0; -#endif + /** \brief Returns the number of materials assigned to the shape. @@ -534,10 +534,10 @@ class PxShape : public PxRefCounted @see PxFEMSoftBodyMaterial getNbMaterials() PxMaterial::release() */ virtual PxU32 getSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION /** \brief Retrieve all the FEM cloth material pointers associated with the shape. + \warning Feature under development, only for internal usage. You can retrieve the number of material pointers by calling #getNbMaterials() @@ -551,7 +551,7 @@ class PxShape : public PxRefCounted @see PxFEMClothMaterial getNbMaterials() PxMaterial::release() */ virtual PxU32 getClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; -#endif + /** \brief Retrieve material from given triangle index. diff --git a/physx/include/PxSoftBody.h b/physx/include/PxSoftBody.h index 10864f5ad..f0a7fd210 100644 --- a/physx/include/PxSoftBody.h +++ b/physx/include/PxSoftBody.h @@ -578,9 +578,10 @@ namespace physx \param[in] handle Index that identifies the attachment. This handle gets returned by the addSoftBodyAttachment when the attachment is created. */ virtual void removeSoftBodyAttachment(PxSoftBody* softbody0, PxU32 handle) = 0; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + /** \brief Creates collision filter between a tetrahedron in a soft body and a triangle in a cloth. + \warning Feature under development, only for internal usage. \param[in] cloth The cloth actor used for collision filter \param[in] triIdx The index of the triangle in the cloth mesh to be filtered. @@ -590,6 +591,7 @@ namespace physx /** \brief Removes collision filter between a tetrahedron in a soft body and a triangle in a cloth. + \warning Feature under development, only for internal usage. \param[in] cloth The cloth actor used for collision filter \param[in] triIdx The index of the triangle in the cloth mesh to be filtered. @@ -605,6 +607,8 @@ namespace physx This method attaches a point inside a tetrahedron of the collision mesh to a cloth. + \warning Feature under development, only for internal usage. + \param[in] cloth The cloth actor used for the attachment \param[in] triIdx The index of a triangle in the cloth mesh that contains the point to be attached to the soft body \param[in] triBarycentric The barycentric coordinates of the attachment point inside the triangle specified by triangleIdx @@ -623,11 +627,13 @@ namespace physx This method removes a previously-created attachment between a point inside a collision mesh tetrahedron and a point inside a cloth mesh. + \warning Feature under development, only for internal usage. + \param[in] cloth The cloth actor used for the attachment \param[in] handle Index that identifies the attachment. This handle gets returned by the addClothAttachment when the attachment is created */ virtual void removeClothAttachment(PxFEMCloth* cloth, PxU32 handle) = 0; -#endif + /** \brief Access to the vertices of the simulation mesh on the host @@ -712,11 +718,15 @@ namespace physx \return The GPU index, or 0xFFFFFFFF if the soft body is not in a scene. */ - virtual PxU32 getGpuSoftBodyIndex() = 0; + virtual PxU32 getGpuSoftBodyIndex() = 0; + + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxSoftBody"; } + protected: PX_INLINE PxSoftBody(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {} PX_INLINE PxSoftBody(PxBaseFlags baseFlags) : PxActor(baseFlags) {} + virtual bool isKindOf(const char* name) const PX_OVERRIDE { return !::strcmp("PxSoftBody", name) || PxActor::isKindOf(name); } }; #if PX_VC diff --git a/physx/include/common/PxTypeInfo.h b/physx/include/common/PxTypeInfo.h index 9203de2aa..86fa94107 100644 --- a/physx/include/common/PxTypeInfo.h +++ b/physx/include/common/PxTypeInfo.h @@ -80,6 +80,8 @@ struct PxConcreteType eARTICULATION_SENSOR, eARTICULATION_SPATIAL_TENDON, eARTICULATION_FIXED_TENDON, + eARTICULATION_ATTACHMENT, + eARTICULATION_TENDON_JOINT, ePRUNING_STRUCTURE, eBVH, eSOFT_BODY, @@ -144,6 +146,7 @@ PX_DEFINE_TYPEINFO(PxAggregate, PxConcreteType::eAGGREGATE) PX_DEFINE_TYPEINFO(PxConstraint, PxConcreteType::eCONSTRAINT) PX_DEFINE_TYPEINFO(PxShape, PxConcreteType::eSHAPE) PX_DEFINE_TYPEINFO(PxPruningStructure, PxConcreteType::ePRUNING_STRUCTURE) +PX_DEFINE_TYPEINFO(PxParticleSystem, PxConcreteType::eUNDEFINED) PX_DEFINE_TYPEINFO(PxPBDParticleSystem, PxConcreteType::ePBD_PARTICLESYSTEM) PX_DEFINE_TYPEINFO(PxFLIPParticleSystem, PxConcreteType::eFLIP_PARTICLESYSTEM) PX_DEFINE_TYPEINFO(PxMPMParticleSystem, PxConcreteType::eMPM_PARTICLESYSTEM) diff --git a/physx/include/foundation/PxPhysicsVersion.h b/physx/include/foundation/PxPhysicsVersion.h index dce1005a9..a0723f75e 100644 --- a/physx/include/foundation/PxPhysicsVersion.h +++ b/physx/include/foundation/PxPhysicsVersion.h @@ -50,7 +50,7 @@ sometimes they are stored in a byte. #define PX_PHYSICS_VERSION_MAJOR 5 #define PX_PHYSICS_VERSION_MINOR 1 -#define PX_PHYSICS_VERSION_BUGFIX 0 +#define PX_PHYSICS_VERSION_BUGFIX 1 /** The constant PX_PHYSICS_VERSION is used when creating certain PhysX module objects. diff --git a/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h b/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h index 607554147..746fa0c84 100644 --- a/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h +++ b/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h @@ -651,6 +651,8 @@ struct PxVehicleMultiWheelDriveDifferentialParams } PX_CHECK_AND_RETURN_VAL(aveWheelSpeedSum >= 0.99f && aveWheelSpeedSum <= 1.01f, "Sum of PxVehicleMultiWheelDriveDifferentialParams.aveWheelSpeedRatios[i] must be 1.0.", false); PX_CHECK_AND_RETURN_VAL(torqueRatioSum >= 0.99f && torqueRatioSum <= 1.01f, "Sum of PxVehicleMultiWheelDriveDifferentialParams.torqueRatios[i] must be 1.0.", false); + PX_UNUSED(aveWheelSpeedSum); + PX_UNUSED(torqueRatioSum); return true; } }; diff --git a/physx/snippets/snippethellogrb/SnippetHelloGRB.cpp b/physx/snippets/snippethellogrb/SnippetHelloGRB.cpp index 8c1e84dc1..687464b82 100644 --- a/physx/snippets/snippethellogrb/SnippetHelloGRB.cpp +++ b/physx/snippets/snippethellogrb/SnippetHelloGRB.cpp @@ -89,15 +89,6 @@ void initPhysics(bool /*interactive*/) gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); PxCudaContextManagerDesc cudaContextManagerDesc; - -#ifdef RENDER_SNIPPET - cudaContextManagerDesc.interopMode = PxCudaInteropMode::OGL_INTEROP; //Choose interop mode. As the snippets use OGL, we select OGL_INTEROP - //when using D3D, cudaContextManagerDesc.graphicsDevice must be set as the graphics device pointer. -#else - cudaContextManagerDesc.interopMode = PxCudaInteropMode::NO_INTEROP; -#endif - - gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); //Create the CUDA context manager, required for GRB to dispatch CUDA kernels. if( gCudaContextManager ) { diff --git a/physx/snippets/snippetpbdcloth/SnippetPBDCloth.cpp b/physx/snippets/snippetpbdcloth/SnippetPBDCloth.cpp index c616f731a..9ce4c84c7 100644 --- a/physx/snippets/snippetpbdcloth/SnippetPBDCloth.cpp +++ b/physx/snippets/snippetpbdcloth/SnippetPBDCloth.cpp @@ -151,7 +151,6 @@ static void initCloth(const PxU32 numX, const PxU32 numZ, const PxVec3& position PxReal x = position.x; PxReal y = position.y; PxReal z = position.z; - PxReal maxZ = z; // Define springs and triangles PxArray springs; @@ -200,7 +199,6 @@ static void initCloth(const PxU32 numX, const PxU32 numZ, const PxVec3& position z += particleSpacing; } - maxZ = z - particleSpacing; z = position.z; x += particleSpacing; } diff --git a/physx/snippets/snippetpbf/SnippetPBF.cpp b/physx/snippets/snippetpbf/SnippetPBF.cpp index a8bf150d7..6ab08e107 100644 --- a/physx/snippets/snippetpbf/SnippetPBF.cpp +++ b/physx/snippets/snippetpbf/SnippetPBF.cpp @@ -176,8 +176,6 @@ static void initParticles(const PxU32 numX, const PxU32 numY, const PxU32 numZ, PxReal x = position.x; PxReal y = position.y; PxReal z = position.z; - PxReal maxY = y; - PxReal maxZ = z; for (PxU32 i = 0; i < numX; ++i) { @@ -194,11 +192,9 @@ static void initParticles(const PxU32 numX, const PxU32 numY, const PxU32 numZ, z += particleSpacing; } - maxZ = z - particleSpacing; z = position.z; y += particleSpacing; } - maxY = y - particleSpacing; y = position.y; x += particleSpacing; } diff --git a/physx/snippets/snippetpbfmultimat/SnippetPBFMultiMat.cpp b/physx/snippets/snippetpbfmultimat/SnippetPBFMultiMat.cpp index 97d413e26..5aedd3dc8 100644 --- a/physx/snippets/snippetpbfmultimat/SnippetPBFMultiMat.cpp +++ b/physx/snippets/snippetpbfmultimat/SnippetPBFMultiMat.cpp @@ -118,21 +118,16 @@ static void initParticles(const PxU32 numX, const PxU32 numY, const PxU32 numZ, // We are applying different material parameters for each section const PxU32 maxMaterials = 3; - PxPBDMaterial* materials[maxMaterials]; PxU32 phases[maxMaterials]; for (PxU32 i = 0; i < maxMaterials; ++i) { PxPBDMaterial* mat = gPhysics->createPBDMaterial(0.05f, i / (maxMaterials - 1.0f), 0.f, 10.002f* (i + 1), 0.5f, 0.005f * i, 0.01f, 0.f, 0.f); - materials[i] = mat; - phases[i] = gParticleSystem->createPhase(mat, PxParticlePhaseFlags(PxParticlePhaseFlag::eParticlePhaseFluid | PxParticlePhaseFlag::eParticlePhaseSelfCollide)); } PxReal x = position.x; PxReal y = position.y; PxReal z = position.z; - PxReal maxY = y; - PxReal maxZ = z; for (PxU32 i = 0; i < numX; ++i) { @@ -149,11 +144,9 @@ static void initParticles(const PxU32 numX, const PxU32 numY, const PxU32 numZ, z += particleSpacing; } - maxZ = z - particleSpacing; z = position.z; y += particleSpacing; } - maxY = y - particleSpacing; y = position.y; x += particleSpacing; } diff --git a/physx/snippets/snippetvehicle2multithreading/SnippetVehicleMultithreading.cpp b/physx/snippets/snippetvehicle2multithreading/SnippetVehicleMultithreading.cpp index 610ba56ca..86e9b3ed5 100644 --- a/physx/snippets/snippetvehicle2multithreading/SnippetVehicleMultithreading.cpp +++ b/physx/snippets/snippetvehicle2multithreading/SnippetVehicleMultithreading.cpp @@ -186,17 +186,17 @@ static const char* gUpdatePhaseNames[UpdatePhases::eMAX_NUM_UPDATE_STAGES] = "physXSceneSimulate" }; -struct ProfilerCallback : public physx::PxProfilerCallback +struct ProfileZones { PxU64 times[UpdatePhases::eMAX_NUM_UPDATE_STAGES]; - ProfilerCallback() + ProfileZones() { for (int i = 0; i < UpdatePhases::eMAX_NUM_UPDATE_STAGES; ++i) times[i] = 0; } - ~ProfilerCallback() + void print() { for (int i = 0; i < UpdatePhases::eMAX_NUM_UPDATE_STAGES; ++i) { @@ -205,33 +205,46 @@ struct ProfilerCallback : public physx::PxProfilerCallback } } - virtual void* zoneStart(const char* eventName, bool, uint64_t) + void zoneStart(UpdatePhases::Enum zoneId) { - for (int i = 0; i < UpdatePhases::eMAX_NUM_UPDATE_STAGES; ++i) - { - if (!strcmp(gUpdatePhaseNames[i], eventName)) - { - times[i] -= SnippetUtils::getCurrentTimeCounterValue(); - break; - } - } - return NULL; + PxU64 time = SnippetUtils::getCurrentTimeCounterValue(); + times[zoneId] -= time; } - virtual void zoneEnd(void* /*profilerData*/, const char* eventName, bool, uint64_t) + + void zoneEnd(UpdatePhases::Enum zoneId) { PxU64 time = SnippetUtils::getCurrentTimeCounterValue(); + times[zoneId] += time; + } +}; +ProfileZones gProfileZones; - for (int i = 0; i < UpdatePhases::eMAX_NUM_UPDATE_STAGES; ++i) - { - if (!strcmp(gUpdatePhaseNames[i], eventName)) - { - times[i] += time; - break; - } - } +class ScopedProfileZone +{ +private: + ScopedProfileZone(const ScopedProfileZone&); + ScopedProfileZone& operator=(const ScopedProfileZone&); + +public: + ScopedProfileZone(ProfileZones& zones, UpdatePhases::Enum zoneId) + : mZones(zones) + , mZoneId(zoneId) + { + zones.zoneStart(zoneId); } + + ~ScopedProfileZone() + { + mZones.zoneEnd(mZoneId); + } + + +private: + ProfileZones& mZones; + UpdatePhases::Enum mZoneId; }; -ProfilerCallback gProfilerCallback; + +#define SNIPPET_PROFILE_ZONE(zoneId) ScopedProfileZone PX_CONCAT(_scoped, __LINE__)(gProfileZones, zoneId) //TaskVehicleUpdates allows vehicle updates to be performed concurrently across //multiple threads. @@ -334,11 +347,6 @@ void initPhysX() PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); gPvd->connect(*transport,PxPvdInstrumentationFlag::ePROFILE); - // PVD sets itself up as the profiler during the "connect" call above. We override this with - // our own callback. If we wanted both our profiling and PVD's at the same time, we would - // just call the PVD functions (available in PxPvd's base class) from our own profiler callback. - PxSetProfilerCallback(&gProfilerCallback); - gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); @@ -542,7 +550,7 @@ void concurrentVehicleUpdates(const PxReal timestep) //Perform all physx reads/writes serially in a separate step to avoid serializing code that can take //advantage of multithreading. { - PX_PROFILE_ZONE(gUpdatePhaseNames[UpdatePhases::eVEHICLE_PHYSX_BEGIN_COMPONENTS], 0); + SNIPPET_PROFILE_ZONE(UpdatePhases::eVEHICLE_PHYSX_BEGIN_COMPONENTS); for (PxU32 i = 0; i < NUM_VEHICLES; i++) { gPhysXBeginComponents[i]->update(timestep, gVehicleSimulationContext); @@ -551,7 +559,7 @@ void concurrentVehicleUpdates(const PxReal timestep) //Multi-threaded update of direct drive vehicles. { - PX_PROFILE_ZONE(gUpdatePhaseNames[UpdatePhases::eVEHICLE_UPDATE_COMPONENTS], 0); + SNIPPET_PROFILE_ZONE(UpdatePhases::eVEHICLE_UPDATE_COMPONENTS); //Update the vehicles concurrently then wait until all vehicles //have completed their update. @@ -577,7 +585,7 @@ void concurrentVehicleUpdates(const PxReal timestep) //Perform all physx reads/writes serially in a separate step to avoid serializing code that can take //advantage of multithreading. { - PX_PROFILE_ZONE(gUpdatePhaseNames[UpdatePhases::eVEHICLE_PHYSX_END_COMPONENTS], 0); + SNIPPET_PROFILE_ZONE(UpdatePhases::eVEHICLE_PHYSX_END_COMPONENTS); for (PxU32 i = 0; i < NUM_VEHICLES; i++) { gPhysXEndComponents[i]->update(timestep, gVehicleSimulationContext); @@ -597,7 +605,7 @@ void stepPhysics() concurrentVehicleUpdates(timestep); //Forward integrate the phsyx scene by a single timestep. - PX_PROFILE_ZONE(gUpdatePhaseNames[UpdatePhases::ePHYSX_SCENE_SIMULATE], 0); + SNIPPET_PROFILE_ZONE(UpdatePhases::ePHYSX_SCENE_SIMULATE); gScene->simulate(timestep); gScene->fetchResults(true); @@ -638,6 +646,7 @@ int snippetMain(int argc, const char*const* argv) stepPhysics(); } printf("Completed %d simulate steps with %d substeps per simulate step \n", gNbSimulateSteps, NB_SUBSTEPS); + gProfileZones.print(); cleanupPhysics(); } diff --git a/physx/source/compiler/cmake/PhysX.cmake b/physx/source/compiler/cmake/PhysX.cmake index 0e9c152d6..3c15125af 100644 --- a/physx/source/compiler/cmake/PhysX.cmake +++ b/physx/source/compiler/cmake/PhysX.cmake @@ -63,6 +63,7 @@ SET(PHYSX_HEADERS ${PHYSX_ROOT_DIR}/include/PxCustomParticleSystemSolverCallback.h ${PHYSX_ROOT_DIR}/include/PxDeletionListener.h ${PHYSX_ROOT_DIR}/include/PxFEMParameter.h + ${PHYSX_ROOT_DIR}/include/PxFEMClothFlags.h ${PHYSX_ROOT_DIR}/include/PxFiltering.h ${PHYSX_ROOT_DIR}/include/PxForceMode.h ${PHYSX_ROOT_DIR}/include/PxHairSystemFlag.h @@ -71,7 +72,6 @@ SET(PHYSX_HEADERS ${PHYSX_ROOT_DIR}/include/PxNodeIndex.h ${PHYSX_ROOT_DIR}/include/PxParticleBuffer.h ${PHYSX_ROOT_DIR}/include/PxParticleGpu.h - ${PHYSX_ROOT_DIR}/include/PxParticlePhase.h ${PHYSX_ROOT_DIR}/include/PxParticleSolverType.h ${PHYSX_ROOT_DIR}/include/PxParticleSystem.h ${PHYSX_ROOT_DIR}/include/PxParticleSystemFlag.h diff --git a/physx/source/compiler/cmake/linux/CMakeLists.txt b/physx/source/compiler/cmake/linux/CMakeLists.txt index 605c61835..48d8e463c 100644 --- a/physx/source/compiler/cmake/linux/CMakeLists.txt +++ b/physx/source/compiler/cmake/linux/CMakeLists.txt @@ -88,9 +88,24 @@ IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") # -Wno-invalid-offsetof -Wno-unused-result -Wno-unused-variable -Wno-uninitialized -Wno-unused-but-set-variable # -Wno-unused-function -Wno-conversion-null -Wno-deprecated-declarations SET(GCC_WARNINGS "-Wall -Wno-error -fcommon -faligned-new -z muldefs -fpermissive") - SET(AARCH64_FLAGS "-ffp-contract=off") + # gw: these optimizations are disabled for now. fp-contract causes floating point inaccuracy and deviation in behavior, + # tree-vrp and delete-null-pointer-checks cause known bugs on some versions of gcc + IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + SET(AARCH64_FLAGS "-ffp-contract=off -fno-delete-null-pointer-checks") + ELSE() + SET(AARCH64_FLAGS "-ffp-contract=off") + ENDIF() ELSE() - SET(GCC_WARNINGS "-Wall -Werror -Wno-invalid-offsetof -Wno-uninitialized -Wno-nonnull-compare -Wno-mismatched-new-delete -Wno-pragmas -Wno-unused-function") + SET(GCC_WARNINGS "-Wall -Werror\ + -Wno-array-bounds\ + -Wno-class-memaccess\ + -Wno-invalid-offsetof\ + -Wno-mismatched-new-delete\ + -Wno-nonnull-compare\ + -Wno-pragmas\ + -Wno-uninitialized\ + -Wno-unused-function\ + ") SET(AARCH64_FLAGS "") ENDIF() diff --git a/physx/source/compiler/cmake/linux/PhysX.cmake b/physx/source/compiler/cmake/linux/PhysX.cmake index 732447fff..b0f7540c2 100644 --- a/physx/source/compiler/cmake/linux/PhysX.cmake +++ b/physx/source/compiler/cmake/linux/PhysX.cmake @@ -117,3 +117,7 @@ SET(PHYSX_PLATFORM_LINK_FLAGS_PROFILE " ") SET(PHYSX_PLATFORM_LINK_FLAGS_RELEASE " ") SET(PHYSX_PLATFORM_LINKED_LIBS dl) + +IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + SET_SOURCE_FILES_PROPERTIES(${PX_SOURCE_DIR}/omnipvd/OmniPvdPxSampler.cpp PROPERTIES COMPILE_FLAGS "-fpermissive -Wno-error") +ENDIF() diff --git a/physx/source/compiler/cmake/linux/PhysXExtensions.cmake b/physx/source/compiler/cmake/linux/PhysXExtensions.cmake index 28b61feb2..8c9685a5d 100644 --- a/physx/source/compiler/cmake/linux/PhysXExtensions.cmake +++ b/physx/source/compiler/cmake/linux/PhysXExtensions.cmake @@ -52,4 +52,8 @@ SET(PHYSXEXTENSIONS_COMPILE_DEFS $<$:${PHYSX_LINUX_RELEASE_COMPILE_DEFS};> ) -SET(PHYSXEXTENSIONS_LIBTYPE STATIC) \ No newline at end of file +SET(PHYSXEXTENSIONS_LIBTYPE STATIC) + +IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + SET_SOURCE_FILES_PROPERTIES(${LL_SOURCE_DIR}/omnipvd/OmniPvdPxExtensionsSampler.cpp PROPERTIES COMPILE_FLAGS "-fpermissive -Wno-error") +ENDIF() diff --git a/physx/source/compiler/resource_x64/PhysX.rc b/physx/source/compiler/resource_x64/PhysX.rc index 73c606863..81d23d6c1 100644 --- a/physx/source/compiler/resource_x64/PhysX.rc +++ b/physx/source/compiler/resource_x64/PhysX.rc @@ -52,8 +52,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,1,0,0 - PRODUCTVERSION 5,1,0,0 + FILEVERSION 5,1,1,0 + PRODUCTVERSION 5,1,1,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -70,12 +70,12 @@ BEGIN BEGIN VALUE "CompanyName", "NVIDIA Corporation" VALUE "FileDescription", "PhysX 64bit Dynamic Link Library" - VALUE "FileVersion", "5.1.0.0" + VALUE "FileVersion", "5.1.1.0" VALUE "InternalName", "PhysX_64" VALUE "LegalCopyright", "Copyright (C) 2021 NVIDIA Corporation" VALUE "OriginalFilename", "PhysX_64.dll" VALUE "ProductName", "PhysX" - VALUE "ProductVersion", "5.1.0.0" + VALUE "ProductVersion", "5.1.1.0" END END BLOCK "VarFileInfo" diff --git a/physx/source/compiler/resource_x64/PhysXCommon.rc b/physx/source/compiler/resource_x64/PhysXCommon.rc index b8f4318f6..214e688a4 100644 --- a/physx/source/compiler/resource_x64/PhysXCommon.rc +++ b/physx/source/compiler/resource_x64/PhysXCommon.rc @@ -52,8 +52,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,1,0,0 - PRODUCTVERSION 5,1,0,0 + FILEVERSION 5,1,1,0 + PRODUCTVERSION 5,1,1,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -70,12 +70,12 @@ BEGIN BEGIN VALUE "CompanyName", "NVIDIA Corporation" VALUE "FileDescription", "PhysXCommon 64bit Dynamic Link Library" - VALUE "FileVersion", "5.1.0.0" + VALUE "FileVersion", "5.1.1.0" VALUE "InternalName", "PhysXCommon_64" VALUE "LegalCopyright", "Copyright (C) 2021 NVIDIA Corporation" VALUE "OriginalFilename", "PhysXCommon_64.dll" VALUE "ProductName", "PhysX" - VALUE "ProductVersion", "5.1.0.0" + VALUE "ProductVersion", "5.1.1.0" END END BLOCK "VarFileInfo" diff --git a/physx/source/compiler/resource_x64/PhysXCooking.rc b/physx/source/compiler/resource_x64/PhysXCooking.rc index 11fe2e8cd..28760e68f 100644 --- a/physx/source/compiler/resource_x64/PhysXCooking.rc +++ b/physx/source/compiler/resource_x64/PhysXCooking.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,1,0,0 - PRODUCTVERSION 5,1,0,0 + FILEVERSION 5,1,1,0 + PRODUCTVERSION 5,1,1,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -71,12 +71,12 @@ BEGIN BEGIN VALUE "CompanyName", "NVIDIA Corporation" VALUE "FileDescription", "PhysXCooking 64bit Dynamic Link Library" - VALUE "FileVersion", "5.1.0.0" + VALUE "FileVersion", "5.1.1.0" VALUE "InternalName", "PhysXCooking_64" VALUE "LegalCopyright", "Copyright (C) 2021 NVIDIA Corporation" VALUE "OriginalFilename", "PhysXCooking_64.dll" VALUE "ProductName", "PhysX" - VALUE "ProductVersion", "5.1.0.0" + VALUE "ProductVersion", "5.1.1.0" END END BLOCK "VarFileInfo" diff --git a/physx/source/compiler/resource_x64/PhysXFoundation.rc b/physx/source/compiler/resource_x64/PhysXFoundation.rc index 22d936240..ff8b694e9 100644 Binary files a/physx/source/compiler/resource_x64/PhysXFoundation.rc and b/physx/source/compiler/resource_x64/PhysXFoundation.rc differ diff --git a/physx/source/compiler/resource_x86/PhysX.rc b/physx/source/compiler/resource_x86/PhysX.rc index b22e71fd2..82943af29 100644 --- a/physx/source/compiler/resource_x86/PhysX.rc +++ b/physx/source/compiler/resource_x86/PhysX.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,1,0,0 - PRODUCTVERSION 5,1,0,0 + FILEVERSION 5,1,1,0 + PRODUCTVERSION 5,1,1,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -71,12 +71,12 @@ BEGIN BEGIN VALUE "CompanyName", "NVIDIA Corporation" VALUE "FileDescription", "PhysX 32bit Dynamic Link Library" - VALUE "FileVersion", "5.1.0.0" + VALUE "FileVersion", "5.1.1.0" VALUE "InternalName", "PhysX_32" VALUE "LegalCopyright", "Copyright (C) 2021 NVIDIA Corporation" VALUE "OriginalFilename", "PhysX_32.dll" VALUE "ProductName", "PhysX" - VALUE "ProductVersion", "5.1.0.0" + VALUE "ProductVersion", "5.1.1.0" END END BLOCK "VarFileInfo" diff --git a/physx/source/compiler/resource_x86/PhysXCommon.rc b/physx/source/compiler/resource_x86/PhysXCommon.rc index 6aadcd785..ae6e942a8 100644 --- a/physx/source/compiler/resource_x86/PhysXCommon.rc +++ b/physx/source/compiler/resource_x86/PhysXCommon.rc @@ -54,8 +54,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,1,0,0 - PRODUCTVERSION 5,1,0,0 + FILEVERSION 5,1,1,0 + PRODUCTVERSION 5,1,1,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -72,12 +72,12 @@ BEGIN BEGIN VALUE "CompanyName", "NVIDIA Corporation" VALUE "FileDescription", "PhysXCommon 32bit Dynamic Link Library" - VALUE "FileVersion", "5.1.0.0" + VALUE "FileVersion", "5.1.1.0" VALUE "InternalName", "PhysXCommon_32" VALUE "LegalCopyright", "Copyright (C) 2021 NVIDIA Corporation" VALUE "OriginalFilename", "PhysXCommon_32.dll" VALUE "ProductName", "PhysX" - VALUE "ProductVersion", "5.1.0.0" + VALUE "ProductVersion", "5.1.1.0" END END BLOCK "VarFileInfo" diff --git a/physx/source/compiler/resource_x86/PhysXCooking.rc b/physx/source/compiler/resource_x86/PhysXCooking.rc index 8b763ad24..847d0b81d 100644 --- a/physx/source/compiler/resource_x86/PhysXCooking.rc +++ b/physx/source/compiler/resource_x86/PhysXCooking.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,1,0,0 - PRODUCTVERSION 5,1,0,0 + FILEVERSION 5,1,1,0 + PRODUCTVERSION 5,1,1,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -71,12 +71,12 @@ BEGIN BEGIN VALUE "CompanyName", "NVIDIA Corporation" VALUE "FileDescription", "PhysXCooking 32bit Dynamic Link Library" - VALUE "FileVersion", "5.1.0.0" + VALUE "FileVersion", "5.1.1.0" VALUE "InternalName", "PhysXCooking_32" VALUE "LegalCopyright", "Copyright (C) 2021 NVIDIA Corporation" VALUE "OriginalFilename", "PhysXCooking_32.dll" VALUE "ProductName", "PhysX" - VALUE "ProductVersion", "5.1.0.0" + VALUE "ProductVersion", "5.1.1.0" END END BLOCK "VarFileInfo" diff --git a/physx/source/compiler/resource_x86/PhysXFoundation.rc b/physx/source/compiler/resource_x86/PhysXFoundation.rc index afde2d51d..218697671 100644 Binary files a/physx/source/compiler/resource_x86/PhysXFoundation.rc and b/physx/source/compiler/resource_x86/PhysXFoundation.rc differ diff --git a/physx/source/lowlevel/software/include/PxsSimulationController.h b/physx/source/lowlevel/software/include/PxsSimulationController.h index 6ef683bc8..c2f4e3718 100644 --- a/physx/source/lowlevel/software/include/PxsSimulationController.h +++ b/physx/source/lowlevel/software/include/PxsSimulationController.h @@ -37,10 +37,19 @@ #include "foundation/PxUserAllocated.h" #include "PxScene.h" #include "PxParticleSystem.h" + #if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION -#include "PxFLIPParticleSystem.h" -#include "PxMPMParticleSystem.h" + #include "PxFLIPParticleSystem.h" + #include "PxMPMParticleSystem.h" + + // if these assert fail adjust the type here and in the forward declaration of the #else section just below + PX_COMPILE_TIME_ASSERT(sizeof(physx::PxMPMParticleDataFlag::Enum) == sizeof(physx::PxU32)); + PX_COMPILE_TIME_ASSERT(sizeof(physx::PxSparseGridDataFlag::Enum) == sizeof(physx::PxU32)); +#else + namespace PxMPMParticleDataFlag { enum Enum : physx::PxU32; } + namespace PxSparseGridDataFlag { enum Enum : physx::PxU32; } #endif + #include "PxParticleSolverType.h" namespace physx @@ -336,12 +345,8 @@ namespace physx #endif -// jcarius: Methods that are disabled in public build must be at the end to not screw with -// vtable offsets -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual void* getMPMDataPointer(const Dy::ParticleSystem& psLL, PxMPMParticleDataFlag::Enum flags) = 0; virtual void* getSparseGridDataPointer(const Dy::ParticleSystem& psLL, PxSparseGridDataFlag::Enum flags, PxParticleSolverType::Enum type) = 0; -#endif protected: PxsSimulationControllerCallback* mCallback; diff --git a/physx/source/lowleveldynamics/include/DyArticulationJointCore.h b/physx/source/lowleveldynamics/include/DyArticulationJointCore.h index 34d08829b..e08bab568 100644 --- a/physx/source/lowleveldynamics/include/DyArticulationJointCore.h +++ b/physx/source/lowleveldynamics/include/DyArticulationJointCore.h @@ -54,8 +54,6 @@ namespace physx ArticulationJointCore(const PxEMPTY&) : jointDirtyFlag(PxEmpty) { PX_COMPILE_TIME_ASSERT(sizeof(PxArticulationMotions) == sizeof(PxU8)); - PxMemSet(dofIds, 0, sizeof(dofIds)); - PxMemSet(invDofIds, 0, sizeof(invDofIds)); } //~PX_SERIALIZATION diff --git a/physx/source/lowleveldynamics/include/DyFEMClothCore.h b/physx/source/lowleveldynamics/include/DyFEMClothCore.h index 9dea8fd3f..f8bdcfcec 100644 --- a/physx/source/lowleveldynamics/include/DyFEMClothCore.h +++ b/physx/source/lowleveldynamics/include/DyFEMClothCore.h @@ -33,6 +33,8 @@ #if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION #include "PxFEMCloth.h" #endif +#include "PxFEMParameter.h" +#include "PxFEMClothFlags.h" #include "PxsFEMClothMaterialCore.h" namespace physx @@ -45,15 +47,12 @@ namespace physx { public: -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxFEMParameters parameters; -#endif PxU16 solverIterationCounts; bool dirty; PxReal wakeCounter; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxFEMClothFlags mFlags; -#endif + // Ratio between target volume and rest volume in inflatable simulation. PxReal mRestVolumeScale; diff --git a/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp b/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp index 83e9ae5d3..4e6001249 100644 --- a/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp +++ b/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp @@ -2444,7 +2444,7 @@ namespace Dy for (PxU32 i = 0; i < dofCount; ++i) { - const PxReal jointForce = data.mMotionMatrix[offset + i].innerProduct(spatialForce); + const PxReal jointForce = data.mWorldMotionMatrix[offset + i].innerProduct(spatialForce); constraintForces[offset + i] = jointForce; } } diff --git a/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp b/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp index 725b2006b..e58d627dd 100644 --- a/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp +++ b/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp @@ -51,7 +51,8 @@ namespace physx context.translatePxBase(mParent); context.translatePxBase(mChild); mCore.setRoot(this); - + NpArticulationReducedCoordinate* articulation = static_cast(&mParent->getRoot()); + mCore.setArticulation(&articulation->getCore()); } //~PX_SERIALIZATION @@ -64,7 +65,6 @@ namespace physx mParent(&parent), mChild(&child) { - NpArticulationReducedCoordinate* articulation = static_cast(&parent.getRoot()); mCore.setArticulation(&articulation->getCore()); mCore.setRoot(this); diff --git a/physx/source/physx/src/NpArticulationReducedCoordinate.cpp b/physx/source/physx/src/NpArticulationReducedCoordinate.cpp index 94c92e9be..e4cd6ae3d 100644 --- a/physx/source/physx/src/NpArticulationReducedCoordinate.cpp +++ b/physx/source/physx/src/NpArticulationReducedCoordinate.cpp @@ -524,7 +524,10 @@ PxArticulationSpatialTendon* NpArticulationReducedCoordinate::createSpatialTendo "PxArticulationReducedCoordinate::createSpatialTendon() not allowed while the articulation is in a scene. Call will be ignored."); return NULL; } - NpArticulationSpatialTendon* tendon = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(NpArticulationSpatialTendon), "NpArticulationSpatialTendon"), NpArticulationSpatialTendon)(this); + + void* tendonMem = PX_ALLOC(sizeof(NpArticulationSpatialTendon), "NpArticulationSpatialTendon"); + PxMarkSerializedMemory(tendonMem, sizeof(NpArticulationSpatialTendon)); + NpArticulationSpatialTendon* tendon = PX_PLACEMENT_NEW(tendonMem, NpArticulationSpatialTendon)(this); tendon->setHandle(mSpatialTendons.size()); mSpatialTendons.pushBack(tendon); @@ -546,7 +549,10 @@ PxArticulationFixedTendon* NpArticulationReducedCoordinate::createFixedTendon() return NULL; } - NpArticulationFixedTendon* tendon = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(NpArticulationFixedTendon), "NpArticulationFixedTendon"), NpArticulationFixedTendon)(this); + void* tendonMem = PX_ALLOC(sizeof(NpArticulationFixedTendon), "NpArticulationFixedTendon"); + PxMarkSerializedMemory(tendonMem, sizeof(NpArticulationFixedTendon)); + NpArticulationFixedTendon* tendon = PX_PLACEMENT_NEW(tendonMem, NpArticulationFixedTendon)(this); + tendon->setHandle(mFixedTendons.size()); mFixedTendons.pushBack(tendon); return tendon; @@ -574,7 +580,10 @@ PxArticulationSensor* NpArticulationReducedCoordinate::createSensor(PxArticulati return NULL; } - NpArticulationSensor* sensor = PX_NEW(NpArticulationSensor)(link, relativePose); + void* sensorMem = PX_ALLOC(sizeof(NpArticulationSensor), "NpArticulationSensor"); + PxMarkSerializedMemory(sensorMem, sizeof(NpArticulationSensor)); + NpArticulationSensor* sensor = PX_PLACEMENT_NEW(sensorMem, NpArticulationSensor)(link, relativePose); + sensor->setHandle(mSensors.size()); mSensors.pushBack(sensor); @@ -600,7 +609,9 @@ void NpArticulationReducedCoordinate::releaseSensor(PxArticulationSensor& sensor mSensors.back()->setHandle(handle); mSensors.replaceWithLast(handle); npSensor->~NpArticulationSensor(); - PX_FREE(npSensor); + + if (npSensor->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(npSensor); mTopologyChanged = true; } @@ -683,7 +694,8 @@ NpArticulationReducedCoordinate::~NpArticulationReducedCoordinate() if (mSpatialTendons[i]) { mSpatialTendons[i]->~NpArticulationSpatialTendon(); - PX_FREE(mSpatialTendons[i]); + if(mSpatialTendons[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(mSpatialTendons[i]); } } @@ -692,7 +704,8 @@ NpArticulationReducedCoordinate::~NpArticulationReducedCoordinate() if (mFixedTendons[i]) { mFixedTendons[i]->~NpArticulationFixedTendon(); - PX_FREE(mFixedTendons[i]); + if(mFixedTendons[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(mFixedTendons[i]); } } @@ -701,7 +714,8 @@ NpArticulationReducedCoordinate::~NpArticulationReducedCoordinate() if (mSensors[i]) { mSensors[i]->~NpArticulationSensor(); - PX_FREE(mSensors[i]); + if(mSensors[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(mSensors[i]); } } @@ -741,11 +755,6 @@ void NpArticulationReducedCoordinate::recomputeLinkIDs() } } -//void NpSetArticulationOnJoint(PxArticulationJointReducedCoordinate& joint, PxArticulationImpl& articulation) -//{ -// joint.getImpl()->getCore().setArticulation(&articulation.getCore()); -//} - // PX_SERIALIZATION void NpArticulationReducedCoordinate::requiresObjects(PxProcessPxBaseCallback& c) { @@ -753,22 +762,41 @@ void NpArticulationReducedCoordinate::requiresObjects(PxProcessPxBaseCallback& c const PxU32 nbLinks = mArticulationLinks.size(); for (PxU32 i = 0; i < nbLinks; i++) c.process(*mArticulationLinks[i]); + + const PxU32 nbSensors = mSensors.size(); + for (PxU32 i = 0; i < nbSensors; i++) + c.process(*mSensors[i]); + + const PxU32 nbSpatialTendons = mSpatialTendons.size(); + for (PxU32 i = 0; i < nbSpatialTendons; i++) + c.process(*mSpatialTendons[i]); + + const PxU32 nbFixedTendons = mFixedTendons.size(); + for (PxU32 i = 0; i < nbFixedTendons; i++) + c.process(*mFixedTendons[i]); + } void NpArticulationReducedCoordinate::exportExtraData(PxSerializationContext& stream) { Cm::exportInlineArray(mArticulationLinks, stream); + Cm::exportArray(mSpatialTendons, stream); + Cm::exportArray(mFixedTendons, stream); + Cm::exportArray(mSensors, stream); + stream.writeName(mName); } void NpArticulationReducedCoordinate::importExtraData(PxDeserializationContext& context) { Cm::importInlineArray(mArticulationLinks, context); + Cm::importArray(mSpatialTendons, context); + Cm::importArray(mFixedTendons, context); + Cm::importArray(mSensors, context); + context.readName(mName); } -//void NpSetArticulationOnJoint(PxArticulationJointReducedCoordinate& jointBase, PxArticulationImpl& articulation); - void NpArticulationReducedCoordinate::resolveReferences(PxDeserializationContext& context) { const PxU32 nbLinks = mArticulationLinks.size(); @@ -776,15 +804,27 @@ void NpArticulationReducedCoordinate::resolveReferences(PxDeserializationContext { NpArticulationLink*& link = mArticulationLinks[i]; context.translatePxBase(link); + } - PxArticulationJointReducedCoordinate* pxJointBase = link->getInboundJoint(); - if (pxJointBase) - { - //KS - introduced C function to do this to avoid undefined types and circular dependency problems - //backlinks to articulation impl can only be initialized - //after articulation object has been constructed. - //NpSetArticulationOnJoint(*pxJointBase, mImpl); - } + const PxU32 nbSensors = mSensors.size(); + for (PxU32 i = 0; i < nbSensors; i++) + { + NpArticulationSensor*& sensor = mSensors[i]; + context.translatePxBase(sensor); + } + + const PxU32 nbSpatialTendons = mSpatialTendons.size(); + for (PxU32 i = 0; i < nbSpatialTendons; i++) + { + NpArticulationSpatialTendon*& spatialTendon = mSpatialTendons[i]; + context.translatePxBase(spatialTendon); + } + + const PxU32 nbFixedTendons = mFixedTendons.size(); + for (PxU32 i = 0; i < nbFixedTendons; i++) + { + NpArticulationFixedTendon*& fixedTendon = mFixedTendons[i]; + context.translatePxBase(fixedTendon); } mAggregate = NULL; diff --git a/physx/source/physx/src/NpArticulationReducedCoordinate.h b/physx/source/physx/src/NpArticulationReducedCoordinate.h index a4c461ff3..eb9a1dc26 100644 --- a/physx/source/physx/src/NpArticulationReducedCoordinate.h +++ b/physx/source/physx/src/NpArticulationReducedCoordinate.h @@ -39,6 +39,7 @@ #include "NpArticulationLink.h" #include "NpArticulationJointReducedCoordinate.h" +#include "NpArticulationTendon.h" #include "ScArticulationCore.h" namespace physx @@ -66,10 +67,8 @@ namespace physx NpArticulationReducedCoordinate(PxBaseFlags baseFlags) : PxArticulationReducedCoordinate(baseFlags), NpBase(PxEmpty), mCore(PxEmpty), - mArticulationLinks(PxEmpty), mLoopJoints(PxEmpty) + mArticulationLinks(PxEmpty), mLoopJoints(PxEmpty), mSpatialTendons(PxEmpty), mFixedTendons(PxEmpty), mSensors(PxEmpty) { - mSpatialTendons.reserve(50); - mFixedTendons.reserve(50); } void preExportDataReset(); diff --git a/physx/source/physx/src/NpArticulationSensor.cpp b/physx/source/physx/src/NpArticulationSensor.cpp index a5a48a838..d7c866b77 100644 --- a/physx/source/physx/src/NpArticulationSensor.cpp +++ b/physx/source/physx/src/NpArticulationSensor.cpp @@ -37,6 +37,23 @@ using namespace physx; namespace physx { +// PX_SERIALIZATION + +void NpArticulationSensor::resolveReferences(PxDeserializationContext& context) +{ + context.translatePxBase(mLink); +} + +NpArticulationSensor* NpArticulationSensor::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationSensor* obj = PX_PLACEMENT_NEW(address, NpArticulationSensor(PxBaseFlags(0))); + address += sizeof(NpArticulationSensor); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + NpArticulationSensor::NpArticulationSensor(PxArticulationLink* link, const PxTransform& relativePose) : PxArticulationSensor(PxConcreteType::eARTICULATION_SENSOR, PxBaseFlag::eOWNS_MEMORY), NpBase(NpType::eARTICULATION_SENSOR) @@ -66,7 +83,8 @@ void NpArticulationSensor::release() sensors.replaceWithLast(mHandle); this->~NpArticulationSensor(); - PX_FREE_THIS; + if(getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE_THIS; } PxSpatialForce NpArticulationSensor::getForces() const diff --git a/physx/source/physx/src/NpArticulationSensor.h b/physx/source/physx/src/NpArticulationSensor.h index 937e39d75..3eaa3dbfd 100644 --- a/physx/source/physx/src/NpArticulationSensor.h +++ b/physx/source/physx/src/NpArticulationSensor.h @@ -44,6 +44,19 @@ class NpArticulationSensor : public PxArticulationSensor, public NpBase { public: +// PX_SERIALIZATION + NpArticulationSensor(PxBaseFlags baseFlags) + : PxArticulationSensor(baseFlags), NpBase(PxEmpty), mCore(PxEmpty) {} + void preExportDataReset() {} + virtual void exportExtraData(PxSerializationContext& ) {} + void importExtraData(PxDeserializationContext& ) {} + void resolveReferences(PxDeserializationContext& ); + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + virtual bool isSubordinate() const { return true; } + static NpArticulationSensor* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + NpArticulationSensor(PxArticulationLink* link, const PxTransform& relativePose); virtual ~NpArticulationSensor() {} @@ -62,8 +75,6 @@ class NpArticulationSensor : public PxArticulationSensor, public NpBase PX_FORCE_INLINE ArticulationSensorHandle getHandle() { return mHandle; } PX_FORCE_INLINE void setHandle(ArticulationSensorHandle handle) { mHandle = handle; } - static void getBinaryMetaData(PxOutputStream& stream); - private: PxArticulationLink* mLink; Sc::ArticulationSensorCore mCore; diff --git a/physx/source/physx/src/NpArticulationTendon.cpp b/physx/source/physx/src/NpArticulationTendon.cpp index 66fc9143b..22e9544a2 100644 --- a/physx/source/physx/src/NpArticulationTendon.cpp +++ b/physx/source/physx/src/NpArticulationTendon.cpp @@ -34,11 +34,57 @@ using namespace physx; +// PX_SERIALIZATION +void NpArticulationAttachment::requiresObjects(PxProcessPxBaseCallback& c) +{ + // Collect articulation links + const PxU32 nbChildren = mChildren.size(); + for (PxU32 i = 0; i < nbChildren; i++) + c.process(*mChildren[i]); +} + +void NpArticulationAttachment::exportExtraData(PxSerializationContext& stream) +{ + Cm::exportInlineArray(mChildren, stream); +} + +void NpArticulationAttachment::importExtraData(PxDeserializationContext& context) +{ + Cm::importInlineArray(mChildren, context); +} + +void NpArticulationAttachment::resolveReferences(PxDeserializationContext& context) +{ + context.translatePxBase(mLink); + context.translatePxBase(mParent); + + const PxU32 nbChildren = mChildren.size(); + for (PxU32 i = 0; i < nbChildren; i++) + { + NpArticulationAttachment*& attachment = mChildren[i]; + context.translatePxBase(attachment); + } + + context.translatePxBase(mTendon); + mCore.mParent = mParent ? &static_cast(mParent)->mCore : NULL; +} + +NpArticulationAttachment* NpArticulationAttachment::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationAttachment* obj = PX_PLACEMENT_NEW(address, NpArticulationAttachment(PxBaseFlags(0))); + address += sizeof(NpArticulationAttachment); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +// ~PX_SERIALIZATION + NpArticulationAttachment::NpArticulationAttachment(PxArticulationAttachment* parent, const PxReal coefficient, const PxVec3 relativeOffset, PxArticulationLink* link): + PxArticulationAttachment(PxConcreteType::eARTICULATION_ATTACHMENT, PxBaseFlag::eOWNS_MEMORY), + NpBase(NpType::eARTICULATION_ATTACHMENT), mLink(link), mParent(parent) { - mChildren.reserve(64); - NpArticulationAttachment* npParent = static_cast(parent); mCore.mRelativeOffset = link->getCMassLocalPose().transform(relativeOffset); @@ -146,7 +192,8 @@ void NpArticulationAttachment::release() attachments.replaceWithLast(mHandle); this->~NpArticulationAttachment(); - PX_FREE_THIS; + if (mBaseFlags & PxBaseFlag::eOWNS_MEMORY) + PX_FREE_THIS; } void NpArticulationAttachment::removeChild(NpArticulationAttachment* child) @@ -168,11 +215,51 @@ void NpArticulationAttachment::removeChild(NpArticulationAttachment* child) mChildren.forceSize_Unsafe(lastIndex); } +// PX_SERIALIZATION + +void NpArticulationSpatialTendon::requiresObjects(PxProcessPxBaseCallback& c) +{ + const PxU32 nbAttachments = mAttachments.size(); + for (PxU32 i = 0; i < nbAttachments; i++) + c.process(*mAttachments[i]); +} + +void NpArticulationSpatialTendon::exportExtraData(PxSerializationContext& stream) +{ + Cm::exportInlineArray(mAttachments, stream); +} + +void NpArticulationSpatialTendon::importExtraData(PxDeserializationContext& context) +{ + Cm::importInlineArray(mAttachments, context); +} + +void NpArticulationSpatialTendon::resolveReferences(PxDeserializationContext& context) +{ + const PxU32 nbAttachments = mAttachments.size(); + for (PxU32 i = 0; i < nbAttachments; i++) + { + NpArticulationAttachment*& attachment = mAttachments[i]; + context.translatePxBase(attachment); + } + + context.translatePxBase(mArticulation); +} + +NpArticulationSpatialTendon* NpArticulationSpatialTendon::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationSpatialTendon* obj = PX_PLACEMENT_NEW(address, NpArticulationSpatialTendon(PxBaseFlags(0))); + address += sizeof(NpArticulationSpatialTendon); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + NpArticulationSpatialTendon::NpArticulationSpatialTendon(NpArticulationReducedCoordinate* articulation) : PxArticulationSpatialTendon(PxConcreteType::eARTICULATION_SPATIAL_TENDON, PxBaseFlag::eOWNS_MEMORY), - NpBase(NpType::eARTICULATION_TENDON), mArticulation(articulation) + NpBase(NpType::eARTICULATION_SPATIAL_TENDON), mArticulation(articulation) { - mAttachments.reserve(50); mLLIndex = 0xffffffff; mHandle = 0xffffffff; } @@ -184,7 +271,8 @@ NpArticulationSpatialTendon::~NpArticulationSpatialTendon() if (mAttachments[i]) { mAttachments[i]->~NpArticulationAttachment(); - PX_FREE(mAttachments[i]); + if(mAttachments[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(mAttachments[i]); } } } @@ -204,7 +292,9 @@ PxArticulationAttachment* NpArticulationSpatialTendon::createAttachment(PxArticu PX_CHECK_AND_RETURN_NULL(parent->getTendon() == this, "PxArticulationSpatialTendon::createAttachment: Parent attachment from another tendon provided. Need valid parent from same tendon."); #endif - NpArticulationAttachment* npAttachment = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(NpArticulationAttachment), "NpArticulationAttachment"), NpArticulationAttachment)(parent, coefficient, relativeOffset, link); + void* npAttachmentMem = PX_ALLOC(sizeof(NpArticulationAttachment), "NpArticulationAttachment"); + PxMarkSerializedMemory(npAttachmentMem, sizeof(NpArticulationAttachment)); + NpArticulationAttachment* npAttachment = PX_PLACEMENT_NEW(npAttachmentMem, NpArticulationAttachment)(parent, coefficient, relativeOffset, link); if (npAttachment) { @@ -330,7 +420,8 @@ void NpArticulationSpatialTendon::release() spatialTendons.replaceWithLast(mHandle); this->~NpArticulationSpatialTendon(); - PX_FREE_THIS; + if (mBaseFlags & PxBaseFlag::eOWNS_MEMORY) + PX_FREE_THIS; } NpArticulationAttachment* NpArticulationSpatialTendon::getAttachment(const PxU32 index) @@ -345,11 +436,57 @@ PxU32 NpArticulationSpatialTendon::getNbAttachments() const ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// PX_SERIALIZATION +void NpArticulationTendonJoint::requiresObjects(PxProcessPxBaseCallback& c) +{ + // Collect articulation links + const PxU32 nbChildren = mChildren.size(); + for (PxU32 i = 0; i < nbChildren; i++) + c.process(*mChildren[i]); +} + +void NpArticulationTendonJoint::exportExtraData(PxSerializationContext& stream) +{ + Cm::exportInlineArray(mChildren, stream); +} + +void NpArticulationTendonJoint::importExtraData(PxDeserializationContext& context) +{ + Cm::importInlineArray(mChildren, context); +} + +void NpArticulationTendonJoint::resolveReferences(PxDeserializationContext& context) +{ + context.translatePxBase(mLink); + context.translatePxBase(mParent); + + const PxU32 nbChildren = mChildren.size(); + for (PxU32 i = 0; i < nbChildren; i++) + { + NpArticulationTendonJoint*& tendonJoint = mChildren[i]; + context.translatePxBase(tendonJoint); + } + + context.translatePxBase(mTendon); + mCore.mParent = mParent ? &static_cast(mParent)->mCore : NULL; +} + +NpArticulationTendonJoint* NpArticulationTendonJoint::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationTendonJoint* obj = PX_PLACEMENT_NEW(address, NpArticulationTendonJoint(PxBaseFlags(0))); + address += sizeof(NpArticulationTendonJoint); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +// ~PX_SERIALIZATION + NpArticulationTendonJoint::NpArticulationTendonJoint(PxArticulationTendonJoint* parent, PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient, PxArticulationLink* link) : - PxArticulationTendonJoint() + PxArticulationTendonJoint(PxConcreteType::eARTICULATION_TENDON_JOINT, PxBaseFlag::eOWNS_MEMORY), + NpBase(NpType::eARTICULATION_TENDON_JOINT) { - NpArticulationTendonJoint* npParent = static_cast(parent); mCore.mParent = parent ? &npParent->getCore() : NULL; mCore.mLLTendonJointIndex = 0xffffffff; @@ -410,14 +547,55 @@ void NpArticulationTendonJoint::release() tendonJoints.replaceWithLast(mHandle); this->~NpArticulationTendonJoint(); - PX_FREE_THIS; + if (mBaseFlags & PxBaseFlag::eOWNS_MEMORY) + PX_FREE_THIS; +} + +// PX_SERIALIZATION + +void NpArticulationFixedTendon::requiresObjects(PxProcessPxBaseCallback& c) +{ + const PxU32 nbTendonJoints = mTendonJoints.size(); + for (PxU32 i = 0; i < nbTendonJoints; i++) + c.process(*mTendonJoints[i]); +} + +void NpArticulationFixedTendon::exportExtraData(PxSerializationContext& stream) +{ + Cm::exportInlineArray(mTendonJoints, stream); +} + +void NpArticulationFixedTendon::importExtraData(PxDeserializationContext& context) +{ + Cm::importInlineArray(mTendonJoints, context); +} + +void NpArticulationFixedTendon::resolveReferences(PxDeserializationContext& context) +{ + const PxU32 nbTendonJoints = mTendonJoints.size(); + for (PxU32 i = 0; i < nbTendonJoints; i++) + { + NpArticulationTendonJoint*& tendonJoint = mTendonJoints[i]; + context.translatePxBase(tendonJoint); + } + + context.translatePxBase(mArticulation); +} + +NpArticulationFixedTendon* NpArticulationFixedTendon::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationFixedTendon* obj = PX_PLACEMENT_NEW(address, NpArticulationFixedTendon(PxBaseFlags(0))); + address += sizeof(NpArticulationFixedTendon); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; } +//~PX_SERIALIZATION NpArticulationFixedTendon::NpArticulationFixedTendon(NpArticulationReducedCoordinate* articulation) : PxArticulationFixedTendon(PxConcreteType::eARTICULATION_FIXED_TENDON, PxBaseFlag::eOWNS_MEMORY), - NpBase(NpType::eARTICULATION_TENDON), mArticulation(articulation) + NpBase(NpType::eARTICULATION_FIXED_TENDON), mArticulation(articulation) { - mTendonJoints.reserve(50); mLLIndex = 0xffffffff; mHandle = 0xffffffff; } @@ -429,7 +607,10 @@ NpArticulationFixedTendon::~NpArticulationFixedTendon() if (mTendonJoints[i]) { mTendonJoints[i]->~NpArticulationTendonJoint(); - PX_FREE(mTendonJoints[i]); + if (mTendonJoints[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + PX_FREE(mTendonJoints[i]); + } } } } @@ -448,7 +629,8 @@ void NpArticulationFixedTendon::release() fixedTendons.replaceWithLast(mHandle); this->~NpArticulationFixedTendon(); - PX_FREE_THIS; + if (mBaseFlags & PxBaseFlag::eOWNS_MEMORY) + PX_FREE_THIS; } PxArticulationTendonJoint* NpArticulationFixedTendon::createTendonJoint(PxArticulationTendonJoint* parent, PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient, PxArticulationLink* link) @@ -470,7 +652,9 @@ PxArticulationTendonJoint* NpArticulationFixedTendon::createTendonJoint(PxArticu } #endif - NpArticulationTendonJoint* npTendonJoint = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(NpArticulationTendonJoint), "NpArticulationTendonJoint"), NpArticulationTendonJoint)(parent, axis, coefficient, recipCoefficient, link); + void* npTendonJointtMem = PX_ALLOC(sizeof(NpArticulationTendonJoint), "NpArticulationTendonJoint"); + PxMarkSerializedMemory(npTendonJointtMem, sizeof(NpArticulationTendonJoint)); + NpArticulationTendonJoint* npTendonJoint = PX_PLACEMENT_NEW(npTendonJointtMem, NpArticulationTendonJoint)(parent, axis, coefficient, recipCoefficient, link); if (npTendonJoint) { diff --git a/physx/source/physx/src/NpArticulationTendon.h b/physx/source/physx/src/NpArticulationTendon.h index b42c387c6..9844366a5 100644 --- a/physx/source/physx/src/NpArticulationTendon.h +++ b/physx/source/physx/src/NpArticulationTendon.h @@ -83,10 +83,25 @@ class NpArticulationTendonJointArray : public PxInlineArray("NpArticulationTendonJointArray") {} }; -class NpArticulationAttachment : public PxArticulationAttachment +class NpArticulationAttachment : public PxArticulationAttachment, public NpBase { public: + +// PX_SERIALIZATION + NpArticulationAttachment(PxBaseFlags baseFlags) + : PxArticulationAttachment(baseFlags), NpBase(PxEmpty), mHandle(PxEmpty), mChildren(PxEmpty), mCore(PxEmpty) {} + void preExportDataReset() { mCore.preExportDataReset(); } + virtual void exportExtraData(PxSerializationContext& ); + void importExtraData(PxDeserializationContext& ); + void resolveReferences(PxDeserializationContext& ); + virtual void requiresObjects(PxProcessPxBaseCallback&); + virtual bool isSubordinate() const { return true; } + static NpArticulationAttachment* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + NpArticulationAttachment(PxArticulationAttachment* parent, const PxReal coefficient, const PxVec3 relativeOffset, PxArticulationLink* link); virtual ~NpArticulationAttachment(); @@ -122,8 +137,6 @@ class NpArticulationAttachment : public PxArticulationAttachment void removeChild(NpArticulationAttachment* child); - static void getBinaryMetaData(PxOutputStream& stream); - PxArticulationLink* mLink; //the link this attachment attach to PxArticulationAttachment* mParent; ArticulationAttachmentHandle mHandle; @@ -137,6 +150,19 @@ class NpArticulationSpatialTendon : public PxArticulationSpatialTendon, public N { public: +// PX_SERIALIZATION + NpArticulationSpatialTendon(PxBaseFlags baseFlags) + : PxArticulationSpatialTendon(baseFlags), NpBase(PxEmpty), mAttachments(PxEmpty), mCore(PxEmpty) {} + void preExportDataReset() { mCore.preExportDataReset(); } + virtual void exportExtraData(PxSerializationContext& ); + void importExtraData(PxDeserializationContext& ); + void resolveReferences(PxDeserializationContext& ); + virtual void requiresObjects(PxProcessPxBaseCallback&); + virtual bool isSubordinate() const { return true; } + static NpArticulationSpatialTendon* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + NpArticulationSpatialTendon(NpArticulationReducedCoordinate* articulation); virtual ~NpArticulationSpatialTendon(); @@ -170,8 +196,6 @@ class NpArticulationSpatialTendon : public PxArticulationSpatialTendon, public N PX_FORCE_INLINE NpArticulationAttachmentArray& getAttachments() { return mAttachments; } - static void getBinaryMetaData(PxOutputStream& stream); - private: NpArticulationAttachmentArray mAttachments; NpArticulationReducedCoordinate* mArticulation; @@ -180,9 +204,21 @@ class NpArticulationSpatialTendon : public PxArticulationSpatialTendon, public N ArticulationTendonHandle mHandle; }; -class NpArticulationTendonJoint : public PxArticulationTendonJoint +class NpArticulationTendonJoint : public PxArticulationTendonJoint, public NpBase { public: + // PX_SERIALIZATION + NpArticulationTendonJoint(PxBaseFlags baseFlags) : PxArticulationTendonJoint(baseFlags), NpBase(PxEmpty), mChildren(PxEmpty), mCore(PxEmpty), mHandle(PxEmpty) {} + void preExportDataReset() { mCore.preExportDataReset(); } + virtual void exportExtraData(PxSerializationContext& ); + void importExtraData(PxDeserializationContext& ); + void resolveReferences(PxDeserializationContext& ); + virtual void requiresObjects(PxProcessPxBaseCallback&); + virtual bool isSubordinate() const { return true; } + static NpArticulationTendonJoint* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + NpArticulationTendonJoint(PxArticulationTendonJoint* parent, PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient, PxArticulationLink* link); virtual ~NpArticulationTendonJoint(){} @@ -209,8 +245,6 @@ class NpArticulationTendonJoint : public PxArticulationTendonJoint void removeChild(NpArticulationTendonJoint* child); - static void getBinaryMetaData(PxOutputStream& stream); - PxArticulationLink* mLink; //the link this joint associated with PxArticulationTendonJoint* mParent; NpArticulationTendonJointArray mChildren; @@ -223,6 +257,17 @@ class NpArticulationTendonJoint : public PxArticulationTendonJoint class NpArticulationFixedTendon : public PxArticulationFixedTendon, public NpBase { public: + // PX_SERIALIZATION + NpArticulationFixedTendon(PxBaseFlags baseFlags): PxArticulationFixedTendon(baseFlags), NpBase(PxEmpty), mTendonJoints(PxEmpty), mCore(PxEmpty), mHandle(PxEmpty) {} + void preExportDataReset() {} + virtual void exportExtraData(PxSerializationContext& ); + void importExtraData(PxDeserializationContext& ); + void resolveReferences(PxDeserializationContext& ); + virtual void requiresObjects(PxProcessPxBaseCallback&); + virtual bool isSubordinate() const { return true; } + static NpArticulationFixedTendon* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION NpArticulationFixedTendon(NpArticulationReducedCoordinate* articulation); @@ -263,8 +308,6 @@ class NpArticulationFixedTendon : public PxArticulationFixedTendon, public NpBas PX_FORCE_INLINE NpArticulationTendonJointArray& getTendonJoints() { return mTendonJoints; } - static void getBinaryMetaData(PxOutputStream& stream); - private: NpArticulationTendonJointArray mTendonJoints; NpArticulationReducedCoordinate* mArticulation; diff --git a/physx/source/physx/src/NpBase.h b/physx/source/physx/src/NpBase.h index c05ae87f8..9d750461a 100644 --- a/physx/source/physx/src/NpBase.h +++ b/physx/source/physx/src/NpBase.h @@ -141,8 +141,11 @@ namespace physx eCONSTRAINT, eARTICULATION, eARTICULATION_JOINT, - eARTICULATION_TENDON, eARTICULATION_SENSOR, + eARTICULATION_SPATIAL_TENDON, + eARTICULATION_ATTACHMENT, + eARTICULATION_FIXED_TENDON, + eARTICULATION_TENDON_JOINT, eAGGREGATE, eSOFTBODY, eFEMCLOTH, diff --git a/physx/source/physx/src/NpFEMCloth.h b/physx/source/physx/src/NpFEMCloth.h index b0a25a477..565d7c43b 100644 --- a/physx/source/physx/src/NpFEMCloth.h +++ b/physx/source/physx/src/NpFEMCloth.h @@ -132,10 +132,6 @@ namespace physx virtual void release(); - virtual bool isKindOf(const char* name) const { return !::strcmp("PxFEMCloth", name) || PxBase::isKindOf(name); } - - virtual const char* getConcreteTypeName() const { return "PxFEMCloth"; } - PX_FORCE_INLINE const Sc::FEMClothCore& getCore() const { return mCore; } PX_FORCE_INLINE Sc::FEMClothCore& getCore() { return mCore; } diff --git a/physx/source/physx/src/NpHairSystem.h b/physx/source/physx/src/NpHairSystem.h index da6d713bb..6ea0fc9e4 100644 --- a/physx/source/physx/src/NpHairSystem.h +++ b/physx/source/physx/src/NpHairSystem.h @@ -149,8 +149,6 @@ namespace physx virtual void release() PX_OVERRIDE; virtual PxActorType::Enum getType() const PX_OVERRIDE { return PxActorType::eHAIRSYSTEM; } - virtual bool isKindOf(const char* name) const PX_OVERRIDE { return !::strcmp("PxHairSystem", name) || PxBase::isKindOf(name); } - virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxHairSystem"; } virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const PX_OVERRIDE; diff --git a/physx/source/physx/src/NpMetaData.cpp b/physx/source/physx/src/NpMetaData.cpp index ca61343e8..8dc17e643 100644 --- a/physx/source/physx/src/NpMetaData.cpp +++ b/physx/source/physx/src/NpMetaData.cpp @@ -64,9 +64,6 @@ using namespace Gu; #define DefineMetaData_PxActor(x) \ PX_DEF_BIN_METADATA_ITEM(stream, x, void, userData, PxMetaDataFlag::ePTR) -#define DefineMetaData_NpArticulationReducedCoordinate(x) \ - PX_DEF_BIN_METADATA_ITEM(stream, x, void, userData, PxMetaDataFlag::ePTR) - #define DefineMetaData_NpRigidActorTemplate(x) \ PX_DEF_BIN_METADATA_ITEM(stream, x, NpShapeManager, mShapeManager, 0) // PX_DEF_BIN_METADATA_ITEM(stream, x, PxU32, mIndex, 0) @@ -440,30 +437,21 @@ void NpArticulationLinkArray::getBinaryMetaData(PxOutputStream& stream) PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, NpArticulationLinkArray, NpArticulationLink, mBufferUsed, mCapacity, PxMetaDataFlag::eCONTROL_FLIP|PxMetaDataFlag::eCOUNT_MASK_MSB|PxMetaDataFlag::ePTR, 0) } -//void PxArticulationImpl::getBinaryMetaData(PxOutputStream& stream) -//{ -// PX_DEF_BIN_METADATA_CLASS(stream, PxArticulationImpl) -// PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxArticulationImpl, NpBase) -// -// PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationImpl, ArticulationCore, mCore, 0) -// PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationImpl, NpArticulationLinkArray, mArticulationLinks, 0) -// PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationImpl, PxU32, mNumShapes, 0) -// PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationImpl, NpAggregate, mAggregate, PxMetaDataFlag::ePTR) -// PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationImpl, char, mName, PxMetaDataFlag::ePTR) -// PX_DEF_BIN_METADATA_EXTRA_NAME(stream, PxArticulationImpl, mName, 0) -// PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationImpl, PxU32, mCacheVersion, 0) -//} - -//void PxArticulationJointImpl::getBinaryMetaData(PxOutputStream& stream) -//{ -// PX_DEF_BIN_METADATA_CLASS(stream, PxArticulationJointImpl) -// PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxArticulationJointImpl, NpBase) -// -// PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationJointImpl, ArticulationJointCore, mCore, 0) -// PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationJointImpl, NpArticulationLink, mParent, PxMetaDataFlag::ePTR) -// PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationJointImpl, NpArticulationLink, mChild, PxMetaDataFlag::ePTR) -//} +void NpArticulationAttachmentArray::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, NpArticulationAttachmentArray) + PX_DEF_BIN_METADATA_ITEMS(stream, NpArticulationAttachmentArray, NpArticulationAttachment, mBuffer, PxMetaDataFlag::ePTR, 4) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, bool, mBufferUsed, 0) + // PT: OMG this is so painful... I can't put the padding explicitely in the template + { PxMetaDataEntry tmp = {"char", "mPadding", 1 + PxU32(PX_OFFSET_OF_RT(NpArticulationAttachmentArray, mBufferUsed)), 3, 3, 0, PxMetaDataFlag::ePADDING, 0}; PX_STORE_METADATA(stream, tmp); } + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, NpArticulationAttachment, mData, PxMetaDataFlag::ePTR) // ### + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, PxU32, mSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, PxU32, mCapacity, 0) + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, NpArticulationAttachmentArray, NpArticulationAttachment, mBufferUsed, mCapacity, PxMetaDataFlag::eCONTROL_FLIP|PxMetaDataFlag::eCOUNT_MASK_MSB|PxMetaDataFlag::ePTR, 0) +} namespace { @@ -488,6 +476,7 @@ struct ShadowArray##T : public PxArray \ PX_DEF_BIN_METADATA_ITEM(stream, ShadowArray##T, T, mData, PxMetaDataFlag::ePTR)\ PX_DEF_BIN_METADATA_ITEM(stream, ShadowArray##T, PxU32, mSize, 0) \ PX_DEF_BIN_METADATA_ITEM(stream, ShadowArray##T, PxU32, mCapacity, 0) \ + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, ShadowArray##T, T, mData, mCapacity, PxMetaDataFlag::eCOUNT_MASK_MSB|PxMetaDataFlag::ePTR, 0) \ } \ }; @@ -504,11 +493,14 @@ void NpArticulationReducedCoordinate::getBinaryMetaData(PxOutputStream& stream) ShadowArrayNpArticulationFixedTendon::getBinaryMetaData(stream); ShadowArrayNpArticulationSensor::getBinaryMetaData(stream); + //sticking this here, since typedefs are only allowed to declared once. + PX_DEF_BIN_METADATA_TYPEDEF(stream, ArticulationTendonHandle, PxU32) + PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationReducedCoordinate) PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationReducedCoordinate, PxBase) PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationReducedCoordinate, NpBase) - DefineMetaData_NpArticulationReducedCoordinate(NpArticulationReducedCoordinate) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, void, userData, PxMetaDataFlag::ePTR) PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, ArticulationCore, mCore, 0) PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, NpArticulationLinkArray, mArticulationLinks, 0) @@ -523,72 +515,99 @@ void NpArticulationReducedCoordinate::getBinaryMetaData(PxOutputStream& stream) PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, ShadowArrayNpArticulationSpatialTendon, mSpatialTendons, 0) PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, ShadowArrayNpArticulationFixedTendon, mFixedTendons, 0) PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, ShadowArrayNpArticulationSensor, mSensors, 0) - } void NpArticulationSensor::getBinaryMetaData(PxOutputStream& stream) { PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationSensor) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationSensor, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationSensor, NpBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSensor, void, userData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSensor, PxArticulationLink, mLink, PxMetaDataFlag::ePTR) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSensor, Sc::ArticulationSensorCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSensor, ArticulationSensorCore, mCore, 0) PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSensor, PxU32, mHandle, 0) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSensor, void, userData, PxMetaDataFlag::ePTR) } void NpArticulationAttachment::getBinaryMetaData(PxOutputStream& stream) { PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationAttachment) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, NpArticulationAttachmentArray, mChildren, 0) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, NpArticulationSpatialTendon, mTendon, PxMetaDataFlag::ePTR) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, Sc::ArticulationAttachmentCore, mCore, 0) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationAttachment, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationAttachment, NpBase) + + PX_DEF_BIN_METADATA_TYPEDEF(stream, ArticulationAttachmentHandle, PxU32); + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, void, userData, PxMetaDataFlag::ePTR) -} -void NpArticulationAttachmentArray::getBinaryMetaData(PxOutputStream& stream) -{ - PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationAttachmentArray) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, NpArticulationAttachment*, mData, PxMetaDataFlag::ePTR) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, PxU32, mSize, 0) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, PxU32, mCapacity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, PxArticulationLink, mLink, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, PxArticulationAttachment, mParent, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, ArticulationAttachmentHandle, mHandle, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, NpArticulationAttachmentArray, mChildren, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, NpArticulationSpatialTendon, mTendon, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, ArticulationAttachmentCore, mCore, 0) } void NpArticulationTendonJoint::getBinaryMetaData(PxOutputStream& stream) { PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationTendonJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationTendonJoint, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationTendonJoint, NpBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, void, userData, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, PxArticulationLink, mLink, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, PxArticulationTendonJoint, mParent, PxMetaDataFlag::ePTR) PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, NpArticulationTendonJointArray, mChildren, 0) PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, NpArticulationFixedTendon, mTendon, PxMetaDataFlag::ePTR) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, Sc::ArticulationTendonJointCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, ArticulationTendonJointCore, mCore, 0) PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, PxU32, mHandle, 0) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, void, userData, PxMetaDataFlag::ePTR) } void NpArticulationTendonJointArray::getBinaryMetaData(PxOutputStream& stream) { - PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationTendonJointArray) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, NpArticulationTendonJoint*, mData, PxMetaDataFlag::ePTR) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, PxU32, mSize, 0) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, PxU32, mCapacity, 0) + PX_DEF_BIN_METADATA_CLASS(stream, NpArticulationTendonJointArray) + PX_DEF_BIN_METADATA_ITEMS(stream, NpArticulationTendonJointArray, NpArticulationTendonJoint, mBuffer, PxMetaDataFlag::ePTR, 4) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, bool, mBufferUsed, 0) + // PT: OMG this is so painful... I can't put the padding explicitely in the template + { PxMetaDataEntry tmp = {"char", "mPadding", 1 + PxU32(PX_OFFSET_OF_RT(NpArticulationTendonJointArray, mBufferUsed)), 3, 3, 0, PxMetaDataFlag::ePADDING, 0}; PX_STORE_METADATA(stream, tmp); } + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, NpArticulationTendonJoint, mData, PxMetaDataFlag::ePTR) // ### + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, PxU32, mSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, PxU32, mCapacity, 0) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, NpArticulationTendonJointArray, NpArticulationTendonJoint, mBufferUsed, mCapacity, PxMetaDataFlag::eCONTROL_FLIP|PxMetaDataFlag::eCOUNT_MASK_MSB|PxMetaDataFlag::ePTR, 0) } void NpArticulationSpatialTendon::getBinaryMetaData(PxOutputStream& stream) { PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationSpatialTendon) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, ArticulationTendonHandle, mHandle, 0) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, NpArticulationReducedCoordinate, mAttachments, 0) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, NpArticulationAttachmentArray, mArticulation, PxMetaDataFlag::ePTR) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, Sc::ArticulationSpatialTendonCore, mCore, 0) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationSpatialTendon, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationSpatialTendon, NpBase) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, void, userData, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, NpArticulationAttachmentArray, mAttachments, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, NpArticulationReducedCoordinate, mArticulation, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, PxU32, mLLIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, ArticulationSpatialTendonCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, ArticulationTendonHandle, mHandle, 0) } void NpArticulationFixedTendon::getBinaryMetaData(PxOutputStream& stream) { PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationFixedTendon) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, ArticulationTendonHandle, mHandle, 0) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationFixedTendon, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationFixedTendon, NpBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, void, userData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, NpArticulationTendonJointArray, mTendonJoints, 0) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, NpArticulationAttachmentArray, mArticulation, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, NpArticulationReducedCoordinate, mArticulation, PxMetaDataFlag::ePTR) PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, PxU32, mLLIndex, 0) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, Sc::ArticulationFixedTendonCore, mCore, 0) - PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, void, userData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, ArticulationFixedTendonCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, ArticulationTendonHandle, mHandle, 0) } void NpArticulationLink::getBinaryMetaData(PxOutputStream& stream) @@ -750,7 +769,6 @@ template<> void PxsMPMMaterialCore::getBinaryMetaData(PxOutputStream& stream); void PxGetPhysicsBinaryMetaData(PxOutputStream& stream) { getFoundationMetaData(stream); - getBinaryMetaData_PxMeshScale(stream); Gu::ConvexMesh::getBinaryMetaData(stream); @@ -777,6 +795,12 @@ void PxGetPhysicsBinaryMetaData(PxOutputStream& stream) Sc::ConstraintCore::getBinaryMetaData(stream); Sc::ArticulationCore::getBinaryMetaData(stream); Sc::ArticulationJointCore::getBinaryMetaData(stream); + Sc::ArticulationSensorCore::getBinaryMetaData(stream); + Sc::ArticulationTendonCore::getBinaryMetaData(stream); + Sc::ArticulationSpatialTendonCore::getBinaryMetaData(stream); + Sc::ArticulationAttachmentCore::getBinaryMetaData(stream); + Sc::ArticulationFixedTendonCore::getBinaryMetaData(stream); + Sc::ArticulationTendonJointCore::getBinaryMetaData(stream); NpConnector::getBinaryMetaData(stream); NpConnectorArray::getBinaryMetaData(stream); @@ -801,6 +825,13 @@ void PxGetPhysicsBinaryMetaData(PxOutputStream& stream) NpArticulationLink::getBinaryMetaData(stream); NpArticulationJointReducedCoordinate::getBinaryMetaData(stream); NpArticulationLinkArray::getBinaryMetaData(stream); + NpArticulationSensor::getBinaryMetaData(stream); + NpArticulationSpatialTendon::getBinaryMetaData(stream); + NpArticulationFixedTendon::getBinaryMetaData(stream); + NpArticulationAttachment::getBinaryMetaData(stream); + NpArticulationAttachmentArray::getBinaryMetaData(stream); + NpArticulationTendonJoint::getBinaryMetaData(stream); + NpArticulationTendonJointArray::getBinaryMetaData(stream); NpShapeManager::getBinaryMetaData(stream); NpAggregate::getBinaryMetaData(stream); } diff --git a/physx/source/physx/src/NpParticleSystem.cpp b/physx/source/physx/src/NpParticleSystem.cpp index bc346f624..5cf987e6d 100644 --- a/physx/source/physx/src/NpParticleSystem.cpp +++ b/physx/source/physx/src/NpParticleSystem.cpp @@ -1123,38 +1123,6 @@ namespace physx } } - ////////////////////////////////////////////////////////////////////////////////////////////// - void NpParticlePhase::setFlags(PxParticlePhaseFlags flags) - { - mPhase = (mPhase & (~PxParticlePhaseFlag::eParticlePhaseFlagsMask)) | PxU32(flags); - } - void NpParticlePhase::setFlag(PxParticlePhaseFlag::Enum flag, bool enabled) - { - if (enabled) - mPhase |= flag; - else - mPhase &= (~flag); - } - - PxParticlePhaseFlags NpParticlePhase::getFlags() const - { - return PxParticlePhaseFlags(mPhase & PxParticlePhaseFlag::eParticlePhaseFlagsMask); - } - - PxParticleMaterial* NpParticlePhase::getMaterial() const - { - return mMaterial; - } - void NpParticlePhase::setMaterial(PxParticleMaterial* material) - { - //Acquire and release materials as required - material->acquireReference(); - if(mMaterial) - mMaterial->release(); - - mMaterial = material; - } - PxU32 NpCustomParticleSystem::createPhase(PxParticleMaterial* material, const PxParticlePhaseFlags flags) { if (material->getConcreteType() == PxConcreteType::eCUSTOM_MATERIAL) diff --git a/physx/source/physx/src/NpParticleSystem.h b/physx/source/physx/src/NpParticleSystem.h index 440ae1d8d..633b364c0 100644 --- a/physx/source/physx/src/NpParticleSystem.h +++ b/physx/source/physx/src/NpParticleSystem.h @@ -41,7 +41,7 @@ #include "PxActor.h" #include "PxFiltering.h" #include "PxParticleBuffer.h" -#include "PxParticlePhase.h" +//#include "PxParticlePhase.h" #include "PxParticleSolverType.h" #include "PxParticleSystem.h" #include "PxPBDParticleSystem.h" @@ -79,34 +79,6 @@ namespace physx class ParticleSystemSim; } - class NpParticlePhase : public PxParticlePhase - { - PxParticleSystem* mSystem; - PxParticleMaterial* mMaterial; - PxU32 mPhase; - - public: - virtual void setFlags(PxParticlePhaseFlags flags); - virtual void setFlag(PxParticlePhaseFlag::Enum flag, bool enabled); - virtual PxParticlePhaseFlags getFlags() const; - - virtual PxParticleMaterial* getMaterial() const; - virtual void setMaterial(PxParticleMaterial* material); - - NpParticlePhase(PxParticleSystem* system, PxParticleMaterial* material, PxU32 phase) - : mSystem(system), mMaterial(material), mPhase(phase) - { - } - - ~NpParticlePhase() - { - mMaterial->release(); - mMaterial = NULL; - } - - }; - - template class NpParticleSystem : public NpActorTemplate { @@ -271,9 +243,6 @@ namespace physx return 0xffffffff; } - virtual bool isKindOf(const char* name) const { return !::strcmp("PxParticleSystem", name) || PxBase::isKindOf(name); } - virtual const char* getConcreteTypeName() const { return "PxParticleSystem"; } - PX_FORCE_INLINE const Sc::ParticleSystemCore& getCore() const { return mCore; } PX_FORCE_INLINE Sc::ParticleSystemCore& getCore() { return mCore; } static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpParticleSystem, mCore); } diff --git a/physx/source/physx/src/NpPhysics.cpp b/physx/source/physx/src/NpPhysics.cpp index 433f3050e..b3c20ce87 100644 --- a/physx/source/physx/src/NpPhysics.cpp +++ b/physx/source/physx/src/NpPhysics.cpp @@ -490,6 +490,11 @@ PxShape* NpPhysics::createShape(const PxGeometry& geometry, PxFEMClothMaterial*c return NpFactory::getInstance().createShape(geometry, shapeFlags, materials, materialCount, isExclusive); } +#else +PxShape* NpPhysics::createShape(const PxGeometry&, PxFEMClothMaterial*const *, PxU16, bool, PxShapeFlags) +{ + return NULL; +} #endif PxU32 NpPhysics::getNbShapes() const @@ -523,13 +528,6 @@ PxSoftBody* NpPhysics::createSoftBody(PxCudaContextManager& cudaContextManager) return NpFactory::getInstance().createSoftBody(cudaContextManager); } -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION -PxFEMCloth* NpPhysics::createFEMCloth(PxCudaContextManager& cudaContextManager) -{ - return NpFactory::getInstance().createFEMCloth(cudaContextManager); -} -#endif - PxPBDParticleSystem* NpPhysics::createPBDParticleSystem(PxCudaContextManager& cudaContexManager, PxU32 maxNeighborhood) { return NpFactory::getInstance().createPBDParticleSystem(maxNeighborhood, cudaContexManager); @@ -550,10 +548,39 @@ PxCustomParticleSystem* NpPhysics::createCustomParticleSystem(PxCudaContextManag { return NpFactory::getInstance().createCustomParticleSystem(cudaContexManager, maxNeighborhood); } + + PxFEMCloth* NpPhysics::createFEMCloth(PxCudaContextManager& cudaContextManager) + { + return NpFactory::getInstance().createFEMCloth(cudaContextManager); + } + PxHairSystem* NpPhysics::createHairSystem(PxCudaContextManager& cudaContextManager) { return NpFactory::getInstance().createHairSystem(cudaContextManager); } +#else + PxFLIPParticleSystem* NpPhysics::createFLIPParticleSystem(PxCudaContextManager&) + { + return NULL; + } + + PxMPMParticleSystem* NpPhysics::createMPMParticleSystem(PxCudaContextManager&) + { + return NULL; + } + + PxCustomParticleSystem* NpPhysics::createCustomParticleSystem(PxCudaContextManager&, PxU32) + { + return NULL; + } + PxFEMCloth* NpPhysics::createFEMCloth(PxCudaContextManager&) + { + return NULL; + } + PxHairSystem* NpPhysics::createHairSystem(PxCudaContextManager&) + { + return NULL; + } #endif PxBuffer* NpPhysics::createBuffer(PxU64 byteSize, PxBufferType::Enum bufferType, PxCudaContextManager* cudaContexManager) @@ -867,6 +894,11 @@ PxFEMClothMaterial* NpPhysics::createFEMClothMaterial(PxReal youngs, PxReal pois PxFEMClothMaterial* m = NpFactory::getInstance().createFEMClothMaterial(youngs, poissons, dynamicFriction); return addFEMClothMaterial(static_cast(m)); } +#else +PxFEMClothMaterial* NpPhysics::createFEMClothMaterial(PxReal, PxReal, PxReal) +{ + return NULL; +} #endif PxU32 NpPhysics::getNbFEMClothMaterials() const @@ -1079,19 +1111,33 @@ NpFLIPMaterial* NpPhysics::addFLIPMaterial(NpFLIPMaterial* m) return NULL; #endif } +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxFLIPMaterial* NpPhysics::createFLIPMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, PxReal viscosity, PxReal gravityScale) { PxFLIPMaterial* m = NpFactory::getInstance().createFLIPMaterial(friction, damping, maxVelocity, viscosity, gravityScale); return addFLIPMaterial(static_cast(m)); } +#else +PxFLIPMaterial* NpPhysics::createFLIPMaterial(PxReal, PxReal, PxReal, PxReal, PxReal) +{ + return NULL; +} +#endif PxU32 NpPhysics::getNbFLIPMaterials() const { +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); return mMasterFLIPMaterialManager.getNumMaterials(); +#else + return 0; +#endif } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxU32 NpPhysics::getFLIPMaterials(PxFLIPMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const { PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); @@ -1109,7 +1155,15 @@ PxU32 NpPhysics::getFLIPMaterials(PxFLIPMaterial** userBuffer, PxU32 bufferSize, } return writeCount; } +#else +PxU32 NpPhysics::getFLIPMaterials(PxFLIPMaterial** , PxU32, PxU32) const +{ + return 0; +} +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION void NpPhysics::removeFLIPMaterialFromTable(NpFLIPMaterial& m) { #if PX_SUPPORT_GPU_PHYSX @@ -1181,19 +1235,32 @@ NpMPMMaterial* NpPhysics::addMPMMaterial(NpMPMMaterial* m) return NULL; #endif } +#endif // PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxMPMMaterial* NpPhysics::createMPMMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, PxReal criticalCompression, PxReal criticalStretch, PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, PxReal attractiveForceResidual, PxReal gravityScale) { PxMPMMaterial* m = NpFactory::getInstance().createMPMMaterial(friction, damping, maxVelocity, isPlastic, youngsModulus, poissons, hardening, criticalCompression, criticalStretch, tensileDamageSensitivity, compressiveDamageSensitivity, attractiveForceResidual, gravityScale); return addMPMMaterial(static_cast(m)); } +#else +PxMPMMaterial* NpPhysics::createMPMMaterial(PxReal, PxReal, PxReal, bool, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal) +{ + return NULL; +} +#endif PxU32 NpPhysics::getNbMPMMaterials() const { +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); return mMasterMPMMaterialManager.getNumMaterials(); +#else + return 0; +#endif } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxU32 NpPhysics::getMPMMaterials(PxMPMMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const { PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); @@ -1211,7 +1278,14 @@ PxU32 NpPhysics::getMPMMaterials(PxMPMMaterial** userBuffer, PxU32 bufferSize, P } return writeCount; } +#else +PxU32 NpPhysics::getMPMMaterials(PxMPMMaterial**, PxU32, PxU32) const +{ + return 0; +} +#endif +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION void NpPhysics::removeMPMMaterialFromTable(NpMPMMaterial& m) { #if PX_SUPPORT_GPU_PHYSX @@ -1281,19 +1355,32 @@ NpCustomMaterial* NpPhysics::addCustomMaterial(NpCustomMaterial* m) return NULL; #endif } +#endif +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxCustomMaterial* NpPhysics::createCustomMaterial(void* gpuBuffer) { PxCustomMaterial* m = NpFactory::getInstance().createCustomMaterial(gpuBuffer); return addCustomMaterial(static_cast(m)); } +#else +PxCustomMaterial* NpPhysics::createCustomMaterial(void*) +{ + return NULL; +} +#endif PxU32 NpPhysics::getNbCustomMaterials() const { +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); return mMasterCustomMaterialManager.getNumMaterials(); +#else + return 0; +#endif } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxU32 NpPhysics::getCustomMaterials(PxCustomMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const { PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); @@ -1311,7 +1398,14 @@ PxU32 NpPhysics::getCustomMaterials(PxCustomMaterial** userBuffer, PxU32 bufferS } return writeCount; } +#else +PxU32 NpPhysics::getCustomMaterials(PxCustomMaterial**, PxU32, PxU32) const +{ + return 0; +} +#endif +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION void NpPhysics::removeCustomMaterialFromTable(NpCustomMaterial& m) { #if PX_SUPPORT_GPU_PHYSX @@ -1347,7 +1441,7 @@ void NpPhysics::updateCustomMaterial(NpCustomMaterial& m) PX_UNUSED(m); #endif } -#endif +#endif // PX_ENABLE_FEATURES_UNDER_CONSTRUCTION /////////////////////////////////////////////////////////////////////////////// diff --git a/physx/source/physx/src/NpPhysics.h b/physx/source/physx/src/NpPhysics.h index 9c0067f8e..cf451b10c 100644 --- a/physx/source/physx/src/NpPhysics.h +++ b/physx/source/physx/src/NpPhysics.h @@ -142,25 +142,21 @@ class NpPhysics : public PxPhysics, public PxUserAllocated virtual PxRigidDynamic* createRigidDynamic(const PxTransform&) PX_OVERRIDE; virtual PxArticulationReducedCoordinate* createArticulationReducedCoordinate() PX_OVERRIDE; virtual PxSoftBody* createSoftBody(PxCudaContextManager& cudaContextManager) PX_OVERRIDE; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual PxHairSystem* createHairSystem(PxCudaContextManager& cudaContextManager) PX_OVERRIDE; virtual PxFEMCloth* createFEMCloth(PxCudaContextManager& cudaContextManager) PX_OVERRIDE; -#endif virtual PxPBDParticleSystem* createPBDParticleSystem(PxCudaContextManager& cudaContexManager, PxU32 maxNeighborhood) PX_OVERRIDE; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual PxFLIPParticleSystem* createFLIPParticleSystem(PxCudaContextManager& cudaContexManager) PX_OVERRIDE; virtual PxMPMParticleSystem* createMPMParticleSystem(PxCudaContextManager& cudaContexManager) PX_OVERRIDE; virtual PxCustomParticleSystem* createCustomParticleSystem(PxCudaContextManager& cudaContexManager, PxU32 maxNeighborhood) PX_OVERRIDE; -#endif + virtual PxBuffer* createBuffer(PxU64 byteSize, PxBufferType::Enum bufferType, PxCudaContextManager* cudaContextManager) PX_OVERRIDE; virtual PxConstraint* createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) PX_OVERRIDE; virtual PxAggregate* createAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint) PX_OVERRIDE; virtual PxShape* createShape(const PxGeometry&, PxMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE; virtual PxShape* createShape(const PxGeometry&, PxFEMSoftBodyMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual PxShape* createShape(const PxGeometry&, PxFEMClothMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE; -#endif + virtual PxU32 getNbShapes() const PX_OVERRIDE; virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex) const PX_OVERRIDE; @@ -172,9 +168,7 @@ class NpPhysics : public PxPhysics, public PxUserAllocated virtual PxU32 getNbFEMSoftBodyMaterials() const PX_OVERRIDE; virtual PxU32 getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual PxFEMClothMaterial* createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) PX_OVERRIDE; -#endif virtual PxU32 getNbFEMClothMaterials() const PX_OVERRIDE; virtual PxU32 getFEMClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; @@ -182,7 +176,6 @@ class NpPhysics : public PxPhysics, public PxUserAllocated virtual PxU32 getNbPBDMaterials() const PX_OVERRIDE; virtual PxU32 getPBDMaterials(PxPBDMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual PxFLIPMaterial* createFLIPMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, PxReal viscosity, PxReal gravityScale) PX_OVERRIDE; virtual PxU32 getNbFLIPMaterials() const PX_OVERRIDE; virtual PxU32 getFLIPMaterials(PxFLIPMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; @@ -192,10 +185,9 @@ class NpPhysics : public PxPhysics, public PxUserAllocated virtual PxU32 getMPMMaterials(PxMPMMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; virtual PxCustomMaterial* createCustomMaterial(void* gpuBuffer) PX_OVERRIDE; - // PT: what's going on here? Incomplete API? - virtual PxU32 getNbCustomMaterials() const /*PX_OVERRIDE*/; - virtual PxU32 getCustomMaterials(PxCustomMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const /*PX_OVERRIDE*/; -#endif + virtual PxU32 getNbCustomMaterials() const PX_OVERRIDE; + virtual PxU32 getCustomMaterials(PxCustomMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; + virtual PxTriangleMesh* createTriangleMesh(PxInputStream&) PX_OVERRIDE; virtual PxU32 getNbTriangleMeshes() const PX_OVERRIDE; virtual PxU32 getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; diff --git a/physx/source/physx/src/NpRigidBodyTemplate.h b/physx/source/physx/src/NpRigidBodyTemplate.h index 52b5fb74a..af3fe5e2b 100644 --- a/physx/source/physx/src/NpRigidBodyTemplate.h +++ b/physx/source/physx/src/NpRigidBodyTemplate.h @@ -713,6 +713,10 @@ PX_FORCE_INLINE void NpRigidBodyTemplate::setRigidBodyFlagsInternal(co } scSetFlags(filteredNewFlags); +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, rigidBodyFlags, *actor, filteredNewFlags) +#endif // PT: the SQ update should be done after the scSetFlags() call if(mustUpdateSQ) diff --git a/physx/source/physx/src/NpScene.cpp b/physx/source/physx/src/NpScene.cpp index 273bd7301..58f9f3125 100644 --- a/physx/source/physx/src/NpScene.cpp +++ b/physx/source/physx/src/NpScene.cpp @@ -1558,10 +1558,11 @@ void NpScene::removeFEMCloth(PxFEMCloth& femCloth, bool /*wakeOnLostTouch*/) PX_UNUSED(femCloth); #endif } +#endif PxU32 NpScene::getNbFEMCloths() const { -#if PX_SUPPORT_GPU_PHYSX +#if PX_SUPPORT_GPU_PHYSX && PX_ENABLE_FEATURES_UNDER_CONSTRUCTION NP_READ_CHECK(this); return mFEMCloths.size(); #else @@ -1569,6 +1570,7 @@ PxU32 NpScene::getNbFEMCloths() const #endif } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxU32 NpScene::getFEMCloths(PxFEMCloth** userBuffer, PxU32 bufferSize, PxU32 startIndex) const { #if PX_SUPPORT_GPU_PHYSX @@ -1581,6 +1583,11 @@ PxU32 NpScene::getFEMCloths(PxFEMCloth** userBuffer, PxU32 bufferSize, PxU32 sta return 0; #endif } +#else +PxU32 NpScene::getFEMCloths(PxFEMCloth**, PxU32, PxU32) const +{ + return 0; +} #endif /////////////////////////////////////////////////////////////////////////////// @@ -1845,10 +1852,11 @@ void NpScene::removeHairSystem(PxHairSystem& hairSystem, bool /*wakeOnLostTouch* PX_UNUSED(hairSystem); #endif } +#endif PxU32 NpScene::getNbHairSystems() const { -#if PX_SUPPORT_GPU_PHYSX +#if PX_SUPPORT_GPU_PHYSX && PX_ENABLE_FEATURES_UNDER_CONSTRUCTION NP_READ_CHECK(this); return mHairSystems.size(); #else @@ -1858,7 +1866,7 @@ PxU32 NpScene::getNbHairSystems() const PxU32 NpScene::getHairSystems(PxHairSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex) const { -#if PX_SUPPORT_GPU_PHYSX +#if PX_SUPPORT_GPU_PHYSX && PX_ENABLE_FEATURES_UNDER_CONSTRUCTION NP_READ_CHECK(this); return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mHairSystems.getEntries(), mHairSystems.size()); #else @@ -1868,7 +1876,6 @@ PxU32 NpScene::getHairSystems(PxHairSystem** userBuffer, PxU32 bufferSize, PxU32 return 0; #endif } -#endif /////////////////////////////////////////////////////////////////////////////// diff --git a/physx/source/physx/src/NpScene.h b/physx/source/physx/src/NpScene.h index fdd0a2c2f..08c9eb7fe 100644 --- a/physx/source/physx/src/NpScene.h +++ b/physx/source/physx/src/NpScene.h @@ -108,9 +108,6 @@ class NpMPMMaterial; class NpCustomMaterial; #endif -class PxArticulationImpl; - - class NpContactCallbackTask : public physx::PxLightCpuTask { NpScene* mScene; @@ -176,13 +173,11 @@ class NpScene : public NpSceneAccessor, public PxUserAllocated virtual PxU32 getNbParticleSystems(PxParticleSolverType::Enum type) const; virtual PxU32 getParticleSystems(PxParticleSolverType::Enum type, PxParticleSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual PxU32 getNbFEMCloths() const; virtual PxU32 getFEMCloths(PxFEMCloth** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const; virtual PxU32 getNbHairSystems() const; virtual PxU32 getHairSystems(PxHairSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const; -#endif // Aggregates virtual bool addAggregate(PxAggregate&); diff --git a/physx/source/physx/src/NpSerializerAdapter.cpp b/physx/source/physx/src/NpSerializerAdapter.cpp index 9d674c924..6f125dda5 100644 --- a/physx/source/physx/src/NpSerializerAdapter.cpp +++ b/physx/source/physx/src/NpSerializerAdapter.cpp @@ -42,6 +42,7 @@ #include "NpRigidDynamic.h" #include "NpArticulationReducedCoordinate.h" #include "NpArticulationLink.h" +#include "NpArticulationSensor.h" #include "NpMaterial.h" #include "NpAggregate.h" @@ -148,6 +149,11 @@ void PxRegisterPhysicsSerializers(PxSerializationRegistry& sr) sr.registerSerializer(PxConcreteType::eARTICULATION_REDUCED_COORDINATE, PX_NEW_SERIALIZER_ADAPTER(NpArticulationReducedCoordinate)); sr.registerSerializer(PxConcreteType::eARTICULATION_LINK, PX_NEW_SERIALIZER_ADAPTER(NpArticulationLink)); sr.registerSerializer(PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE, PX_NEW_SERIALIZER_ADAPTER(NpArticulationJointReducedCoordinate)); + sr.registerSerializer(PxConcreteType::eARTICULATION_SENSOR, PX_NEW_SERIALIZER_ADAPTER(NpArticulationSensor)); + sr.registerSerializer(PxConcreteType::eARTICULATION_SPATIAL_TENDON, PX_NEW_SERIALIZER_ADAPTER(NpArticulationSpatialTendon)); + sr.registerSerializer(PxConcreteType::eARTICULATION_ATTACHMENT, PX_NEW_SERIALIZER_ADAPTER(NpArticulationAttachment)); + sr.registerSerializer(PxConcreteType::eARTICULATION_FIXED_TENDON, PX_NEW_SERIALIZER_ADAPTER(NpArticulationFixedTendon)); + sr.registerSerializer(PxConcreteType::eARTICULATION_TENDON_JOINT, PX_NEW_SERIALIZER_ADAPTER(NpArticulationTendonJoint)); sr.registerSerializer(PxConcreteType::ePRUNING_STRUCTURE, PX_NEW_SERIALIZER_ADAPTER(Sq::PruningStructure)); } @@ -167,5 +173,10 @@ void PxUnregisterPhysicsSerializers(PxSerializationRegistry& sr) PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_REDUCED_COORDINATE)); PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_LINK)); PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_SENSOR)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_SPATIAL_TENDON)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_ATTACHMENT)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_FIXED_TENDON)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_TENDON_JOINT)); PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::ePRUNING_STRUCTURE)); } diff --git a/physx/source/physx/src/NpShape.cpp b/physx/source/physx/src/NpShape.cpp index b04d9d3dc..a2065bd13 100644 --- a/physx/source/physx/src/NpShape.cpp +++ b/physx/source/physx/src/NpShape.cpp @@ -459,10 +459,10 @@ void NpShape::setSoftBodyMaterials(PxFEMSoftBodyMaterial*const* materials, PxU16 PX_UNUSED(materialCount); #endif } -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + void NpShape::setClothMaterials(PxFEMClothMaterial*const* materials, PxU16 materialCount) { -#if PX_SUPPORT_GPU_PHYSX +#if PX_SUPPORT_GPU_PHYSX && PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PX_CHECK_AND_RETURN((mCore.getCore().mShapeCoreFlags & PxShapeCoreFlag::eCLOTH_SHAPE), "NpShape::setMaterials: can only apply cloth materials to a cloth shape!"); @@ -472,7 +472,6 @@ void NpShape::setClothMaterials(PxFEMClothMaterial*const* materials, PxU16 mater PX_UNUSED(materialCount); #endif } -#endif PxU16 NpShape::getNbMaterials() const { @@ -498,6 +497,11 @@ PxU32 NpShape::getClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSi NP_READ_CHECK(getNpScene()); return scGetMaterials(userBuffer, bufferSize, startIndex); } +#else +PxU32 NpShape::getClothMaterials(PxFEMClothMaterial**, PxU32, PxU32) const +{ + return 0; +} #endif PxBaseMaterial* NpShape::getMaterialFromInternalFaceIndex(PxU32 faceIndex) const diff --git a/physx/source/physx/src/NpShape.h b/physx/source/physx/src/NpShape.h index c61c7d179..13f978ce9 100644 --- a/physx/source/physx/src/NpShape.h +++ b/physx/source/physx/src/NpShape.h @@ -86,15 +86,11 @@ class NpShape : public PxShape, public NpBase virtual PxFilterData getQueryFilterData() const PX_OVERRIDE; virtual void setMaterials(PxMaterial*const* materials, PxU16 materialCount) PX_OVERRIDE; virtual void setSoftBodyMaterials(PxFEMSoftBodyMaterial*const* materials, PxU16 materialCount) PX_OVERRIDE; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual void setClothMaterials(PxFEMClothMaterial*const* materials, PxU16 materialCount) PX_OVERRIDE; -#endif virtual PxU16 getNbMaterials() const PX_OVERRIDE; virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; virtual PxU32 getSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual PxU32 getClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; -#endif virtual PxBaseMaterial* getMaterialFromInternalFaceIndex(PxU32 faceIndex) const PX_OVERRIDE; virtual void setContactOffset(PxReal) PX_OVERRIDE; virtual PxReal getContactOffset() const PX_OVERRIDE; diff --git a/physx/source/physx/src/NpSoftBody.cpp b/physx/source/physx/src/NpSoftBody.cpp index 6b979586a..b262ca359 100644 --- a/physx/source/physx/src/NpSoftBody.cpp +++ b/physx/source/physx/src/NpSoftBody.cpp @@ -788,7 +788,11 @@ namespace physx return mCore.addClothFilter(*core, triIdx, tetIdx); } +#else + void NpSoftBody::addClothFilter(PxFEMCloth*, PxU32, PxU32) {} +#endif +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION void NpSoftBody::removeClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx) { NP_WRITE_CHECK(getNpScene()); @@ -803,7 +807,12 @@ namespace physx mCore.removeClothFilter(*core, triIdx, tetIdx); } +#else + void NpSoftBody::removeClothFilter(PxFEMCloth*, PxU32, PxU32) {} +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION PxU32 NpSoftBody::addClothAttachment(PxFEMCloth* cloth, PxU32 triIdx, const PxVec4& triBarycentric, PxU32 tetIdx, const PxVec4& tetBarycentric, PxConeLimitedConstraint* constraint) { NP_WRITE_CHECK(getNpScene()); @@ -818,7 +827,14 @@ namespace physx return mCore.addClothAttachment(*core, triIdx, triBarycentric, tetIdx, tetBarycentric, constraint); } +#else + PxU32 NpSoftBody::addClothAttachment(PxFEMCloth*, PxU32, const PxVec4&, PxU32, const PxVec4&, PxConeLimitedConstraint*) + { + return 0; + } +#endif +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION void NpSoftBody::removeClothAttachment(PxFEMCloth* cloth, PxU32 handle) { NP_WRITE_CHECK(getNpScene()); @@ -833,6 +849,8 @@ namespace physx mCore.removeClothAttachment(*core, handle); } +#else + void NpSoftBody::removeClothAttachment(PxFEMCloth*, PxU32) {} #endif } diff --git a/physx/source/physx/src/NpSoftBody.h b/physx/source/physx/src/NpSoftBody.h index 1d61b9110..8a82cd3fe 100644 --- a/physx/source/physx/src/NpSoftBody.h +++ b/physx/source/physx/src/NpSoftBody.h @@ -92,9 +92,6 @@ namespace physx virtual void release(); - virtual bool isKindOf(const char* name) const { return !::strcmp("PxSoftBody", name) || PxBase::isKindOf(name); } - virtual const char* getConcreteTypeName() const { return "PxSoftBody"; } - PX_FORCE_INLINE const Sc::SoftBodyCore& getCore() const { return mCore; } PX_FORCE_INLINE Sc::SoftBodyCore& getCore() { return mCore; } static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpSoftBody, mCore); } @@ -126,14 +123,13 @@ namespace physx PxConeLimitedConstraint* constraint); virtual void removeSoftBodyAttachment(PxSoftBody* softbody0, PxU32 handle); -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual void addClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx); virtual void removeClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx); virtual PxU32 addClothAttachment(PxFEMCloth* cloth, PxU32 triIdx, const PxVec4& triBarycentric, PxU32 tetIdx, const PxVec4& tetBarycentric, PxConeLimitedConstraint* constraint); virtual void removeClothAttachment(PxFEMCloth* cloth, PxU32 handle); -#endif + // Debug name void setName(const char*); const char* getName() const; diff --git a/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjectNames.h b/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjectNames.h index 02c6f01b3..5277ca8fc 100644 --- a/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjectNames.h +++ b/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjectNames.h @@ -48,6 +48,7 @@ PxPhysics_Materials, PxPhysics_FEMSoftBodyMaterials, PxPhysics_FEMClothMaterials, PxPhysics_PBDMaterials, +PxPhysics_CustomMaterials, PxPhysics_PropertiesStop, PxRefCounted_PropertiesStart, PxRefCounted_ReferenceCount, diff --git a/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjects.h b/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjects.h index accfca51e..14549f55c 100644 --- a/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjects.h +++ b/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjects.h @@ -75,6 +75,7 @@ template<> struct PxEnumTraits< physx::PxBufferType::Enum > { PxEnumTraits() : N PxReadOnlyCollectionPropertyInfo FEMSoftBodyMaterials; PxReadOnlyCollectionPropertyInfo FEMClothMaterials; PxReadOnlyCollectionPropertyInfo PBDMaterials; + PxFactoryCollectionPropertyInfo CustomMaterials; PX_PHYSX_CORE_API PxPhysicsGeneratedInfo(); template @@ -94,7 +95,7 @@ template<> struct PxEnumTraits< physx::PxBufferType::Enum > { PxEnumTraits() : N PX_UNUSED(inStartIndex); return inStartIndex; } - static PxU32 instancePropertyCount() { return 13; } + static PxU32 instancePropertyCount() { return 14; } static PxU32 totalPropertyCount() { return instancePropertyCount(); } template PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const @@ -114,7 +115,8 @@ template<> struct PxEnumTraits< physx::PxBufferType::Enum > { PxEnumTraits() : N inOperator( FEMSoftBodyMaterials, inStartIndex + 10 );; inOperator( FEMClothMaterials, inStartIndex + 11 );; inOperator( PBDMaterials, inStartIndex + 12 );; - return 13 + inStartIndex; + inOperator( CustomMaterials, inStartIndex + 13 );; + return 14 + inStartIndex; } }; template<> struct PxClassInfoTraits diff --git a/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp b/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp index 5e456b36f..c6b6e0c9d 100644 --- a/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp +++ b/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp @@ -76,6 +76,9 @@ PxU32 getPxPhysics_FEMClothMaterials( const PxPhysics* inObj, PxFEMClothMaterial PxU32 getNbPxPhysics_FEMClothMaterials( const PxPhysics* inObj ) { return inObj->getNbFEMClothMaterials( ); } PxU32 getPxPhysics_PBDMaterials( const PxPhysics* inObj, PxPBDMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getPBDMaterials( outBuffer, inBufSize ); } PxU32 getNbPxPhysics_PBDMaterials( const PxPhysics* inObj ) { return inObj->getNbPBDMaterials( ); } +PxU32 getPxPhysics_CustomMaterials( const PxPhysics* inObj, PxCustomMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getCustomMaterials( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_CustomMaterials( const PxPhysics* inObj ) { return inObj->getNbCustomMaterials( ); } +PxCustomMaterial * createPxPhysics_CustomMaterials( PxPhysics* inObj, void * inCreateParam ){ return inObj->createCustomMaterial( inCreateParam ); } PX_PHYSX_CORE_API PxPhysicsGeneratedInfo::PxPhysicsGeneratedInfo() : TolerancesScale( "TolerancesScale", getPxPhysics_TolerancesScale) , TriangleMeshes( "TriangleMeshes", getPxPhysics_TriangleMeshes, getNbPxPhysics_TriangleMeshes, createPxPhysics_TriangleMeshes ) @@ -90,6 +93,7 @@ PX_PHYSX_CORE_API PxPhysicsGeneratedInfo::PxPhysicsGeneratedInfo() , FEMSoftBodyMaterials( "FEMSoftBodyMaterials", getPxPhysics_FEMSoftBodyMaterials, getNbPxPhysics_FEMSoftBodyMaterials ) , FEMClothMaterials( "FEMClothMaterials", getPxPhysics_FEMClothMaterials, getNbPxPhysics_FEMClothMaterials ) , PBDMaterials( "PBDMaterials", getPxPhysics_PBDMaterials, getNbPxPhysics_PBDMaterials ) + , CustomMaterials( "CustomMaterials", getPxPhysics_CustomMaterials, getNbPxPhysics_CustomMaterials, createPxPhysics_CustomMaterials ) {} PX_PHYSX_CORE_API PxPhysicsGeneratedValues::PxPhysicsGeneratedValues( const PxPhysics* inSource ) :TolerancesScale( getPxPhysics_TolerancesScale( inSource ) ) diff --git a/physx/source/simulationcontroller/include/ScArticulationAttachmentCore.h b/physx/source/simulationcontroller/include/ScArticulationAttachmentCore.h index a44da6eb6..afb022adb 100644 --- a/physx/source/simulationcontroller/include/ScArticulationAttachmentCore.h +++ b/physx/source/simulationcontroller/include/ScArticulationAttachmentCore.h @@ -39,6 +39,13 @@ namespace Sc class ArticulationAttachmentCore { public: + +// PX_SERIALIZATION + ArticulationAttachmentCore(const PxEMPTY) : mTendonSim(NULL) {} + void preExportDataReset() { } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + ArticulationAttachmentCore() : mLowLimit(PX_MAX_F32), mHighLimit(-PX_MAX_F32), mRestLength(0.f) { diff --git a/physx/source/simulationcontroller/include/ScArticulationSensor.h b/physx/source/simulationcontroller/include/ScArticulationSensor.h index 03cda3c68..ec5aa1fc8 100644 --- a/physx/source/simulationcontroller/include/ScArticulationSensor.h +++ b/physx/source/simulationcontroller/include/ScArticulationSensor.h @@ -40,10 +40,18 @@ namespace Sc class ArticulationCore; class ArticulationSensorSim; -class ArticulationSensorCore +class ArticulationSensorCore { public: +// PX_SERIALIZATION + ArticulationSensorCore(const PxEMPTY) :mSim(NULL) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + + ArticulationSensorCore(){} + PX_FORCE_INLINE void setSim(ArticulationSensorSim* sim) { PX_ASSERT((sim == 0) ^ (mSim == 0)); @@ -52,7 +60,6 @@ class ArticulationSensorCore PX_FORCE_INLINE ArticulationSensorSim* getSim() const { return mSim; } - void getBinaryMetaData(PxOutputStream& stream); ArticulationSensorSim* mSim; PxTransform mRelativePose; PxU16 mFlags; diff --git a/physx/source/simulationcontroller/include/ScArticulationTendonCore.h b/physx/source/simulationcontroller/include/ScArticulationTendonCore.h index 8f5aae40e..f5bcc8f8f 100644 --- a/physx/source/simulationcontroller/include/ScArticulationTendonCore.h +++ b/physx/source/simulationcontroller/include/ScArticulationTendonCore.h @@ -42,6 +42,13 @@ namespace Sc class ArticulationTendonCore { public: + +// PX_SERIALIZATION + ArticulationTendonCore(const PxEMPTY) {} + void preExportDataReset() { } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + ArticulationTendonCore() : mStiffness(0.f), mDamping(0.f), mOffset(0.f), mLimitStiffness(0.f) { @@ -55,6 +62,13 @@ namespace Sc class ArticulationSpatialTendonCore : public ArticulationTendonCore { public: + +// PX_SERIALIZATION + ArticulationSpatialTendonCore(const PxEMPTY) : ArticulationTendonCore(PxEmpty), mSim(NULL) {} + void preExportDataReset() { } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + ArticulationSpatialTendonCore() : ArticulationTendonCore() { mSim = NULL; } ~ArticulationSpatialTendonCore() {} @@ -81,13 +95,17 @@ namespace Sc ArticulationSpatialTendonSim* mSim; - - static void getBinaryMetaData(PxOutputStream& stream); }; class ArticulationFixedTendonCore : public ArticulationTendonCore { public: + // PX_SERIALIZATION + ArticulationFixedTendonCore(const PxEMPTY) : ArticulationTendonCore(PxEmpty), mSim(NULL) {} + void preExportDataReset() {} + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + ArticulationFixedTendonCore() : ArticulationTendonCore(), mLowLimit(PX_MAX_F32), mHighLimit(-PX_MAX_F32), mRestLength(0.f) { mSim = NULL; } ~ArticulationFixedTendonCore() {} @@ -123,8 +141,6 @@ namespace Sc PxReal mRestLength; ArticulationFixedTendonSim* mSim; - - static void getBinaryMetaData(PxOutputStream& stream); }; diff --git a/physx/source/simulationcontroller/include/ScArticulationTendonJointCore.h b/physx/source/simulationcontroller/include/ScArticulationTendonJointCore.h index 632657a71..d2060b9a0 100644 --- a/physx/source/simulationcontroller/include/ScArticulationTendonJointCore.h +++ b/physx/source/simulationcontroller/include/ScArticulationTendonJointCore.h @@ -43,6 +43,12 @@ namespace physx { public: + // PX_SERIALIZATION + ArticulationTendonJointCore(const PxEMPTY) : mTendonSim(NULL) {} + void preExportDataReset() { } + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + ArticulationTendonJointCore() { coefficient = PX_MAX_F32; @@ -70,7 +76,6 @@ namespace physx PxU32 mLLLinkIndex; ArticulationTendonJointCore* mParent; PxU32 mLLTendonJointIndex; - //Dy::ArticulationTendonJoint* mLLTendonJoint; Sc::ArticulationFixedTendonSim* mTendonSim; }; }//namespace Sc diff --git a/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp b/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp index b53889a71..94666cb6e 100644 --- a/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp +++ b/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp @@ -41,10 +41,7 @@ void Sc::ArticulationSpatialTendonCore::setStiffness(const PxReal stiffness) PxReal Sc::ArticulationSpatialTendonCore::getStiffness() const { - if(mSim) - return mSim->getStiffness(); - - return 0.f; + return mStiffness; } void Sc::ArticulationSpatialTendonCore::setDamping(const PxReal damping) @@ -57,10 +54,7 @@ void Sc::ArticulationSpatialTendonCore::setDamping(const PxReal damping) PxReal Sc::ArticulationSpatialTendonCore::getDamping() const { - if(mSim) - return mSim->getDamping(); - - return 0.f; + return mDamping; } void Sc::ArticulationSpatialTendonCore::setLimitStiffness(const PxReal stiffness) @@ -73,10 +67,7 @@ void Sc::ArticulationSpatialTendonCore::setLimitStiffness(const PxReal stiffness PxReal Sc::ArticulationSpatialTendonCore::getLimitStiffness() const { - if (mSim) - return mSim->getLimitStiffness(); - - return 0.f; + return mLimitStiffness; } void Sc::ArticulationSpatialTendonCore::setOffset(const PxReal offset) @@ -89,10 +80,7 @@ void Sc::ArticulationSpatialTendonCore::setOffset(const PxReal offset) PxReal Sc::ArticulationSpatialTendonCore::getOffset() const { - if(mSim) - return mSim->getOffset(); - - return 0.f; + return mOffset; } ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -107,10 +95,7 @@ void Sc::ArticulationFixedTendonCore::setStiffness(const PxReal stiffness) PxReal Sc::ArticulationFixedTendonCore::getStiffness() const { - if (mSim) - return mSim->getStiffness(); - - return 0.f; + return mStiffness; } void Sc::ArticulationFixedTendonCore::setDamping(const PxReal damping) @@ -123,10 +108,7 @@ void Sc::ArticulationFixedTendonCore::setDamping(const PxReal damping) PxReal Sc::ArticulationFixedTendonCore::getDamping() const { - if(mSim) - return mSim->getDamping(); - - return 0.f; + return mDamping; } void Sc::ArticulationFixedTendonCore::setLimitStiffness(const PxReal stiffness) @@ -138,10 +120,7 @@ void Sc::ArticulationFixedTendonCore::setLimitStiffness(const PxReal stiffness) PxReal Sc::ArticulationFixedTendonCore::getLimitStiffness() const { - if (mSim) - return mSim->getLimitStiffness(); - - return 0.f; + return mLimitStiffness; } void Sc::ArticulationFixedTendonCore::setSpringRestLength(const PxReal restLength) @@ -153,10 +132,7 @@ void Sc::ArticulationFixedTendonCore::setSpringRestLength(const PxReal restLengt PxReal Sc::ArticulationFixedTendonCore::getSpringRestLength() const { - if (mSim) - return mSim->getSpringRestLength(); - - return 0.f; + return mRestLength; } void Sc::ArticulationFixedTendonCore::setLimitRange(const PxReal lowLimit, const PxReal highLimit) @@ -170,8 +146,8 @@ void Sc::ArticulationFixedTendonCore::setLimitRange(const PxReal lowLimit, const void Sc::ArticulationFixedTendonCore::getLimitRange(PxReal& lowLimit, PxReal& highLimit) const { - if(mSim) - mSim->getLimitRange(lowLimit, highLimit); + lowLimit = mLowLimit; + highLimit = mHighLimit; } void Sc::ArticulationFixedTendonCore::setOffset(const PxReal offset) @@ -183,8 +159,5 @@ void Sc::ArticulationFixedTendonCore::setOffset(const PxReal offset) PxReal Sc::ArticulationFixedTendonCore::getOffset() const { - if(mSim) - return mSim->getOffset(); - - return 0.f; + return mOffset; } diff --git a/physx/source/simulationcontroller/src/ScMetaData.cpp b/physx/source/simulationcontroller/src/ScMetaData.cpp index 2a1da7f9e..9928501b1 100644 --- a/physx/source/simulationcontroller/src/ScMetaData.cpp +++ b/physx/source/simulationcontroller/src/ScMetaData.cpp @@ -37,6 +37,8 @@ #include "ScArticulationJointCore.h" #include "ScArticulationSensor.h" #include "ScArticulationTendonCore.h" +#include "ScArticulationAttachmentCore.h" +#include "ScArticulationTendonJointCore.h" using namespace physx; using namespace Cm; @@ -303,21 +305,66 @@ void Sc::ArticulationSensorCore::getBinaryMetaData(PxOutputStream& stream) PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSensorCore, ArticulationSensorSim, mSim, PxMetaDataFlag::ePTR) PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSensorCore, PxTransform, mRelativePose, 0) - PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSensorCore, PxU32, mFlags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSensorCore, PxU16, mFlags, 0) +} + +void Sc::ArticulationAttachmentCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationAttachmentCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxVec3, mRelativeOffset, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, ArticulationAttachmentCore, mParent, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxReal, mLowLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxReal, mHighLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxReal, mRestLength, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxReal, mCoefficient, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxU32, mLLLinkIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxU32, mAttachmentIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, ArticulationSpatialTendonSim, mTendonSim, PxMetaDataFlag::ePTR) +} + +void Sc::ArticulationTendonCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationTendonCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonCore, PxReal, mStiffness, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonCore, PxReal, mDamping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonCore, PxReal, mOffset, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonCore, PxReal, mLimitStiffness, 0) } void Sc::ArticulationSpatialTendonCore::getBinaryMetaData(PxOutputStream& stream) { PX_DEF_BIN_METADATA_CLASS(stream, ArticulationSpatialTendonCore) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, ArticulationSpatialTendonCore, ArticulationTendonCore) - PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSpatialTendonCore, ArticulationSpatialTendonSim, mSim, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSpatialTendonCore, ArticulationSpatialTendonSim, mSim, PxMetaDataFlag::ePTR) } void Sc::ArticulationFixedTendonCore::getBinaryMetaData(PxOutputStream& stream) { PX_DEF_BIN_METADATA_CLASS(stream, ArticulationFixedTendonCore) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, ArticulationFixedTendonCore, ArticulationTendonCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationFixedTendonCore, PxReal, mLowLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationFixedTendonCore, PxReal, mHighLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationFixedTendonCore, PxReal, mRestLength, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationFixedTendonCore, ArticulationFixedTendonSim, mSim, PxMetaDataFlag::ePTR) +} + +void Sc::ArticulationTendonJointCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxArticulationAxis, PxU32) + + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationTendonJointCore) - PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSpatialTendonCore, ArticulationFixedTendonSim, mSim, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, PxArticulationAxis, axis, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, PxReal, coefficient, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, PxReal, recipCoefficient, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, PxU32, mLLLinkIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, ArticulationTendonJointCore, mParent, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, PxU32, mLLTendonJointIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, ArticulationFixedTendonSim, mTendonSim, PxMetaDataFlag::ePTR) } /////////////////////////////////////////////////////////////////////////////// diff --git a/physx/source/simulationcontroller/src/ScSimulationController.h b/physx/source/simulationcontroller/src/ScSimulationController.h index fc8c266f4..43fc7be1a 100644 --- a/physx/source/simulationcontroller/src/ScSimulationController.h +++ b/physx/source/simulationcontroller/src/ScSimulationController.h @@ -233,10 +233,9 @@ namespace Sc virtual void applyActorData(void* /*data*/, PxGpuActorPair* /*index*/, PxActorCacheFlag::Enum /*flag*/, const PxU32 /*nbUpdatedActors*/, void* /*waitEvent*/, void* /*signalEvent*/) {} -#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION virtual void* getMPMDataPointer(const Dy::ParticleSystem& /*psLL*/, PxMPMParticleDataFlag::Enum /*flags*/) { return NULL; } virtual void* getSparseGridDataPointer(const Dy::ParticleSystem& /*psLL*/, PxSparseGridDataFlag::Enum /*flags*/, PxParticleSolverType::Enum /*type*/) { return NULL; } -#endif + virtual void allocatePBDMaterialsBuffer(PxPhysXGpu* /*physxGpu*/, Dy::ParticleSystemCore& /*core*/, PxU64* /*gpuMemStat*/) {} virtual void allocateFLIPMaterialsBuffer(PxPhysXGpu* /*physxGpu*/, Dy::ParticleSystemCore& /*core*/, PxU64* /*gpuMemStat*/) {} virtual void allocateMPMMaterialsBuffer(PxPhysXGpu* /*physxGpu*/, Dy::ParticleSystemCore& /*core*/, PxU64* /*gpuMemStat*/) {} diff --git a/physx/version.txt b/physx/version.txt index 8150caa9b..ab11b3087 100644 --- a/physx/version.txt +++ b/physx/version.txt @@ -1 +1 @@ -5.1.0.32022492 \ No newline at end of file +5.1.1.32142945 \ No newline at end of file