import { Laya } from "Laya" ; import { Camera , CameraClearFlags } from "laya/d3/core/Camera" ; import { SkyBoxMaterial } from "laya/d3/core/material/SkyBoxMaterial" ; import { Scene3D } from "laya/d3/core/scene/Scene3D" ; import { Vector3 } from "laya/d3/math/Vector3" ; import { SkyBox } from "laya/d3/resource/models/SkyBox" ; import { SkyRenderer } from "laya/d3/resource/models/SkyRenderer" ; import { Stage } from "laya/display/Stage" ; import { Handler } from "laya/utils/Handler" ; import { Stat } from "laya/utils/Stat" ; import { Laya3D } from "Laya3D" ; import { Material } from "laya/d3/core/material/Material" ; import { CameraMoveScript } from "../common/CameraMoveScript" ; export class Sky_SkyBox { constructor ( ) { Laya3D . init ( 0 , 0 ) ; Laya . stage . scaleMode = Stage . SCALE_FULL ; Laya . stage . screenMode = Stage . SCREEN_NONE ; Stat . show ( ) ; var scene = ( < Scene3D > Laya . stage . addChild ( new Scene3D ( ) ) ) ; var camera = ( < Camera > scene . addChild ( new Camera ( 0 , 0.1 , 100 ) ) ) ; camera . transform . rotate ( new Vector3 ( 10 , 0 , 0 ) , true , false ) ; camera . addComponent ( CameraMoveScript ) ; camera . clearFlag = CameraClearFlags . Sky ; Material . load ( "res/threeDimen/skyBox/DawnDusk/SkyBox.lmat" , Handler . create ( this , function ( mat ) : void { var skyRenderer = camera . skyRenderer ; skyRenderer . mesh = SkyBox . instance ; skyRenderer . material = mat ; var exposureNumber = 0 ; Laya . timer . frameLoop ( 1 , this , function ( ) : void { mat . exposure = Math . sin ( exposureNumber += 0.01 ) + 1 ; mat . rotation += 0.01 ; } ) ; } ) ) ; } }