浏览代码

change WebGLObjects.updateList to weakmap

Yutaka Obuchi 5 年之前
父节点
当前提交
00f2d38994
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/renderers/webgl/WebGLObjects.js

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

@@ -4,7 +4,7 @@
 
 function WebGLObjects( gl, geometries, attributes, info ) {
 
-	var updateList = {};
+	var updateMap = new WeakMap();
 
 	function update( object ) {
 
@@ -15,7 +15,7 @@ function WebGLObjects( gl, geometries, attributes, info ) {
 
 		// Update once per frame
 
-		if ( updateList[ buffergeometry.id ] !== frame ) {
+		if ( updateMap.get( buffergeometry ) !== frame ) {
 
 			if ( geometry.isGeometry ) {
 
@@ -25,7 +25,7 @@ function WebGLObjects( gl, geometries, attributes, info ) {
 
 			geometries.update( buffergeometry );
 
-			updateList[ buffergeometry.id ] = frame;
+			updateMap.set( buffergeometry, frame );
 
 		}
 
@@ -41,7 +41,7 @@ function WebGLObjects( gl, geometries, attributes, info ) {
 
 	function dispose() {
 
-		updateList = {};
+		updateMap.clear();
 
 	}