updateWind static method

void updateWind(
  1. double delta
)

Advance the wind time uniform on every registered foliage material. Call this from your game-loop update, e.g.: Tree.updateWind(frameTime);

Implementation

static void updateWind(double delta) {
  for (final mat in windMaterials) {
    final uniforms = mat.uniforms;
    if (uniforms == null) continue;
    final speed   = (uniforms['u_windSpeed']?['value'] ?? 1.0) as double;
    final current = (uniforms['u_windTime']?['value']  ?? 0.0) as double;
    uniforms['u_windTime']!['value'] = current + speed * delta;
  }
}