Skip to content

Commit

Permalink
PLYLoader: Fix for linesplitting on universal newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
gregash committed Jun 22, 2022
1 parent f45ba9b commit b4ed33d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/js/loaders/PLYLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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 ) {
Expand Down Expand Up @@ -269,7 +269,7 @@

}

const lines = body.split( '\n' );
const lines = body.split( /[\r\n|\r|\n]/ );
let currentElement = 0;
let currentElementCount = 0;

Expand Down
6 changes: 3 additions & 3 deletions examples/jsm/loaders/PLYLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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 ) {
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit b4ed33d

Please sign in to comment.