次の方法で共有


Device.LightsFixed プロパティ

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

固定小数点演算を使用して、現在のデバイスのライトのコレクションを取得します。

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

構文

'宣言
Public ReadOnly Property LightsFixed As LightsFixedCollection
    Get
'使用
Dim instance As Device
Dim value As LightsFixedCollection

value = instance.LightsFixed
public LightsFixedCollection LightsFixed { get; }
public:
property LightsFixedCollection^ LightsFixed {
    LightsFixedCollection^ get ();
}
member LightsFixed : LightsFixedCollection

プロパティ値

型 : Microsoft.WindowsMobile.DirectX.Direct3D.LightsFixedCollection
LightFixed オブジェクトを返します。

解説

.NET Compact Framework では、固定小数点演算のために LightFixed が用意されています。

LightFixed 構造体を使用する方法を次のコード例に示します。

' This code example is from the ' Direct3D Mobile Fixed Point Lighting Sample' of the .NET Compact Framework Samples in the SDK.
' The FrameMove method is called once per frame, ' and is the entry point for animating the scene.PublicSub FrameMove()
    lightData = device.LightsFixed(2)

    ' Rotate through the various light typesIf Fix(appTime) Mod 20 < 10 Then
        device.LightsFixed(2).Type = LightType.Point
    Else
        device.LightsFixed(2).Type = LightType.Directional
    EndIf
    ' Make sure the light type is supported by the device.  If     ' VertexProcessingCaps.PositionAllLights is not set, the device    ' does not support point or spot lights, so change light #2's    ' type to a directional light.IfNot _
     device.DeviceCaps.VertexProcessingCaps.SupportsPositionalLights _
        ThenIf device.LightsFixed(2).Type = LightType.Point Then
            device.LightsFixed(2).Type = LightType.Directional
        EndIfEndIf
    ' Values for the light position, direction, and colorDim x AsSingle = System.Convert.ToSingle(Math.Sin(appTime * 2.0F))
    Dim y AsSingle = System.Convert.ToSingle( _
        Math.Sin(appTime * 2.246F))
    Dim z AsSingle = System.Convert.ToSingle( _
        Math.Sin(appTime * 2.64F))

    Dim r AsByte = System.Convert.ToByte((0.5F + 0.5F * x) * &HFF)
    Dim g AsByte = System.Convert.ToByte((0.5F + 0.5F * y) * &HFF)
    Dim b AsByte = System.Convert.ToByte((0.5F + 0.5F * z) * &HFF)
    device.LightsFixed(2).DiffuseColor = _
        ColorValueFixed.FromColor( _
        System.Drawing.Color.FromArgb(r, g, b))
    device.LightsFixed(2).Range = 100.0F

    SelectCase device.LightsFixed(2).Type
        Case LightType.Point
            device.LightsFixed(2).Position = _
                New Vector3Fixed(4.5F * x, 4.5F * y, 4.5F * z)
            device.LightsFixed(2).Attenuation1 = 0.4F
        Case LightType.Directional
            device.LightsFixed(2).Direction = _
                New Vector3Fixed(x, y, z)
    EndSelect
    device.LightsFixed(2).Update()
EndSub
// This code example is from the// Direct3D Mobile Fixed Point Lighting Sample// of the .NET Compact Framework Samples in the SDK.// The FrameMove method is called once per frame,// and is the entry point for animating the scene.publicvoid FrameMove()
{
    lightData = device.LightsFixed[2];
    // Rotate through the various light typesif (((int)appTime % 20) < 10)
        device.LightsFixed[2].Type = LightType.Point;
    else
        device.LightsFixed[2].Type = LightType.Directional;

    // Make sure the light type is supported by the device. If// VertexProcessingCaps.PositionAllLights is not set, the// device does not support point or spot lights, so change// light #2's type to a directional light.if
    (!device.DeviceCaps.VertexProcessingCaps.SupportsPositionalLights)
    {
        if (device.LightsFixed[2].Type == LightType.Point)
            device.LightsFixed[2].Type = LightType.Directional;
    }

    // Values for the light position, direction, and colorfloat x = (float)Math.Sin(appTime*2.000f);
    float y = (float)Math.Sin(appTime*2.246f);
    float z = (float)Math.Sin(appTime*2.640f);

    byte r = (byte)((0.5f + 0.5f * x) * 0xff);
    byte g = (byte)((0.5f + 0.5f * y) * 0xff);
    byte b = (byte)((0.5f + 0.5f * z) * 0xff);
    device.LightsFixed[2].DiffuseColor =
        ColorValueFixed.FromColor(System.Drawing.Color.FromArgb(r,
        g, b));
    device.LightsFixed[2].Range = 100.0f;

    switch(device.LightsFixed[2].Type)
    {
        case LightType.Point:
            device.LightsFixed[2].Position =
                new Vector3Fixed(4.5f * x, 4.5f * y, 4.5f * z);
            device.LightsFixed[2].Attenuation1  = 0.4f;
            break;
        case LightType.Directional:
            device.LightsFixed[2].Direction =
                new Vector3Fixed(x, y, z);
            break;
    }
    device.LightsFixed[2].Update();
}

.NET Framework セキュリティ

プラットフォーム

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

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

バージョン情報

.NET Compact Framework

サポート対象 : 3.5、2.0

参照

参照

Device クラス

Device メンバー

Microsoft.WindowsMobile.DirectX.Direct3D 名前空間