FixedPoint Structure

Represents a 16.16 fixed-point number.

Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)

Syntax

'Declaration
Public Structure FixedPoint
    Implements IComparable, IFormattable, IConvertible
'Usage
Dim instance As FixedPoint
public struct FixedPoint : IComparable, IFormattable, IConvertible
public value class FixedPoint : IComparable, IFormattable, IConvertible
public final class FixedPoint extends ValueType implements IComparable, IFormattable, 
    IConvertible
JScript suports the use of structures, but not the declaration of new ones.

Remarks

This structure is used to interoperate with the various types in Windows Mobile Direct 3D that have fixed-point interfaces. The internal representation of this class is an Int32 structure.

Example

The following example shows how you can use a FixedPoint structure.

' The following code is from the
' Direct3D Mobile Fixed Point Billboard Sample.
' It uses FixedPoint to position meshes of trees randomly.
' Initialize the tree data
Dim i As Integer
For i = 0 To numberTrees - 1
    Dim t As New Tree()
    ' Position the trees randomly
    Do
        Dim fTheta As Single = 2.0F * _
            System.Convert.ToSingle(Math.PI) * _
            System.Convert.ToSingle(rand.NextDouble())
        Dim fRadius As Single = 25.0F + 55.0F * _
            System.Convert.ToSingle(rand.NextDouble())
        Dim position As Vector3Fixed
        position.X = CType(fRadius * _
            System.Convert.ToSingle( _
            Math.Sin(fTheta)), FixedPoint)
        position.Z = CType(fRadius * _
            System.Convert.ToSingle(Math.Cos(fTheta)), FixedPoint)
        position.Y = CType(HeightField( _
            System.Convert.ToSingle(position.X), _
            System.Convert.ToSingle(position.Z)), FixedPoint)
        t.Position = position
    Loop While Not IsTreePositionValid(t.Position)
// The following code is from the
// Direct3D Mobile Fixed Point Billboard Sample.
// It uses FixedPoint to position meshes of trees randomly.

        // Initialize the tree data
        for (int i=0; i<numberTrees; i++)
        {
            Tree t = new Tree();


do
{
    float fTheta  = 2.0f * (float)Math.PI *
        (float)rand.NextDouble();
    float fRadius = 25.0f + 55.0f * (float)rand.NextDouble();
    Vector3Fixed position;
    position.X  =
        (FixedPoint)(fRadius * (float)Math.Sin(fTheta));
    position.Z  =
        (FixedPoint)(fRadius * (float)Math.Cos(fTheta));
    position.Y  =
        (FixedPoint)HeightField((float)position.X,
        (float)position.Z);
    t.Position = position;
}
while (!IsTreePositionValid(t.Position));

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Compact Framework

Supported in: 2.0

See Also

Reference

FixedPoint Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace

Other Resources

Mobile Direct3D Programming