Added depth sorting based on Z coordinate in the transformation, fixed triangulation and chunk allocation