public Mesh makeMeshObject() {

        // Make a new mesh
        mesh = new Mesh(filename, materialLibraryName);
        if (materialLibrary != null) {
        	mesh.importMaterials(materialLibrary.getMaterials());
        }

        // Add the vertices to the Mesh
        for (int vertex = 0; vertex < vertexData.size(); vertex++) {
            float[] coords = (float[]) vertexData.get(vertex);
			mesh.addVertex(coords[0], coords[1], coords[2]);
        }

        // Allocate space for groups
        mesh.makeGroups(groups.size());

        // For each group
        for (int group = 0; group < groups.size(); group++) {
        	// Import its data, allocating space for triangles
            mesh.importGroup(group,
                          ((Group)groups.get(group)).getName(),
                          ((Group)groups.get(group)).getMaterialName(),
                          ((Group)groups.get(group)).getNoOfTriangles());
        }

        // Import triangles to the Mesh. 
        // A Face may be a triangle, quad or polygon.  
        // Convert all faces to triangles.
        
        // For each group
        for (int group = 0; group < groups.size(); group++) {
            int noOfTriangles = 0;
            // Stores its faces
            faces = ((Group)groups.get(group)).getFaces();
            // For each face
            for (int face = 0; face < faces.size(); face++) {
                Face addFace = (Face) faces.get(face);
                // Put vertices, normals, and texture coordinates into the mesh
                // by converting any polygon to a triangle fan, with first vertex (0)
                // at centre:  0,1,2   0,2,3   0,3,4   0,4,5
                for (int triangle = 0; triangle < addFace.getNoOfTriangles(); triangle++) {
                    addTriangle(mesh, group, noOfTriangles, addFace, 0, triangle + 1, triangle + 2, addFace.getMaterialID());
                    noOfTriangles++;
                }
            }
        }

		// Optimise the Mesh
		mesh.optimise();

        // Calculate the dimensions for the mesh
        mesh.calculateDimensions();
        
		return mesh;
	}