[这张照片是左侧为Microsoft wpf的面孔绘制,右侧为Sharpdx wpf的面孔绘制。Sharpdx面的边缘不太光滑。这就是我在VB.net中不使用XAML的所有SharpDX代码。我想念什么?
Imports System.Windows
Imports System.Windows.Controls
Imports HelixToolkit.Wpf.SharpDX
Imports SharpDX
Module UnitMain
Public MainForm As New Window
Public FormGrid As New Grid
Public GridPort As New Viewport3DX
Public PortCamera As New PerspectiveCamera
Public PortLamp As New DirectionalLight3D
Public PortModel As New MeshGeometryModel3D
Public ModelBuilder As New MeshBuilder
Sub MainFormInit()
ModelBuilder.AddQuad(New Vector3(-0.5, 0.5, 0), New Vector3(-0.5, -0.5, 0), New Vector3(0.5, -0.5, 0), New SharpDX.Vector3(0.5, 0.5, 0))
PortModel.Geometry = ModelBuilder.ToMeshGeometry3D
PortModel.Material = DiffuseMaterials.Yellow
PortLamp.Color = Media.Colors.White
PortLamp.Direction = New Media.Media3D.Vector3D(2, -1, -3)
PortCamera.Position = New Media.Media3D.Point3D(-2, 1, 3)
PortCamera.LookDirection = New Media.Media3D.Vector3D(2, -1, -3)
PortCamera.FieldOfView = 40
GridPort.Items.Add(PortModel)
GridPort.Items.Add(PortLamp)
GridPort.Camera = PortCamera
GridPort.EffectsManager = New DefaultEffectsManager
FormGrid.Children.Add(GridPort)
MainForm.Width = 800
MainForm.Height = 800
MainForm.Content = FormGrid
End Sub
Sub Main()
MainFormInit()
MainForm.ShowDialog()
End Sub
End Module
作为退休的VB6和VBA程序员,我尝试切换到VB.net并发现了WPF。我的爱好是避免XAML部分。这是可能的,也可以通过功能强大的Helix Toolkit扩展代码来实现。因此,我遇到了上述问题的解决,这要归功于Andrew Morton。添加到上面的代码
GridPort.MSAA = MSAAlevel.Maximum
我的模型的边缘与不使用Helix工具包时我首先绘制的模型一样好。
很棒的论坛!