2
0
Эх сурвалжийг харах

WebGLObjects: Robustness.

Mr.doob 10 жил өмнө
parent
commit
50a327d1a4

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

@@ -178,25 +178,37 @@ THREE.WebGLObjects = function ( gl, info ) {
 
 
 			var bufferGeometry = geometries[ geometry.id ];
 			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;
+
+				}
 
 
 			}
 			}