aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/extensions/include/NvClothExt
diff options
context:
space:
mode:
authormtamis <[email protected]>2017-02-15 16:06:25 +0100
committermtamis <[email protected]>2017-02-15 16:06:25 +0100
commit85305930aeeb1d513e23522bd91f29ba81aa6d14 (patch)
tree45f1bb20a45a300d1fef107e436cac95602a0e57 /NvCloth/extensions/include/NvClothExt
downloadnvcloth-85305930aeeb1d513e23522bd91f29ba81aa6d14.tar.xz
nvcloth-85305930aeeb1d513e23522bd91f29ba81aa6d14.zip
NvCloth library v1.0.0
Diffstat (limited to 'NvCloth/extensions/include/NvClothExt')
-rw-r--r--NvCloth/extensions/include/NvClothExt/ClothFabricCooker.h224
-rw-r--r--NvCloth/extensions/include/NvClothExt/ClothMeshDesc.h211
-rw-r--r--NvCloth/extensions/include/NvClothExt/ClothMeshQuadifier.h78
-rw-r--r--NvCloth/extensions/include/NvClothExt/ClothTetherCooker.h94
4 files changed, 607 insertions, 0 deletions
diff --git a/NvCloth/extensions/include/NvClothExt/ClothFabricCooker.h b/NvCloth/extensions/include/NvClothExt/ClothFabricCooker.h
new file mode 100644
index 0000000..f2dada0
--- /dev/null
+++ b/NvCloth/extensions/include/NvClothExt/ClothFabricCooker.h
@@ -0,0 +1,224 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2017 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 NV_CLOTH_EXTENSIONS_CLOTH_FABRIC_COOKER_H
+#define NV_CLOTH_EXTENSIONS_CLOTH_FABRIC_COOKER_H
+
+/** \addtogroup extensions
+ @{
+*/
+
+#include "ClothMeshDesc.h"
+#include "NvCloth/Fabric.h"
+#include "NvCloth/Factory.h"
+
+namespace nv
+{
+namespace cloth
+{
+
+struct CookedData
+{
+ uint32_t mNumParticles;
+ Range<const uint32_t> mPhaseIndices;
+ Range<const int32_t> mPhaseTypes;
+ Range<const uint32_t> mSets;
+ Range<const float> mRestvalues;
+ Range<const float> mStiffnessValues;
+ Range<const uint32_t> mIndices;
+ Range<const uint32_t> mAnchors;
+ Range<const float> mTetherLengths;
+ Range<const uint32_t> mTriangles;
+};
+
+/**
+\brief Describe type of phase in cloth fabric.
+\see Fabric for an explanation of concepts on phase and set.
+*/
+struct ClothFabricPhaseType
+{
+ enum Enum
+ {
+ eINVALID, //!< invalid type
+ eVERTICAL, //!< resists stretching or compression, usually along the gravity
+ eHORIZONTAL, //!< resists stretching or compression, perpendicular to the gravity
+ eBENDING, //!< resists out-of-plane bending in angle-based formulation
+ eSHEARING, //!< resists in-plane shearing along (typically) diagonal edges,
+ eCOUNT // internal use only
+ };
+};
+
+/**
+\brief References a set of constraints that can be solved in parallel.
+\see Fabric for an explanation of the concepts on phase and set.
+*/
+struct ClothFabricPhase
+{
+ ClothFabricPhase(ClothFabricPhaseType::Enum type =
+ ClothFabricPhaseType::eINVALID, physx::PxU32 index = 0);
+
+ /**
+ \brief Type of constraints to solve.
+ */
+ ClothFabricPhaseType::Enum phaseType;
+
+ /**
+ \brief Index of the set that contains the particle indices.
+ */
+ physx::PxU32 setIndex;
+};
+
+PX_INLINE ClothFabricPhase::ClothFabricPhase(
+ ClothFabricPhaseType::Enum type, physx::PxU32 index)
+ : phaseType(type)
+ , setIndex(index)
+{}
+
+/**
+\brief References all the data required to create a fabric.
+\see ClothFabricCooker.getDescriptor()
+*/
+class ClothFabricDesc
+{
+public:
+ /** \brief The number of particles needed when creating a PxCloth instance from the fabric. */
+ physx::PxU32 nbParticles;
+
+ /** \brief The number of solver phases. */
+ physx::PxU32 nbPhases;
+ /** \brief Array defining which constraints to solve each phase. See #Fabric.getPhases(). */
+ const ClothFabricPhase* phases;
+
+ /** \brief The number of sets in the fabric. */
+ physx::PxU32 nbSets;
+ /** \brief Array with an index per set which points one entry beyond the last constraint of the set. See #Fabric.getSets(). */
+ const physx::PxU32* sets;
+
+ /** \brief Array of particle indices which specifies the pair of constrained vertices. See #Fabric.getParticleIndices(). */
+ const physx::PxU32* indices;
+ /** \brief Array of rest values for each constraint. See #Fabric.getRestvalues(). */
+ const physx::PxReal* restvalues;
+
+ /** \brief Size of tetherAnchors and tetherLengths arrays, needs to be multiple of nbParticles. */
+ physx::PxU32 nbTethers;
+ /** \brief Array of particle indices specifying the tether anchors. See #Fabric.getTetherAnchors(). */
+ const physx::PxU32* tetherAnchors;
+ /** \brief Array of rest distance between tethered particle pairs. See #Fabric.getTetherLengths(). */
+ const physx::PxReal* tetherLengths;
+
+ physx::PxU32 nbTriangles;
+ const physx::PxU32* triangles;
+
+ /**
+ \brief constructor sets to default.
+ */
+ PX_INLINE ClothFabricDesc();
+
+ /**
+ \brief (re)sets the structure to the default.
+ */
+ PX_INLINE void setToDefault();
+
+ /**
+ \brief Returns true if the descriptor is valid.
+ \return True if the current settings are valid
+ */
+ PX_INLINE bool isValid() const;
+};
+
+PX_INLINE ClothFabricDesc::ClothFabricDesc()
+{
+ setToDefault();
+}
+
+PX_INLINE void ClothFabricDesc::setToDefault()
+{
+ memset(this, 0, sizeof(ClothFabricDesc));
+}
+
+PX_INLINE bool ClothFabricDesc::isValid() const
+{
+ return nbParticles && nbPhases && phases && restvalues && nbSets
+ && sets && indices && (!nbTethers || (tetherAnchors && tetherLengths))
+ && (!nbTriangles || triangles);
+}
+
+///Use NvClothCreateFabricCooker() to create an implemented instance
+class NV_CLOTH_IMPORT ClothFabricCooker : public UserAllocated
+{
+public:
+ virtual ~ClothFabricCooker(){}
+
+ /**
+ \brief Cooks a triangle mesh to a ClothFabricDesc.
+ \param desc The cloth mesh descriptor on which the generation of the cooked mesh depends.
+ \param gravity A normalized vector which specifies the direction of gravity.
+ This information allows the cooker to generate a fabric with higher quality simulation behavior.
+ The gravity vector should point in the direction gravity will be pulling towards in the most common situation/at rest.
+ e.g. For flags it might be beneficial to set the gravity horizontal if they are cooked in landscape orientation, as a flag will hang in portrait orientation at rest.
+ \param useGeodesicTether A flag to indicate whether to compute geodesic distance for tether constraints.
+ \note The geodesic option for tether only works for manifold input. For non-manifold input, a simple Euclidean distance will be used.
+ For more detailed cooker status for such cases, try running ClothGeodesicTetherCooker directly.
+ */
+ virtual bool cook(const ClothMeshDesc& desc, physx::PxVec3 gravity, bool useGeodesicTether = true) = 0;
+
+ /** \brief Returns fabric cooked data for creating fabrics. */
+ virtual CookedData getCookedData() const = 0;
+
+ /** \brief Returns the fabric descriptor to create the fabric. */
+ virtual ClothFabricDesc getDescriptor() const = 0;
+ /** \brief Saves the fabric data to a platform and version dependent stream. */
+ virtual void save(physx::PxOutputStream& stream, bool platformMismatch) const = 0;
+};
+
+/** @} */
+
+} // namespace cloth
+} // namespace nv
+
+
+NV_CLOTH_API(nv::cloth::ClothFabricCooker*) NvClothCreateFabricCooker();
+
+/**
+\brief Cooks a triangle mesh to a Fabric.
+
+\param factory The factory for which the cloth is cooked.
+\param desc The cloth mesh descriptor on which the generation of the cooked mesh depends.
+\param gravity A normalized vector which specifies the direction of gravity.
+This information allows the cooker to generate a fabric with higher quality simulation behavior.
+\param phaseTypes Optional array where phase type information can be writen to.
+\param useGeodesicTether A flag to indicate whether to compute geodesic distance for tether constraints.
+\return The created cloth fabric, or NULL if creation failed.
+*/
+NV_CLOTH_API(nv::cloth::Fabric*) NvClothCookFabricFromMesh(nv::cloth::Factory* factory,
+ const nv::cloth::ClothMeshDesc& desc, const physx::PxVec3& gravity,
+ nv::cloth::Vector<int32_t>::Type* phaseTypes = nullptr, bool useGeodesicTether = true);
+
+#endif // NV_CLOTH_EXTENSIONS_CLOTH_FABRIC_COOKER_H
diff --git a/NvCloth/extensions/include/NvClothExt/ClothMeshDesc.h b/NvCloth/extensions/include/NvClothExt/ClothMeshDesc.h
new file mode 100644
index 0000000..c649a11
--- /dev/null
+++ b/NvCloth/extensions/include/NvClothExt/ClothMeshDesc.h
@@ -0,0 +1,211 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2017 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 NV_CLOTH_EXTENSIONS_CLOTHMESHDESC
+#define NV_CLOTH_EXTENSIONS_CLOTHMESHDESC
+/** \addtogroup extensions
+@{
+*/
+
+#include "foundation/PxVec3.h"
+
+namespace nv
+{
+namespace cloth
+{
+
+struct StridedData
+{
+ /**
+ \brief The offset in bytes between consecutive samples in the data.
+
+ <b>Default:</b> 0
+ */
+ physx::PxU32 stride;
+ const void* data;
+
+ StridedData() : stride( 0 ), data( NULL ) {}
+
+ template<typename TDataType>
+ PX_INLINE const TDataType& at( physx::PxU32 idx ) const
+ {
+ physx::PxU32 theStride( stride );
+ if ( theStride == 0 )
+ theStride = sizeof( TDataType );
+ physx::PxU32 offset( theStride * idx );
+ return *(reinterpret_cast<const TDataType*>( reinterpret_cast< const physx::PxU8* >( data ) + offset ));
+ }
+};
+
+struct BoundedData : public StridedData
+{
+ physx::PxU32 count;
+ BoundedData() : count( 0 ) {}
+};
+
+/**
+\brief Enum with flag values to be used in ClothMeshDesc.
+*/
+struct MeshFlag
+{
+ enum Enum
+ {
+ e16_BIT_INDICES = (1<<1) //!< Denotes the use of 16-bit vertex indices
+ };
+};
+
+/**
+\brief Descriptor class for a cloth mesh.
+*/
+class ClothMeshDesc
+{
+public:
+
+ /**
+ \brief Pointer to first vertex point.
+ */
+ BoundedData points;
+
+ /**
+ \brief Pointer to first stiffness value in stiffnes per vertex array. empty if unused.
+ */
+ BoundedData pointsStiffness;
+
+ /**
+ \brief Determines whether particle is simulated or static.
+ A positive value denotes that the particle is being simulated, zero denotes a static particle.
+ This data is used to generate tether and zero stretch constraints.
+ If invMasses.data is null, all particles are assumed to be simulated
+ and no tether and zero stretch constraints are being generated.
+ */
+ BoundedData invMasses;
+
+ /**
+ \brief Pointer to the first triangle.
+
+ These are triplets of 0 based indices:
+ vert0 vert1 vert2
+ vert0 vert1 vert2
+ vert0 vert1 vert2
+ ...
+
+ where vert* is either a 32 or 16 bit unsigned integer. There are a total of 3*count indices.
+ The stride determines the byte offset to the next index triple.
+
+ This is declared as a void pointer because it is actually either an physx::PxU16 or a physx::PxU32 pointer.
+ */
+ BoundedData triangles;
+
+ /**
+ \brief Pointer to the first quad.
+
+ These are quadruples of 0 based indices:
+ vert0 vert1 vert2 vert3
+ vert0 vert1 vert2 vert3
+ vert0 vert1 vert2 vert3
+ ...
+
+ where vert* is either a 32 or 16 bit unsigned integer. There are a total of 4*count indices.
+ The stride determines the byte offset to the next index quadruple.
+
+ This is declared as a void pointer because it is actually either an physx::PxU16 or a physx::PxU32 pointer.
+ */
+ BoundedData quads;
+
+ /**
+ \brief Flags bits, combined from values of the enum ::MeshFlag
+ */
+ unsigned int flags;
+
+ /**
+ \brief constructor sets to default.
+ */
+ PX_INLINE ClothMeshDesc();
+ /**
+ \brief (re)sets the structure to the default.
+ */
+ PX_INLINE void setToDefault();
+ /**
+ \brief Returns true if the descriptor is valid.
+ \return True if the current settings are valid
+ */
+ PX_INLINE bool isValid() const;
+};
+
+PX_INLINE ClothMeshDesc::ClothMeshDesc() //constructor sets to default
+{
+ flags = 0;
+}
+
+PX_INLINE void ClothMeshDesc::setToDefault()
+{
+ *this = ClothMeshDesc();
+}
+
+PX_INLINE bool ClothMeshDesc::isValid() const
+{
+ if(points.count < 3) //at least 1 trig's worth of points
+ return false;
+ if((pointsStiffness.count != points.count) && pointsStiffness.count != 0)
+ return false; //Either all or none of the points can have stiffness information
+ if(points.count > 0xffff && flags & MeshFlag::e16_BIT_INDICES)
+ return false;
+ if(!points.data)
+ return false;
+ if(points.stride < sizeof(physx::PxVec3)) //should be at least one point's worth of data
+ return false;
+
+ if(invMasses.data && invMasses.stride < sizeof(float))
+ return false;
+ if(invMasses.data && invMasses.count != points.count)
+ return false;
+
+ if (!triangles.count && !quads.count) // no support for non-indexed mesh
+ return false;
+ if (triangles.count && !triangles.data)
+ return false;
+ if (quads.count && !quads.data)
+ return false;
+
+ physx::PxU32 indexSize = (flags & MeshFlag::e16_BIT_INDICES) ? sizeof(physx::PxU16) : sizeof(physx::PxU32);
+ if(triangles.count && triangles.stride < indexSize*3)
+ return false;
+ if(quads.count && quads.stride < indexSize*4)
+ return false;
+
+ return true;
+}
+
+} // namespace cloth
+} // namespace nv
+
+
+/** @} */
+#endif
diff --git a/NvCloth/extensions/include/NvClothExt/ClothMeshQuadifier.h b/NvCloth/extensions/include/NvClothExt/ClothMeshQuadifier.h
new file mode 100644
index 0000000..735e758
--- /dev/null
+++ b/NvCloth/extensions/include/NvClothExt/ClothMeshQuadifier.h
@@ -0,0 +1,78 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2017 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 NV_CLOTH_EXTENSIONS_CLOTH_EDGE_QUADIFIER_H
+#define NV_CLOTH_EXTENSIONS_CLOTH_EDGE_QUADIFIER_H
+
+/** \addtogroup extensions
+@{
+*/
+
+#include "ClothMeshDesc.h"
+#include "NvCloth/Callbacks.h"
+#include "NvCloth/Allocator.h"
+
+namespace nv
+{
+namespace cloth
+{
+
+class ClothMeshQuadifier : public UserAllocated
+{
+public:
+ virtual ~ClothMeshQuadifier(){}
+
+ /**
+ \brief Convert triangles of ClothMeshDesc to quads.
+ \details In NvCloth, quad dominant mesh representations are preferable to pre-triangulated versions.
+ In cases where the mesh has been already triangulated, this class provides a meachanism to
+ convert (quadify) some triangles back to quad representations.
+ \see ClothFabricCooker
+ \param desc The cloth mesh descriptor prepared for cooking
+ */
+ virtual bool quadify(const ClothMeshDesc& desc) = 0;
+
+ /**
+ \brief Returns a mesh descriptor with some triangle pairs converted to quads.
+ \note The returned descriptor is valid only within the lifespan of ClothMeshQuadifier class.
+ */
+
+ virtual ClothMeshDesc getDescriptor() const = 0;
+
+};
+
+} // namespace cloth
+} // namespace nv
+
+NV_CLOTH_API(nv::cloth::ClothMeshQuadifier*) NvClothCreateMeshQuadifier();
+
+/** @} */
+
+#endif // NV_CLOTH_EXTENSIONS_CLOTH_EDGE_QUADIFIER_H
diff --git a/NvCloth/extensions/include/NvClothExt/ClothTetherCooker.h b/NvCloth/extensions/include/NvClothExt/ClothTetherCooker.h
new file mode 100644
index 0000000..b8c9e3c
--- /dev/null
+++ b/NvCloth/extensions/include/NvClothExt/ClothTetherCooker.h
@@ -0,0 +1,94 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2017 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 NV_CLOTH_EXTENSIONS_CLOTH_TETHER_COOKER_H
+#define NV_CLOTH_EXTENSIONS_CLOTH_TETHER_COOKER_H
+
+/** \addtogroup extensions
+@{
+*/
+
+#include "ClothMeshDesc.h"
+#include "NvCloth/Allocator.h"
+
+namespace nv
+{
+namespace cloth
+{
+
+class ClothTetherCooker : public UserAllocated
+{
+public:
+ virtual ~ClothTetherCooker(){}
+
+ /**
+ \brief Compute tether data from ClothMeshDesc with simple distance measure.
+ \details The tether constraint in NvCloth requires rest distance and anchor index to be precomputed during cooking time.
+ This cooker computes a simple Euclidean distance to closest anchor point.
+ The Euclidean distance measure works reasonably for flat cloth and flags and computation time is very fast.
+ With this cooker, there is only one tether anchor point per particle.
+ \see ClothTetherGeodesicCooker for more accurate distance estimation.
+ \param desc The cloth mesh descriptor prepared for cooking
+ */
+ virtual bool cook(const ClothMeshDesc &desc) = 0;
+
+ /**
+ \brief Returns cooker status
+ \details This function returns cooker status after cooker computation is done.
+ A non-zero return value indicates a failure.
+ */
+ virtual uint32_t getCookerStatus() const = 0; //From APEX
+
+ /**
+ \brief Returns number of tether anchors per particle
+ \note Returned number indicates the maximum anchors.
+ If some particles are assigned fewer anchors, the anchor indices will be physx::PxU32(-1)
+ \note If there is no attached point in the input mesh descriptor, this will return 0 and no tether data will be generated.
+ */
+ virtual physx::PxU32 getNbTethersPerParticle() const = 0;
+
+ /**
+ \brief Returns computed tether data.
+ \details This function returns anchor indices for each particle as well as desired distance between the tether anchor and the particle.
+ The user buffers should be at least as large as number of particles.
+ */
+ virtual void getTetherData(physx::PxU32* userTetherAnchors, physx::PxReal* userTetherLengths) const = 0;
+
+};
+
+} // namespace cloth
+} // namespace nv
+
+NV_CLOTH_API(nv::cloth::ClothTetherCooker*) NvClothCreateSimpleTetherCooker();
+NV_CLOTH_API(nv::cloth::ClothTetherCooker*) NvClothCreateGeodesicTetherCooker();
+
+/** @} */
+
+#endif // NV_CLOTH_EXTENSIONS_CLOTH_TETHER_COOKER_H