|
@@ -3197,7 +3197,13 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
function painterSortStable ( a, b ) {
|
|
|
|
|
|
- if ( a.z !== b.z ) {
|
|
|
+ if ( a.material.id !== b.material.id ) {
|
|
|
+
|
|
|
+ // sort by material first (save on state changes)
|
|
|
+
|
|
|
+ return b.material.id - a.material.id;
|
|
|
+
|
|
|
+ } else if ( a.z !== b.z ) {
|
|
|
|
|
|
return b.z - a.z;
|
|
|
|