author Yannick Deubel (https://github.com/yandeu)
 *  copyright license https import * as THREE from 'three' ; import * as Types from '@enable3d/common/dist/types' ; import Cameras from './plugins/cameras' ; import { AmmoPhysics } from '@enable3d/ammo-physics/dist/index' ; import { sRGBEncoding } from 'three' ; import { logger } from '@enable3d/common/dist/logger' ; export class ThreeGraphics { public cache : typeof THREE . Cache ; public scene : THREE . Scene ; public renderer : THREE . WebGLRenderer ; public camera : THREE . PerspectiveCamera | THREE . OrthographicCamera ; protected textureAnisotropy : number ; public cameras ! : Cameras ; public physics ! : AmmoPhysics ; constructor ( protected threeGraphicsConfig = { } ) { const { alpha = false , anisotropy = 1 , camera = Cameras . Perspective ( { z : 25 , y : 5 } ) , antialias = false , usePhysics = true , renderer } = threeGraphicsConfig ; this . textureAnisotropy = anisotropy ; this . camera = camera ; this . scene = new THREE . Scene ( ) ; this . renderer = renderer || new THREE . WebGLRenderer ( { antialias , alpha } ) ; this . renderer . shadowMap . enabled = true ; this . renderer . shadowMap . type = THREE . PCFSoftShadowMap ; this . cache = THREE . Cache ; this . cache . enabled = true ; if ( usePhysics ) { if ( typeof Ammo !== 'undefined' ) this . physics = new AmmoPhysics ( this . scene , threeGraphicsConfig ) ; else logger ( 'Are you sure you included ammo.js?' ) ; } } }