Class EditorSpriteCache

java.lang.Object
mindustry.editor.EditorSpriteCache
All Implemented Interfaces:
arc.util.Disposable

public class EditorSpriteCache extends Object implements arc.util.Disposable
  • Constructor Summary

    Constructors
    Constructor
    Description
    EditorSpriteCache(float[] tmpVertices, float packX, float packY, float packW, float packH)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    build(arc.graphics.gl.IndexData indices)
    Builds this cache into a mesh that can be used for rendering.
    void
     
    void
    draw(arc.graphics.g2d.TextureRegion region, float x, float y, float originX, float originY, float width, float height, float rotation, float colorPacked)
    Adds the specified region to the cache.
    boolean
     
    void
    render(arc.graphics.gl.Shader shader)
    Renders the cached mesh.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface arc.util.Disposable

    isDisposed
  • Constructor Details

    • EditorSpriteCache

      public EditorSpriteCache(float[] tmpVertices, float packX, float packY, float packW, float packH)
      Parameters:
      tmpVertices - Temporary buffer to hold vertices while building up sprites. Should be large enough to hold all sprite data this cache will contain.
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns:
      whether anything was added to the cache.
    • build

      public void build(arc.graphics.gl.IndexData indices)
      Builds this cache into a mesh that can be used for rendering. Use after calling draw(TextureRegion, float, float, float, float, float, float, float, float). Until this method is called, no mesh is created.
      Parameters:
      indices - The shared index data in standard quad format, as seen in SpriteBatch. Since this data is static, it should be the same across all caches, and be large enough to accommodate all sprites.
    • draw

      public void draw(arc.graphics.g2d.TextureRegion region, float x, float y, float originX, float originY, float width, float height, float rotation, float colorPacked)
      Adds the specified region to the cache.
    • render

      public void render(arc.graphics.gl.Shader shader)
      Renders the cached mesh. The shader must already have the correct view matrix set as a uniform.
    • dispose

      public void dispose()
      Specified by:
      dispose in interface arc.util.Disposable