render method

dynamic render(
  1. dynamic renderer,
  2. dynamic writeBuffer,
  3. dynamic readBuffer, {
  4. num? deltaTime,
  5. bool? maskActive,
})
override

Implementation

render(renderer, writeBuffer, readBuffer,
    {num? deltaTime, bool? maskActive}) {
  renderer.getClearColor(this.oldClearColor);
  this.oldClearAlpha = renderer.getClearAlpha();
  this.oldAutoClear = renderer.autoClear;
  renderer.autoClear = false;

  renderer.setClearColor(this.clearColor, alpha: 0.0);

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

  if (this.uniforms[this.textureID] != null) {
    this.uniforms[this.textureID]["value"] = readBuffer.texture;
  }

  if (passes != null) {
    int i = 0;
    int _lastPass = passes!.length - 1;
    WebGLRenderTarget? lastRenderTarget;
    for (Map<String, dynamic> _pass in passes!) {
      this.material.uniforms["acPass"] = {"value": i};
      if (lastRenderTarget != null) {
        this.material.uniforms["acPassTexture"] = {
          "value": lastRenderTarget.texture
        };
      }

      this.material.needsUpdate = true;

      if (this.renderTargetsPass[i] == null) {
        var pars = WebGLRenderTargetOptions({
          "minFilter": LinearFilter,
          "magFilter": LinearFilter,
          "format": RGBAFormat
        });
        var renderTargetPass =
            new WebGLRenderTarget(readBuffer.width, readBuffer.height, pars);
        renderTargetPass.texture.name = 'renderTargetPass' + i.toString();
        renderTargetPass.texture.generateMipmaps = false;
        this.renderTargetsPass[i] = renderTargetPass;
      }

      if (i >= _lastPass) {
        if (this.renderToScreen) {
          renderPass(renderer, this.material, null, null, null, this.clear);
        } else {
          renderPass(
              renderer, this.material, writeBuffer, null, null, this.clear);
        }
      } else {
        renderPass(renderer, this.material, this.renderTargetsPass[i], null,
            null, this.clear);
      }

      lastRenderTarget = this.renderTargetsPass[i];

      i = i + 1;
    }
  } else {
    if (this.renderToScreen) {
      renderPass(renderer, this.material, null, null, null, this.clear);
    } else {
      renderPass(
          renderer, this.material, writeBuffer, null, null, this.clear);
    }
  }
}