다음을 통해 공유


Device.LightsFixed 속성

업데이트: 2007년 11월

고정 소수점 수학을 사용하여 현재 장치에 대한 조명 컬렉션을 가져옵니다.

네임스페이스:  Microsoft.WindowsMobile.DirectX.Direct3D
어셈블리:  Microsoft.WindowsMobile.DirectX(Microsoft.WindowsMobile.DirectX.dll)

구문

‘선언
Public ReadOnly Property LightsFixed As LightsFixedCollection
‘사용 방법
Dim instance As Device
Dim value As LightsFixedCollection

value = instance.LightsFixed
public LightsFixedCollection LightsFixed { get; }
public:
property LightsFixedCollection^ LightsFixed {
    LightsFixedCollection^ get ();
}
public function get 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.

Public Sub FrameMove()
    lightData = device.LightsFixed(2)

    ' Rotate through the various light types
    If Fix(appTime) Mod 20 < 10 Then
        device.LightsFixed(2).Type = LightType.Point
    Else
        device.LightsFixed(2).Type = LightType.Directional
    End If

    ' 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 Not _
     device.DeviceCaps.VertexProcessingCaps.SupportsPositionalLights _
        Then
        If device.LightsFixed(2).Type = LightType.Point Then
            device.LightsFixed(2).Type = LightType.Directional
        End If
    End If

    ' Values for the light position, direction, and color
    Dim x As Single = System.Convert.ToSingle(Math.Sin(appTime * 2.0F))
    Dim y As Single = System.Convert.ToSingle( _
        Math.Sin(appTime * 2.246F))
    Dim z As Single = System.Convert.ToSingle( _
        Math.Sin(appTime * 2.64F))

    Dim r As Byte = System.Convert.ToByte((0.5F + 0.5F * x) * &HFF)
    Dim g As Byte = System.Convert.ToByte((0.5F + 0.5F * y) * &HFF)
    Dim b As Byte = 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

    Select Case 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)
    End Select
    device.LightsFixed(2).Update()
End Sub
// 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.

public void FrameMove()
{
    lightData = device.LightsFixed[2];
    // Rotate through the various light types
    if (((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 color
    float 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();
}

권한

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

플랫폼

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

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Compact Framework

3.5, 2.0에서 지원

참고 항목

참조

Device 클래스

Device 멤버

Microsoft.WindowsMobile.DirectX.Direct3D 네임스페이스