resize 窗口时,如何实现渲染物体大小不变

2019-10-15  本文已影响0人  不决书

We want all objects, regardless of their distance from the camera, to appear the same size, even as the window is resized.

The key equation to solving this is this formula for the visible height at a given distance:

visible_height = 2 * Math.tan( ( Math.PI / 180 ) * camera.fov / 2 ) * distance_from_camera;

If we increase the window height by a certain percentage, then what we want is the visible height at all distances
to increase by the same percentage.

This can not be done by changing the camera position. Instead you have to change the camera field-of-view.
http://jsfiddle.net/Q4Jpu/

https://threejs.org/docs/#manual/en/introduction/FAQ

上一篇下一篇

猜你喜欢

热点阅读