-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Add lazy option to GLTFLoader. #14492
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ THREE.GLTFLoader = ( function () { | |
|
||
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; | ||
this.dracoLoader = null; | ||
this.lazy = false; | ||
|
||
} | ||
|
||
|
@@ -76,6 +77,13 @@ THREE.GLTFLoader = ( function () { | |
|
||
}, | ||
|
||
setLazy: function ( lazy ) { | ||
|
||
this.lazy = lazy; | ||
return this; | ||
|
||
}, | ||
|
||
parse: function ( data, path, onLoad, onError ) { | ||
|
||
var content; | ||
|
@@ -172,6 +180,14 @@ THREE.GLTFLoader = ( function () { | |
|
||
} ); | ||
|
||
if ( this.lazy ) { | ||
|
||
onLoad( { parser: parser } ); | ||
|
||
return; | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you want to also return the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The When specifying
When using the default non-lazy method:
|
||
|
||
parser.parse( function ( scene, scenes, cameras, animations, json ) { | ||
|
||
var glTF = { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also some pre-processing in
parser.parse()
that still needs to happen here — specificallyparser.markDefs()
.