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}) {
  if (maskActive == true) renderer.state.buffers.stencil.setTest(false);

  // Render quad with blured scene into texture (convolution pass 1)

  this.fsQuad.material = this.materialConvolution;

  this.convolutionUniforms['tDiffuse']["value"] = readBuffer.texture;
  this.convolutionUniforms['uImageIncrement']["value"] = BloomPass.blurX;

  renderer.setRenderTarget(this.renderTargetX);
  renderer.clear(null, null, null);
  this.fsQuad.render(renderer);

  // Render quad with blured scene into texture (convolution pass 2)

  this.convolutionUniforms['tDiffuse']["value"] = this.renderTargetX.texture;
  this.convolutionUniforms['uImageIncrement']["value"] = BloomPass.blurY;

  renderer.setRenderTarget(this.renderTargetY);
  renderer.clear(null, null, null);
  this.fsQuad.render(renderer);

  // Render original scene with superimposed blur to texture

  this.fsQuad.material = this.materialCopy;

  this.uniforms['tDiffuse']["value"] = this.renderTargetY.texture;

  if (maskActive == true) renderer.state.buffers.stencil.setTest(true);

  renderer.setRenderTarget(readBuffer);
  if (this.clear) renderer.clear(null, null, null);
  this.fsQuad.render(renderer);
}