I'm very new at Javascript and coding. I use Three.js to make a scene where there is a glass, in which liquid moves depending upon events (mouseMove, click...). I thought about Constructive Solid Geometry to achieve that, in the way depicted on the following images from a 3D modeling program :
Only the cube would move in position and rotation, to make the liquid look like filling the glass and making "waves". I made some tries using CSG.js with Three.js, but the process seems too costly to be achieved at every frame, and the rendering is not smooth at all.
So my question is, is there any way to make this kind of client-side operation with javascript ? Another API that may help ? Do you think that modeling NURBS with verb.js, subtracting and then making a mesh from the result would be less costly ? Or maybe I'm wrong, it's definitely too costly and I should forget this idea ? Or rather import animations in my scene ?
Any clue would be welcome !