Преглед изворни кода

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 пре 11 година
родитељ
комит
01ccd8df79
2 измењених фајлова са 17 додато и 1 уклоњено
  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 );
+
+			}
+		}
+	}
+
 };