Jump to content

Texture names and urls


dr3d
 Share

Recommended Posts

I've encountered a problem that's preventing me from loading a saved, serialized scene.

 

new Texture() constructor takes a simple url, and assigns that url to the texture's name. so if the texture url is in a scene directory, the name will include that directory

 

however, Internals.loadTexture()  when deserializing a scene whe encountering a texture, prepends the rootURL to the texture's name. 

 

Consequently, I get errors during loads about rootUrl/rootUrl/image.png not being found ...

 

not causing problems for anyone else?

Link to comment
Share on other sites

Okay I made a quick demo of the problem. It's a bit wonky to use but illustrates problem

 

it's at http://enjoy3d.com/babylonjs/

 

basically it shows a scene made from an imported mesh

it also loads the last 'saved' scene into another scene you can toggle to

 

there are 3 keys you can press:

 

if you type 's', it saves the current scene in the scene directory

if you type 't', it toggles the scene with the one last saved in the scene directory

if you type 'c', it changes the texture of the book to a jpg loaded from the scene directory.

 

if you SAVE the original scene, no problem with the toggle.

But if you change the texture and then save it, next time you refresh (and reload scene) there will be an error about texture

and the toggled scene will show the missing texture pattern

 

So I am trying to work with assets in a scene directory, but the way textures are made during scene de-serialize causes the rootURL to get prepended to the texture name - which already has the rootURL in its name.

 

Let me know if  any of this isn't clear or maybe my overall strategy could be improved somehow

 

tnx!

-scott

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...