src/components/scene/screenshot.js
function (projection) {
    var el = this.el;
    var size;
    var camera;
    var cubeCamera;
    // Configure camera.
    if (projection === 'perspective') {
      // Quad is only used in equirectangular mode. Hide it in this case.
      this.quad.visible = false;
      // Use scene camera.
      camera = (this.data.camera && this.data.camera.components.camera.camera) || el.camera;
      size = {width: this.data.width, height: this.data.height};
    } else {
      // Use ortho camera.
      camera = this.camera;
      // Create cube camera and copy position from scene camera.
      cubeCamera = new THREE.CubeCamera(el.camera.near, el.camera.far,
                                        Math.min(this.cubeMapSize, 2048));
      // Copy camera position into cube camera;
      el.camera.getWorldPosition(cubeCamera.position);
      el.camera.getWorldQuaternion(cubeCamera.quaternion);
      // Render scene with cube camera.
      cubeCamera.update(el.renderer, el.object3D);
      this.quad.material.uniforms.map.value = cubeCamera.renderTarget.texture;
      size = {width: this.data.width, height: this.data.height};
      // Use quad to project image taken by the cube camera.
      this.quad.visible = true;
    }
    return {
      camera: camera,
      size: size,
      projection: projection
    };
  }
function (projection) {
    var el = this.el;
    var size;
    var camera;
    var cubeCamera;
    // Configure camera.
    if (projection === 'perspective') {
      // Quad is only used in equirectangular mode. Hide it in this case.
      this.quad.visible = false;
      // Use scene camera.
      camera = (this.data.camera && this.data.camera.components.camera.camera) || el.camera;
      size = {width: this.data.width, height: this.data.height};
    } else {
      // Use ortho camera.
      camera = this.camera;
      // Create cube camera and copy position from scene camera.
      cubeCamera = new THREE.CubeCamera(el.camera.near, el.camera.far,
                                        Math.min(this.cubeMapSize, 2048));
      // Copy camera position into cube camera;
      el.camera.getWorldPosition(cubeCamera.position);
      el.camera.getWorldQuaternion(cubeCamera.quaternion);
      // Render scene with cube camera.
      cubeCamera.update(el.renderer, el.object3D);
      this.quad.material.uniforms.map.value = cubeCamera.renderTarget.texture;
      size = {width: this.data.width, height: this.data.height};
      // Use quad to project image taken by the cube camera.
      this.quad.visible = true;
    }
    return {
      camera: camera,
      size: size,
      projection: projection
    };
  }
function ( projection ) { var el = this . el ; var size ; var camera ; var cubeCamera ; // Configure camera. if ( projection === 'perspective' ) { // Quad is only used in equirectangular mode. Hide it in this case. this . quad . visible = false ; // Use scene camera. camera = ( this . data . camera && this . data . camera . components . camera . camera ) || el . camera ; size = { width : this . data . width , height : this . data . height } ; } else { // Use ortho camera. camera = this . camera ; // Create cube camera and copy position from scene camera. cubeCamera = new THREE . CubeCamera ( el . camera . near , el . camera . far , Math . min ( this . cubeMapSize , 2048 ) ) ; // Copy camera position into cube camera; el . camera . getWorldPosition ( cubeCamera . position ) ; el . camera . getWorldQuaternion ( cubeCamera . quaternion ) ; // Render scene with cube camera. cubeCamera . update ( el . renderer , el . object3D ) ; this . quad . material . uniforms . map . value = cubeCamera . renderTarget . texture ; size = { width : this . data . width , height : this . data . height } ; // Use quad to project image taken by the cube camera. this . quad . visible = true ; } return { camera : camera , size : size , projection : projection } ; }
Capture a screenshot of the scene.

@param {string} projection - Screenshot projection (equirectangular or perspective).
Capture a screenshot of the scene .