如何使用threejs创建轴测斜/骑士/橱柜? [英] how can I create an axonometric oblique / cavalier / cabinet with threejs?
本文介绍了如何使用threejs创建轴测斜/骑士/橱柜?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 使用 THREE.js 的等距相机中找到了有关如何创建(轴测)等距相机的示例,但如何创建轴测斜线?
I found examples on how to create (axonometric) isometric camera in Isometric camera with THREE.js, but how can I create an axonometric oblique?
推荐答案
您可以渲染带有倾斜的场景 机柜透视使用一种变通方法,其中相机是正交的,并且网格的几何形状在渲染之前用剪切矩阵倾斜.
You can render a scene with an oblique cabinet perspective using a work-around in which the camera is an orthographic one, and the geometry of your mesh is skewed with a shear matrix before rendering.
// 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
这是一个小提琴.
three.js r.72
three.js r.72
这篇关于如何使用threejs创建轴测斜/骑士/橱柜?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文