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

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

  fsQuad.material = materialConvolution;

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

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

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

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

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

  // Render original scene with superimposed blur to texture

  fsQuad.material = materialCopy;

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

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

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