![]() | |
MeshSet |
public void SetCustomIndexBuffer( GpuBuffer? indexBuffer, int indexOffset = 0, int customIndexCount = -1, IndexType indexBufferType = IndexType.Uint32 )
SetCustomIndexBuffer sets a custom GpuBuffer to be used as a IndexBuffer.
This enabled reusing the GpuBuffer on different Scene objects that use the same GpuDevice.
When the specified indexBuffer is null, then this removes the custom index buffer so user can regenerate the index buffer from vertices or other mesh data.
Note that the custom indexBuffer 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 TriangleIndices array in order for the hit testing code to work correctly. Otherwise, the old triangle indices will be used for hit testing. To change