This documentation is archived and is not being maintained.
LightFixed Class
Visual Studio 2008
Represents a set of lighting properties. This class cannot be inherited.
Assembly: Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)
The following code example shows how to use LightFixed structures.
' 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
Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: