src/components/light.js
function () {
    var el = this.el;
    var data = this.data;
    var light = this.light;

    light.castShadow = data.castShadow;

    // Shadow camera helper.
    var cameraHelper = el.getObject3D('cameraHelper');
    if (data.shadowCameraVisible && !cameraHelper) {
      el.setObject3D('cameraHelper', new THREE.CameraHelper(light.shadow.camera));
    } else if (!data.shadowCameraVisible && cameraHelper) {
      el.removeObject3D('cameraHelper');
    }

    if (!data.castShadow) { return light; }

    // Shadow appearance.
    light.shadow.bias = data.shadowBias;
    light.shadow.radius = data.shadowRadius;
    light.shadow.mapSize.height = data.shadowMapHeight;
    light.shadow.mapSize.width = data.shadowMapWidth;

    // Shadow camera.
    light.shadow.camera.near = data.shadowCameraNear;
    light.shadow.camera.far = data.shadowCameraFar;
    if (light.shadow.camera instanceof THREE.OrthographicCamera) {
      light.shadow.camera.top = data.shadowCameraTop;
      light.shadow.camera.right = data.shadowCameraRight;
      light.shadow.camera.bottom = data.shadowCameraBottom;
      light.shadow.camera.left = data.shadowCameraLeft;
    } else {
      light.shadow.camera.fov = data.shadowCameraFov;
    }
    light.shadow.camera.updateProjectionMatrix();

    if (cameraHelper) { cameraHelper.update(); }
  }
function () {
    var el = this.el;
    var data = this.data;
    var light = this.light;

    light.castShadow = data.castShadow;

    // Shadow camera helper.
    var cameraHelper = el.getObject3D('cameraHelper');
    if (data.shadowCameraVisible && !cameraHelper) {
      el.setObject3D('cameraHelper', new THREE.CameraHelper(light.shadow.camera));
    } else if (!data.shadowCameraVisible && cameraHelper) {
      el.removeObject3D('cameraHelper');
    }

    if (!data.castShadow) { return light; }

    // Shadow appearance.
    light.shadow.bias = data.shadowBias;
    light.shadow.radius = data.shadowRadius;
    light.shadow.mapSize.height = data.shadowMapHeight;
    light.shadow.mapSize.width = data.shadowMapWidth;

    // Shadow camera.
    light.shadow.camera.near = data.shadowCameraNear;
    light.shadow.camera.far = data.shadowCameraFar;
    if (light.shadow.camera instanceof THREE.OrthographicCamera) {
      light.shadow.camera.top = data.shadowCameraTop;
      light.shadow.camera.right = data.shadowCameraRight;
      light.shadow.camera.bottom = data.shadowCameraBottom;
      light.shadow.camera.left = data.shadowCameraLeft;
    } else {
      light.shadow.camera.fov = data.shadowCameraFov;
    }
    light.shadow.camera.updateProjectionMatrix();

    if (cameraHelper) { cameraHelper.update(); }
  }
function ( ) { var el = this . el ; var data = this . data ; var light = this . light ; light . castShadow = data . castShadow ; // Shadow camera helper. var cameraHelper = el . getObject3D ( 'cameraHelper' ) ; if ( data . shadowCameraVisible && ! cameraHelper ) { el . setObject3D ( 'cameraHelper' , new THREE . CameraHelper ( light . shadow . camera ) ) ; } else if ( ! data . shadowCameraVisible && cameraHelper ) { el . removeObject3D ( 'cameraHelper' ) ; } if ( ! data . castShadow ) { return light ; } // Shadow appearance. light . shadow . bias = data . shadowBias ; light . shadow . radius = data . shadowRadius ; light . shadow . mapSize . height = data . shadowMapHeight ; light . shadow . mapSize . width = data . shadowMapWidth ; // Shadow camera. light . shadow . camera . near = data . shadowCameraNear ; light . shadow . camera . far = data . shadowCameraFar ; if ( light . shadow . camera instanceof THREE . OrthographicCamera ) { light . shadow . camera . top = data . shadowCameraTop ; light . shadow . camera . right = data . shadowCameraRight ; light . shadow . camera . bottom = data . shadowCameraBottom ; light . shadow . camera . left = data . shadowCameraLeft ; } else { light . shadow . camera . fov = data . shadowCameraFov ; } light . shadow . camera . updateProjectionMatrix ( ) ; if ( cameraHelper ) { cameraHelper . update ( ) ; } }
Updates shadow-related properties on the current light.
Updates shadow - related properties on the current light .