package engine.object; import java.util.Comparator; public class SortZ implements Comparator { public int compare(ObjectGl a, ObjectGl b) { float diff = a.getZPos() - b.getZPos(); if (diff < 0) return -1; else if (diff > 0) return 1; else return 0; } }