packages/Windows API Code Pack 1.1/source/Samples/DirectX/CS/UtilitiesLibrary/MeshLoader/XMeshLoader.cs
/// <summary>
/// Loads the texture coordinates(U,V) for a mesh
/// </summary>
/// <param name="textureCoordinateData"></param>
/// <returns></returns>
Loads the texture coordinates(U,V) for a mesh
Loads the texture coordinates ( U V ) for a mesh
List<Vector2F> LoadMeshTextureCoordinates(IXDataObject dataObject)
        {
            Match coordinateCount = findArrayCount.Match(dataObject.Body);
            if(!coordinateCount.Success)
                throw new System.IO.InvalidDataException("problem reading mesh texture coordinates count");
            List<Vector2F> textureCoordinates = new List<Vector2F>();
            int coordinates = int.Parse(coordinateCount.Groups[1].Value, CultureInfo.InvariantCulture);
            int dataOffset = coordinateCount.Index + coordinateCount.Length;
            for(int coordinateIndex = 0; coordinateIndex < coordinates; coordinateIndex++)
            {
                Match coordinate = findVector2F.Match(dataObject.Body, dataOffset);
                if(!coordinate.Success)
                    throw new System.IO.InvalidDataException("problem reading texture coordinate count");
                else
                    dataOffset = coordinate.Index + coordinate.Length;
                textureCoordinates.Add(
                    new Vector2F(
                        float.Parse(coordinate.Groups[1].Value, CultureInfo.InvariantCulture),
                        float.Parse(coordinate.Groups[2].Value, CultureInfo.InvariantCulture)));
            }
            return textureCoordinates;
        }
List < Vector2F > LoadMeshTextureCoordinates ( IXDataObject dataObject ) { Match coordinateCount = findArrayCount . Match ( dataObject . Body ) ; if ( ! coordinateCount . Success ) throw new System . IO . InvalidDataException ( " " ) ; List < Vector2F > textureCoordinates = new List < Vector2F > ( ) ; int coordinates = int . Parse ( coordinateCount . Groups [ 1 ] . Value , CultureInfo . InvariantCulture ) ; int dataOffset = coordinateCount . Index + coordinateCount . Length ; for ( int coordinateIndex = 0 ; coordinateIndex < coordinates ; coordinateIndex ++ ) { Match coordinate = findVector2F . Match ( dataObject . Body , dataOffset ) ; if ( ! coordinate . Success ) throw new System . IO . InvalidDataException ( " " ) ; else dataOffset = coordinate . Index + coordinate . Length ; textureCoordinates . Add ( new Vector2F ( float . Parse ( coordinate . Groups [ 1 ] . Value , CultureInfo . InvariantCulture ) , float . Parse ( coordinate . Groups [ 2 ] . Value , CultureInfo . InvariantCulture ) ) ) ; } return textureCoordinates ; }
Loads the texture coordinates(U,V) for a mesh
Loads the texture coordinates ( U V ) for a mesh
None
dataObject
IXDataObject
textureCoordinateData
None