X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=blobdiff_plain;f=scilab%2Fmodules%2Fscirenderer%2Fsrc%2Forg%2Fscilab%2Fforge%2Fscirenderer%2Fimplementation%2Fg2d%2Fmotor%2FMotor3D.java;h=75cbc11114f05d57e1ef418a5d650e3ac6859211;hp=c403950f4269ec432f95cce6eaedd2f76ff62642;hb=31d8ab47a754afcabcdb59b68eac24436c6dd303;hpb=18f930355df1b8ef62090dbc99b6dedd73d4574e diff --git a/scilab/modules/scirenderer/src/org/scilab/forge/scirenderer/implementation/g2d/motor/Motor3D.java b/scilab/modules/scirenderer/src/org/scilab/forge/scirenderer/implementation/g2d/motor/Motor3D.java index c403950..75cbc11 100644 --- a/scilab/modules/scirenderer/src/org/scilab/forge/scirenderer/implementation/g2d/motor/Motor3D.java +++ b/scilab/modules/scirenderer/src/org/scilab/forge/scirenderer/implementation/g2d/motor/Motor3D.java @@ -1,6 +1,6 @@ /* * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2012-2013 - Scilab Enterprises - Calixte Denizet + * Copyright (C) 2012 - Scilab Enterprises - Calixte Denizet * * This file must be used under the terms of the CeCILL. * This source file is licensed as described in the file COPYING, which @@ -250,10 +250,6 @@ public class Motor3D { Scene.addToRoot(is2DView(), sprite); } - private void add(PolyLine p) { - Scene.addToRoot(is2DView(), p); - } - /** * Get arrays from Buffer * @param vertices a buffer containing vertices @@ -287,7 +283,7 @@ public class Motor3D { } colorsArray = getMultiColors(buffer); } else { - colorsArray = new Color[vertices.limit() / G2DElementsBuffer.ELEMENT_SIZE]; + colorsArray = new Color[vertices.limit()]; Arrays.fill(colorsArray, defaultColor); } @@ -355,48 +351,34 @@ public class Motor3D { switch (drawingMode) { case SEGMENTS_STRIP : - if (is2DView()) { - List list = PolyLine.getPolyLines(verticesArray, colorsArray, G2DStroke.getStroke(appearance, 0), false); - for (PolyLine p : list) { - add(p); - } - } else { - for (int i = 0; i < verticesArray.length - 1; i++) { - v = new Vector3d[] {verticesArray[i], verticesArray[i + 1]}; - c = new Color[] {colorsArray[i], colorsArray[i + 1]}; - try { - add(new Segment(v, c, G2DStroke.getStroke(appearance, cumLength))); - cumLength += Segment.getLength(v); - } catch (InvalidPolygonException e) { - cumLength = 0; - } + for (int i = 0; i < verticesArray.length - 1; i++) { + v = new Vector3d[] {verticesArray[i], verticesArray[i + 1]}; + c = new Color[] {colorsArray[i], colorsArray[i + 1]}; + try { + add(new Segment(v, c, G2DStroke.getStroke(appearance, cumLength))); + cumLength += Segment.getLength(v); + } catch (InvalidPolygonException e) { + cumLength = 0; } } break; case SEGMENTS_LOOP : - if (is2DView()) { - List list = PolyLine.getPolyLines(verticesArray, colorsArray, G2DStroke.getStroke(appearance, 0), true); - for (PolyLine p : list) { - add(p); - } - } else { - for (int i = 0; i < verticesArray.length - 1; i++) { - v = new Vector3d[] {verticesArray[i], verticesArray[i + 1]}; - c = new Color[] {colorsArray[i], colorsArray[i + 1]}; - try { - add(new Segment(v, c, G2DStroke.getStroke(appearance, cumLength))); - cumLength += Segment.getLength(v); - } catch (InvalidPolygonException e) { - cumLength = 0; - } - } - int n = verticesArray.length - 1; - v = new Vector3d[] {verticesArray[n], verticesArray[0]}; - c = new Color[] {colorsArray[n], colorsArray[0]}; + for (int i = 0; i < verticesArray.length - 1; i++) { + v = new Vector3d[] {verticesArray[i], verticesArray[i + 1]}; + c = new Color[] {colorsArray[i], colorsArray[i + 1]}; try { add(new Segment(v, c, G2DStroke.getStroke(appearance, cumLength))); - } catch (InvalidPolygonException e) { } + cumLength += Segment.getLength(v); + } catch (InvalidPolygonException e) { + cumLength = 0; + } } + int n = verticesArray.length - 1; + v = new Vector3d[] {verticesArray[n], verticesArray[0]}; + c = new Color[] {colorsArray[n], colorsArray[0]}; + try { + add(new Segment(v, c, G2DStroke.getStroke(appearance, cumLength))); + } catch (InvalidPolygonException e) { } break; case SEGMENTS : default :