Viewport3D.Camera プロパティ

定義

3-D3-DViewport3D コンテンツを 2-D2-DViewport3D 画面に投影するカメラ オブジェクトを取得または設定します。Gets or sets a camera object that projects the 3-D3-D contents of the Viewport3D to the 2-D2-D surface of the 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

プロパティ値

3-D3-D のコンテンツを 2-D2-D 画面に投影するカメラ。The camera that projects the 3-D3-D contents to the 2-D2-D surface.

次の例は、コードを使用して Viewport3DCamera プロパティを設定する方法を示しています。The following example shows setting the Camera property of a Viewport3D using code. この抜粋が作成されたコード全体を確認するには、「方法: 3-D シーンを作成する」を参照してください。To see the entirety of the code from which this excerpt was taken, see How to: Create a 3-D 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

次の例は、Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML)を使用して Viewport3DCamera プロパティを設定する方法を示しています。The following example shows setting the Camera property of a Viewport3D using Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML). この抜粋が作成されたコード全体を確認するには、「方法: 3-D シーンを作成する」を参照してください。To see the entirety of the code from which this excerpt was taken, see How to: Create a 3-D 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>

注釈

このプロパティは、3-D3-D シーンの表示投影を表します。This property represents the viewing projection of the 3-D3-D scene.

依存プロパティ情報Dependency Property Information

識別子フィールドIdentifier field CameraProperty
メタデータプロパティが true に設定されるMetadata properties set to true なしNone

注意

この依存関係プロパティのメタデータ型は PropertyMetadataであり、FrameworkPropertyMetadataではありません。The metadata type on this dependency property is PropertyMetadata, not FrameworkPropertyMetadata.

適用対象