Ejemplo n.º 1
0
	FPhysXMesh::FPhysXMesh(const SPtr<MeshData>& meshData, PhysicsMeshType type)
		:FPhysicsMesh(meshData, type)
	{
		// Perform cooking if needed
		if (meshData != nullptr)
			cookMesh(meshData, mType, &mCookedData, mCookedDataSize);

		initialize();
	}
Ejemplo n.º 2
0
// -----------------------------------------------------------------------
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;
}
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
// -----------------------------------------------------------------------
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;
}