X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Frenderer%2Fraster%2Fshapes%2Fbasic%2Fsolidpolygon%2FSolidPolygon.java;h=1ef63f4d8b8219b8adb451873059913bee92bcea;hp=992a4060f9c64c3f89226090240a35d3c59e6037;hb=59baa428fb2d9e7f0fe5423f4cea47f2d6245914;hpb=dcdff57f0bab42387b2e4e215778d9e8efc60221 diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/SolidPolygon.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/SolidPolygon.java index 992a406..1ef63f4 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/SolidPolygon.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/SolidPolygon.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine. Copyright ©2012-2019, 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 @@ -11,17 +11,18 @@ package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.solidpolygon; 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, @@ -52,7 +53,7 @@ public class SolidPolygon extends AbstractCoordinateShape { 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; @@ -103,10 +104,10 @@ public class SolidPolygon extends AbstractCoordinateShape { 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;