Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USDZLoader: Avoid recursive calls of parseNextLine(). #27169

Merged
merged 1 commit into from
Nov 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 3 additions & 17 deletions examples/jsm/loaders/USDZLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,15 @@ class USDAParser {
const data = {};

const lines = text.split( '\n' );
const length = lines.length;

let current = 0;
let string = null;
let target = data;

const stack = [ data ];

// debugger;

function parseNextLine() {

const line = lines[ current ];
for ( const line of lines ) {

// console.log( line );

Expand Down Expand Up @@ -74,7 +70,7 @@ class USDAParser {

stack.pop();

if ( stack.length === 0 ) return;
if ( stack.length === 0 ) continue;

target = stack[ stack.length - 1 ];

Expand All @@ -100,18 +96,8 @@ class USDAParser {

}

current ++;

if ( current < length ) {

parseNextLine();

}

}

parseNextLine();

return data;

}
Expand Down Expand Up @@ -640,7 +626,7 @@ class USDZLoader extends Loader {

}

} else if ( 'float inputs:clearcoat' in surface ) {
} else if ( 'float inputs:clearcoat' in surface ) {

material.clearcoat = parseFloat( surface[ 'float inputs:clearcoat' ] );

Expand Down