소스 검색

WebGLObjects: Robustness.

Mr.doob 10 년 전
부모
커밋
50a327d1a4
1개의 변경된 파일23개의 추가작업 그리고 11개의 파일을 삭제
  1. 23 11
      src/renderers/webgl/WebGLObjects.js

+ 23 - 11
src/renderers/webgl/WebGLObjects.js

@@ -178,25 +178,37 @@ THREE.WebGLObjects = function ( gl, info ) {
 
 			var bufferGeometry = geometries[ geometry.id ];
 
-			if ( geometry.verticesNeedUpdate === true ) {
+			if ( object instanceof THREE.PointCloud || object instanceof THREE.Line ) {
 
-				var attribute = bufferGeometry.attributes.position;
+				if ( geometry.verticesNeedUpdate === true ) {
 
-				attribute.copyVector3sArray( geometry.vertices );
-				attribute.needsUpdate = true;
+					var attribute = bufferGeometry.attributes.position;
 
-				geometry.verticesNeedUpdate = false;
+					if ( attribute !== undefined ) {
 
-			}
+						attribute.copyVector3sArray( geometry.vertices );
+						attribute.needsUpdate = true;
+
+					}
+
+					geometry.verticesNeedUpdate = false;
+
+				}
 
-			if ( geometry.colorsNeedUpdate === true ) {
+				if ( geometry.colorsNeedUpdate === true ) {
 
-				var attribute = bufferGeometry.attributes.color;
+					var attribute = bufferGeometry.attributes.color;
 
-				attribute.copyColorsArray( geometry.colors );
-				attribute.needsUpdate = true;
+					if ( attribute !== undefined ) {
 
-				geometry.colorsNeedUpdate = false;
+						attribute.copyColorsArray( geometry.colors );
+						attribute.needsUpdate = true;
+
+					}
+
+					geometry.colorsNeedUpdate = false;
+
+				}
 
 			}