Class Instance2D

java.lang.Object
org.xjge.graphics.Instance2D

public class Instance2D
extends java.lang.Object
Defines a set of reusable vertex data that can be utilized to represent a 2D object that makes use of instanced rendering techniques.
Since:
2.0.0
  • Field Summary

    Fields
    Modifier and Type Field Description
    Atlas atlas  
    int cellHeight  
    int cellWidth  
    Texture texture  
    int vao  
  • Constructor Summary

    Constructors
    Constructor Description
    Instance2D​(Texture texture, int cellWidth, int cellHeight, boolean fromCenter)
    Constructs a rectangular instance that uses a sprite image as its texture.
  • Method Summary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • vao

      public final int vao
    • cellWidth

      public final int cellWidth
    • cellHeight

      public final int cellHeight
    • texture

      public final Texture texture
    • atlas

      public final Atlas atlas
  • Constructor Details

    • Instance2D

      public Instance2D​(Texture texture, int cellWidth, int cellHeight, boolean fromCenter)
      Constructs a rectangular instance that uses a sprite image as its texture. Useful for text, tiles, etc.
      Parameters:
      texture - the texture image to use
      cellWidth - the width of each sub-image cell in pixels
      cellHeight - the height of each sub-image cell in pixels
      fromCenter - determines whether the instance will be offset by its center or bottom left corner relative to its position