Click or drag to resize
Ab4d.SharpEngine logo

MeshSetCustomIndexBuffer(GpuBuffer, Int32, Int32, IndexType) Method

SetCustomIndexBuffer sets a custom GpuBuffer to be used as a IndexBuffer. See remarks for more info.

Namespace: Ab4d.SharpEngine.Meshes
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 3.0.9196+3eba290aba85a9aa739abf2459bc51e303a050d7
Syntax
C#
public void SetCustomIndexBuffer(
	GpuBuffer? indexBuffer,
	int indexOffset = 0,
	int customIndexCount = -1,
	IndexType indexBufferType = IndexType.Uint32
)

Parameters

indexBuffer  GpuBuffer
indexBuffer as GpuBuffer or null to disable using custom index buffer
indexOffset  Int32  (Optional)
custom index offset (0 by default) that specifies an offset in the index buffer where data for this mesh begins
customIndexCount  Int32  (Optional)
when positive number, then it specifies the custom number of used triangle indices; when negative, then number of items in the indexBuffer is used (-1 by default).
indexBufferType  IndexType  (Optional)
Type of index buffer (Uint32 by default)
Remarks

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

See Also