renderPass method

dynamic renderPass(
  1. dynamic renderer,
  2. dynamic passMaterial,
  3. dynamic renderTarget,
  4. dynamic clearColor,
  5. dynamic clearAlpha,
  6. dynamic clear,
)

Implementation

renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha, clear) {
  // print("renderPass passMaterial: ${passMaterial} renderTarget: ${renderTarget}  ");
  // print(passMaterial.uniforms);

  // setup pass state
  renderer.autoClear = false;

  renderer.setRenderTarget(renderTarget);

  if (clearColor != null) {
    renderer.setClearColor(clearColor);
    renderer.setClearAlpha(clearAlpha ?? 0.0);
    renderer.clear();
  }

  // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
  if (clear) {
    renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);
  }

  fsQuad.material = passMaterial;
  fsQuad.render(renderer);

  // restore original state
  renderer.autoClear = oldAutoClear;
  renderer.setClearColor(oldClearColor);
  renderer.setClearAlpha(oldClearAlpha);
}