Class RenderBuckets


public class RenderBuckets extends MapTile.TileData
This class is primarily intended for rendering the vector elements of a MapTile. It can be used for other purposes as well but some optimizations (and limitations) probably wont make sense in different contexts.
  • Field Details

    • VERTEX_CNT

      public static final int[] VERTEX_CNT
    • SHORT_BYTES

      public static final int SHORT_BYTES
      See Also:
    • TILE_FILL_VERTICES

      public static final int TILE_FILL_VERTICES
      Number of vertices to fill a tile (represented by a quad).
      See Also:
    • vbo

      public BufferObject vbo
      VBO holds all vertex data to draw lines and polygons after compilation. Layout: 16 bytes fill coordinates (TILE_FILL_VERTICES * SHORT_BYTES * coordsPerVertex), n bytes polygon vertices, m bytes lines vertices ...
    • ibo

      public BufferObject ibo
    • offset

      public int[] offset
      To not need to switch VertexAttribPointer positions all the time: 1. polygons are packed in VBO at offset 0 2. lines afterwards at lineOffset 3. other buckets keep their byte offset in offset
  • Constructor Details

    • RenderBuckets

      public RenderBuckets()
  • Method Details

    • addLineBucket

      public LineBucket addLineBucket(int level, LineStyle style)
      add the LineBucket for a level with a given Line style. Levels are ordered from bottom (0) to top
    • addPolygonBucket

      public PolygonBucket addPolygonBucket(int level, AreaStyle style)
    • addMeshBucket

      public MeshBucket addMeshBucket(int level, AreaStyle style)
    • addHairLineBucket

      public HairLineBucket addHairLineBucket(int level, LineStyle style)
    • addCircleBucket

      public CircleBucket addCircleBucket(int level, CircleStyle style)
    • getLineBucket

      public LineBucket getLineBucket(int level)
      Get or add the LineBucket for a level. Levels are ordered from bottom (0) to top
    • getMeshBucket

      public MeshBucket getMeshBucket(int level)
      Get or add the MeshBucket for a level. Levels are ordered from bottom (0) to top
    • getPolygonBucket

      public PolygonBucket getPolygonBucket(int level)
      Get or add the PolygonBucket for a level. Levels are ordered from bottom (0) to top
    • getLineTexBucket

      public LineTexBucket getLineTexBucket(int level)
      Get or add the TexLineBucket for a level. Levels are ordered from bottom (0) to top
    • getHairLineBucket

      public HairLineBucket getHairLineBucket(int level)
      Get or add the TexLineBucket for a level. Levels are ordered from bottom (0) to top
    • getCircleBucket

      public CircleBucket getCircleBucket(int level)
      Get or add the CircleBucket for a level. Levels are ordered from bottom (0) to top
    • set

      public void set(RenderBucket buckets)
      Set new bucket items and clear previous.
    • get

      public RenderBucket get()
      Returns:
      internal linked list of RenderBucket items
    • setFrom

      public void setFrom(RenderBuckets buckets)
    • clear

      public void clear()
      cleanup only when buckets are not used by tile or bucket anymore!
    • clearBuckets

      public void clearBuckets()
      cleanup only when buckets are not used by tile or bucket anymore!
    • dispose

      protected void dispose()
      Specified by:
      dispose in class MapTile.TileData
    • prepare

      public void prepare()
    • bind

      public void bind()
    • compile

      public boolean compile(boolean addFill)
      Compile different types of buckets in one VBO.
      Parameters:
      addFill - fill tile (add 4 vertices).
      Returns:
      true if compilation succeeded.
    • initRenderer

      public static void initRenderer()