|
|
|
@ -65,6 +65,11 @@ public partial class Viewport3D |
|
|
|
|
#if DEBUG |
|
|
|
|
Viewport3Dx.ShowViewCube = true; |
|
|
|
|
Viewport3Dx.ShowCoordinateSystem = true; |
|
|
|
|
Viewport3Dx.ShowCameraInfo = true; |
|
|
|
|
Viewport3Dx.ShowCameraTarget = !Viewport3Dx.ShowCameraTarget; |
|
|
|
|
Viewport3Dx.ShowFrameDetails = !Viewport3Dx.ShowFrameDetails; |
|
|
|
|
Viewport3Dx.ShowFrameRate = !Viewport3Dx.ShowFrameRate; |
|
|
|
|
Viewport3Dx.ShowTriangleCountInfo = !Viewport3Dx.ShowTriangleCountInfo; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -188,7 +193,8 @@ public partial class Viewport3D |
|
|
|
|
var maxDimension = ViewportManager.ModelBounds.Size.Length(); |
|
|
|
|
var distance = maxDimension *1.2; // 调整相机到模型的距离,保证视野范围内 |
|
|
|
|
var camera = Viewport3Dx.Camera as HelixToolkit.Wpf.SharpDX.OrthographicCamera; |
|
|
|
|
camera.Position = new Point3D(center.X, center.Y, center.Z + distance); // 从前面看,Z轴正方向 |
|
|
|
|
camera.Position = new Point3D(center.X, center.Y, center.Z); // 从前面看,Z轴正方向 |
|
|
|
|
camera.Width = ViewportManager.calCameraWidth(); |
|
|
|
|
camera.UpDirection = new Vector3D(0, -1, 0); |
|
|
|
|
camera.LookDirection = new Vector3D(center.X - camera.Position.X, center.Y - camera.Position.Y, center.Z - camera.Position.Z); |
|
|
|
|
ViewportHelperPro.RotateModel(new Vector3D(0,-1,0)); |
|
|
|
|