Class NvTriangleStripper

java.lang.Object
com.ardor3d.extension.model.util.nvtristrip.NvTriangleStripper
All Implemented Interfaces:
Visitor

public class NvTriangleStripper extends Object implements Visitor
  • Field Details

    • CACHESIZE_GEFORCE1_2

      public static final int CACHESIZE_GEFORCE1_2
      GeForce1 and 2 cache size
      See Also:
    • CACHESIZE_GEFORCE3

      public static final int CACHESIZE_GEFORCE3
      GeForce3 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

      public PrimitiveGroup[] generateStrips(int[] in_indices, boolean validate)
      Parameters:
      in_indices - input index list, the indices you would use to render
      validate - 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 remapped
      remappedVertices - store of the remapped vertices if not null
      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.
      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

      public void visit(Spatial spatial)
      Description copied from interface: Visitor
      Execute our logic on the given Spatial
      Specified by:
      visit in interface Visitor
      Parameters:
      spatial - the spatial