three.js正交相机:全部缩放 [英] three.js Orthographic Camera: Zoom All

查看:514
本文介绍了three.js正交相机:全部缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于three.js,我是一个完全的新手,但我找不到如何使用OrthograpicCamera实施全部缩放"的方法.我一直在文档和网络上进行搜索,但只找到了PerspectiveCamera的解决方案,其中涉及更改视野.

I am a complete newbee to three.js, and I cannot find out how to implement a "zoom all" with a 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.

我的目标是使场景的所有3D对象都适合屏幕,因此将它们显示得尽可能大.任何实现此目的的想法都会有所帮助.谢谢.

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. Any ideas to achieve this will be helpful. Thanks.

推荐答案

您可以计算所有对象周围的2D屏幕空间边界框,然后使用它来设置正交摄影机的高度和宽度.在此处查看如何计算: 3D对象的ThreeJS 2D边界框

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. See how to calculate it here: ThreeJS 2D bounding box of 3D object

这篇关于three.js正交相机:全部缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆