Jelajahi Sumber

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 tahun lalu
induk
melakukan
01ccd8df79
2 mengubah file dengan 17 tambahan dan 1 penghapusan
  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号