Class InstancedMaterial<D extends InstanceData>

java.lang.Object
com.jozufozu.flywheel.backend.instancing.instancing.InstancedMaterial<D>
Type Parameters:
D -
All Implemented Interfaces:
Material<D>

public class InstancedMaterial<D extends InstanceData> extends Object implements Material<D>
A collection of Instancers that all have the same format.
  • Field Details

  • Constructor Details

    • InstancedMaterial

      public InstancedMaterial(Instanced<D> type)
  • Method Details

    • model

      public Instancer<D> model(Object key, Supplier<Model> modelSupplier)
      Get an instancer for the given model. Calling this method twice with the same key will return the same instancer.
      Specified by:
      model in interface Material<D extends InstanceData>
      Parameters:
      key - An object that uniquely identifies the model.
      modelSupplier - A factory that creates the IModel that you want to render.
      Returns:
      An instancer for the given model, capable of rendering many copies for little cost.
    • getAllInstancers

      public Collection<GPUInstancer<D>> getAllInstancers()
    • getInstanceCount

      public int getInstanceCount()
    • getVertexCount

      public int getVertexCount()
    • nothingToRender

      public boolean nothingToRender()
    • clear

      public void clear()
      Clear all instance data without freeing resources.
    • delete

      public void delete()