diff options
| author | Marijn Tamis <[email protected]> | 2018-05-03 18:22:48 +0200 |
|---|---|---|
| committer | Marijn Tamis <[email protected]> | 2018-05-03 18:22:48 +0200 |
| commit | ca32c59a58d37c1822e185a2d5f3d0d3e8943593 (patch) | |
| tree | b06b9eec03f34344ef8fc31aa147b2714d3962ee /NvCloth/samples/SampleBase/utils/ClothMeshGenerator.h | |
| parent | Forced rename of platform folders in cmake dir. Git didn't pick this up before. (diff) | |
| download | nvcloth-ca32c59a58d37c1822e185a2d5f3d0d3e8943593.tar.xz nvcloth-ca32c59a58d37c1822e185a2d5f3d0d3e8943593.zip | |
NvCloth 1.1.4 Release. (24070740)
Diffstat (limited to 'NvCloth/samples/SampleBase/utils/ClothMeshGenerator.h')
| -rw-r--r-- | NvCloth/samples/SampleBase/utils/ClothMeshGenerator.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/NvCloth/samples/SampleBase/utils/ClothMeshGenerator.h b/NvCloth/samples/SampleBase/utils/ClothMeshGenerator.h index 1db4115..a765fee 100644 --- a/NvCloth/samples/SampleBase/utils/ClothMeshGenerator.h +++ b/NvCloth/samples/SampleBase/utils/ClothMeshGenerator.h @@ -18,6 +18,17 @@ struct ClothMeshData { + template <typename T> + static nv::cloth::BoundedData ToBoundedData(T& vector) + { + nv::cloth::BoundedData d; + d.data = &vector[0]; + d.stride = sizeof(vector[0]); + d.count = (physx::PxU32)vector.size(); + + return d; + } + struct Triangle { Triangle(){} @@ -46,10 +57,18 @@ struct ClothMeshData void Clear(); void GeneratePlaneCloth(float width, float height, int segmentsX, int segmentsY, bool createQuads = false, physx::PxMat44 transform = physx::PxIdentity, bool alternatingDiagonals = true, int zigzag = 0); - + void GenerateCylinderWave(float radiusTop, float radiusBottom, float height, float frequency, float ampitudeTop, float ampitudeBottom, int segmentsX, int segmentsY, physx::PxMat44 transform = physx::PxIdentity, bool attachTop = false, bool attachBottom = false, bool createQuads = false, int missingXsegments = 0); void AttachClothPlaneByAngles(int segmentsX, int segmentsY, bool attachByWidth = true); void AttachClothPlaneBySide(int segmentsX, int segmentsY, bool attachByWidth = true); + bool ReadClothFromFile(const std::string& verticesPath, const std::string& indicesPath, physx::PxMat44 transform = physx::PxIdentity); + + //positions as float (3 elements per position) + template<typename PositionType = float, typename IndexType = uint16_t> + bool InitializeFromData(nv::cloth::BoundedData positions, nv::cloth::BoundedData indices, physx::PxMat44 transform = physx::PxMat44(physx::PxIdentity)); + + void AttachClothUsingTopVertices(float thresholdY = 0.5f); + void SetInvMasses(float invMass); void SetInvMassesFromDensity(float density); // Todo |