X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Frenderer%2Fraster%2Fshapes%2Fbasic%2Fsolidpolygon%2FSolidPolygon.java;h=bc1085789979fdbe5b4f2d5badefae0ce92097b1;hb=a40c9c2a3ef372ea0f2c87af644ca2302315baca;hp=ae3442365238dd7fcdc68f7ca29afe553d1e8fda;hpb=03447008b8ee26a6463d2cd03005dc26464863db;p=sixth-3d.git 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 ae34423..bc10857 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,27 +1,23 @@ /* - * Sixth 3D engine. Copyright ©2012-2016, 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 - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - 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 +48,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 +99,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;