X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Frenderer%2Fraster%2Fshapes%2Fcomposite%2Fbase%2FAbstractCompositeShape.java;h=184d57a7e77a68649e2a7c1d78758db93b8ed577;hb=de8fb260a5e99922231b1d0f437916e796ec6ccb;hp=54729aeeb3166e86b058ea43176e98ab5c3df6bc;hpb=03447008b8ee26a6463d2cd03005dc26464863db;p=sixth-3d.git diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java index 54729ae..184d57a 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java @@ -1,20 +1,15 @@ /* - * 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.composite.base; import eu.svjatoslav.sixth.e3d.geometry.Point3D; -import eu.svjatoslav.sixth.e3d.geometry.Transform; -import eu.svjatoslav.sixth.e3d.geometry.TransformPipe; import eu.svjatoslav.sixth.e3d.gui.RenderingContext; import eu.svjatoslav.sixth.e3d.gui.UserRelativityTracker; import eu.svjatoslav.sixth.e3d.gui.humaninput.MouseInteractionController; +import eu.svjatoslav.sixth.e3d.math.Transform; +import eu.svjatoslav.sixth.e3d.math.TransformsPipeline; import eu.svjatoslav.sixth.e3d.renderer.raster.Color; import eu.svjatoslav.sixth.e3d.renderer.raster.RenderAggregator; import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape; @@ -25,6 +20,7 @@ import eu.svjatoslav.sixth.e3d.renderer.raster.slicer.Slicer; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * In order to get perspective correct textures, large textured polygons are @@ -68,7 +64,7 @@ public class AbstractCompositeShape extends AbstractShape { * This method should be overridden by anyone wanting to customize shape * before it is rendered. */ - public void beforeTransformHook(final TransformPipe transformPipe, + public void beforeTransformHook(final TransformsPipeline transformPipe, final RenderingContext context) { } @@ -119,6 +115,12 @@ public class AbstractCompositeShape extends AbstractShape { } } + public List getGroup(final String groupIdentifier) { + return originalSubShapes.stream().filter( + subShape -> subShape.matchesGroup(groupIdentifier)) + .collect(Collectors.toList()); + } + private void resliceIfNeeded() { final double proposedSliceFactor = relativityTracker @@ -146,7 +148,7 @@ public class AbstractCompositeShape extends AbstractShape { } public void setGroupForUngrouped(final String groupIdentifier) { - originalSubShapes.stream().filter(subShape -> subShape.isUngrouped()).forEach(subShape -> subShape.setGroup(groupIdentifier)); + originalSubShapes.stream().filter(SubShape::isUngrouped).forEach(subShape -> subShape.setGroup(groupIdentifier)); } @Override @@ -192,7 +194,7 @@ public class AbstractCompositeShape extends AbstractShape { } @Override - public void transform(final TransformPipe transformPipe, + public void transform(final TransformsPipeline transformPipe, final RenderAggregator aggregator, final RenderingContext context) { // add current composite shape transform to the end of the transform