function onResize(){
//更新相机参数
if(type == 'PerspectiveCamera'){
this.camera.aspect = container.width/container.height;
}
else if(type == 'OrthographicCamera'){
this.camera.left = container.clientLeft;
this.camera..right = container.clientLeft + container.clientWidth;
this.camera.top = container.clientTop;
this.camera.bottom = container.clientTop + container.clientHeight;
}
//更新相机矩阵
this.camera.updateProjectionMatrix();
//更新渲染器
this.renderer.setSize(container.clientWidth,container.clientHeight);
this.CSS2DRenderer.setSize(container.clientWidth,container.clientHeight);
}
Three.js onsize方法 (含对相机的处理)
猜你喜欢
转载自blog.csdn.net/weixin_39423672/article/details/118668580
今日推荐
周排行