import { Laya } from "Laya" ; import { BaseCamera } from "laya/d3/core/BaseCamera" ; import { Camera } from "laya/d3/core/Camera" ; import { DirectionLight } from "laya/d3/core/light/DirectionLight" ; import { BaseMaterial } from "laya/d3/core/material/BaseMaterial" ; import { Material } from "laya/d3/core/material/Material" ; import { MeshSprite3D } from "laya/d3/core/MeshSprite3D" ; import { Scene3D } from "laya/d3/core/scene/Scene3D" ; import { Matrix4x4 } from "laya/d3/math/Matrix4x4" ; 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 { CameraMoveScript } from "../common/CameraMoveScript" ; export class SceneLoad2 { constructor ( ) { Laya3D . init ( 0 , 0 ) ; Laya . stage . scaleMode = Stage . SCALE_FULL ; Laya . stage . screenMode = Stage . SCREEN_NONE ; Stat . show ( ) ; Scene3D . load ( "res/threeDimen/scene/TerrainScene/XunLongShi.ls" , Handler . create ( this , function ( scene ) : void { Laya . stage . addChild ( scene ) ; scene . enableFog = true ; scene . fogColor = new Vector3 ( 0 , 0 , 0.6 ) ; scene . fogStart = 10 ; scene . fogRange = 40 ; scene . ambientColor = new Vector3 ( 0.6 , 0 , 0 ) ; var camera = new Camera ( ) ; scene . addChild ( camera ) ; camera . transform . translate ( new Vector3 ( 10 , 15 , - 25 ) ) ; camera . transform . rotate ( new Vector3 ( - 20 , 170 , 0 ) , false , false ) ; camera . aspectRatio = 0 ; camera . nearPlane = 0.1 ; camera . farPlane = 1000 ; camera . clearFlag = BaseCamera . CLEARFLAG_SKY ; camera . fieldOfView = 60 ; camera . addComponent ( CameraMoveScript ) ; BaseMaterial . load ( "res/threeDimen/skyBox/skyBox2/skyBox2.lmat" , Handler . create ( this , function ( mat ) : void { var skyRenderer = camera . skyRenderer ; skyRenderer . mesh = SkyBox . instance ; skyRenderer . material = mat ; } ) ) ; var light = ( < DirectionLight > scene . addChild ( new DirectionLight ( ) ) ) ; light . transform . translate ( new Vector3 ( 0 , 2 , 5 ) ) ; var mat = light . transform . worldMatrix ; mat . setForward ( new Vector3 ( 0 , - 5 , 1 ) ) ; light . transform . worldMatrix = mat ; light . color = new Vector3 ( 0.3 , 0.3 , 0.3 ) ; ( ( < MeshSprite3D > scene . getChildByName ( 'Scenes' ) . getChildByName ( 'HeightMap' ) ) ) . active = false ; ( ( < MeshSprite3D > scene . getChildByName ( 'Scenes' ) . getChildByName ( 'Area' ) ) ) . active = false ; } ) ) ; } }