declare var os ; declare var Canvas ; export default class TestApp { private canvas : any ; private engine : any ; constructor ( ) { this . canvas = new Canvas ( ) ; this . engine = new BABYLON . Engine ( this . canvas , true , { stencil : true , disableWebGL2Support : false , preserveDrawingBuffer : true , premultipliedAlpha : false } ) ; BABYLON . Engine . ShadersRepository = 'Shaders/' ; } createScene ( ) { const scene = new BABYLON . Scene ( this . engine ) ; const camera = new BABYLON . FreeCamera ( 'camera1' , new BABYLON . Vector3 ( 0 , 5 , - 10 ) , scene ) ; camera . setTarget ( BABYLON . Vector3 . Zero ( ) ) ; camera . attachControl ( this . canvas , true ) ; const light = new BABYLON . HemisphericLight ( 'light1' , new BABYLON . Vector3 ( 0 , 1 , 0 ) , scene ) ; light . intensity = 0.7 ; const sphere = BABYLON . Mesh . CreateSphere ( 'sphere1' , 16 , 2 , scene ) ; sphere . position . y = 1 ; const ground = BABYLON . Mesh . CreateGround ( 'ground1' , 6 , 6 , 2 , scene ) ; scene . onPrePointerObservable . add ( function ( pointerInfo , eventState ) { const event = pointerInfo . event ; let delta = 0 ; if ( event . wheelDelta ) { delta = event . wheelDelta ; } else if ( event . detail ) { delta = - event . detail ; } if ( delta ) { const dir = scene . activeCamera . getDirection ( BABYLON . Axis . Z ) ; if ( delta > 0 ) { scene . activeCamera . position . addInPlace ( dir . scaleInPlace ( delta * 10 ) ) ; } else { scene . activeCamera . position . subtractInPlace ( dir . scaleInPlace ( - delta * 10 ) ) ; } } } , BABYLON . PointerEventTypes . POINTERWHEEL , false ) ; return scene ; } run ( ) { const scene = this . createScene ( ) ; this . engine . runRenderLoop ( ( ) => { const before = os . clock ( ) ; scene . render ( ) ; const time = ( os . clock ( ) - before ) ; console . log ( `Render time: ${ time } sec.` ) ; } ) ; window . addEventListener ( 'resize' , ( ) => { this . engine . resize ( ) ; } ) ; } }