public static void main(String[] args) {
        Mesh mesh = new Mesh();
        mesh.setBuffer(Type.Position, 3, new float[]{
                    0, 0, 0,
                    1, 0, 0,
                    1, 1, 0,
                    0, 1, 0
                });
        mesh.setBuffer(Type.Index, 2, new short[]{
                    0, 1,
                    1, 2,
                    2, 3,
                    3, 0
                });

        Geometry g1 = new Geometry("g1", mesh);

        ArrayList<Geometry> geoms = new ArrayList<>();
        geoms.add(g1);

        Mesh outMesh = new Mesh();
        mergeGeometries(geoms, outMesh);
        printMesh(outMesh);
    }
Optimizes a scene by combining Geometry with the same material.
All Geometries found in the scene are detached from their parent and
a new Node containing the optimized Geometries is attached.
@param scene The scene to optimize
@param useLods true if you want the resulting geometry to keep lod information
@return The newly created optimized geometries attached to a node
jme3-core/src/tools/java/jme3tools/optimize/GeometryBatchFactory.java