[]Laya截图3D场景相关模型,导致模型透视!
重现问题条件,有一个(.lh)后缀模型资源。
具体代码如下:
(function () {
Laya3D.init(0, 0, true);
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
var resUrl = "../bin/res/modles/role_48_lurenyi/role_48_lurenyi.lh";
var scene = Laya.stage.addChild(new Laya.Scene());
var camera = scene.addChild(new Laya.Camera(0, 0.1, 100));
camera.transform.position = new Laya.Vector3(0, 0, 10);
camera.transform.rotate(new Laya.Vector3(0, 180, 0), true, false);
camera.orthographic = true;
camera.orthographicVerticalSize = 5;
this.effRes = Laya.Sprite3D.load(resUrl);
this.effRes.on(Laya.Event.HIERARCHY_LOADED, this, function(){
this.eff1 = scene.addChild( Laya.Sprite3D.instantiate(this.effRes));
this.eff1.transform.position = new Laya.Vector3(0,0,50);
this.eff1.transform.rotate(new Laya.Vector3(0, 60, 0), true, false);
Laya.timer.callLater(this, screenShot);
});
function screenShot(){
var htmlCanvas = Laya.stage.drawToCanvas(Laya.RenderState.clientWidth,Laya.RenderState.clientHeight,0,0);
var texture = new Laya.Texture(htmlCanvas);
var sp = new Laya.Sprite().pos(100,100);
sp.graphics.drawTexture(texture);
Laya.stage.addChild(sp);
};
}());
具体代码如下:
(function () {
Laya3D.init(0, 0, true);
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
var resUrl = "../bin/res/modles/role_48_lurenyi/role_48_lurenyi.lh";
var scene = Laya.stage.addChild(new Laya.Scene());
var camera = scene.addChild(new Laya.Camera(0, 0.1, 100));
camera.transform.position = new Laya.Vector3(0, 0, 10);
camera.transform.rotate(new Laya.Vector3(0, 180, 0), true, false);
camera.orthographic = true;
camera.orthographicVerticalSize = 5;
this.effRes = Laya.Sprite3D.load(resUrl);
this.effRes.on(Laya.Event.HIERARCHY_LOADED, this, function(){
this.eff1 = scene.addChild( Laya.Sprite3D.instantiate(this.effRes));
this.eff1.transform.position = new Laya.Vector3(0,0,50);
this.eff1.transform.rotate(new Laya.Vector3(0, 60, 0), true, false);
Laya.timer.callLater(this, screenShot);
});
function screenShot(){
var htmlCanvas = Laya.stage.drawToCanvas(Laya.RenderState.clientWidth,Laya.RenderState.clientHeight,0,0);
var texture = new Laya.Texture(htmlCanvas);
var sp = new Laya.Sprite().pos(100,100);
sp.graphics.drawTexture(texture);
Laya.stage.addChild(sp);
};
}());
没有找到相关结果
已邀请:
要回复问题请先登录
12 个回复
Chenyazhi
赞同来自:
Apple
赞同来自:
如果搞不定坐标变换,把在un相机ity里摆好了再输出即可。
Apple
赞同来自:
Apple
赞同来自:
Chenyazhi
赞同来自:
Chenyazhi
赞同来自:
Apple
赞同来自:
Apple
赞同来自:
Apple
赞同来自:
Apple
赞同来自:
Chenyazhi
赞同来自:
(function () {
Laya3D.init(0, 0, true);
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
var resUrl = "../bin/res/modles/role_5_chaoren/role_5_chaoren.lh";
var sceneP = Laya.stage.addChild(new Laya.Sprite());
var scene = sceneP.addChild(new Laya.Scene());
this.effRes = Laya.Sprite3D.load(resUrl);
this.effRes.on(Laya.Event.HIERARCHY_LOADED, this, function(){
this.eff1 = scene.addChild( Laya.Sprite3D.instantiate(this.effRes));
Laya.timer.callLater(this, screenShot);
});
function screenShot(){
var htmlCanvas = Laya.stage.drawToCanvas(Laya.RenderState.clientWidth,Laya.RenderState.clientHeight,0,0);
var texture = new Laya.Texture(htmlCanvas);
var sp = new Laya.Sprite();
sp.graphics.drawTexture(texture);
Laya.stage.addChild(sp);
};
}());
龙某人
赞同来自: