public static void triangulate(IrMesh mesh) {
        List<IrPolygon> newPolygons = new ArrayList<>(mesh.polygons.length);
        for (IrPolygon inputPoly : mesh.polygons) {
            if (inputPoly.vertices.length == 4) {
                IrPolygon[] tris = quadToTri(inputPoly);
                newPolygons.add(tris[0]);
                newPolygons.add(tris[1]);
            } else if (inputPoly.vertices.length == 3) {
                newPolygons.add(inputPoly);
            } else {
                // N-gon. We have to ignore it.
                logger.log(Level.WARNING, "N-gon encountered, ignoring. "
                                        + "The mesh may not appear correctly. "
                                        + "Triangulate your model prior to export.");
            }
        }
        mesh.polygons = new IrPolygon[newPolygons.size()];
        newPolygons.toArray(mesh.polygons);
    }
Convert mesh from quads / triangles to triangles only.

@param mesh the input IrMesh (not null)
jme3-plugins/src/main/java/com/jme3/scene/plugins/IrUtils.java