pmndrs / lamina

🍰 An extensible, layer based shader material for ThreeJS
MIT License
1.01k stars 41 forks source link

fix: children should refresh the parent #27

Closed drcmda closed 2 years ago

drcmda commented 2 years ago

lamina will re-create the shader on every render because "children" is not a stable reference. children should rather inform lamina on mount, and when certain props have changed that it must refresh. this of course would duplicate refresh multiple times once you're dealing with multiple layers — this draft would try to work against that.

FarazzShaikh commented 2 years ago

This should be fixed in #29

No more args in anything. All non-uniforms are also converted to setters, the layers then call refresh() on the material when a non unifom changes.

Also removed children and args from <LayerMaterial /> so it will not re-render needlessly

Kevinparra535 commented 2 years ago

I'm having problems with the refresh of the LayoutMaterial, I suppose that PR solves it, when will it be available?

FarazzShaikh commented 2 years ago

@Kevinparra535 Due to deeper underlying issues this PR has been incorporated into the upcoming 1.2.0. You can track progress of it in https://github.com/pmndrs/lamina/pull/29

Will be available as time openes up for me to complete the release.