Do you know https://stephaneginier.com/sculptgl/? It is open source [1] so you could adjust it to your needs.
[1] https://github.com/stephomi/sculptgl