setRenderTargetTextures method

void setRenderTargetTextures(
  1. RenderTarget renderTarget,
  2. dynamic colorTexture,
  3. dynamic depthTexture
)

Implementation

void setRenderTargetTextures(
    RenderTarget renderTarget, colorTexture, depthTexture) {
  properties.get(renderTarget.texture)["__webglTexture"] = colorTexture;
  properties.get(renderTarget.depthTexture)["__webglTexture"] = depthTexture;

  var renderTargetProperties = properties.get(renderTarget);
  renderTargetProperties["__hasExternalTextures"] = true;

  if (renderTargetProperties["__hasExternalTextures"] == true) {
    renderTargetProperties["__autoAllocateDepthBuffer"] =
        depthTexture == null;

    if (!(renderTargetProperties["__autoAllocateDepthBuffer"] == true)) {
      // The multisample_render_to_texture extension doesn't work properly if there
      // are midframe flushes and an external depth buffer. Disable use of the extension.
      if (extensions.has('WEBGL_multisampled_render_to_texture') == true) {
        console.warn(
            'THREE.WebGLRenderer: extension was disabled because an external texture was provided');
        renderTarget.useRenderToTexture = false;
        renderTarget.useRenderbuffer = true;
      }
    }
  }
}