Share via


Matrix 構造体

[このドキュメントはプレビュー版であり、後のリリースで変更されることがあります。 空白のトピックは、プレースホルダーとして挿入されています。]

行列を記述および処理します。

名前空間:  Microsoft.WindowsMobile.DirectX
アセンブリ:  Microsoft.WindowsMobile.DirectX (Microsoft.WindowsMobile.DirectX.dll 内)

構文

'宣言
Public Structure Matrix
'使用
Dim instance As Matrix
public struct Matrix
public value class Matrix
[<SealedAttribute>]
type Matrix =  struct end

解説

この構造体は、単精度浮動小数点数の 4 × 4 の行列を表します。この構造体のフィールドには、行番号、列番号の順で名前が付けられます。

Microsoft Windows Mobile Direct3D では、射影行列の M34 要素を負数にはできません。アプリケーションがこの位置で負数を使用する必要がある場合は、代わりに射影行列全体を –1 でスケーリングする必要があります。

Matrix 構造体を使用する方法を次の例に示します。

' This code example is from the Direct3D Mobile Matrices Sample' in the .NET Compact Framework Samples in the SDK.PrivateSub SetupMatrices()
    ' For the world matrix, rotate the object about the y-axis.    ' Set up the rotation matrix to generate one full rotation (2*PI radians)     ' every 1000 ms. To avoid the loss of precision inherent in very high     ' floating-point numbers, the system time is modulated by the rotation     ' period before conversion to a radian angle.Dim iTime AsInteger = Environment.TickCount Mod 1000
    Dim fAngle AsSingle = iTime * (2.0F * System.Convert.ToSingle(Math.PI)) / 1000.0F
    device.Transform.World = Matrix.RotationY(fAngle)
    ' Set up the view matrix. A view matrix can be defined given an eye point,    ' a point to lookat, and a direction indicating 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 = 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))
    ' For the projection matrix, 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    ' the distances at which geometry should no longer be rendered).
    device.Transform.Projection = Matrix.PerspectiveFovLH(System.Convert.ToSingle(Math.PI) / 4, 1.0F, 1.0F, 100.0F)
EndSub
// This code example is from the Direct3D Mobile Matrices Sample// in the .NET Compact Framework Samples in the SDK.privatevoid SetupMatrices()
{
    // For the world matrix, rotate the object about the y-axis.// Set up the rotation matrix to generate one full rotation (2*PI radians)// every 1000 ms. To avoid the loss of precision inherent in very high// floating-point numbers, the system time is modulated by the rotation// period before conversion to a radian angle.int iTime = Environment.TickCount % 1000;
    float fAngle = iTime * (2.0f * (float)Math.PI) / 1000.0f;
    device.Transform.World = Matrix.RotationY(fAngle);
    // Set up the view matrix. A view matrix can be defined given an eye point,// a point to look at, and a direction indicating 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 = 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));
    // For the projection matrix, 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// the distances at which geometry should no longer be rendered).
    device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4, 1.0f, 1.0f, 100.0f);
}

スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバーは、スレッド セーフです。 インスタンス メンバーの場合は、スレッド セーフであるとは限りません。

プラットフォーム

Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。 サポートされているバージョンについては、「.NET フレームワークのシステム要件」を参照してください。

バージョン情報

.NET Compact Framework

サポート対象 : 3.5、2.0

参照

参照

Matrix メンバー

Microsoft.WindowsMobile.DirectX 名前空間

その他の技術情報

.NET Compact Framework でモバイル Direct3D プログラミング