Table Of Contents

Previous topic

21.23. The GeometryInstance Object

Next topic

21.25. The JSProfiling Object

This Page

21.24. The IndexBufferManager Object

Provides allocation and freeing of ranges within IndexBuffers.

The IndexBufferManager will create and free any IndexBuffers it requires.

Required scripts

The IndexBufferManager object requires:

/*{{ javascript("jslib/indexbuffermanager.js") }}*/

21.24.1. Constructor

21.24.1.1. create

Summary

Syntax

var indexBufferManager = IndexBufferManager.create(graphicsDevice, dynamic);
graphicsDevice
The GraphicsDevice object to allocate from.
dynamic
If true the IndexBuffers should be created with the dynamic flag set to true. By default the IndexBuffers are static.

21.24.2. Method

21.24.2.1. allocate

Summary

Allocate a number of indices of a given format.

The returned object should be retained to pass to free().

Syntax

var format = graphicsDevice.INDEXFORMAT_USHORT;

var allocation = indexBufferManager.allocate(numIndices, format);

var indexBuffer = allocation.indexBuffer;
var baseIndex = allocation.baseIndex;
numIndices
The number of indices to allocate.
format
An index format.

The returned object has two public values:

indexBuffer
The IndexBuffer the indices are allocated from.
baseIndex
The first index in the buffer to use.

21.24.2.2. free

Summary

Called to free an allocation from the IndexBufferManager.

Syntax

indexBufferManager.free(allocation);
allocation
The object returned from allocate().

21.24.2.3. destroy

Summary

Called when the object is no longer required.

Syntax

indexBufferManager.destroy();

21.24.3. Properties

21.24.3.1. version

Summary

The version number of the IndexBufferManager implementation.

Syntax

var versionNumber = indexBufferManager.version;