Explorar o código

WebGLRenderer: Sort by material.id first. See #5077.
webgl_sandbox goes from ~30.000 to ~7.000 calls.

Mr.doob %!s(int64=11) %!d(string=hai) anos
pai
achega
140dba7529
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      src/renderers/WebGLRenderer.js

+ 7 - 1
src/renderers/WebGLRenderer.js

@@ -3197,7 +3197,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	function painterSortStable ( a, b ) {
 	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;
 			return b.z - a.z;
 
 

粤ICP备19079148号