MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SetMesh

Method SetMesh

Source/Engine/Physics/Actors/Cloth.cpp:44–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void Cloth::SetMesh(const ModelInstanceActor::MeshReference& value)
45{
46 if (_mesh.LODIndex == value.LODIndex && _mesh.MeshIndex == value.MeshIndex)
47 return;
48
49 // Remove mesh deformer (mesh index/lod changes)
50 if (_meshDeformation)
51 {
52 Function<void(const MeshBase*, MeshDeformationData&)> deformer;
53 deformer.Bind<Cloth, &Cloth::RunClothDeformer>(this);
54 _meshDeformation->RemoveDeformer(_mesh.LODIndex, _mesh.MeshIndex, MeshBufferType::Vertex0, deformer);
55 _meshDeformation->RemoveDeformer(_mesh.LODIndex, _mesh.MeshIndex, MeshBufferType::Vertex1, deformer);
56 _meshDeformation = nullptr;
57 }
58
59 _mesh = value;
60 _mesh.Actor = nullptr; // Don't store this reference
61#if WITH_CLOTH
62 if (_cloth)
63 Rebuild();
64#endif
65}
66
67void Cloth::SetForce(const ForceSettings& value)
68{

Callers

nothing calls this directly

Calls 2

RebuildFunction · 0.85
RemoveDeformerMethod · 0.80

Tested by

no test coverage detected