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

  var oldClearAlpha, oldOverrideMaterial;

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

    this.scene.overrideMaterial = this.overrideMaterial;
  }

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

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

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

  renderer.setRenderTarget(this.renderToScreen ? null : readBuffer);

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

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

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

  renderer.autoClear = oldAutoClear;
}