EffectComposer constructor

EffectComposer(
  1. WebGLRenderer renderer,
  2. WebGLRenderTarget? renderTarget
)

Implementation

EffectComposer(WebGLRenderer renderer, WebGLRenderTarget? renderTarget) {
  this.renderer = renderer;

  if (renderTarget == null) {
    var parameters = {
      "minFilter": LinearFilter,
      "magFilter": LinearFilter,
      "format": RGBAFormat
    };

    var size = renderer.getSize(new Vector2(null, null));
    this._pixelRatio = renderer.getPixelRatio();
    this._width = size.width.toInt();
    this._height = size.height.toInt();

    renderTarget = new WebGLRenderTarget(
        (this._width * this._pixelRatio).toInt(),
        (this._height * this._pixelRatio).toInt(),
        WebGLRenderTargetOptions(parameters));
  } else {
    this._pixelRatio = 1;
    this._width = renderTarget.width;
    this._height = renderTarget.height;
  }

  this.renderTarget1 = renderTarget;
  this.renderTarget2 = renderTarget.clone();
  this.renderTarget2.texture.name = 'EffectComposer.rt2';

  this.writeBuffer = this.renderTarget1;
  this.readBuffer = this.renderTarget2;

  this.renderToScreen = true;

  this.passes = [];

  // dependencies

  if (CopyShader == null) {
    print('THREE.EffectComposer relies on CopyShader');
  }

  if (ShaderPass == null) {
    print('THREE.EffectComposer relies on ShaderPass');
  }

  this.copyPass = new ShaderPass(CopyShader, null);

  this.clock = new Clock(false);
}