• D
    Improves/extends whitespace parsing in OBJLoader · d7b9dfd3
    Dahie 提交于
    I had the issue that some of my OBJ-files weren't loaded by the OBJLoader provided in the examples. Parsing the file crashed with this exception:
    
    Uncaught TypeError: Cannot read property 'x' of undefined Three.js:13
    THREE.Vector3.addSelf (Three.js:13)
    THREE.Geometry.computeCentroids (Three.js:91)
    THREE.OBJLoader.parse (OBJLoader.js:295)
    xhr.onreadystatechange (OBJLoader.js:21)
    
    I traced the error to the OBJLoader and my OBJ files. The obj files were exported by 3ds Max Wavefront OBJ Exporter and slightly differ in format:
    
    Where the loader expected:
    v 0.4500 1.5256 0.6595
    
    they were:
    v  0.4500 1.5256 0.6595
    
    Note the extra space. This threw off the regular expressions, the vertices weren't parsed and the computeCentroid failed. This commit changes the regular impression to accomodate this variance.
    d7b9dfd3
OBJLoader.js 6.9 KB