RenderTarget constructor

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

Implementation

RenderTarget(this.width, this.height, [WebGLRenderTargetOptions? options]):super(){
  scissor = Vector4(0, 0, width.toDouble(), height.toDouble());
  scissorTest = false;

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

  this.options = options ?? WebGLRenderTargetOptions();

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

  final 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.colorSpace
  );

  texture.isRenderTargetTexture = true;
  texture.flipY = false;
  texture.generateMipmaps = this.options.generateMipmaps;
  texture.internalFormat = this.options.internalFormat;
  texture.minFilter = this.options.minFilter != null ? this.options.minFilter! : LinearFilter;
		texture.colorSpace = this.options.colorSpace ?? NoColorSpace;
  textures = [];

		final count = this.options.count;
		for (int i = 0; i < count; i ++ ) {
			textures.add(texture.clone());
			textures[i].isRenderTargetTexture = true;
		}

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

		resolveDepthBuffer = this.options.resolveDepthBuffer;
		resolveStencilBuffer = this.options.resolveStencilBuffer;

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