Skip to content

Commit

Permalink
GLTFLoader: Fix use of setPath with external resources (mrdoob#27106)
Browse files Browse the repository at this point in the history
* Fix for dispose error
sampleRenderTarget is being deleted and set to null by super.dispose();
the check for undefined was incorrect causing an attempt to call dispose on a null object.

* Removed disposal of sampleRenderTarget entierly

* Fix for setting path not affecting GLTF Sub Assets correctly.

* Fixed Comment

* Update GLTFLoader.js

Fix code style.

---------

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
  • Loading branch information
Archimagus and Mugen87 authored Nov 4, 2023
1 parent 38990d8 commit 15d3a1d
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 15d3a1d

Please sign in to comment.