Browse Source

put statistics calculation out of the conditional

Anton 9 years ago
parent
commit
3c757084e9
1 changed files with 8 additions and 10 deletions
  1. 8 10
      src/renderers/webgl/WebGLBufferRenderer.js

+ 8 - 10
src/renderers/webgl/WebGLBufferRenderer.js

@@ -35,28 +35,26 @@ THREE.WebGLBufferRenderer = function ( _gl, extensions, _infoRender ) {
 
 		var position = geometry.attributes.position;
 
+		var count = 0;
+
 		if ( position instanceof THREE.InterleavedBufferAttribute ) {
 
-			var count = position.data.count;
+			count = position.data.count;
 
 			extension.drawArraysInstancedANGLE( mode, 0, count, geometry.maxInstancedCount );
 
-			_infoRender.calls ++;
-			_infoRender.vertices += count * geometry.maxInstancedCount;
-			if ( mode === _gl.TRIANGLES ) _infoRender.faces += geometry.maxInstancedCount * count / 3;
-
 		} else {
 
-			var count = position.count;
+			count = position.count;
 
 			extension.drawArraysInstancedANGLE( mode, 0, count, geometry.maxInstancedCount );
 
-			_infoRender.calls ++;
-			_infoRender.vertices += count * geometry.maxInstancedCount;
-			if ( mode === _gl.TRIANGLES ) _infoRender.faces += geometry.maxInstancedCount * count / 3;
-
 		}
 
+		_infoRender.calls ++;
+		_infoRender.vertices += count * geometry.maxInstancedCount;
+		if ( mode === _gl.TRIANGLES ) _infoRender.faces += geometry.maxInstancedCount * count / 3;
+
 	}
 
 	this.setMode = setMode;