ビュー行列を設定する
ビュー行列を設定する
この例では、ワールド座標をカメラ空間 (ビュー空間) にトランスフォームするビュー トランスフォーム行列の初期化方法を示す。
Vector3 構造体のベクトル成分は、左手 (LH) 座標系ビュー行列を作成する LookAtLH メソッドの引数となる。View トランスフォーム行列は、このビュー行列と等しくなるように設定する。
3 つの入力ベクトルが表す内容は、それぞれ次のとおりである。
- 視点。この場合は [0, 3, -5]。
- カメラの注視対象。 この場合は、原点座標の [0, 0, 0]。
- 現在のワールドの上方。通常は、[0, 1, 0]。
using Microsoft.DirectX.Direct3D;
Device device = null; // Create rendering device
// Set up the view matrix. A view matrix can be defined given an eye point,
// a point to look at, and a direction for which way is up. Here, you set
// the eye five units back along the z-axis and up three units, look at the
// origin, and define "up" to be in the y-direction.
device.Transform.View = Microsoft.DirectX.Matrix.LookAtLH(
new Vector3( 0.0f, 3.0f,-5.0f ),
new Vector3( 0.0f, 0.0f, 0.0f ),
new Vector3( 0.0f, 1.0f, 0.0f ) );
© 2002 Microsoft Corporation. All rights reserved. Terms of use.