【问题标题】:Resizing Window when using EffectComposer使用 EffectComposer 时调整窗口大小
【发布时间】:2015-06-04 13:17:29
【问题描述】:

我在一年前发现了这个小提琴,并且成功地实现了它。除了特定场景外,它就像一个魅力。如果我调整窗口大小,从非常小到大,很明显相机投影矩阵没有得到更新。这发生在 jsFiffle 示例和我的实现中。任何可能的修复?谢谢!

onWindowResize = function(){

    screenWidth  = window.innerWidth;
    screenHeight = window.innerHeight;

    camera1.aspect = screenWidth / screenHeight;
    camera2.aspect = camera1.aspect;
    camera3.aspect = camera1.aspect;

    camera1.updateProjectionMatrix();
    camera2.updateProjectionMatrix();
    camera3.updateProjectionMatrix();

    renderer.setSize( screenWidth, screenHeight);
}

带有效果作曲家演示的大纲:http://jsfiddle.net/Eskel/g593q/5/

【问题讨论】:

  • (1) 为什么要使用 3 个摄像头? (2) 为什么要添加到场景中?

标签: three.js renderer


【解决方案1】:

调整窗口大小时,EffectComposer 使用的 renderTarget(或目标)未调整大小。

在您的onWindowResize 回调中,请务必调用以下两个方法:

renderer.setSize( width, height );
composer.setSize( width, height );

three.js r.71

【讨论】:

  • 谢谢!如此简单的修复:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-05-15
  • 2011-11-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-20
  • 1970-01-01
相关资源
最近更新 更多