import { Laya } from "Laya" ; import { Camera } from "laya/d3/core/Camera" ; import { DirectionLight } from "laya/d3/core/light/DirectionLight" ; import { Scene3D } from "laya/d3/core/scene/Scene3D" ; import { Sprite3D } from "laya/d3/core/Sprite3D" ; import { Vector3 } from "laya/d3/math/Vector3" ; import { Stage } from "laya/display/Stage" ; import { Loader } from "laya/net/Loader" ; import { Handler } from "laya/utils/Handler" ; import { Stat } from "laya/utils/Stat" ; import { Laya3D } from "Laya3D" ; import { CameraMoveScript } from "../common/CameraMoveScript" ; export class SkinnedMeshSprite3DDemo { private scene : Scene3D ; constructor ( ) { Laya3D . init ( 0 , 0 ) ; Laya . stage . scaleMode = Stage . SCALE_FULL ; Laya . stage . screenMode = Stage . SCREEN_NONE ; Stat . show ( ) ; this . scene = ( < Scene3D > Laya . stage . addChild ( new Scene3D ( ) ) ) ; var camera = ( < Camera > this . scene . addChild ( new Camera ( 0 , 0.1 , 100 ) ) ) ; camera . transform . translate ( new Vector3 ( 0 , 0.5 , 1 ) ) ; camera . transform . rotate ( new Vector3 ( - 15 , 0 , 0 ) , true , false ) ; camera . addComponent ( CameraMoveScript ) ; var directionLight = ( < DirectionLight > this . scene . addChild ( new DirectionLight ( ) ) ) ; directionLight . color = new Vector3 ( 1 , 1 , 1 ) ; directionLight . transform . rotate ( new Vector3 ( - 3.14 / 3 , 0 , 0 ) ) ; Laya . loader . create ( "res/threeDimen/skinModel/dude/dude.lh" , Handler . create ( this , this . onComplete ) ) ; } onComplete ( ) { var dude = ( < Sprite3D > this . scene . addChild ( Loader . getRes ( "res/threeDimen/skinModel/dude/dude.lh" ) ) ) ; var scale = new Vector3 ( 0.1 , 0.1 , 0.1 ) ; dude . transform . localScale = scale ; dude . transform . rotate ( new Vector3 ( 0 , 3.14 , 0 ) ) ; } }