update method

  1. @override
dynamic update(
  1. dynamic frameTime,
  2. dynamic elapsedTime
)
override

Implementation

@override
// only need to do once as all share
update(frameTime, elapsedTime)
{
  for (var idx=0; idx<_waterVertData.length; idx++) {
    var vd=_waterVertData[idx];
    ///  _waterVertData.forEach((vd, idx) => {
    var y = vd['initH']+ math.sin( elapsedTime +
        vd['phase']) * vd['amplitude'];
    g.attributes['position'].setY(idx, y);
    //print("hrrr");

    // });
  }
  g.attributes['position'].needsUpdate = true;
  g.computeVertexNormals();
}