Tipsify

Tipsify

Encapsulates an algorithm to optimize triangles for the post vertex-shader cache. This is based on the 2007 SIGGRAPH paper 'Fast Triangle Reordering for Vertex Locality and Reduced Overdraw.' The runtime is linear but several passes are made.

See:
Source:

Methods

<static>

Calculates the average cache miss ratio (ACMR) for a given set of indices.

Parameters:
Name Type Argument Default Description
description.indices Array Lists triads of numbers corresponding to the indices of the vertices in the vertex buffer that define the mesh's triangles.
description.maximumIndex Number <optional>
The maximum value of the elements in args.indices. If not supplied, this value will be computed.
description.cacheSize Number <optional>
24 The number of vertices that can be stored in the cache at any one time.
Throws:
Returns:
Number The average cache miss ratio (ACMR).
Example
var indices = [0, 1, 2, 3, 4, 5];
var maxIndex = 5;
var cacheSize = 3;
var acmr = Tipsify.calculateACMR({indices : indices, maxIndex : maxIndex, cacheSize : cacheSize});

<static>

Optimizes triangles for the post-vertex shader cache.

Parameters:
Name Type Argument Default Description
description.indices Array Lists triads of numbers corresponding to the indices of the vertices in the vertex buffer that define the mesh's triangles.
description.maximumIndex Number <optional>
The maximum value of the elements in args.indices. If not supplied, this value will be computed.
description.cacheSize Number <optional>
24 The number of vertices that can be stored in the cache at any one time.
Throws:
Returns:
Array A list of the input indices in an optimized order.
Example
var indices = [0, 1, 2, 3, 4, 5];
var maxIndex = 5;
var cacheSize = 3;
var reorderedIndices = Tipsify.tipsify({indices : indices, maxIndex : maxIndex, cacheSize : cacheSize});