import { Laya } from "Laya" ; import { BaseCamera } from "laya/d3/core/BaseCamera" ; import { Camera , CameraClearFlags } from "laya/d3/core/Camera" ; import { DirectionLight } from "laya/d3/core/light/DirectionLight" ; import { SkyProceduralMaterial } from "laya/d3/core/material/SkyProceduralMaterial" ; import { Scene3D } from "laya/d3/core/scene/Scene3D" ; import { Matrix4x4 } from "laya/d3/math/Matrix4x4" ; import { Vector3 } from "laya/d3/math/Vector3" ; import { SkyDome } from "laya/d3/resource/models/SkyDome" ; import { SkyRenderer } from "laya/d3/resource/models/SkyRenderer" ; import { Shader3D } from "laya/d3/shader/Shader3D" ; import { Stage } from "laya/display/Stage" ; import { Stat } from "laya/utils/Stat" ; import { Laya3D } from "Laya3D" ; import { CameraMoveScript } from "../common/CameraMoveScript" ; export class Sky_Procedural { 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 skyRenderer = scene . skyRenderer ; skyRenderer . mesh = SkyDome . instance ; skyRenderer . material = new SkyProceduralMaterial ( ) ; var camera = ( < Camera > scene . addChild ( new Camera ( 0 , 0.1 , 100 ) ) ) ; camera . addComponent ( CameraMoveScript ) ; camera . clearFlag = CameraClearFlags . Sky ; var directionLight = ( < DirectionLight > scene . addChild ( new DirectionLight ( ) ) ) ; var mat = directionLight . transform . worldMatrix ; mat . setForward ( new Vector3 ( - 1.0 , - 1.0 , - 1.0 ) ) ; directionLight . transform . worldMatrix = mat ; var rotation = new Vector3 ( - 0.01 , 0 , 0 ) ; Laya . timer . frameLoop ( 1 , this , function ( ) : void { directionLight . transform . rotate ( rotation ) ; } ) ; } }