简体   繁体   English

three.js正交相机:全部缩放

[英]three.js Orthographic Camera: Zoom All

I am a complete newbee to three.js , and I cannot find out how to implement a "zoom all" with a OrthograpicCamera . 我是three.js的完整three.js ,而且我找不到如何使用OrthograpicCamera实现“全部缩放”的方法。 I have been searching on the documentation and on the web, and I have only found solutions for PerspectiveCamera , that involve altering the field of view. 我一直在文档和Web上进行搜索,但只找到了PerspectiveCamera解决方案,该解决方案涉及更改视野。

My goal is to achieve a fitting of all the 3D objects of a scene to the screen, so they are shown as bigger as possible. 我的目标是使场景的所有3D对象都适合屏幕,因此将它们显示得尽可能大。 Any ideas to achieve this will be helpful. 任何实现此目的的想法都会有所帮助。 Thanks. 谢谢。

You could calculate the 2D screen space bounding box around all the objects, and then use that to set the height and width of the orthographic camera. 您可以计算所有对象周围的2D屏幕空间边界框,然后使用它来设置正交摄影机的高度和宽度。 See how to calculate it here: ThreeJS 2D bounding box of 3D object 在此处查看如何计算: 3D对象的ThreeJS 2D边界框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM