render method

  1. @override
dynamic render(
  1. dynamic renderer,
  2. dynamic writeBuffer,
  3. dynamic readBuffer, {
  4. num? deltaTime,
  5. bool? maskActive,
})
override

Implementation

@override
render(renderer, writeBuffer, readBuffer, {num? deltaTime, bool? maskActive}) {
  uniforms['tDiffuse']["value"] = readBuffer.texture;
  uniforms['seed']["value"] = Math.random(); //default seeding
  uniforms['byp']["value"] = 0;

  if (curF % randX == 0 || goWild == true) {
    uniforms['amount']["value"] = Math.random() / 30;
    uniforms['angle']["value"] = MathUtils.randFloat(-Math.pi, Math.pi);
    uniforms['seed_x']["value"] = MathUtils.randFloat(-1, 1);
    uniforms['seed_y']["value"] = MathUtils.randFloat(-1, 1);
    uniforms['distortion_x']["value"] = MathUtils.randFloat(0, 1);
    uniforms['distortion_y']["value"] = MathUtils.randFloat(0, 1);
    curF = 0;
    generateTrigger();
  } else if (curF % randX < randX / 5) {
    uniforms['amount']["value"] = Math.random() / 90;
    uniforms['angle']["value"] = MathUtils.randFloat(-Math.pi, Math.pi);
    uniforms['distortion_x']["value"] = MathUtils.randFloat(0, 1);
    uniforms['distortion_y']["value"] = MathUtils.randFloat(0, 1);
    uniforms['seed_x']["value"] = MathUtils.randFloat(-0.3, 0.3);
    uniforms['seed_y']["value"] = MathUtils.randFloat(-0.3, 0.3);
  } else if (goWild == false) {
    uniforms['byp']["value"] = 1;
  }

  curF++;

  if (renderToScreen) {
    renderer.setRenderTarget(null);
    fsQuad.render(renderer);
  } else {
    renderer.setRenderTarget(writeBuffer);
    if (clear) renderer.clear();
    fsQuad.render(renderer);
  }
}