/*
- * Sixth 3D engine. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * Sixth 3D engine. Copyright ©2012-2020, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 3 of the GNU Lesser General Public License
import eu.svjatoslav.sixth.e3d.geometry.Point2D;
import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Polygon;
import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
import eu.svjatoslav.sixth.e3d.gui.humaninput.MouseInteractionController;
import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractCoordinateShape;
+import static eu.svjatoslav.sixth.e3d.geometry.Polygon.pointWithinPolygon;
+
public class SolidPolygon extends AbstractCoordinateShape {
- final static LineInterpolator polygonBoundary1 = new LineInterpolator();
- final static LineInterpolator polygonBoundary2 = new LineInterpolator();
- final static LineInterpolator polygonBoundary3 = new LineInterpolator();
+ private final static LineInterpolator polygonBoundary1 = new LineInterpolator();
+ private final static LineInterpolator polygonBoundary2 = new LineInterpolator();
+ private final static LineInterpolator polygonBoundary3 = new LineInterpolator();
private Color color;
public SolidPolygon(final Point3D point1, final Point3D point2,
final int width = x2 - x1;
int offset = ((y * renderBuffer.width) + x1) * 4;
- final byte[] offSreenBufferBytes = renderBuffer.bytes;
+ final byte[] offSreenBufferBytes = renderBuffer.pixels;
final int polygonAlpha = color.a;
final int b = color.b;
onScreenPoint3.roundToInteger();
if (mouseInteractionController != null)
- if (context.mouseClick != null)
- if (Polygon.pointWithinPolygon(context.mouseClick.coordinate,
+ if (context.getMouseEvent() != null)
+ if (pointWithinPolygon(context.getMouseEvent().coordinate,
onScreenPoint1, onScreenPoint2, onScreenPoint3))
- context.clickedItem = mouseInteractionController;
+ context.setObjectUnderMouse(mouseInteractionController);
if (color.isTransparent())
return;