break;
}
} while (gc != 0);
PolyhedronGeometry mesh = null;
if (state.currentSection.equals("ENTITIES")) {
if (state._3dfaces == null) {
state._3dfaces = new PolyhedronGeometry();
state.root.addChild(state._3dfaces);
}
mesh = state._3dfaces;
} else if (state.currentBlock != null) {
if (state.currentBlock._3dfaces == null) {
state.currentBlock._3dfaces = new PolyhedronGeometry();
state.currentBlock.geometry.addChild(state.currentBlock._3dfaces);
}
mesh = state.currentBlock._3dfaces;
} else {
return;
}
Point3[] vertices = new Point3[4];
for (int i = 0; i < 4; i++) {
vertices[i] = new Point3(v[3 * i + 0], v[3 * i + 1], v[3 * i + 2]);
}
int nv = vertices[3].squaredDistanceTo(vertices[2]) < MathUtil.EPSILON ? 3 : 4;
int offset = mesh.getNumVertices();
for (int i = 0; i < nv; i++) {
mesh.addVertex(vertices[i]);
}
mesh.addFace(new int[]{ offset + 0, offset + 1, offset + 2 });
if (nv > 3) { // quad
mesh.addFace(new int[]{ offset + 2, offset + 3, offset + 0 });
}
}