diff options
| author | Marijn Tamis <[email protected]> | 2017-10-20 14:30:56 +0200 |
|---|---|---|
| committer | Marijn Tamis <[email protected]> | 2017-10-20 14:36:12 +0200 |
| commit | fabb251458f4a2d6d4f87dd36038fac2774b378c (patch) | |
| tree | 68a4a0ecd940dc949e0477d521d8c159968cfcd5 /NvCloth/samples/SampleBase/scene/Scene.cpp | |
| parent | NvCloth 1.1.2 Release. (22576033) (diff) | |
| download | nvcloth-1.1.3.tar.xz nvcloth-1.1.3.zip | |
NvCloth 1.1.3 Release. (23014067)v1.1.3
Diffstat (limited to 'NvCloth/samples/SampleBase/scene/Scene.cpp')
| -rw-r--r-- | NvCloth/samples/SampleBase/scene/Scene.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/NvCloth/samples/SampleBase/scene/Scene.cpp b/NvCloth/samples/SampleBase/scene/Scene.cpp index 6296a05..00e23ae 100644 --- a/NvCloth/samples/SampleBase/scene/Scene.cpp +++ b/NvCloth/samples/SampleBase/scene/Scene.cpp @@ -451,6 +451,24 @@ void Scene::addClothToSolver(ClothActor* clothActor, nv::cloth::Solver* solver) mClothSolverMap[clothActor] = solver; } +void Scene::addClothsToSolver(nv::cloth::Range<ClothActor*> clothActors, nv::cloth::Solver* solver) +{ + // A temporary vector of Cloth*, to construct a Range from and pass to solver + std::vector<nv::cloth::Cloth*> cloths; + + for (uint32_t i = 0; i < clothActors.size(); ++i) + { + auto* clothActor = clothActors[i]; + assert(mClothSolverMap.find(clothActor) == mClothSolverMap.end()); + mClothSolverMap[clothActor] = solver; + + cloths.push_back(clothActor->mCloth); + } + + auto clothsRange = nv::cloth::Range<nv::cloth::Cloth*>(&cloths.front(), &cloths.back() + 1); + solver->addCloths(clothsRange); +} + void Scene::trackRenderable(Renderable* renderable) { trackT(mRenderableList, renderable); |