Class LightStorage

java.lang.Object
dev.engine_room.flywheel.backend.engine.LightStorage
All Implemented Interfaces:
Effect

public class LightStorage extends Object implements Effect
A managed arena of light sections for uploading to the GPU.

Each section represents an 18x18x18 block volume of light data. The "edges" are taken from the neighboring sections, so that each shader invocation only needs to access a single section of data. Even still, neighboring shader invocations may need to access other sections.

Sections are logically stored as a 9x9x9 array of longs, where each long holds a 2x2x2 array of light data.
Both the greater array and the longs are packed in x, z, y order.

Thus, each section occupies 5832 bytes.

  • Field Details

    • BLOCKS_PER_SECTION

      public static final int BLOCKS_PER_SECTION
      See Also:
    • LIGHT_SIZE_BYTES

      public static final int LIGHT_SIZE_BYTES
      See Also:
    • SOLID_SIZE_BYTES

      public static final int SOLID_SIZE_BYTES
    • SECTION_SIZE_BYTES

      public static final int SECTION_SIZE_BYTES
    • arena

      public final CpuArena arena
  • Constructor Details

    • LightStorage

      public LightStorage(net.minecraft.world.level.LevelAccessor level)
  • Method Details

    • level

      public net.minecraft.world.level.LevelAccessor level()
      Specified by:
      level in interface Effect
    • visualize

      public EffectVisual<?> visualize(VisualizationContext ctx, float partialTick)
      Description copied from interface: Effect
      Create a visual that will be keyed by this effect object.
      Specified by:
      visualize in interface Effect
      Parameters:
      ctx - The visualization context.
      Returns:
      An arbitrary EffectVisual.
    • sections

      public void sections(it.unimi.dsi.fastutil.longs.LongSet sections)
      Set the set of requested sections.

      When set, this will be processed in the next frame plan. It may not be set every frame.

      Parameters:
      sections - The set of sections requested by the impl.
    • onLightUpdate

      public void onLightUpdate(long section)
    • createFramePlan

      public <C> Plan<C> createFramePlan()
    • capacity

      public int capacity()
    • collectSection

      public void collectSection(long section)
    • delete

      public void delete()
    • checkNeedsLutRebuildAndClear

      public boolean checkNeedsLutRebuildAndClear()
    • uploadChangedSections

      public void uploadChangedSections(StagingBuffer staging, int dstVbo)
    • upload

      public void upload(GlBuffer buffer)
    • createLut

      public it.unimi.dsi.fastutil.ints.IntArrayList createLut()