WebGLRenderTarget constructor

WebGLRenderTarget(
  1. int width,
  2. int height, [
  3. WebGLRenderTargetOptions? options
])

Implementation

WebGLRenderTarget(int width, int height, [WebGLRenderTargetOptions? options]) {
  this.width = width;
  this.height = height;
  scissor = Vector4(0, 0, width, height);
  scissorTest = false;

  viewport = Vector4(0, 0, width, height);

  this.options = options ?? WebGLRenderTargetOptions({});

  var image = ImageElement(width: width, height: height, depth: 1);

  texture = Texture(image, this.options.mapping, this.options.wrapS, this.options.wrapT, this.options.magFilter,
      this.options.minFilter, this.options.format, this.options.type, this.options.anisotropy, this.options.encoding);
  texture.isRenderTargetTexture = true;
  texture.flipY = false;
  texture.generateMipmaps = this.options.generateMipmaps;
  texture.minFilter = this.options.minFilter != null ? this.options.minFilter! : LinearFilter;

  depthBuffer = this.options.depthBuffer != null ? this.options.depthBuffer! : true;
  stencilBuffer = this.options.stencilBuffer;
  depthTexture = this.options.depthTexture;

  ignoreDepthForMultisampleCopy = this.options.ignoreDepth;
  hasExternalTextures = false;
  useMultisampleRenderToTexture = false;
  useMultisampleRenderbuffer = false;

  _samples = (options != null && options.samples != null) ? options.samples! : 0;
}