From 50a327d1a4c2d084319df875da3097f2e0a69638 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Mon, 6 Apr 2015 21:54:56 -0400 Subject: [PATCH] WebGLObjects: Robustness. --- src/renderers/webgl/WebGLObjects.js | 34 +++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/renderers/webgl/WebGLObjects.js b/src/renderers/webgl/WebGLObjects.js index 5cc0c664fd..1f861932c8 100644 --- a/src/renderers/webgl/WebGLObjects.js +++ b/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; + + } } -- GitLab