question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ColladaLoader: Malformed urls

See original GitHub issue

I’m loading dae via http url, the dae and all of its textures are accessed like wise:

http://<baseurl>/<relative path>/name.dae
http://<baseurl>/<relative path>/TextureResource1.png
http://<baseurl>/<relative path>/TextureResource2.png

All textures in the dae are references like:

<image id = "TextureResource1img">
<init_from>./TextureResource1.jpg</init_from>
</image>
<image id = "TextureResource2img">
<init_from>./TextureResource2.jpg</init_from>

I use ColladaLoader to load dae with relative url like "/<relative path>/name.dae"

  1. When I pass this line:

    var path = (scope.path === '') ? core_js_libs_threejs1_three_module_js__WEBPACK_IMPORTED_MODULE_0__["LoaderUtils"].extractUrlBase(url) : scope.path;

    path is set to "/<relative path>/"

  2. Then in ColladaLoader.parse you create a texture loader and set it’s path to "/<relative path>/"

    textureLoader.setPath(this.resourcePath || path).setCrossOrigin(this.crossOrigin);

  3. In the process of loading the textures you are calling loatTextureForUniform, there

var image = getImage(surface.init_from);

is set to "./TextureResource1.jpg"

since I have path set to "/<relative path>/", I get in the if

if (path) {
	var parts = path.split('/');
	parts.pop();
	let baseUrl = (parts.length < 1 ? '.' : parts.join('/')) + '/';
	url = baseUrl + image;
}

as a result I get url set to "/<relative path>/./TextureResource1.jpg"

Which btw is still fine by the browser since If you call it like this, the browser resolves the relative path to absolute by itself, but you do not stop here!

  1. While makeing this call:

var texture = getTextureLoader(url).load(url);

I end up in ImageLoader.load with url "/<relative path>/./TextureResource1.jpg" and this.path = "/<relative path>/" and this IF kills it:

if ( this.path !== undefined ) url = this.path + url;

The result is url "/<relative path>//<relative path>/./TextureResource1.jpg"?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Mugen87commented, May 25, 2020

Closing due to lack of feedback.

Please share a working demo (e.g. as a live example or a GitHub repo) that demonstrates the issue.

0reactions
Mugen87commented, May 13, 2020

url is “/<relative path>/./TextureResource1.jpg”

Can you please explain once more why this URL is given to ImageLoader? When reading the code in ColladaLoader, it looks like the loader directly passes the image name to the load() method (without modification).

BTW: Instead of copy/paste code, you can also link to source files like I did in my post before.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ColladaLoader can't load two different models - Stack Overflow
You're trampling on the model variable. The callback that you've provided doesn't run until the model is loaded, but it has already started ......
Read more >
Malformed URL | Imperva
Malformed URL Summary SecureSphere has detected an HTTP request that has a malformed URL in its request line. Detailed Description According to the...
Read more >
[Solved]-Animated material colors not working in three.js when ...
It basically looks like the three.js ColladaLoader simply does not support material animations (it only supports position and rotation animations).
Read more >
Final Technical Report - DTIC
Figure 21: KML Tree Network Links . ... two shading techniques are now supported in the latest version of the JView Collada loader....
Read more >
Sweet Home 3D Forum - Create forniture from Sketchup
There was no collada loader in the links you provided. ... full name... but I will give up soon if I find no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found