render method

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

Implementation

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

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

  this.curF++;

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