gpt4 book ai didi

javascript - 具有正交相机 Canvas 原点更改的 CSS3D 渲染器?

转载 作者:行者123 更新时间:2023-11-30 16:25:35 24 4
gpt4 key购买 nike

当将相机从透视图更改为正交时,相机位置似乎也会发生变化,因此 0,0,0 位于左上角。

这种行为是否正确?

参见 Example

正交

var h = window.innerHeight;
var w = window.innerWidth;

var viewSize = h;
var aspectRatio = w/h; //1 unit should be one pixel
var left = (-aspectRatio * viewSize) / 2;
var right = (aspectRatio * viewSize) / 2;
var top = viewSize / 2;
var bottom = -viewSize / 2;
var near = 1;
var far = 100;

camera = new THREE.OrthographicCamera( left, right, top, bottom, near, far );

Ortho

透视

camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000);
camera.position.z = 500;

Perspective

最佳答案

CSS3DRenderer 不支持 OrthographicCamera

three.js r.73

关于javascript - 具有正交相机 Canvas 原点更改的 CSS3D 渲染器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34175449/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com