diff --git a/examples/js/loaders/VRMLLoader.js b/examples/js/loaders/VRMLLoader.js index 397450d1b15ad2ac8b569b7be92d609b5ad10733..d7a3ee81b8383a305b4e52b112ed6b89586baeac 100644 --- a/examples/js/loaders/VRMLLoader.js +++ b/examples/js/loaders/VRMLLoader.js @@ -65,7 +65,7 @@ THREE.VRMLLoader.prototype = { var parseV2 = function ( lines, scene ) { var defines = {}; var float_pattern = /(\b|\-|\+)([\d\.e]+)/; - var float3_pattern = /([\d\.\+\-e]+),?\s+([\d\.\+\-e]+),?\s+([\d\.\+\-e]+)/; + var float3_pattern = /([\d\.\+\-e]+)\s+([\d\.\+\-e]+)\s+([\d\.\+\-e]+)/g; /** * Interpolates colors a and b following their relative distance @@ -279,10 +279,7 @@ THREE.VRMLLoader.prototype = { } else if (this.isRecordingPoints) { - parts = float3_pattern.exec(line); - - // parts may be empty on first and last line - if (null != parts) { + while ( null !== ( parts = float3_pattern.exec(line) ) ) { point = { x: parseFloat(parts[1]), y: parseFloat(parts[2]), @@ -322,10 +319,8 @@ THREE.VRMLLoader.prototype = { } } else if (this.isRecordingColors) { - // this is the float3 regex with the g modifier added, you could also explode the line by comma first (faster probably) - var float3_repeatable = /([\d\.\+\-e]+),?\s+([\d\.\+\-e]+),?\s+([\d\.\+\-e]+)/g; - while( null !== (parts = float3_repeatable.exec(line) ) ) { + while( null !== ( parts = float3_pattern.exec(line) ) ) { color = { r: parseFloat(parts[1]),