예제 #1
0
  /**
   * When you call methods like for example {@link #setHalfWidth(float)} or {@link
   * #updateVertex(int, float, float)} work is being queued up. Before each draw call this method is
   * automatically called to do all this work.
   *
   * <p>It can be smart to call this method after you are done configuring your OutlinePolygon, but
   * before you exit your loading screen. This way you do more work during the loading screen and
   * get less initial lag.
   */
  public void updateStripAndCulling() {
    if (!changesToStripOrCulling) return;

    updateAllBoxIndices();

    boolean clockwiseUpdated = false;

    for (int i = 0; i < needsUpdate.size; i++) {
      boolean update = needsUpdate.items[i];
      if (update) {
        if (!clockwiseUpdated) {
          clockwiseUpdated = true;
          updateAuxVertexFinderClockwise();
        }
        if (drawInside) {
          updateVertex(i, true);
        }
        if (drawOutside) {
          updateVertex(i, false);
        }

        needsUpdate.items[i] = false;
      }
    }

    for (BoundingBox box : boundingBoxes) {
      if (box.needsCullingUpdate) {
        updateBoxCulling(box);
        box.needsCullingUpdate = false;
      }
    }
  }
예제 #2
0
 /**
  * You can call this method to update a vertex individually, instead of updating
  * all the vertices with {@link #setVertices(Array).
  *
  * @param vertexIndex the index of the vertex you wish to change
  * @param vertex      the new vertex coordinates
  */
 public void updateVertex(int vertexIndex, Vector2 vertex) {
   updateVertex(vertexIndex, vertex.x, vertex.y);
 }