From ca32c59a58d37c1822e185a2d5f3d0d3e8943593 Mon Sep 17 00:00:00 2001 From: Marijn Tamis Date: Thu, 3 May 2018 18:22:48 +0200 Subject: NvCloth 1.1.4 Release. (24070740) --- .../SampleBase/scene/scenes/SelfCollisionScene.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'NvCloth/samples/SampleBase/scene/scenes/SelfCollisionScene.cpp') diff --git a/NvCloth/samples/SampleBase/scene/scenes/SelfCollisionScene.cpp b/NvCloth/samples/SampleBase/scene/scenes/SelfCollisionScene.cpp index 89fed39..f2c368e 100644 --- a/NvCloth/samples/SampleBase/scene/scenes/SelfCollisionScene.cpp +++ b/NvCloth/samples/SampleBase/scene/scenes/SelfCollisionScene.cpp @@ -61,7 +61,7 @@ void SelfCollisionScene::initializeCloth(int index, physx::PxMat44 transform) particlesCopy.resize(clothMesh.mVertices.size()); physx::PxVec3 clothOffset = transform.getPosition(); - for(int i = 0; i < (int)clothMesh.mVertices.size(); i++) + for (int i = 0; i < (int)clothMesh.mVertices.size(); i++) { // To put attachment point closer to each other if(clothMesh.mInvMasses[i] < 1e-6) @@ -79,9 +79,10 @@ void SelfCollisionScene::initializeCloth(int index, physx::PxMat44 transform) nv::cloth::Range planesR(&planes[0], &planes[0] + planes.size()); mClothActor[index]->mCloth->setPlanes(planesR, 0, mClothActor[index]->mCloth->getNumPlanes()); + std::vector indices; indices.resize(planes.size()); - for(int i = 0; i < (int)indices.size(); i++) + for (int i = 0; i < (int)indices.size(); i++) indices[i] = 1 << i; nv::cloth::Range cind(&indices[0], &indices[0] + indices.size()); mClothActor[index]->mCloth->setConvexes(cind, 0, mClothActor[index]->mCloth->getNumConvexes()); @@ -97,20 +98,21 @@ void SelfCollisionScene::initializeCloth(int index, physx::PxMat44 transform) std::vector selfCollisionIndices; //only enable every other particle for self collision - for(int y = 0; y < 5*h + 1; y++) - for(int x = 0; x < 5 * w + 1; x++) - if((x & 1) ^ (y & 1)) selfCollisionIndices.push_back(x + y*(5 * w + 1)); + for (int y = 0; y < 5*h + 1; y++) + for (int x = 0; x < 5 * w + 1; x++) + if ((x & 1) ^ (y & 1)) selfCollisionIndices.push_back(x + y*(5 * w + 1)); - for(int y = 0; y < 5 * h2 + 1; y++) - for(int x = 0; x < 5 * w2 + 1; x++) - if((x & 1) ^ (y & 1)) selfCollisionIndices.push_back(FirstParticleIndexCloth2 + x + y*(5 * w2 + 1)); + for (int y = 0; y < 5 * h2 + 1; y++) + for (int x = 0; x < 5 * w2 + 1; x++) + if ((x & 1) ^ (y & 1)) + selfCollisionIndices.push_back(FirstParticleIndexCloth2 + x + y*(5 * w2 + 1)); nv::cloth::Range selfCollisionIndicesRange (&selfCollisionIndices[0], &selfCollisionIndices[0] + selfCollisionIndices.size()); mClothActor[index]->mCloth->setSelfCollisionIndices(selfCollisionIndicesRange); // Setup phase configs std::vector phases(mFabric[index]->getNumPhases()); - for(int i = 0; i < (int)phases.size(); i++) + for (int i = 0; i < (int)phases.size(); i++) { phases[i].mPhaseIndex = i; phases[i].mStiffness = 1.0f; @@ -137,6 +139,7 @@ void SelfCollisionScene::onInitialize() return true; } );*/ + trackSolver(mSolver); physx::PxMat44 posTrans(physx::PxIdentity); -- cgit v1.2.3