Share via


Device.Transform (Propiedad)

Actualización: noviembre 2007

Obtiene una matriz que describe un estado de transformación.

Espacio de nombres:  Microsoft.WindowsMobile.DirectX.Direct3D
Ensamblado:  Microsoft.WindowsMobile.DirectX (en Microsoft.WindowsMobile.DirectX.dll)

Sintaxis

'Declaración
Public ReadOnly Property Transform As Transforms
'Uso
Dim instance As Device
Dim value As Transforms

value = instance.Transform
public Transforms Transform { get; }
public:
property Transforms^ Transform {
    Transforms^ get ();
}
public function get Transform () : Transforms

Valor de propiedad

Tipo: Microsoft.WindowsMobile.DirectX.Direct3D.Transforms
Estructura Transforms que describe el estado de transformación devuelto.

Excepciones

Excepción Condición
InvalidCallException

La llamada al método no es válida. Por ejemplo, puede que un parámetro contenga un valor que no es válido.

Ejemplos

En el ejemplo de código siguiente se muestra cómo se utiliza la propiedad Transform.

' This code example is from the Direct3D Mobile Matrices Sample
' in the .NET Compact Framework Samples in the SDK.
Private Sub 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 As Integer = Environment.TickCount Mod 1000
    Dim fAngle As Single = 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)
End Sub
// This code example is from the Direct3D Mobile Matrices Sample
// in the .NET Compact Framework Samples in the SDK.
private void 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);
}

Permisos

Plataformas

Windows CE, Windows Mobile para Smartphone, Windows Mobile para Pocket PC

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Compact Framework

Compatible con: 3.5, 2.0

Vea también

Referencia

Device (Clase)

Device (Miembros)

Microsoft.WindowsMobile.DirectX.Direct3D (Espacio de nombres)