author Yannick Deubel (https://github.com/yandeu)
 *  copyright license https import { OrthographicCameraConfig , PerspectiveCameraConfig } from '@enable3d/common/dist/types' ; import { OrthographicCamera , PerspectiveCamera } from 'three' ; export default class Cameras { public perspectiveCamera ( config = { } ) { return Cameras . Perspective ( config ) ; } public orthographicCamera ( config = { } ) { return Cameras . Orthographic ( config ) ; } static Perspective ( config = { } ) { const { fov = 50 , aspect = window . innerWidth / window . innerHeight , near = 0.1 , far = 2000 , x = 0 , y = 5 , z = 25 } = config ; const camera = new PerspectiveCamera ( fov , aspect , near , far ) ; camera . position . set ( x , y , z ) ; return camera ; } static Orthographic ( config = { } ) { const width = window . innerWidth ; const height = window . innerHeight ; const { left = width / - 2 , right = width / 2 , top = height / 2 , bottom = height / - 2 , near = 1 , far = 1000 , x = 0 , y = 0 , z = 10 } = config ; const camera = new OrthographicCamera ( left , right , top , bottom , near , far ) ; camera . position . set ( x , y , z ) ; return camera ; } }