Class AbstractShape
java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
- Direct Known Subclasses:
AbstractCompositeShape,AbstractCoordinateShape
Base class for all renderable shapes in the Sixth 3D engine.
Every shape that can be rendered must extend this class and implement the
transform(TransformStack, RenderAggregator, RenderingContext) method,
which projects the shape from world space into screen space during each render frame.
Shapes can optionally have a MouseInteractionController attached to receive
mouse click and hover events when the user interacts with the shape in the 3D view.
Shape hierarchy overview:
AbstractShape +-- AbstractCoordinateShape (shapes with vertex coordinates: lines, polygons) +-- AbstractCompositeShape (groups of sub-shapes: boxes, grids, text canvases)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionOptional controller that receives mouse interaction events (click, enter, exit) when the user interacts with this shape in the 3D view. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetMouseInteractionController(MouseInteractionController mouseInteractionController) Assigns a mouse interaction controller to this shape.abstract voidtransform(TransformStack transforms, RenderAggregator aggregator, RenderingContext renderingContext) Transforms this shape from world space to screen space and queues it for rendering.
-
Field Details
-
mouseInteractionController
Optional controller that receives mouse interaction events (click, enter, exit) when the user interacts with this shape in the 3D view. Set tonullif mouse interaction is not needed.
-
-
Constructor Details
-
AbstractShape
public AbstractShape()
-
-
Method Details
-
setMouseInteractionController
Assigns a mouse interaction controller to this shape.Example usage:
shape.setMouseInteractionController(new MouseInteractionController() { public boolean mouseClicked(int button) { System.out.println("Shape clicked!"); return true; } public boolean mouseEntered() { return false; } public boolean mouseExited() { return false; } });- Parameters:
mouseInteractionController- the controller to handle mouse events, ornullto disable mouse interaction
-
transform
public abstract void transform(TransformStack transforms, RenderAggregator aggregator, RenderingContext renderingContext) Transforms this shape from world space to screen space and queues it for rendering.This method is called once per frame for each shape in the scene. Implementations should apply the current transform stack to their vertices, compute screen-space coordinates, and if the shape is visible, add it to the
RenderAggregatorfor depth-sorted painting.- Parameters:
transforms- the current stack of transforms (world-to-camera transformations)aggregator- collects transformed shapes for depth-sorted renderingrenderingContext- provides frame dimensions, graphics context, and frame metadata
-