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}) {
  var oldAutoClear = renderer.autoClear;
  renderer.autoClear = false;

  var oldClearAlpha, oldOverrideMaterial;

  if (overrideMaterial != null) {
    oldOverrideMaterial = scene.overrideMaterial;

    scene.overrideMaterial = overrideMaterial;
  }

  if (clearColor != null) {
    renderer.getClearColor(_oldClearColor);
    oldClearAlpha = renderer.getClearAlpha();

    renderer.setClearColor(clearColor, alpha: clearAlpha);
  }

  if (clearDepth) {
    renderer.clearDepth();
  }

  renderer.setRenderTarget(renderToScreen ? null : readBuffer);

  // 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);
  }
  renderer.render(scene, camera);

  if (clearColor != null) {
    renderer.setClearColor(_oldClearColor, alpha: oldClearAlpha);
  }

  if (overrideMaterial != null) {
    scene.overrideMaterial = oldOverrideMaterial;
  }

  renderer.autoClear = oldAutoClear;
}