Ver Fonte

Batch buffer update

Improve pipelining: submit buffer updates in order that they will be
rendered before they are rendered to allow for them to complete before
the data is required.
Ben Adams há 11 anos atrás
pai
commit
01ccd8df79
2 ficheiros alterados com 17 adições e 1 exclusões
  1. 2 0
      src/renderers/WebGLRenderer.js
  2. 15 1
      src/renderers/webgl/WebGLObjects.js

+ 2 - 0
src/renderers/WebGLRenderer.js

@@ -1668,6 +1668,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		objects.update( opaqueObjects );
+		objects.update( transparentObjects );
 		//
 
 		shadowMap.render( scene, camera );

+ 15 - 1
src/renderers/webgl/WebGLObjects.js

@@ -111,7 +111,7 @@ THREE.WebGLObjects = function ( gl, info ) {
 
 	};
 
-	this.update = function ( object ) {
+	var update = function ( object ) {
 
 		var geometry = geometries.get( object );
 
@@ -188,4 +188,18 @@ THREE.WebGLObjects = function ( gl, info ) {
 
 	};
 
+	this.update = function ( renderList ) {
+
+		for ( var i = 0, ul = renderList.length; i < ul; i++ ) {
+
+			var object = renderList[i].object;
+
+			if ( object.material.visible !== false ) {
+
+				update( object );
+
+			}
+		}
+	}
+
 };

粤ICP备19079148号