Skip to content

Commit

Permalink
sort opaque meshes first.
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed Sep 25, 2024
1 parent 4a22ef5 commit c59558c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,16 @@ private void sortMeshMaterialList(List<MeshMaterial> meshMaterial) {
if(m1==null) return -1;
if(m2==null) return 1;

// TODO sort opaque materials first
// sort opaque materials first
var a1 = m1.getDiffuseColor().getAlpha();
var a2 = m2.getDiffuseColor().getAlpha();
if(a1!=255 || a2!=255) {
return a2-a1;
}

// TODO sort transparent materials by distance from camera

// sort by UniqueID so there's a consistent order
return m1.getUniqueID().compareTo(m2.getUniqueID());
});
}
Expand Down

0 comments on commit c59558c

Please sign in to comment.