copy method

Implementation

WebGLRenderTarget copy(WebGLRenderTarget source) {
  width = source.width;
  height = source.height;
  depth = source.depth;

  viewport.setFrom(source.viewport);
  scissor.setFrom(source.scissor);

  texture = source.texture.clone();
  texture.isRenderTargetTexture = true;

  texture.source = Source(source.texture.image);

  depthBuffer = source.depthBuffer;
  stencilBuffer = source.stencilBuffer;
  if (source.depthTexture != null) {
    depthTexture = source.depthTexture!.clone();
  }

  samples = source.samples;

  return this;
}