ObservableIntegerArray faceSmoothingGroups = mesh.getFaceSmoothingGroups(); ObservableFloatArray points = mesh.getPoints(); newFaces.clear(); newFaces.ensureCapacity(faces.size()); newFaceSmoothingGroups.clear(); newFaceSmoothingGroups.ensureCapacity(faceSmoothingGroups.size()); int pointElementSize = mesh.getPointElementSize(); int faceElementSize = mesh.getFaceElementSize(); for (int i = 0; i < faces.size(); i += faceElementSize) { total++; int i1 = faces.get(i) * pointElementSize; int i2 = faces.get(i + 2) * pointElementSize; int i3 = faces.get(i + 4) * pointElementSize; if (i1 == i2 || i1 == i3 || i2 == i3) { sameIndexes++; newFaces.addAll(faces, i, faceElementSize); int fIndex = i / faceElementSize; if (fIndex < faceSmoothingGroups.size()) { newFaceSmoothingGroups.addAll(faceSmoothingGroups.get(fIndex)); faces.setAll(newFaces); faceSmoothingGroups.setAll(newFaceSmoothingGroups); faces.trimToSize(); faceSmoothingGroups.trimToSize();
newTexCoords.clear(); newTexCoords.ensureCapacity(texcoords.size()); reindex.clear(); reindex.resize(os); if (index == null) { pp.put(p, ni); reindex.set(oi, ni); newTexCoords.addAll(x, y); ni++; } else { reindex.set(oi, index); for (int i = 1; i < faces.size(); i += 2) { faces.set(i, reindex.get(faces.get(i)));
public SymbolicPolygonMesh(PolygonMesh mesh) { this.points = new OriginalPointArray(mesh); this.texCoords = mesh.getTexCoords().toArray(this.texCoords); this.faces = mesh.faces; this.faceSmoothingGroups = mesh.getFaceSmoothingGroups().toArray(null); }
throw new AssertionError("Faces array size is not correct: " + tMesh.getPoints().size()); if (numFaces != tMesh.getFaceSmoothingGroups().size() && tMesh.getFaceSmoothingGroups().size() > 0) { throw new AssertionError("FaceSmoothingGroups array size is not correct: " + tMesh.getPoints().size() + ", numFaces = " + numFaces); for (int i = 0; i < faces.size(); i += 2) { int pIndex = faces.get(i); if (pIndex < 0 || pIndex > numPoints) { throw new AssertionError("Incorrect point index: " + pIndex + ", numPoints = " + numPoints); int tcIndex = faces.get(i + 1); if (tcIndex < 0 || tcIndex > numTexCoords) { throw new AssertionError("Incorrect texCoord index: " + tcIndex + ", numTexCoords = " + numTexCoords);
triangleMesh.getTexCoords().addAll(convertToFloatArray(texturePoints)); triangleMesh.getFaces().addAll(indices); triangleMesh.getFaceSmoothingGroups().addAll(new int[indices.length / triangleMesh.getFaceElementSize()]); triangleMesh.getNormals().addAll(convertToFloatArray(normals));
triangleMesh.getFaceSmoothingGroups().clear(); for(int f = 0; f < pmesh.faces.length; f++) { int[] face = pmesh.faces[f]; int currentSmoothGroup = pmesh.getFaceSmoothingGroups().get(f); if (DEBUG) System.out.println("face.length = " + face.length+" -- "+Arrays.toString(face)); int firstPointIndex = face[0]; triangleMesh.getFaceSmoothingGroups().setAll(smoothingGroupsArray);
int[] newFaceNormals = ((IntegerArrayList) faceNormals.subList(facesNormalStart, faceNormals.size())).toIntArray(); int[] smGroups = SmoothingGroups.calcSmoothGroups(mesh, newFaces, newFaceNormals, newNormals.toFloatArray()); mesh.getFaceSmoothingGroups().setAll(smGroups); } else { mesh.getFaceSmoothingGroups().setAll(((IntegerArrayList) smoothingGroups.subList(smoothingGroupsStart, smoothingGroups.size())).toIntArray()); + mesh.getTexCoords().size() / mesh.getTexCoordElementSize() + " uvs, " + mesh.getFaces().size() / mesh.getFaceElementSize() + " faces, " + mesh.getFaceSmoothingGroups().size() + " smoothing groups."); log("material diffuse color = " + ((PhongMaterial) material).getDiffuseColor()); log("material diffuse map = " + ((PhongMaterial) material).getDiffuseMap());
faces = symbolicMeshes.get(subdivisionLevel).faces; numEdgesInFaces = -1; getFaceSmoothingGroups().setAll(symbolicMeshes.get(subdivisionLevel).faceSmoothingGroups); getTexCoords().setAll(symbolicMeshes.get(subdivisionLevel).texCoords);
triangleMesh.getTexCoords().addAll(convertToFloatArray(texturePoints)); triangleMesh.getFaces().addAll(indices); triangleMesh.getFaceSmoothingGroups().addAll(new int[indices.length / triangleMesh.getFaceElementSize()]); triangleMesh.getNormals().addAll(convertToFloatArray(normals));
newPoints.clear(); newPoints.ensureCapacity(points.size()); reindex.clear(); reindex.resize(os); if (index == null) { pp.put(p, ni); reindex.set(oi, ni); newPoints.addAll(x, y, z); ni++; } else { reindex.set(oi, index); for (int i = 0; i < faces.size(); i += 2) { faces.set(i, reindex.get(faces.get(i)));