![]() | |
MeshSet |
public void SetCustomVertexBuffer( GpuBuffer? vertexBuffer, BoundingBox boundingBox, VertexBufferDescription? customVertexBufferDescription = null )
SetCustomVertexBuffer sets a custom GpuBuffer to be used as a VertexBuffer.
This enabled reusing the GpuBuffer on different Scene objects that use the same GpuDevice.
When the specified vertexBuffer is null, then this removes the custom vertex buffer so user can regenerate the vertex buffer from vertices or other mesh data.
Note that the custom vertexBuffer will not be disposed when the meshes in the current Scene are disposed. You need to dispose it manually.
If this mesh is used in a MeshModelNode, then the NotifyChange(SceneNodeDirtyFlags) method must be called and MeshChanged must be passed as a parameter to inform the MeshModelNode about the change.
Note that after calling this method, you also need to update the values in the Vertices array in order for the hit testing code to work correctly. Otherwise, the old vertices will be used for hit testing. To change the Vertices array, call the SetCustomVertexBuffer method on TriangleMesh and pass the new vertices array.