Package eu.svjatoslav.sixth.e3d.gui
Class SegmentRenderingContext
java.lang.Object
eu.svjatoslav.sixth.e3d.gui.RenderingContext
eu.svjatoslav.sixth.e3d.gui.SegmentRenderingContext
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:
-
Field Summary
Fields inherited from class eu.svjatoslav.sixth.e3d.gui.RenderingContext
bufferedImageType, centerCoordinate, debugLogBuffer, developerTools, frameNumber, graphics, height, lightingManager, NUM_RENDER_SEGMENTS, pixels, projectionScale, renderMaxY, renderMinY, width -
Constructor Summary
ConstructorsConstructorDescriptionSegmentRenderingContext(RenderingContext parent, int renderMinY, int renderMaxY, int segmentIndex) Creates a segment view of a parent rendering context. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteWithGraphics(Consumer<Graphics2D> operation) Executes a graphics operation in a thread-safe manner.Returns the current object under the mouse cursor.Returns the pending mouse event for this frame, ornullif none.Returns the mouse hit detected in this segment.voidCalled when given object was detected under mouse cursor, while processingRenderingContext.mouseEvent.voidsetMouseEvent(MouseEvent mouseEvent) Sets the mouse event to be processed during this frame's rendering.Methods inherited from class eu.svjatoslav.sixth.e3d.gui.RenderingContext
dispose, getSegmentGraphics, handlePossibleComponentMouseEvent, prepareForNewFrameRendering
-
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 torenderMinY- minimum Y coordinate (inclusive) for this segmentrenderMaxY- maximum Y coordinate (exclusive) for this segmentsegmentIndex- the index of this segment (0 to NUM_RENDER_SEGMENTS-1)
-
-
Method Details
-
executeWithGraphics
Description copied from class:RenderingContextExecutes a graphics operation in a thread-safe manner. This must be used for all Graphics2D operations (text, lines, etc.) during multi-threaded rendering.- Overrides:
executeWithGraphicsin classRenderingContext- Parameters:
operation- the graphics operation to execute
-
getMouseEvent
Description copied from class:RenderingContextReturns the pending mouse event for this frame, ornullif none.- Overrides:
getMouseEventin classRenderingContext- Returns:
- the mouse event to process, or
null
-
setMouseEvent
Description copied from class:RenderingContextSets the mouse event to be processed during this frame's rendering.- Overrides:
setMouseEventin classRenderingContext- Parameters:
mouseEvent- the mouse event with position and button information
-
setCurrentObjectUnderMouseCursor
Description copied from class:RenderingContextCalled when given object was detected under mouse cursor, while processingRenderingContext.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:
setCurrentObjectUnderMouseCursorin classRenderingContext- Parameters:
controller- the object that is currently under the mouse cursor
-
getSegmentMouseHit
Returns the mouse hit detected in this segment.- Returns:
- the MouseInteractionController that was under the mouse in this segment, or null
-
getCurrentObjectUnderMouseCursor
Description copied from class:RenderingContextReturns the current object under the mouse cursor. Used by segment rendering to collect mouse results.- Overrides:
getCurrentObjectUnderMouseCursorin classRenderingContext- Returns:
- the current object under mouse cursor, or null
-