예제 #1
0
파일: PhysXCloth.cpp 프로젝트: RoyXiang/FYP
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;
}
예제 #2
0
// -----------------------------------------------------------------------
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;
}