Class RenderResult

java.lang.Object
ke.ric.renderer.api.RenderResult

public final class RenderResult extends Object
Immutable rendered frame, optional attachments, visibility statistics, and measured timings. Constructor inputs are defensively copied, array accessors return copies, and rgbaBuffer() returns a read-only copy.
  • Constructor Details

    • RenderResult

      public RenderResult(int width, int height, byte[] rgba, float[] depth, float[] normals, int[] material, int[] object, VisibilityStatistics visibility, RenderTimings timings)
      Copies a positive-sized immutable frame; optional attachments may be null when unrequested.
      Parameters:
      width - positive pixel width
      height - positive pixel height
      rgba - exactly width*height*4 row-major RGBA8 bytes
      depth - optional one-float-per-pixel depth array
      normals - optional three-float-XYZ-per-pixel normal array
      material - optional one-integer-per-pixel material ID array
      object - optional one-integer-per-pixel stable object ID array
      visibility - non-null immutable rendered visibility statistics
      timings - non-null measured nanosecond timings; unavailable phases use UNAVAILABLE
    • RenderResult

      public RenderResult(int width, int height, byte[] rgba, float[] depth, float[] normals, int[] material, int[] object, VisibilityStatistics visibility, RenderTimings timings, Runnable checkpoint)
      Creates an immutable result while invoking a cooperative checkpoint during large copies. The checkpoint may throw to stop construction; no partially copied result is published.
  • Method Details

    • measuredCopy

      public static RenderResult measuredCopy(int width, int height, byte[] rgba, float[] depth, float[] normals, int[] material, int[] object, VisibilityStatistics visibility, Runnable checkpoint, long copyStartedNanos, LongSupplier nanoTime, BiFunction<Long,Long,RenderTimings> timingFinalizer)
      Copies all retained buffers, then finalizes timings so construction work remains inside copy and total accounting.
    • withVisibleEntities

      public RenderResult withVisibleEntities(List<VisibleEntity> entities)
      Returns a result with copied entity identities, sharing only already-immutable image buffers. An empty list means complete diagnostics found no visible entities; older constructors leave identity diagnostics unavailable instead. Duplicate UUIDs/object IDs and impossible coverage are rejected.
    • worldCapturedNanos

      public long worldCapturedNanos()
      Monotonic timestamp of the scene's first world read, or zero when unavailable.
    • withWorldCapturedNanos

      public RenderResult withWorldCapturedNanos(long capturedNanos)
      Adds scene capture timing without recopying already-immutable image buffers.
    • hasEntityIdentities

      public boolean hasEntityIdentities()
      Whether per-entity UUID diagnostics are available; false is not evidence of an empty frame.
    • visibleEntities

      public List<VisibleEntity> visibleEntities()
      Returns immutable captured identities; consult hasEntityIdentities() for availability.
    • width

      public int width()
      Returns the frame width in pixels.
    • height

      public int height()
      Returns the frame height in pixels.
    • rgba8

      public byte[] rgba8()
      Returns a copy of row-major RGBA8 color, four bytes per pixel.
    • rgbaBuffer

      public ByteBuffer rgbaBuffer()
      Returns a read-only buffer over a defensive copy of row-major RGBA8 color.
    • depth

      public float[] depth()
      Returns copied depth values, or null when not requested.
    • normals

      public float[] normals()
      Returns copied row-major XYZ normal triples, three floats per pixel, or null when not requested.
    • materialIds

      public int[] materialIds()
      Returns copied material identifiers, or null when not requested.
    • objectIds

      public int[] objectIds()
      Returns copied row-major caller-visible object IDs, one integer per pixel, or null when not requested.
    • visibility

      public VisibilityStatistics visibility()
      Returns immutable visibility statistics for the frame.
    • timings

      public RenderTimings timings()
      Returns measured provider timings for the frame.