| 19 | mNoiseBias(xyMap.getWidth(), xyMap.getHeight(), 0.01f, 0.5f) {} |
| 20 | |
| 21 | void FlowField::draw(DrawContext context) { |
| 22 | u32 t_ms = mTimeWarp.update(context.now); |
| 23 | u32 dt_ms = t_ms - mLastWarpedMs; |
| 24 | mLastWarpedMs = t_ms; |
| 25 | // Cap dt to prevent huge jumps when effect was inactive (mode switch). |
| 26 | if (dt_ms > 500) { |
| 27 | dt_ms = 0; |
| 28 | } |
| 29 | mNoiseBias.update(dt_ms * 0.001f); |
| 30 | drawImpl(context, dt_ms, t_ms); |
| 31 | } |
| 32 | |
| 33 | void FlowField::noisePunch(float amplitude, BumpShape shape) { |
| 34 | float cx = getWidth() * 0.5f; |