brianzinn / react-babylonjs

React for Babylon 3D engine
https://brianzinn.github.io/react-babylonjs/
824 stars 105 forks source link

snippet material with block value update + freeze #111

Closed dennemark closed 3 years ago

dennemark commented 3 years ago

Hi, I updated the snippet material story with freezin/unfreezing of material, if the freeze prop is set to true. The snippet material can now take an array of blockValues, which can be Vectors, Colors and even Textures in the form of an array of objects [{name:"Color", value: new Color(0,0,0)]. The name needs to represent of course the block name. Within the useEffect one can iterate over the array and update the block values. Before and after the change, the material will be un/frozen, which should make it pretty performant.

(I hope it is not an issue, that two old commits want to be merged, too...)

brianzinn commented 3 years ago

Nice update @dennemark it's much more useful the way you have it! Thanks for the contribution 😄