import { Component , Input , Optional , SkipSelf } from '@angular/core' ; import * as THREE from 'three' ; import { RendererService } from '../../renderer/renderer.service' ; import { provideParent } from '../../util' ; import { AbstractObject3D } from '../abstract-object-3d' ; @ Component ( { selector : 'atft-point-light' , providers : [ provideParent ( PointLightComponent ) ] , template : '<ng-content></ng-content>' } ) export class PointLightComponent extends AbstractObject3D < THREE . PointLight > { @ Input ( ) color : string | number = '#FFFFFF' ; @ Input ( ) intensity = 1 ; @ Input ( ) distance = 500 ; @ Input ( ) castShadow = false ; constructor ( protected rendererService , @ SkipSelf ( ) @ Optional ( ) protected parent ) { super ( rendererService , parent ) ; } protected newObject3DInstance ( ) { const light = new THREE . PointLight ( this . color , this . intensity , this . distance ) ; if ( this . castShadow === true ) { light . castShadow = this . castShadow ; light . shadow . mapSize . width = 1024 ; light . shadow . mapSize . height = 1024 ; light . shadow . camera . near = 0.5 ; light . shadow . camera . far = 500 ; light . shadow . bias = - 0.001 ; light . shadow . radius = 1 ; } return light ; } }