/* * Check for normals in one smoothing group and remove points from the group * if they are opposite looking in order to prevent a normal to be zero in * one SM group. Opposite looking normals are normals which angle is more * than 110 degrees. */ static void correctSmNormals(MeshVertex n) { // remove opposite looking normals from one smoothing group for (MeshVertex l = n; l != null; l = l.next) { if (l.smGroup != 0) { for (MeshVertex i = l.next; i != null; i = i.next) { if (((i.smGroup & l.smGroup) != 0) && MeshUtil.isOppositeLookingNormals(i.norm, l.norm)) { l.smGroup = 0; i.smGroup = 0; break; } } } } }
static void mergeSmIndexes(MeshVertex n) { for (MeshVertex l = n; l != null; ) { boolean change = false; for (MeshVertex i = l.next; i != null; i = i.next) { if (((l.smGroup & i.smGroup) != 0) && (l.smGroup != i.smGroup)) { l.smGroup = i.smGroup | l.smGroup; i.smGroup = l.smGroup; change = true; } } if (!change) { l = l.next; } } }