pmndrs / react-three-flex

💪📦 Flexbox for react-three-fiber
MIT License
1.65k stars 42 forks source link

WIP: Wasm Yoga port (2021) #67

Open astahmer opened 2 years ago

astahmer commented 2 years ago

Closes #30 #66 Based on #37

I'm definetely not familiar with both WASM and the react-three-flex so please forgive me if anything seems wrong. I feel like the rebase went mostly fine, but please double-check everything especially the conditions in src/Flex.tsx, around the lines of // Recalc all the sizes

One issue remaining is the getIsTopLevelChild in src/util.ts which needs a missing yoga binding (YGNodeGetParent)

drcmda commented 2 years ago

i would love for this project to go forward but i have no idea how to review or test for validity. but after all, if it's maintained the maintainers intuition has more worth than any of that. if you came that far, would you want to take over so that we can move forward more rapidly? i could help with demos testing it out and getting more traction so others can join and help.

could you quickly go into the advantages of the new port? is it faster/slimmer/safer ...

astahmer commented 2 years ago

well, kinda awkward situation but.. same ? I don't think I'm the right guy for the job here 😅 i've got no knowledge on most subjects there, I barely got into 3d/threejs/r3f (like about 3 days ago), I ended up doing this by just trying to start the app using vite without troubles

I litterally have no idea what are the advantages besides the one listed in the original PR, which says that it's slimmer (and looking at the diff on .size-snapshot.json, it seems to be the case indeed !)

Maybe @saitonakamura can help ?

saitonakamura commented 2 years ago

Haha, I was just too afraid to touch wasm, but if you're saying that you don't have experience too (cause you managed to make it work I assumed you are 😅) I can give it a shot. I have pretty good understanding of react-three-flex by now so there's that

giulioz commented 2 years ago

I've tried this approach myself some time ago, the problem is that the code becomes way less easy to maintain and the size/speed advantage is not much. Have you been able to experience real benefits with this?

astahmer commented 2 years ago

I've tried this approach myself some time ago, the problem is that the code becomes way less easy to maintain and the size/speed advantage is not much. Have you been able to experience real benefits with this?

Yeah I did notice that the API wasn't as straightforward as before with yoga-wasm-slim, doesn't seem to be the case with https://github.com/pinqy520/yoga-layout-wasm tho

As for the benefits, no idea, but I couldn't get @react-three/flex running with Vite without it (see https://github.com/pmndrs/react-three-flex/issues/66)

saitonakamura commented 2 years ago

I took my shot at it and here's what I came up with https://github.com/pmndrs/react-three-flex/pull/69