Viewport3D.Camera Propriété

Définition

Obtient ou définit un objet de caméra qui projette le contenu 3D du Viewport3D sur la surface 2D du Viewport3D.

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

Valeur de propriété

Caméra qui projette le contenu 3D sur la surface 2D.

Exemples

L’exemple suivant montre comment définir la Camera propriété d’un code à l’aide d’un Viewport3D code. Pour voir l’intégralité du code à partir duquel cet extrait a été extrait, consultez Guide pratique pour créer une scène 3D.

// 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

L’exemple suivant montre comment définir la propriété d’un Viewport3D à l’aide Camera du langage XAML (Extensible Application Markup Language). Pour voir l’intégralité du code à partir duquel cet extrait a été extrait, consultez Guide pratique pour créer une scène 3D.

<!-- 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>

Remarques

Cette propriété représente la projection d’affichage de la scène 3D.

Informations sur les propriétés de dépendance

Champ Identificateur CameraProperty
Propriétés de métadonnées définies sur true Aucun

Notes

Le type de métadonnées de cette propriété de dépendance est PropertyMetadata, et non FrameworkPropertyMetadata.

S’applique à