Resizing Window when using EffectComposer

☆樱花仙子☆ 提交于 2019-12-11 03:27:15

问题


I found this fiddle a mounth ago and I implemented it succesfully. It works like a charm except a specific scenario. If I resize the window, from very small to large, it becomes really obvious that the camera Projection Matrix doesn't get updated. This happens both on the jsFiffle example and in my implementation of it. Any possible fix? Thank you!

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);
}

Outline with effect composer demo: http://jsfiddle.net/Eskel/g593q/5/


回答1:


The renderTarget (or targets) used by EffectComposer is not being resized when the window is resized.

In your onWindowResize callback, be sure to call both of the following methods:

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

three.js r.71



来源:https://stackoverflow.com/questions/30626567/resizing-window-when-using-effectcomposer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!