次の方法で共有


Matrix.PerspectiveFovLH(Single,Single,Single,Single)

PerspectiveFovLH メソッド

使用例

  • 射影行列を設定する

視野 (FOV) に基づいて、左手座標系パースペクティブ射影行列を作成する。

定義

Visual Basic Public Shared Function PerspectiveFovLH( _
    ByVal fieldOfViewY As Single, _
    ByVal aspectRatio As Single, _
    ByVal znearPlane As Single, _
    ByVal zfarPlane As Single _
) As Matrix
C# public static Matrix PerspectiveFovLH(
    float fieldOfViewY,
    float aspectRatio,
    float znearPlane,
    float zfarPlane
);
Managed C++ public: static Matrix PerspectiveFovLH(
    float fieldOfViewY,
    float aspectRatio,
    float znearPlane,
    float zfarPlane
);
JScript public static function PerspectiveFovLH(
    fieldOfViewY : float,
    aspectRatio : float,
    znearPlane : float,
    zfarPlane : float
) : Matrix;

パラメータ

fieldOfViewY System.Single.
aspectRatio System.Single.
znearPlane System.Single.
zfarPlane System.Single.

戻り値

Microsoft.DirectX.Matrix.

使用例

射影行列を設定する

この例では、3D カメラ空間 (ビュー空間) 座標を 2D スクリーン座標にトランスフォームする射影トランスフォーム行列の設定方法を示す。

ここでは、射影トランスフォーム行列 Projection を、左手座標系 (LH) の PerspectiveFovLH 行列と等しくなるように設定している。PerspectiveFovLH の入力引数は次のようになる。

  1. 視野角 (ラジアン単位)。この場合はπ/4。
  2. アスペクト比 (空間の高さを幅で割った値)。この場合は 1 で、正方形のウィンドウを表す。
  3. 近クリップ面の距離。この場合は 1 単位。
  4. 遠クリップ面の距離。この場合は 100 単位。
using Microsoft.DirectX;

Direct3D.Device device = null;  // Create rendering device

// For the projection matrix, you set up a perspective transform (which
//   transforms geometry from 3-D view space to 2-D viewport space, with
//   a perspective divide making objects smaller in the distance). To build
//   a perspective transform, you need the field of view (1/4 pi is common),
//   the aspect ratio, and the near and far clipping planes (which define at
//   what distances geometry should be no longer be rendered).
device.Transform.Projection = Matrix.PerspectiveFovLH(
                              (float)Math.PI / 4, 1.0f, 1.0f, 100.0f );

対象

Matrix

© 2002 Microsoft Corporation. All rights reserved. Terms of use.