Greedy mesh compiler