XTK中的人字投影

问题描述:

因此,我正在使用XTK开发一个应用程序,该应用程序将允许用户在一个渲染器中查看多个3D网格.问题在于它使用的是透视相机而非正射影像,这会导致平移使网格稍微旋转".有没有人成功地使XTK在不修改源代码的情况下进行正交渲染?我宁愿不修改它,但如果需要的话,我会修改它.谢谢!

So I am using XTK to develop a app that will allow users to view multiple 3D meshes in one renderer. The problem is that it uses a perspective camera instead of a orthographic, which causes panning to 'rotate' the meshes a bit. Has anyone been successful in getting XTK to render orthographically without modifying source code? I would rather not modify it but if I have to I will. Thank you!

因此,据我所知,如果不修改源代码,就无法将3D相机设置为正交透视.但是,添加该功能似乎相当简单.如果将以下内容添加到camera3D.js的函数中,应该会得到正确的结果(我在 XTK教程上进行了测试00 ).

So from what I can see, there's no way to set a 3D camera to be in orthographic perspective without modifying the source code. However, it seems fairly straight forward to add that functionality. If you add the following in a function to camera3D.js, that should get the right result (I tested it on XTK Tutorial 00).

this._perspective = X.matrix.makeOrtho(X.matrix.identity(), -100, 100, -100, 100, 1, 10000);

它使用 goog.vec. Mat4.makeOrtho