Class RenderAggregator

java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.raster.RenderAggregator

public class RenderAggregator extends Object
Collects transformed shapes during a render frame and paints them in depth-sorted order.

The RenderAggregator implements the painter's algorithm: shapes are sorted from back to front (highest Z-depth first) and then painted sequentially. This ensures that closer shapes correctly occlude those behind them.

When two shapes have the same Z-depth, their unique AbstractCoordinateShape.shapeId is used as a tiebreaker to guarantee deterministic rendering order.

This class is used internally by ShapeCollection during the render pipeline. You typically do not need to interact with it directly.

See Also:
  • Constructor Details

    • RenderAggregator

      public RenderAggregator()
      Creates a new render aggregator.
  • Method Details

    • paint

      public void paint(RenderingContext renderBuffer)
      Sorts all queued shapes by Z-depth (back to front) and paints them.
      Parameters:
      renderBuffer - the rendering context to paint shapes into
    • sort

      public void sort()
      Sorts all queued shapes by Z-depth (back to front). Must be called after all shapes are queued and before paintSorted.
    • paintSorted

      public void paintSorted(RenderingContext renderBuffer)
      Paints all shapes that have already been sorted. This method can be called multiple times with different segment contexts for multi-threaded rendering.
      Parameters:
      renderBuffer - the rendering context to paint shapes into
    • size

      public int size()
      Returns the number of shapes currently queued.
      Returns:
      the shape count
    • queueShapeForRendering

      public void queueShapeForRendering(AbstractCoordinateShape shape)
      Queues a shape for rendering. Called during the transform phase.
      Parameters:
      shape - the shape to queue
    • reset

      public void reset()
      Clears all queued shapes, preparing for a new render frame.