Added function to write mesh to obj files.