vberlier / json-model-viewer

A 3d model viewer for minecraft json models.
https://vberlier.github.io/json-model-viewer/
MIT License
37 stars 9 forks source link

Animated Textures Aren't Loading #2

Open DevScyu opened 6 years ago

DevScyu commented 6 years ago

As the title says, when I try to load animated textures with this they sometimes won't load. They never seem to load the first time the page is loaded but when the canvas is refreshed they seem to have a chance of working after that, you can see a live example of this if needed.

vberlier commented 6 years ago

Looks like you're right! It's been a really long time since I touched any of this code, but I remember that the code for loading images was extremely sloppy. I think the issue was that I started to write these huge synchronous functions and when it came to loading the images, I couldn't just use an onload callback since I was doing everything synchronously. Using dataurls seemed to make the attributes of the image immediately available so I went with that, but it looks like it doesn't work for larger images in general (like animated textures).

Yeah I know this is horrible, I was reaaally new to everything web-related. I'm glad people find this project useful but newbie code has its limitations :/

I'm planning to do a full rewrite, to replace this mess with a proper library. I just didn't get to do it yet.

I'm leaving the issue open so people can see it if they run into the same problem.

DevScyu commented 5 years ago

I would really love to use this so I look forward to what you do!!

vberlier commented 5 years ago

@DevScyu Just letting you know, I finally started working on a complete rewrite. Not usable yet but it's going pretty well so far. I'm currently building a clean lower level library that will be able to create three.js geometry, materials and meshes from minecraft models :point_right: https://github.com/vberlier/three-mcmodel.

DevScyu commented 5 years ago

Okay thanks for letting me know! I'm looking forward to using it. I might even see if I can contribute towards it.

On Thu, 18 Oct 2018, 11:46 pm Valentin Berlier, notifications@github.com wrote:

@DevScyu https://github.com/DevScyu Just letting you know, I finally started working on a complete rewrite. Not usable yet but it's going pretty well so far. I'm currently building a clean lower level library that will be able to create three.js geometry, materials and meshes from minecraft models 👉 https://github.com/vberlier/three-mcmodel.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vberlier/json-model-viewer/issues/2#issuecomment-431189115, or mute the thread https://github.com/notifications/unsubscribe-auth/AOh1btySCavM0uq4zErA5n4-dhFa3DaQks5umQS5gaJpZM4Vf8QJ .