Engines/FlatRedBallXNA/FlatRedBall.Content/ModelAnimation/X File/XMeshImporter.cs
// template MeshMaterialList
// {
//      DWORD nMaterials;
//      DWORD nFaceIndexes;
//      array DWORD faceIndexes[nFaceIndexes];
//      [Material]
// } 
/// <summary>
/// Imports a material list that contains the materials used by the current mesh.
/// </summary>
Imports a material list that contains the materials used by the current mesh.
Imports a material list that contains the materials used by the current mesh .
private void ImportMaterialList()
            {
                int numMaterials = tokens.SkipName().NextInt();
                materials = new MaterialContent[numMaterials];
                int numFaces = tokens.NextInt();
                for (int i = 0; i < numFaces; i++)
                    faces[i].MaterialIndex = tokens.NextInt();
                if (tokens.Peek == ";")
                    tokens.SkipToken();
                for (int i = 0; i < numMaterials; i++)
                {
                    if (tokens.Peek == "{")
                    {
                        tokens.SkipToken();
                        string materialReference = tokens.NextToken();
                        tokens.SkipToken();
                        materials[i] = model.materials[materialReference];
                    }
                    else
                    {
                        tokens.SkipToken();
                        materials[i] = model.ImportMaterial();
                    }
                }
                tokens.SkipToken();
            }
private void ImportMaterialList ( ) { int numMaterials = tokens . SkipName ( ) . NextInt ( ) ; materials = new MaterialContent [ numMaterials ] ; int numFaces = tokens . NextInt ( ) ; for ( int i = 0 ; i < numFaces ; i ++ ) faces [ i ] . MaterialIndex = tokens . NextInt ( ) ; if ( tokens . Peek == " " ) tokens . SkipToken ( ) ; for ( int i = 0 ; i < numMaterials ; i ++ ) { if ( tokens . Peek == " " ) { tokens . SkipToken ( ) ; string materialReference = tokens . NextToken ( ) ; tokens . SkipToken ( ) ; materials [ i ] = model . materials [ materialReference ] ; } else { tokens . SkipToken ( ) ; materials [ i ] = model . ImportMaterial ( ) ; } } tokens . SkipToken ( ) ; }
Imports a material list that contains the materials used by the current mesh.
Imports a material list that contains the materials used by the current mesh .
// skip all the indices and their commas/semicolons since // we are just going to apply this material to the entire mesh // account for blenders mistake of putting an extra semicolon here // end of material list