Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : ✨ resolve [TODO] - provide file size of imported mesh #219

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

slash9494
Copy link

@slash9494 slash9494 commented Apr 22, 2022

Hi @brianzinn
while I use model's onProgress or sceneLoader.Context's progress, I found an unresolved TODO feature that loads a correct file size

So, I resolve this in a simple way
let me show you the before and after video

before it was modified, GUI progress had not correct length and not the total length ( written as 10000) when importing asset file

screen-recording.3.mp4

and after modified, GUI progress run correctly

screen-recording.2.mp4

if there is any issue, please let know me

@brianzinn
Copy link
Owner

hi @slash9494 It's definitely a pain when the file size isn't known and you want to show the progress. Are you downloading the entire file (await fetch ...) to get the file size? Can you perhaps share the calling code as it's not quite clear how this works - thanks!

@slash9494
Copy link
Author

yes, what i tried to do was to get entire file size from local asset path

I thought it was unusual to import large files from a local environment
But, I tried to test with a file that has size as big as possible

So,I tested with two files
one of them is from gltf-sample-models
https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/MosquitoInAmber/glTF-Binary

and another is from sketchfab
https://skfb.ly/o6vrn

  • it can be downloaded for free

on storybook, i just change baseUrl of ScaledModelWithProgress with localUrl
스크린샷 2022-04-25 오후 1 47 55
스크린샷 2022-04-25 오후 1 48 28

so, in useSceneLoader ,the below code is executed
스크린샷 2022-04-25 오후 2 06 16

and I figure out if sceneFilename of ScaleModelWithProgress is not declared, the above code does not execute
so, i commit one more for this with catching error

@brianzinn
Copy link
Owner

Sorry @slash9494 I still do not follow. Are you not downloading the asset twice by fetching again in the callback?

@slash9494
Copy link
Author

yes, you're right. the previous way was not good enough. so I fix a little bit more

I change cache control of fetching for getting file data from disk memory
So after requesting a file in sceneLoader.importMesh, if that is a static asset file, load from disk-memory inonProgress without any request

스크린샷 2022-04-28 오후 5 51 49
스크린샷 2022-04-28 오후 5 52 03

I feel that this way would be better

@brianzinn
Copy link
Owner

Ok - I’ll need to check how it runs after my vacation - May 16. I just need to see if on the first try it will load twice. Otherwise it would need to be an opt-in mechanism - also Babylon.js has built-in caching if you are continuously loading same mesh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants