debugged cube mesh generation