Freigeben über


Viewport3D.Camera Eigenschaft

Definition

Ruft ein Kameraobjekt ab, das den 3D-Inhalt der Viewport3D 2D-Oberfläche der Viewport3D2D-Oberfläche projiziert, oder legt dieses fest.

public:
 property System::Windows::Media::Media3D::Camera ^ Camera { System::Windows::Media::Media3D::Camera ^ get(); void set(System::Windows::Media::Media3D::Camera ^ value); };
public System.Windows.Media.Media3D.Camera Camera { get; set; }
member this.Camera : System.Windows.Media.Media3D.Camera with get, set
Public Property Camera As Camera

Eigenschaftswert

Die Kamera, die den 3D-Inhalt auf die 2D-Oberfläche ausgibt.

Beispiele

Das folgende Beispiel zeigt das Festlegen der Camera Eigenschaft eines Viewport3D using-Codes. Die gesamte Anzahl des Codes, aus dem dieser Auszug stammt, finden Sie unter How to: Create a 3D Scene.

// Defines the camera used to view the 3D object. In order to view the 3D object,
// the camera must be positioned and pointed such that the object is within view 
// of the camera.
PerspectiveCamera myPCamera = new PerspectiveCamera();

// Specify where in the 3D scene the camera is.
myPCamera.Position = new Point3D(0, 0, 2);

// Specify the direction that the camera is pointing.
myPCamera.LookDirection = new Vector3D(0, 0, -1);

// Define camera's horizontal field of view in degrees.
myPCamera.FieldOfView = 60;

// Asign the camera to the viewport
myViewport3D.Camera = myPCamera;
' Defines the camera used to view the 3D object. In order to view the 3D object,
' the camera must be positioned and pointed such that the object is within view 
' of the camera.
Dim myPCamera As New PerspectiveCamera()

' Specify where in the 3D scene the camera is.
myPCamera.Position = New Point3D(0, 0, 2)

' Specify the direction that the camera is pointing.
myPCamera.LookDirection = New Vector3D(0, 0, -1)

' Define camera's horizontal field of view in degrees.
myPCamera.FieldOfView = 60

' Asign the camera to the viewport
myViewport3D.Camera = myPCamera

Das folgende Beispiel zeigt das Festlegen der Camera Eigenschaft einer Viewport3D extensible Application Markup Language (XAML). Die gesamte Anzahl des Codes, aus dem dieser Auszug stammt, finden Sie unter How to: Create a 3D Scene.

<!-- Add a camera. -->
<Viewport3D.Camera>
    <PerspectiveCamera FarPlaneDistance="20" LookDirection="5,-2,-3" UpDirection="0,1,0" NearPlaneDistance="1" Position="-5,2,3" FieldOfView="45" />
</Viewport3D.Camera>

Hinweise

Diese Eigenschaft stellt die Anzeigeprojektion der 3D-Szene dar.

Informationen zur Abhängigkeitseigenschaft

Element Wert
Bezeichnerfeld CameraProperty
Auf Metadateneigenschaften festgelegt true Nichts

Hinweis

Der Metadatentyp für diese Abhängigkeitseigenschaft lautet PropertyMetadatanicht FrameworkPropertyMetadata.

Gilt für: