tentone / nunuStudio

Web powered cross-platform 3D, WebXR game engine.
https://nunustudio.org
MIT License
2.11k stars 316 forks source link

Using texture or image from the assets manager #293

Open shantee opened 5 years ago

shantee commented 5 years ago

Hello I would like to know how to use a texture I previously added to my assets. With for example : new THREE.TextureLoader().load("url") how can I get a texture I already have in my assets without using the url?

tentone commented 5 years ago

Hi

The new THREE.TextureLoader().load("url") should return a THREE.Texture object, store it in a variable and use it as many times as you want.

Cheers

shantee commented 5 years ago

Thank you but can we use a variable instead of the "URL" ? I would prefer to use stuff I previously loaded in the assets panel. Is there something similar to the following logic we could use to achieve it ? : texture = program.getMaterialByName("some_texture_in assets"); and then [...]  new THREE.TextureLoader().load(texture) If it is not possible this is really a missing feature on the assets panel.