OrthographicCamera 构造函数

定义

初始化 OrthographicCamera 类的新实例。

重载

OrthographicCamera()

初始化 OrthographicCamera 类的新实例。

OrthographicCamera(Point3D, Vector3D, Vector3D, Double)

使用指定的位置、投影方向、向上方向和宽度初始化 OrthographicCamera 类的新实例。

OrthographicCamera()

初始化 OrthographicCamera 类的新实例。

public:
 OrthographicCamera();
public OrthographicCamera ();
Public Sub New ()

示例

以下示例实例化一个 OrthographicCamera

//Toggle between camera projections.
public void ToggleCamera(object sender, EventArgs e)
{
    if ((bool)CameraCheck.IsChecked == true)
    {
        OrthographicCamera myOCamera = new OrthographicCamera(new Point3D(0, 0, -3), new Vector3D(0, 0, 1), new Vector3D(0, 1, 0), 3);
        myViewport.Camera = myOCamera;
    }
    if ((bool)CameraCheck.IsChecked != true)
    {
        PerspectiveCamera myPCamera = new PerspectiveCamera(new Point3D(0, 0, -3), new Vector3D(0, 0, 1), new Vector3D(0, 1, 0), 50);
        myViewport.Camera = myPCamera;
    }
}
'Toggle between camera projections.
Public Sub ToggleCamera(ByVal sender As Object, ByVal e As EventArgs)
    If CBool(CameraCheck.IsChecked) = True Then
        Dim myOCamera As New OrthographicCamera(New Point3D(0, 0, -3), New Vector3D(0, 0, 1), New Vector3D(0, 1, 0), 3)
        myViewport.Camera = myOCamera
    End If
    If CBool(CameraCheck.IsChecked) <> True Then
        Dim myPCamera As New PerspectiveCamera(New Point3D(0, 0, -3), New Vector3D(0, 0, 1), New Vector3D(0, 1, 0), 50)
        myViewport.Camera = myPCamera
    End If
End Sub

适用于

OrthographicCamera(Point3D, Vector3D, Vector3D, Double)

使用指定的位置、投影方向、向上方向和宽度初始化 OrthographicCamera 类的新实例。

public:
 OrthographicCamera(System::Windows::Media::Media3D::Point3D position, System::Windows::Media::Media3D::Vector3D lookDirection, System::Windows::Media::Media3D::Vector3D upDirection, double width);
public OrthographicCamera (System.Windows.Media.Media3D.Point3D position, System.Windows.Media.Media3D.Vector3D lookDirection, System.Windows.Media.Media3D.Vector3D upDirection, double width);
new System.Windows.Media.Media3D.OrthographicCamera : System.Windows.Media.Media3D.Point3D * System.Windows.Media.Media3D.Vector3D * System.Windows.Media.Media3D.Vector3D * double -> System.Windows.Media.Media3D.OrthographicCamera
Public Sub New (position As Point3D, lookDirection As Vector3D, upDirection As Vector3D, width As Double)

参数

position
Point3D

用于指定摄像机位置的 Point3D

lookDirection
Vector3D

用于指定摄像机投影方向的 Vector3D

upDirection
Vector3D

根据旁观者视角指定向上方向的 Vector3D

width
Double

摄像机取景框的宽度(单位为世界单位)。

示例

以下代码实例化了一个 OrthographicCamera

//Toggle between camera projections.
public void ToggleCamera(object sender, EventArgs e)
{
    if ((bool)CameraCheck.IsChecked == true)
    {
        OrthographicCamera myOCamera = new OrthographicCamera(new Point3D(0, 0, -3), new Vector3D(0, 0, 1), new Vector3D(0, 1, 0), 3);
        myViewport.Camera = myOCamera;
    }
    if ((bool)CameraCheck.IsChecked != true)
    {
        PerspectiveCamera myPCamera = new PerspectiveCamera(new Point3D(0, 0, -3), new Vector3D(0, 0, 1), new Vector3D(0, 1, 0), 50);
        myViewport.Camera = myPCamera;
    }
}
'Toggle between camera projections.
Public Sub ToggleCamera(ByVal sender As Object, ByVal e As EventArgs)
    If CBool(CameraCheck.IsChecked) = True Then
        Dim myOCamera As New OrthographicCamera(New Point3D(0, 0, -3), New Vector3D(0, 0, 1), New Vector3D(0, 1, 0), 3)
        myViewport.Camera = myOCamera
    End If
    If CBool(CameraCheck.IsChecked) <> True Then
        Dim myPCamera As New PerspectiveCamera(New Point3D(0, 0, -3), New Vector3D(0, 0, 1), New Vector3D(0, 1, 0), 50)
        myViewport.Camera = myPCamera
    End If
End Sub

适用于