Class SegmentRenderingContext

java.lang.Object
eu.svjatoslav.sixth.e3d.gui.RenderingContext
eu.svjatoslav.sixth.e3d.gui.SegmentRenderingContext

public class SegmentRenderingContext extends RenderingContext
A view of a RenderingContext for rendering a horizontal screen segment.

This class wraps a parent RenderingContext and provides its own Y-bounds for multi-threaded rendering. All operations delegate to the parent context, but with segment-specific Y bounds for pixel operations.

Mouse tracking is local to each segment and must be combined after all segments complete rendering.

See Also:
  • Constructor Details

    • SegmentRenderingContext

      public SegmentRenderingContext(RenderingContext parent, int renderMinY, int renderMaxY, int segmentIndex)
      Creates a segment view of a parent rendering context.
      Parameters:
      parent - the parent rendering context to delegate to
      renderMinY - minimum Y coordinate (inclusive) for this segment
      renderMaxY - maximum Y coordinate (exclusive) for this segment
      segmentIndex - the index of this segment (0 to NUM_RENDER_SEGMENTS-1)
  • Method Details

    • executeWithGraphics

      public void executeWithGraphics(Consumer<Graphics2D> operation)
      Description copied from class: RenderingContext
      Executes a graphics operation in a thread-safe manner. This must be used for all Graphics2D operations (text, lines, etc.) during multi-threaded rendering.
      Overrides:
      executeWithGraphics in class RenderingContext
      Parameters:
      operation - the graphics operation to execute
    • getMouseEvent

      public MouseEvent getMouseEvent()
      Description copied from class: RenderingContext
      Returns the pending mouse event for this frame, or null if none.
      Overrides:
      getMouseEvent in class RenderingContext
      Returns:
      the mouse event to process, or null
    • setMouseEvent

      public void setMouseEvent(MouseEvent mouseEvent)
      Description copied from class: RenderingContext
      Sets the mouse event to be processed during this frame's rendering.
      Overrides:
      setMouseEvent in class RenderingContext
      Parameters:
      mouseEvent - the mouse event with position and button information
    • setCurrentObjectUnderMouseCursor

      public void setCurrentObjectUnderMouseCursor(MouseInteractionController controller)
      Description copied from class: RenderingContext
      Called when given object was detected under mouse cursor, while processing RenderingContext.mouseEvent. Because objects are rendered back to front. The last method caller will set the top-most object, if there are multiple objects under mouse cursor.
      Overrides:
      setCurrentObjectUnderMouseCursor in class RenderingContext
      Parameters:
      controller - the object that is currently under the mouse cursor
    • getSegmentMouseHit

      public MouseInteractionController getSegmentMouseHit()
      Returns the mouse hit detected in this segment.
      Returns:
      the MouseInteractionController that was under the mouse in this segment, or null
    • getCurrentObjectUnderMouseCursor

      public MouseInteractionController getCurrentObjectUnderMouseCursor()
      Description copied from class: RenderingContext
      Returns the current object under the mouse cursor. Used by segment rendering to collect mouse results.
      Overrides:
      getCurrentObjectUnderMouseCursor in class RenderingContext
      Returns:
      the current object under mouse cursor, or null