com.jme.util.geom.nvtristrip
Class TriStrip

java.lang.Object
  extended by com.jme.util.geom.nvtristrip.TriStrip

public class TriStrip
extends java.lang.Object

To use, call generateStrips method, passing your triangle index list and then construct geometry/render resulting PrimitiveGroup objects. Features:

On cache sizes: Note that it's better to UNDERESTIMATE the cache size instead of OVERESTIMATING. So, if you're targetting GeForce1, 2, and 3, be conservative and use the GeForce1_2 cache size, NOT the GeForce3 cache size. This will make sure you don't "blow" the cache of the GeForce1 and 2. Also note that the cache size you specify is the "actual" cache size, not the "effective" cache size you may have heard about. This is 16 for GeForce1 and 2, and 24 for GeForce3. Credit goes to Curtis Beeson and Joe Demers for the basis for this stripifier and to Jason Regier and Jon Stone at Blizzard for providing a much cleaner version of CreateStrips(). Ported to java by Artur Biesiadowski


Field Summary
(package private)  boolean bListsOnly
           
(package private)  boolean bStitchStrips
           
(package private)  int cacheSize
           
static int CACHESIZE_GEFORCE1_2
           
static int CACHESIZE_GEFORCE3
           
(package private)  int minStripSize
           
 
Constructor Summary
TriStrip()
           
 
Method Summary
 PrimitiveGroup[] generateStrips(int[] in_indices)
           
static void remapArrays(float[] vertexBuffer, int vertexSize, int[] indices)
           
static int[] remapIndices(int[] indices, int numVerts)
          Function to remap your indices to improve spatial locality in your vertex buffer.
 void setCacheSize(int _cacheSize)
          Sets the cache size which the stripfier uses to optimize the data.
 void setListsOnly(boolean _bListsOnly)
          If set to true, will return an optimized list, with no strips at all.
 void setMinStripSize(int _minStripSize)
          Sets the minimum acceptable size for a strip, in triangles.
 void setStitchStrips(boolean _bStitchStrips)
          bool to indicate whether to stitch together strips into one huge strip or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHESIZE_GEFORCE1_2

public static final int CACHESIZE_GEFORCE1_2
See Also:
Constant Field Values

CACHESIZE_GEFORCE3

public static final int CACHESIZE_GEFORCE3
See Also:
Constant Field Values

cacheSize

int cacheSize

bStitchStrips

boolean bStitchStrips

minStripSize

int minStripSize

bListsOnly

boolean bListsOnly
Constructor Detail

TriStrip

public TriStrip()
Method Detail

setListsOnly

public void setListsOnly(boolean _bListsOnly)
If set to true, will return an optimized list, with no strips at all. Default value: false


setCacheSize

public void setCacheSize(int _cacheSize)
Sets the cache size which the stripfier uses to optimize the data. Controls the length of the generated individual strips. This is the "actual" cache size, so 24 for GeForce3 and 16 for GeForce1/2 You may want to play around with this number to tweak performance. Default value: 16


setStitchStrips

public void setStitchStrips(boolean _bStitchStrips)
bool to indicate whether to stitch together strips into one huge strip or not. If set to true, you'll get back one huge strip stitched together using degenerate triangles. If set to false, you'll get back a large number of separate strips. Default value: true


setMinStripSize

public void setMinStripSize(int _minStripSize)
Sets the minimum acceptable size for a strip, in triangles. All strips generated which are shorter than this will be thrown into one big, separate list. Default value: 0


generateStrips

public PrimitiveGroup[] generateStrips(int[] in_indices)
Parameters:
in_indices - input index list, the indices you would use to render
Returns:
array of optimized/stripified PrimitiveGroups

remapIndices

public static int[] remapIndices(int[] indices,
                                 int numVerts)
Function to remap your indices to improve spatial locality in your vertex buffer. in_primGroups: array of PrimitiveGroups you want remapped numGroups: number of entries in in_primGroups numVerts: number of vertices in your vertex buffer, also can be thought of as the range of acceptable values for indices in your primitive groups. remappedGroups: array of remapped PrimitiveGroups Note that, according to the remapping handed back to you, you must reorder your vertex buffer.


remapArrays

public static void remapArrays(float[] vertexBuffer,
                               int vertexSize,
                               int[] indices)