import { Singleton } from 'typescript-ioc' ; import { PerspectiveCamera , Quaternion , Vector3 } from 'three' ; @ Singleton export class CameraComponent { private readonly camera : PerspectiveCamera ; constructor ( ) { this . camera = new PerspectiveCamera ( 70 , 1 , 0.0001 , 5000 ) ; } getCamera ( ) { return this . camera ; } setAspectRatio ( ratio ) { this . camera . aspect = ratio ; this . camera . updateProjectionMatrix ( ) ; } setQuaternion ( quaternion ) { this . camera . quaternion . copy ( quaternion ) ; } setPosition ( position ) { this . camera . position . copy ( position ) ; } }