Ver Fonte

WebGLObjects: Faster checkEdge.

Mr.doob há 10 anos atrás
pai
commit
5df5fc57f0
1 ficheiros alterados com 4 adições e 3 exclusões
  1. 4 3
      src/renderers/webgl/WebGLObjects.js

+ 4 - 3
src/renderers/webgl/WebGLObjects.js

@@ -271,10 +271,11 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
 
 
 	function checkEdge( edges, a, b ) {
 	function checkEdge( edges, a, b ) {
 
 
-		if ( edges[ a + '|' + b ] === true ) return false;
+		var hash = a < b ? a + '_' + b : b + '_' + a;
 
 
-		edges[ a + '|' + b ] = true;
-		edges[ b + '|' + a ] = true;
+		if ( edges.hasOwnProperty( hash ) ) return false;
+
+		edges[ hash ] = 1;
 
 
 		return true;
 		return true;