Class NvTriangleStripper
java.lang.Object
com.ardor3d.extension.model.util.nvtristrip.NvTriangleStripper
- All Implemented Interfaces:
Visitor
Ported from NVIDIA's NvTriStrip Library
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
GeForce1 and 2 cache sizestatic final int
GeForce3 cache size -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
For GPUs that support primitive restart, this disables using primitive restartvoid
enableRestart
(int restartVal) For GPUs that support primitive restart, this sets a value as the restart index Restart is meaningless if strips are not being stitched together, so enabling restart makes NvTriStrip forcing stitching.generateStrips
(int[] in_indices, boolean validate) int
int
boolean
boolean
boolean
boolean
remapIndices
(PrimitiveGroup[] in_primGroups, AtomicReference<int[]> remappedVertices, 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 stripifier 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 minSize) Sets the minimum acceptable size for a strip, in triangles.void
setReorderVertices
(boolean reorder) If set to true, will call remapIndices after generateStrips.void
setStitchStrips
(boolean bStitchStrips) boolean to indicate whether to stitch together strips into one huge strip or not.void
Execute our logic on the given Spatial
-
Field Details
-
CACHESIZE_GEFORCE1_2
public static final int CACHESIZE_GEFORCE1_2GeForce1 and 2 cache size- See Also:
-
CACHESIZE_GEFORCE3
public static final int CACHESIZE_GEFORCE3GeForce3 cache size- See Also:
-
-
Constructor Details
-
NvTriangleStripper
public NvTriangleStripper()
-
-
Method Details
-
enableRestart
public void enableRestart(int restartVal) For GPUs that support primitive restart, this sets a value as the restart index Restart is meaningless if strips are not being stitched together, so enabling restart makes NvTriStrip forcing stitching. So, you'll get back one strip.- Parameters:
restartVal
- restart value
-
disableRestart
public void disableRestart()For GPUs that support primitive restart, this disables using primitive restart -
isRestart
public boolean isRestart() -
setCacheSize
public void setCacheSize(int cacheSize) Sets the cache size which the stripifier 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.- Parameters:
cacheSize
- (Default value: 24)
-
getCacheSize
public int getCacheSize() -
setStitchStrips
public void setStitchStrips(boolean bStitchStrips) boolean 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.- Parameters:
bStitchStrips
- (Default value: true)
-
isStitchStrips
public boolean isStitchStrips() -
setMinStripSize
public void setMinStripSize(int minSize) 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.- Parameters:
minSize
- (Default value: 0)
-
getMinStripSize
public int getMinStripSize() -
setListsOnly
public void setListsOnly(boolean bListsOnly) If set to true, will return an optimized list, with no strips at all.- Parameters:
bListsOnly
- (Default value: false)
-
isListsOnly
public boolean isListsOnly() -
setReorderVertices
public void setReorderVertices(boolean reorder) If set to true, will call remapIndices after generateStrips.- Parameters:
reorder
- (Default value: false)- See Also:
-
isReorderVertices
public boolean isReorderVertices() -
generateStrips
- Parameters:
in_indices
- input index list, the indices you would use to rendervalidate
-true
if the generated data are validated against the input- Returns:
- array of optimized/stripified PrimitiveGroups
-
remapIndices
public PrimitiveGroup[] remapIndices(PrimitiveGroup[] in_primGroups, AtomicReference<int[]> remappedVertices, int numVerts) Function to remap your indices to improve spatial locality in your vertex buffer. Note that you must reorder your vertex buffer according to the remapping handed back to you. Credit goes to the MS Xbox crew for the idea for this interface.- Parameters:
in_primGroups
- array of PrimitiveGroups you want remappedremappedVertices
- store of the remapped vertices if not nullnumVerts
- number of vertices in your vertex buffer, also can be thought of as the range of acceptable values for indices in your primitive groups.- Returns:
- index remap. old index is key into array, value there is the old location for the vertex. -1 means vertex was never referenced
-
visit
Description copied from interface:Visitor
Execute our logic on the given Spatial
-