Class DrawUtils

java.lang.Object
com.prineside.tdi2.utils.DrawUtils

public class DrawUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    bakeVertices(float[] toVertices, TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)
    Запечь вершины, чтобы использовать в Batch.
    static Mesh
    copyMesh(Mesh meshToCopy, boolean isStatic, boolean removeDuplicates, int[] usage)
     
    static void
    drawFontToCache(SpriteCache cache, CharSequence text, BitmapFont font, float color, float x, float y, float targetWidth, int halign, boolean wrap)
     
    static void
    drawFontToCacheScaled(SpriteCache cache, CharSequence text, BitmapFont font, float color, float x, float y, float targetWidth, int halign, boolean wrap, float scale)
     
    static float[]
    getTexturedLineVertices(TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
     
    static int
    getTexturedMultiLineVertices(float[] out, float width, TextureRegion textureRegion, float[] data, int dataStart, int dataLength)
     
    static Mesh
    mergeMeshes(Array<Mesh> meshes, Array<Matrix4> transformations)
     
    static void
    prepareBezierCurve(float[] out, Vector2[] points, int segmentCount, Color startColor, Color endColor)
    Generates an array of segments for the curve, lerping between two colors Can be used for texturedMultiLine()
    static void
    texturedLineA(Batch batch, Texture texture, float u, float v, float u2, float v2, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColorBits, float endColorBits)
     
    static void
    texturedLineB(Batch batch, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width)
     
    static void
    texturedLineC(Batch batch, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width, float startColor, float endColor)
     
    static void
    texturedLineCacheA(SpriteCache spriteCache, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width, float startColor, float endColor)
     
    static void
    texturedLineCacheB(SpriteCache spriteCache, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
     
    static void
    texturedLineD(Batch batch, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, Color startColor, Color endColor)
     
    static void
    texturedLineE(Batch batch, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, Color startColor, Color endColor)
     
    static void
    texturedLineF(Batch batch, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
     
    static void
    texturedMultiLine(Batch batch, float width, TextureRegion textureRegion, float[] data)
    data - массив точек линии, каждая точка состоит из 4 floats: x, y, color Минимум 2 точки

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DrawUtils

      public DrawUtils()
  • Method Details

    • bakeVertices

      public static void bakeVertices(float[] toVertices, TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)
      Запечь вершины, чтобы использовать в Batch. Цвет не устанавливается (будет белый) - менять ячейки i * 5 + 2
      Parameters:
      toVertices - float[20]
    • prepareBezierCurve

      public static void prepareBezierCurve(float[] out, Vector2[] points, int segmentCount, Color startColor, Color endColor)
      Generates an array of segments for the curve, lerping between two colors Can be used for texturedMultiLine()
      Parameters:
      out - array of size (segmentCount + 1) * 3 for every point of the curve. Each point is represented as x, y and color where
      points - Bezier curve points, array of 2 (linear), 3 (cubic) or 4 (quadratic)
      segmentCount - number of segments, at least 2. Higher number = smoother curve
      startColor - color at the start of the curve
      endColor - color at the end of the curve
    • getTexturedMultiLineVertices

      public static int getTexturedMultiLineVertices(float[] out, float width, TextureRegion textureRegion, float[] data, int dataStart, int dataLength)
      Parameters:
      out - must be of size ((dataLength / 3) - 1) * 20 or larger
      Returns:
      length of vertices array
    • getTexturedLineVertices

      public static float[] getTexturedLineVertices(TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
      Returns:
      array of 20 floats ready to be drawn by batch
    • texturedMultiLine

      public static void texturedMultiLine(Batch batch, float width, TextureRegion textureRegion, float[] data)
      data - массив точек линии, каждая точка состоит из 4 floats: x, y, color Минимум 2 точки
    • texturedLineB

      public static void texturedLineB(Batch batch, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width)
    • texturedLineC

      public static void texturedLineC(Batch batch, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width, float startColor, float endColor)
    • texturedLineF

      public static void texturedLineF(Batch batch, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
    • texturedLineCacheA

      public static void texturedLineCacheA(SpriteCache spriteCache, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width, float startColor, float endColor)
    • texturedLineCacheB

      public static void texturedLineCacheB(SpriteCache spriteCache, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
    • texturedLineE

      public static void texturedLineE(Batch batch, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, Color startColor, Color endColor)
    • texturedLineA

      public static void texturedLineA(Batch batch, Texture texture, float u, float v, float u2, float v2, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColorBits, float endColorBits)
    • texturedLineD

      public static void texturedLineD(Batch batch, TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, Color startColor, Color endColor)
    • drawFontToCache

      public static void drawFontToCache(SpriteCache cache, CharSequence text, BitmapFont font, float color, float x, float y, float targetWidth, int halign, boolean wrap)
    • drawFontToCacheScaled

      public static void drawFontToCacheScaled(SpriteCache cache, CharSequence text, BitmapFont font, float color, float x, float y, float targetWidth, int halign, boolean wrap, float scale)
    • mergeMeshes

      public static Mesh mergeMeshes(Array<Mesh> meshes, Array<Matrix4> transformations)
    • copyMesh

      public static Mesh copyMesh(Mesh meshToCopy, boolean isStatic, boolean removeDuplicates, int[] usage)