Package ke.ric.renderer.api
Class RenderResult
java.lang.Object
ke.ric.renderer.api.RenderResult
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 Summary
ConstructorsConstructorDescriptionRenderResult(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.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. -
Method Summary
Modifier and TypeMethodDescriptionfloat[]depth()Returns copied depth values, or null when not requested.booleanWhether per-entity UUID diagnostics are available; false is not evidence of an empty frame.intheight()Returns the frame height in pixels.int[]Returns copied material identifiers, or null when not requested.static RenderResultmeasuredCopy(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.float[]normals()Returns copied row-major XYZ normal triples, three floats per pixel, or null when not requested.int[]Returns copied row-major caller-visible object IDs, one integer per pixel, or null when not requested.byte[]rgba8()Returns a copy of row-major RGBA8 color, four bytes per pixel.Returns a read-only buffer over a defensive copy of row-major RGBA8 color.timings()Returns measured provider timings for the frame.Returns immutable visibility statistics for the frame.Returns immutable captured identities; consulthasEntityIdentities()for availability.intwidth()Returns the frame width in pixels.withVisibleEntities(List<VisibleEntity> entities) Returns a result with copied entity identities, sharing only already-immutable image buffers.withWorldCapturedNanos(long capturedNanos) Adds scene capture timing without recopying already-immutable image buffers.longMonotonic timestamp of the scene's first world read, or zero when unavailable.
-
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 widthheight- positive pixel heightrgba- exactly width*height*4 row-major RGBA8 bytesdepth- optional one-float-per-pixel depth arraynormals- optional three-float-XYZ-per-pixel normal arraymaterial- optional one-integer-per-pixel material ID arrayobject- optional one-integer-per-pixel stable object ID arrayvisibility- non-null immutable rendered visibility statisticstimings- 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
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
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
Returns immutable captured identities; consulthasEntityIdentities()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
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
Returns immutable visibility statistics for the frame. -
timings
Returns measured provider timings for the frame.
-