Sign in to follow this  
DylanD

Preloading Help

Recommended Posts

Hey everyone,

    I am trying to use assetManager to preload as much as I can.  I already have it preloading all of my sounds.  However when trying to preload gui elements (specifically gui images) i get stuck.  I can use addImageTask to get a HTMLImageElement, however i dont know how to make that into a gui element.

 

Any ideas? :D 

Share this post


Link to post
Share on other sites
26 minutes ago, Deltakosh said:

hey!

here is how you can do it: https://www.babylonjs-playground.com/#XCPP9Y#718

Thanks DK that works great!! :D 

Just for future reference (as im sure i will forget sooner or later) here is how i ended up doing it with assetsManager

https://www.babylonjs-playground.com/#XCPP9Y#719

Thanks again!

Share this post


Link to post
Share on other sites
45 minutes ago, Sebavan said:

You could probably rely on TextFileAssetTask and once the task is done fill the ShaderStore with your custom shaders ?

hmm, im not sure i understand what you mean.  To clarify(as i am a novice and want to make sure we are on the same page), i have shaders saved as shaderName.vertex.fx and shaderName.fragment.fx, i want to load them with other preloaded assets, just to make the game a bit smoother on initial load in.  I plan on saving them to a global object/global variable in my project.  

How i have the shaders implemented already is (with having the shaders save like above) i use

 

new BABYLON.ShaderMaterial("",scene, shaderPath, {attributes:[], uniforms:[]});

 

That works great, however i dont use shader store.

 

So what you are saying is i could use textFileAsset task then use that as the fragment and vertex files or use that text to write to shaderstore?

 

Im not sure i would do that as it seems somewhat complicated for little gain (i have 4 shaders so loaded files)

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.