render method

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

Implementation

render(renderer, writeBuffer, readBuffer,
    {num? deltaTime, bool? maskActive}) {
  this.uniforms['tOld']["value"] = this.textureOld.texture;
  this.uniforms['tNew']["value"] = readBuffer.texture;

  renderer.setRenderTarget(this.textureComp);
  this.compFsQuad.render(renderer);

  this.copyFsQuad.material.map = this.textureComp.texture;

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

    if (this.clear) renderer.clear(true, true, true);

    this.copyFsQuad.render(renderer);
  }

  // Swap buffers.
  var temp = this.textureOld;
  this.textureOld = this.textureComp;
  this.textureComp = temp;
  // Now textureOld contains the latest image, ready for the next frame.
}