Othographic Projection in XTK

2020-05-04 15:52发布

问题:

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!

回答1:

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);

It uses goog.vec.Mat4.makeOrtho