FPhysXMesh::FPhysXMesh(const SPtr<MeshData>& meshData, PhysicsMeshType type) :FPhysicsMesh(meshData, type) { // Perform cooking if needed if (meshData != nullptr) cookMesh(meshData, mType, &mCookedData, mCookedDataSize); initialize(); }
// ----------------------------------------------------------------------- void MyCloth::init(NxScene *scene, NxClothDesc &desc, NxClothMeshDesc &meshDesc) { mScene = scene; desc.flags |= NX_CLF_VISUALIZATION; //enable debug rendering cookMesh(meshDesc); releaseMeshDescBuffers(meshDesc); allocateReceiveBuffers(meshDesc.numVertices, meshDesc.numTriangles); desc.clothMesh = mClothMesh; desc.meshData = mReceiveBuffers; mCloth = scene->createCloth(desc); mInitDone = true; }
void PhysXCloth::init(NxClothDesc &desc, NxClothMeshDesc &meshDesc) { allocateReceiveBuffers(meshDesc.numVertices, meshDesc.numTriangles); cookMesh(meshDesc); releaseMeshDescBuffers(meshDesc); desc.clothMesh = mClothMesh; desc.meshData = mReceiveBuffers; assert(desc.isValid()); mCloth = mScene->createCloth(desc); mCloth->wakeUp(); mInitDone = true; }
// ----------------------------------------------------------------------- void Cloth::init(NxScene *scene, NxClothDesc &desc, NxClothMeshDesc &meshDesc) { mScene = scene; // if we want tearing we must tell the cooker // this way it will generate some space for particles that will be generated during tearing if (desc.flags & NX_CLF_TEARABLE) meshDesc.flags |= NX_CLOTH_MESH_TEARABLE; // Enable Debug rendering for this cloth desc.flags |= NX_CLF_VISUALIZATION; cookMesh(meshDesc); releaseMeshDescBuffers(meshDesc); allocateReceiveBuffers(meshDesc.numVertices, meshDesc.numTriangles); desc.clothMesh = mClothMesh; desc.meshData = mReceiveBuffers; mCloth = scene->createCloth(desc); mInitDone = true; }