ByCopyGeometry(GeometryArray ga) { this(ga, ga.getInitialVertexIndex(), ga.getValidVertexCount()) ; }
ByCopyGeometry(GeometryArray ga) { this(ga, ga.getInitialVertexIndex(), ga.getValidVertexCount()) ; }
public void setColor(final List<Color3f> color) { this.color = null; final GeometryArray ga = (GeometryArray) getGeometry(); if (ga == null) return; final int N = ga.getValidVertexCount(); if (color.size() != N) throw new IllegalArgumentException("list of size " + N + " expected"); final Color3f[] colors = new Color3f[N]; color.toArray(colors); ga.setColors(0, colors); changed = true; }
public void setTransparentColor(final List<Color4f> color) { this.color = null; final GeometryArray ga = (GeometryArray) getGeometry(); if (ga == null) return; final int N = ga.getValidVertexCount(); if (color.size() != N) throw new IllegalArgumentException("list of size " + N + " expected"); final Color4f[] colors = new Color4f[N]; color.toArray(colors); ga.setColors(0, colors); changed = true; }
protected void addVerticesToGeometryArray(final Point3f[] v) { changed = true; mesh.addAll(Arrays.asList(v)); // check maximum vertex count final GeometryArray ga = (GeometryArray) getGeometry(); final int max = ga.getVertexCount(); final int idx = ga.getValidVertexCount(); if (idx + v.length > max) { // enlarge arrays setGeometry(createGeometry()); return; } ga.setValidVertexCount(idx + v.length); ga.setCoordinates(idx, v); // update colors final Color3f[] colors = new Color3f[v.length]; Arrays.fill(colors, this.color); ga.setColors(idx, colors); recalculateNormals(ga); }
public void recalculateNormals(final GeometryArray ga) { if (ga == null) return; if ((ga.getVertexFormat() & GeometryArray.NORMALS) == 0) return; changed = true; final GeometryInfo gi = new GeometryInfo(ga); final NormalGenerator ng = new NormalGenerator(); ng.generateNormals(gi); final GeometryArray tmp = gi.getGeometryArray(); final int v = ga.getValidVertexCount(); final float[] normals = new float[3 * v]; tmp.getNormals(0, normals); ga.setNormals(0, normals); }
validVertexCount = ga.getValidVertexCount() ; geometryAccessor = new ByCopyGeometry(ga) ; validVertexCount = ga.getValidVertexCount() ; geometryAccessor = new InterleavedGeometryNIO(ga) ; validVertexCount = ga.getValidVertexCount() ; geometryAccessor = new InterleavedGeometryFloat(ga) ; validVertexCount = ga.getValidVertexCount() ; geometryAccessor = new ByRefGeometryNIO(ga) ; validVertexCount = ga.getValidVertexCount() ; geometryAccessor = new ByRefGeometry(ga) ;
out.writeInt( ((GeometryArray)node).getInitialVertexIndex() ); if ( !(node instanceof GeometryStripArray) ) out.writeInt( ((GeometryArray)node).getValidVertexCount() ); out.writeInt( ((GeometryArray)node).getInitialVertexIndex() ); if ( !(node instanceof GeometryStripArray) ) out.writeInt( ((GeometryArray)node).getValidVertexCount() );
validVertexCount = ga.getValidVertexCount() ; geometryAccessor = new ByCopyGeometry(ga) ; validVertexCount = ga.getValidVertexCount() ; geometryAccessor = new InterleavedGeometryNIO(ga) ; validVertexCount = ga.getValidVertexCount() ; geometryAccessor = new InterleavedGeometryFloat(ga) ; validVertexCount = ga.getValidVertexCount() ; geometryAccessor = new ByRefGeometryNIO(ga) ; validVertexCount = ga.getValidVertexCount() ; geometryAccessor = new ByRefGeometry(ga) ;
public void loadSurfaceColorsFromImage(ImagePlus imp) { final GeometryArray ga = (GeometryArray) getGeometry(); if (ga == null) return; if (imp.getType() != ImagePlus.COLOR_RGB) { imp = new Duplicator().run(imp); new StackConverter(imp).convertToRGB(); } final InterpolatedImage ii = new InterpolatedImage(imp); final int N = ga.getValidVertexCount(); final Color3f[] colors = new Color3f[N]; final Calibration cal = imp.getCalibration(); final double pw = cal.pixelWidth; final double ph = cal.pixelHeight; final double pd = cal.pixelDepth; final Point3f coord = new Point3f(); for (int i = 0; i < N; i++) { ga.getCoordinate(i, coord); final int v = (int) Math.round(ii.interpol.get(coord.x / pw, coord.y / ph, coord.z / pd)); colors[i] = new Color3f(((v & 0xff0000) >> 16) / 255f, ((v & 0xff00) >> 8) / 255f, (v & 0xff) / 255f); } ga.setColors(0, colors); changed = true; }
} else valid = geomArray.getValidVertexCount();