Class NvStripifier

java.lang.Object
com.ardor3d.extension.model.util.nvtristrip.NvStripifier

final class NvStripifier extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • stripify

      void stripify(List<Integer> in_indices, int in_cacheSize, int in_minStripLength, int maxIndex, List<NvStripInfo> outStrips, List<NvFaceInfo> outFaceList)
      Parameters:
      in_indices - the input indices of the mesh to stripify
      in_cacheSize - the target cache size
      in_minStripLength - the minimum strip length
      maxIndex - the maximum index
      outStrips - the strips
      outFaceList - the face list
    • createStrips

      int createStrips(List<NvStripInfo> allStrips, List<Integer> stripIndices, boolean bStitchStrips, boolean bRestart, int restartVal)
      Generates actual strips from the list-in-strip-order.
      Parameters:
      allStrips - all strips
      stripIndices - the strip indices
      bStitchStrips - true if the strips are stitched
      bRestart - true if it restarts
      restartVal - restart value
      Returns:
      the number of separate strips
    • getUniqueVertexInB

      static int getUniqueVertexInB(NvFaceInfo faceA, NvFaceInfo faceB)
      Parameters:
      faceA - the face A
      faceB - the face B
      Returns:
      the first vertex unique to faceB
    • getSharedVertices

      static int[] getSharedVertices(NvFaceInfo faceA, NvFaceInfo faceB)
      Parameters:
      faceA - the face A
      faceB - the face B
      Returns:
      the (at most) two vertices shared between the two faces
    • isDegenerate

      static boolean isDegenerate(NvFaceInfo face)
    • isDegenerate

      static boolean isDegenerate(int v0, int v1, int v2)
    • isCW

      static boolean isCW(NvFaceInfo faceInfo, int v0, int v1)
      Parameters:
      faceInfo - the face info
      v0 - the vertex 0
      v1 - the vertex 1
      Returns:
      true if the face is ordered in CW fashion
    • nextIsCW

      static boolean nextIsCW(int numIndices)
      Parameters:
      numIndices - the number of indices
      Returns:
      true if the next face should be ordered in CW fashion
    • getNextIndex

      static int getNextIndex(List<Integer> indices, NvFaceInfo face)
      Parameters:
      indices - the indices
      face - the face
      Returns:
      vertex of the input face which is "next" in the input index list
    • findEdgeInfo

      static NvEdgeInfo findEdgeInfo(List<NvEdgeInfo> edgeInfos, int v0, int v1)
      find the edge info for these two indices
      Parameters:
      edgeInfos - the edge infos
      v0 - the vertex 0
      v1 - the vertex 1
      Returns:
      the edge info
    • findOtherFace

      static NvFaceInfo findOtherFace(List<NvEdgeInfo> edgeInfos, int v0, int v1, NvFaceInfo faceInfo)
      find the other face sharing these vertices
      Parameters:
      edgeInfos - the edge infos
      v0 - the vertex 0
      v1 - the vertex 1
      faceInfo - the face info
      Returns:
      the other face sharing these vertices
    • findGoodResetPoint

      A good reset point is one near other committed areas so that we know that when we've made the longest strips its because we're stripifying in the same general orientation.
      Parameters:
      faceInfos - the face infos
      edgeInfos - the edge infos
      Returns:
      the good reset point
    • findAllStrips

      void findAllStrips(List<NvStripInfo> allStrips, List<NvFaceInfo> allFaceInfos, List<NvEdgeInfo> allEdgeInfos, int numSamples)
      Does the stripification, puts output strips into vector allStrips Works by setting running a number of experiments in different areas of the mesh, and accepting the one which results in the longest strips. It then accepts this, and moves on to a different area of the mesh. We try to jump around the mesh some, to ensure that large open spans of strips get generated.
      Parameters:
      allStrips - all strips
      allFaceInfos - all face infos
      allEdgeInfos - all edge infos
      numSamples - the number of samples
    • splitUpStripsAndOptimize

      void splitUpStripsAndOptimize(List<NvStripInfo> allStrips, List<NvStripInfo> outStrips, List<NvEdgeInfo> edgeInfos, List<NvFaceInfo> outFaceList)
      Splits the input vector of strips (allBigStrips) into smaller, cache friendly pieces, then reorders these pieces to maximize cache hits. The final strips are stored in outStrips
      Parameters:
      allStrips - all strips
      outStrips - the resulting strips
      edgeInfos - the edge infos
      outFaceList - the resulting face list
    • removeSmallStrips

      void removeSmallStrips(List<NvStripInfo> allStrips, List<NvStripInfo> allBigStrips, List<NvFaceInfo> faceList)
      Parameters:
      allStrips - the whole strip vector...all small strips will be deleted from this list, to avoid leaking mem
      allBigStrips - an out parameter which will contain all strips above minStripLength
      faceList - an out parameter which will contain all faces which were removed from the striplist
    • findTraversal

      boolean findTraversal(List<NvFaceInfo> faceInfos, List<NvEdgeInfo> edgeInfos, NvStripInfo strip, NvStripStartInfo startInfo)
      Finds the next face to start the next strip on.
      Parameters:
      faceInfos - the face infos
      edgeInfos - the edge infos
      strip - the strip
      startInfo - the start info
      Returns:
      true if the next face to start the next strip on is found
    • commitStrips

      void commitStrips(List<NvStripInfo> allStrips, List<NvStripInfo> strips)
      "Commits" the input strips by setting their m_experimentId to -1 and adding to the allStrips vector
      Parameters:
      allStrips - all strips
      strips - the strips
    • avgStripSize

      float avgStripSize(List<NvStripInfo> strips)
      Parameters:
      strips - the strips
      Returns:
      the average strip size of the input vector of strips
    • findStartPoint

      int findStartPoint(List<NvFaceInfo> faceInfos, List<NvEdgeInfo> edgeInfos)
      Finds a good starting point, namely one which has only one neighbor
      Parameters:
      faceInfos - the face infos
      edgeInfos - the edge infos
      Returns:
      the good starting point or -1
    • updateCacheStrip

      Updates the input vertex cache with this strip's vertices
      Parameters:
      vcache - the vertex cache
      strip - the strip
    • updateCacheFace

      void updateCacheFace(VertexCache vcache, NvFaceInfo face)
      Updates the input vertex cache with this face's vertices
      Parameters:
      vcache - the vertex cache
      face - the face
    • calcNumHitsStrip

      float calcNumHitsStrip(VertexCache vcache, NvStripInfo strip)
      Parameters:
      vcache - the vertex cache
      strip - the strip
      Returns:
      the number of cache hits per face in the strip
    • calcNumHitsFace

      Parameters:
      vcache - the vertex cache
      face - the face
      Returns:
      the number of cache hits in the face
    • numNeighbors

      int numNeighbors(NvFaceInfo face, List<NvEdgeInfo> edgeInfoVec)
      Parameters:
      face - the face
      edgeInfoVec - the edge info list
      Returns:
      the number of neighbors that this face has
    • buildStripifyInfo

      void buildStripifyInfo(List<NvFaceInfo> faceInfos, List<NvEdgeInfo> edgeInfos, int maxIndex)
      Builds the list of all face and edge infos
      Parameters:
      faceInfos - the face infos
      edgeInfos - the edge infos
      maxIndex - the maximum index
    • alreadyExists

      boolean alreadyExists(NvFaceInfo toFind, List<NvFaceInfo> faceInfos)