gpt4 book ai didi

three.js - 如何使用threejs创建轴测斜/骑士/橱柜?

转载 作者:行者123 更新时间:2023-12-03 19:40:34 27 4
gpt4 key购买 nike

我在 Isometric camera with THREE.js 中找到了有关如何创建(轴测)等距相机的示例,但如何创建轴测斜线?

最佳答案

您可以渲染带有倾斜的场景 cabinet perspective使用一种变通方法,其中相机是正交的,并且网格的几何形状在渲染之前用剪切矩阵倾斜。

// create shear matrix
var alpha = Math.PI / 6; // or Math.PI / 4

var Syx = 0,
Szx = - 0.5 * Math.cos( alpha ),
Sxy = 0,
Szy = - 0.5 * Math.sin( alpha ),
Sxz = 0,
Syz = 0;

var matrix = new THREE.Matrix4();

matrix.set( 1, Syx, Szx, 0,
Sxy, 1, Szy, 0,
Sxz, Syz, 1, 0,
0, 0, 0, 1 );

// apply shear matrix to geometry
mesh.geometry.applyMatrix( matrix ); // this is the work-around

这是一个 fiddle .

三.js r.72

关于three.js - 如何使用threejs创建轴测斜/骑士/橱柜?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26021618/

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