diff --git a/examples/js/loaders/PLYLoader.js b/examples/js/loaders/PLYLoader.js index a30314269c358c..0bc8895dc33477 100644 --- a/examples/js/loaders/PLYLoader.js +++ b/examples/js/loaders/PLYLoader.js @@ -81,7 +81,7 @@ function parseHeader( data ) { - const patternHeader = /^ply([\s\S]*)end_header\r?\n/; + const patternHeader = /^ply([\s\S]*)end_header(\r\n|\r|\n)/; let headerText = ''; let headerLength = 0; const result = patternHeader.exec( data ); @@ -99,7 +99,7 @@ headerLength: headerLength, objInfo: '' }; - const lines = headerText.split( '\n' ); + const lines = headerText.split( /\r\n|\r|\n/ ); let currentElement; function make_ply_element_property( propertValues, propertyNameMapping ) { @@ -269,7 +269,7 @@ } - const lines = body.split( '\n' ); + const lines = body.split( /\r\n|\r|\n/ ); let currentElement = 0; let currentElementCount = 0; diff --git a/examples/jsm/loaders/PLYLoader.js b/examples/jsm/loaders/PLYLoader.js index d9d1c716bacd62..3c35e7cc1df2f7 100644 --- a/examples/jsm/loaders/PLYLoader.js +++ b/examples/jsm/loaders/PLYLoader.js @@ -90,7 +90,7 @@ class PLYLoader extends Loader { function parseHeader( data ) { - const patternHeader = /^ply([\s\S]*)end_header\r?\n/; + const patternHeader = /^ply([\s\S]*)end_header(\r\n|\r|\n)/; let headerText = ''; let headerLength = 0; const result = patternHeader.exec( data ); @@ -109,7 +109,7 @@ class PLYLoader extends Loader { objInfo: '' }; - const lines = headerText.split( '\n' ); + const lines = headerText.split( /\r\n|\r|\n/ ); let currentElement; function make_ply_element_property( propertValues, propertyNameMapping ) { @@ -283,7 +283,7 @@ class PLYLoader extends Loader { } - const lines = body.split( '\n' ); + const lines = body.split( /\r\n|\r|\n/ ); let currentElement = 0; let currentElementCount = 0;