开发者

WPF 3D Perspective camera question

开发者 https://www.devze.com 2022-12-30 09:22 出处:网络
I am working on a 3D flip control that can flip horizontally, vertically and开发者_如何学运维 can have any size and square or rectangular shape.

I am working on a 3D flip control that can flip horizontally, vertically and开发者_如何学运维 can have any size and square or rectangular shape.

While I have it working, I ran into a very odd issue with the perspective camera. When I create a MeshGeometry3D I scale to the proper ratio of the content. If the width > height, all is well. However, if height > width, then the 3d mesh is sized too small.

The only thing that fixed this was (if height > width) change the UpDirection on the perspective camera from 0 1 0 to 1 0 0 and apply a 90 rotate transform. When I do this, everything looks perfect.

Anyone know why this is? Does the perspective camera only take width into account when sizing the mesh?

Thanks!


Try to play with the FieldOfView property. That's the angle at which the scene is "seen" by the camera. In your case multiplying the ratio by height / width without changing the FoV should suffice.

0

精彩评论

暂无评论...
验证码 换一张
取 消