IndexedByCopyGeometry(GeometryArray ga) { super(ga, 0, ga.getVertexCount()) ; getIndexArrays(ga, ia) ; }
IndexedByCopyGeometry(GeometryArray ga) { super(ga, 0, ga.getVertexCount()) ; getIndexArrays(ga, ia) ; }
public void setColor(final Color3f color) { this.color = color != null ? color : DEFAULT_COLOR; final GeometryArray ga = (GeometryArray) getGeometry(); if (ga == null) return; final int N = ga.getVertexCount(); final Color3f colors[] = new Color3f[N]; for (int i = 0; i < N; i++) { colors[i] = this.color; } ga.setColors(0, colors); changed = true; }
@Override protected void writeConstructorParams( DataOutput out ) throws IOException { vertexCount = ((GeometryArray)node).getVertexCount(); vertexFormat = ((GeometryArray)node).getVertexFormat(); texCoordSetCount = ((GeometryArray)node).getTexCoordSetCount(); texCoordSetMap = new int[ ((GeometryArray)node).getTexCoordSetMapLength() ]; ((GeometryArray)node).getTexCoordSetMap( texCoordSetMap ); out.writeInt(vertexCount); out.writeInt(vertexFormat); out.writeInt( texCoordSetCount ); out.writeInt( texCoordSetMap.length ); for(int i=0; i<texCoordSetMap.length; i++) out.writeInt( texCoordSetMap[i] ); super.writeConstructorParams( out ); }
@Override public void setColor(final Color3f color) { this.color = color != null ? color : DEFAULT_COLOR; final GeometryArray ga = (GeometryArray) getGeometry(); if (ga == null) return; final int N = ga.getVertexCount(); final Color4f colors[] = new Color4f[N]; for (int i = 0; i < N; i++) { colors[i] = new Color4f(this.color.x, this.color.y, this.color.z, 1); } 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); }
@Override public int triangulateIslands(final int[][] islandCounts, final Point3f[][] outVerts, final int[] contourCounts, final ArrayList<GeometryArray> triangData) { int vertOffset = 0; final NormalGenerator ng = new NormalGenerator(); for (int i = 0; i < islandCounts.length; i++) { contourCounts[0] = islandCounts[i].length; final GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY); gi.setCoordinates(outVerts[i]); gi.setStripCounts(islandCounts[i]); gi.setContourCounts(contourCounts); ng.generateNormals(gi); final GeometryArray ga = gi.getGeometryArray(false, false, false); vertOffset += ga.getVertexCount(); triangData.add(ga); } return vertOffset; }
final boolean intersect(int geomIndex, boolean firstpick) { int offset; GeometryArray geom = geometryArrays[geomIndex]; int numPts = geom.getVertexCount(); double[] doubleData = null; float[] floatData = null;
for (j=0;j < islandCounts.length;j++) { GeometryArray ga = triangData.get(j); vertOffset = ga.getVertexCount();
valid = geomArray.getVertexCount(); } else valid = geomArray.getValidVertexCount();