RenderTarget constructor
RenderTarget([
- int width = 1,
- int height = 1,
- WebGLRenderTargetOptions? options
Implementation
RenderTarget([this.width = 1, this.height = 1, 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();
depth = this.options.depth;
final image = ImageElement(width: width, height: height, depth: depth);
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 ?? 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;
textures[i].renderTarget = this;
}
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 = this.options.samples ?? 0;
multiview = this.options.multiview;
}