Laya3D-多照摄像机
Laya3D-多照摄像机
/* 多照相机 */
export class MultipleCamera extends Laya.Scene3D{ private camera1:Laya.Camera; private camera2:Laya.Camera; constructor() { super(); this.init(); } private init():void{ //摄像机1 this.camera1 = this.addChild(new Laya.Camera( 0, 0.1, 100)) as Laya.Camera; this.camera1.clearFlag = Laya.CameraClearFlags.SolidColor; this.camera1.transform.translate(new Laya.Vector3(0, 0, 1.5)); this.camera1.normalizedViewport = new Laya.Viewport(0, 0, 0.5, 1.0); //摄像机2 this.camera2 = this.addChild(new Laya.Camera( 0, 0.1, 100)) as Laya.Camera; this.camera2.transform.translate(new Laya.Vector3(0, 0, 1.5)); this.camera2.normalizedViewport = new Laya.Viewport(0.5, 0.1, 0.5, 0.5); this.camera2.clearFlag = Laya.CameraClearFlags.Sky; Laya.Material.load("res/threeDimen/skyBox/skyBox2/skyBox2.lmat", Laya.Handler.create(this, function(mat:Laya.SkyBoxMaterial):void { let skyRenderer:Laya.SkyRenderer = this.camera2.skyRenderer; skyRenderer.mesh = Laya.SkyBox.instance; skyRenderer.material = mat; })); let directionLight:Laya.DirectionLight = this.addChild(new Laya.DirectionLight()) as Laya.DirectionLight; Laya.Sprite3D.load("res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh", Laya.Handler.create(this, function(sp:Laya.Sprite3D):void { let layaMonkey:Laya.Sprite3D = this.addChild(sp) as Laya.Sprite3D; })); } }