Reputation: 6173
I added the textures to the editor with texture viewer, they show up under "Files" tab as "MySkyboxTexture_px.png", "MySkyboxTexture_py.png"
etc, but how do I reference them in scripts? I.e. what is their path?
I tried multiple combinations, e.g. ./textures/MySkyboxTexture
, ./MySkyboxTexture
etc - nothing works.
skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture(
"MySkyboxTexture", // <--- what do i put here?
scene, ["_px.png", "_py.png", "_pz.png", "_nx.png", "_ny.png", "_nz.png"]
);
The debugger shows file not found at ...BabylonJS Editor/resources/app.asar/MySkyboxTexture_px.png
Upvotes: 0
Views: 165
Reputation: 99
You can have two ways to import an image:
You just give a local path in your function, the path must start at the root of your app for example :
-src/
-index.js
-assets/
-file.png
-style/
-style.css
Then if you want to import file.png, you just have to give the url : /assets/file.png
const url = URL.createObjectURL(myImportedBlob);
then use url
as a param for your function.
Upvotes: 1