8d87b05bb2512ddc90d9967b09d628a8ff9a8e61
[sixth-3d.git] / src / main / java / eu / svjatoslav / sixth / e3d / renderer / raster / shapes / composite / wireframe / WireframeDrawing.java
1 /*
2  * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of version 3 of the GNU Lesser General Public License
6  * or later as published by the Free Software Foundation.
7  *
8  */
9
10 package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
11
12 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
13 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.Line;
14 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
15 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
16
17 public class WireframeDrawing extends AbstractCompositeShape {
18
19     final private LineAppearance lineAppearance;
20     Point3D currentPoint;
21
22     public WireframeDrawing(final LineAppearance lineAppearance) {
23         super();
24         this.lineAppearance = lineAppearance;
25     }
26
27     public void addPoint(final Point3D point3d) {
28         if (currentPoint != null) {
29             final Line line = lineAppearance.getLine(currentPoint, point3d);
30             addShape(line);
31         }
32
33         currentPoint = new Point3D(point3d);
34     }
35
36 }