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

GLTFLoader: Fix use of setPath with external resources #27106

Merged
merged 6 commits into from
Nov 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,13 @@ class GLTFLoader extends Loader {

} else if ( this.path !== '' ) {

resourcePath = this.path;
// If a base path is set, resources will be relative paths from that plus the relative path of the gltf file
// Example path = 'https://my-cnd-server.com/', url = 'assets/models/model.gltf'
// resourcePath = 'https://my-cnd-server.com/assets/models/'
// referenced resource 'model.bin' will be loaded from 'https://my-cnd-server.com/assets/models/model.bin'
// referenced resource '../textures/texture.png' will be loaded from 'https://my-cnd-server.com/assets/textures/texture.png'
const relativeUrl = LoaderUtils.extractUrlBase( url );
resourcePath = LoaderUtils.resolveURL( relativeUrl, this.path );

} else {

Expand Down
Loading