1/*
2 * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12
13
14#ifndef PX_PHYSICS_EXTENSIONS_CLOTH_FABRIC_COOKER_H
15#define PX_PHYSICS_EXTENSIONS_CLOTH_FABRIC_COOKER_H
16
17/** \addtogroup extensions
18 @{
19*/
20
21#include "common/PxPhysXCommonConfig.h"
22#include "PxClothMeshDesc.h"
23#include "cloth/PxClothFabric.h"
24
25#ifndef PX_DOXYGEN
26namespace physx
27{
28#endif
29
30class PxPhysics;
31
32struct PxFabricCookerImpl;
33
34class PxClothFabricCooker
35{
36public:
37 /**
38 \brief Cooks a triangle mesh to a PxClothFabricDesc.
39 \param desc The cloth mesh descriptor on which the generation of the cooked mesh depends.
40 \param gravity A normalized vector which specifies the direction of gravity.
41 This information allows the cooker to generate a fabric with higher quality simulation behavior.
42 \param useGeodesicTether A flag to indicate whether to compute geodesic distance for tether constraints.
43 \note The geodesic option for tether only works for manifold input. For non-manifold input, a simple Euclidean distance will be used.
44 For more detailed cooker status for such cases, try running PxClothGeodesicTetherCooker directly.
45 */
46 PxClothFabricCooker(const PxClothMeshDesc& desc, const PxVec3& gravity, bool useGeodesicTether = true);
47 ~PxClothFabricCooker();
48
49 /** \brief Returns the fabric descriptor to create the fabric. */
50 PxClothFabricDesc getDescriptor() const;
51 /** \brief Saves the fabric data to a platform and version dependent stream. */
52 void save(PxOutputStream& stream, bool platformMismatch) const;
53
54private:
55 PxFabricCookerImpl* mImpl;
56};
57
58/**
59\brief Cooks a triangle mesh to a PxClothFabric.
60
61\param physics The physics instance.
62\param desc The cloth mesh descriptor on which the generation of the cooked mesh depends.
63\param gravity A normalized vector which specifies the direction of gravity.
64This information allows the cooker to generate a fabric with higher quality simulation behavior.
65\param useGeodesicTether A flag to indicate whether to compute geodesic distance for tether constraints.
66\return The created cloth fabric, or NULL if creation failed.
67*/
68PxClothFabric* PxClothFabricCreate(PxPhysics& physics,
69 const PxClothMeshDesc& desc, const PxVec3& gravity, bool useGeodesicTether = true);
70
71#ifndef PX_DOXYGEN
72} // namespace physx
73#endif
74
75/** @} */
76#endif // PX_PHYSICS_EXTENSIONS_CLOTH_FABRIC_COOKER_H
77