bool PhysXCloth::cookMesh(NxClothMeshDesc &desc) { assert(desc.isValid()); MemoryWriteBuffer wb; if (!NxCookClothMesh(desc, wb)) return false; MemoryReadBuffer rb(wb.data); mClothMesh = mScene->getPhysicsSDK().createClothMesh(rb); return true; }
// ----------------------------------------------------------------------- bool MyCloth::cookMesh(NxClothMeshDesc& desc) { // Store correct number to detect tearing mesh in time mLastNumVertices = desc.numVertices; // we cook the mesh on the fly through a memory stream MemoryWriteBuffer wb; assert(desc.isValid()); bool success = CookClothMesh(desc, wb); if (!success) return false; MemoryReadBuffer rb(wb.data); mClothMesh = mScene->getPhysicsSDK().createClothMesh(rb); return true; }