Engines/FlatRedBallXNA/FlatRedBall.Content/ModelAnimation/X File/XModelImporter.cs
/// <summary>
/// Loads a custom material.  That is, loads a material with a custom effect.
/// </summary>
/// <returns>The custom material</returns>
Loads a custom material.  That is, loads a material with a custom effect.
Loads a custom material . That is loads a material with a custom effect .
private MaterialContent ImportCustomMaterial()
        {
            EffectMaterialContent content = new EffectMaterialContent();
            tokens.SkipName();
            string effectName = GetAbsolutePath(tokens.NextString());
            content.Effect = new ExternalReference<EffectContent>(effectName);
            for (string token = tokens.NextToken(); token != "}"; token = tokens.NextToken())
            {
                if (token == "EffectParamFloats")
                {
                    tokens.SkipName();
                    string floatsParamName = tokens.NextString();
                    int numFloats = tokens.NextInt();
                    float[] floats = new float[numFloats];
                    for (int i = 0; i < numFloats; i++)
                        floats[i] = tokens.NextFloat();
                    tokens.SkipToken();
                    content.OpaqueData.Add(floatsParamName, floats);
                }
                else if (token == "EffectParamDWord")
                {
                    tokens.SkipName();
                    string dwordParamName = tokens.NextString();
                    float dword = tokens.NextFloat();
                    tokens.SkipToken();
                    content.OpaqueData.Add(dwordParamName, dword);
                }
                else if (token == "EffectParamString")
                {
                    tokens.SkipName();
                    string stringParamName = tokens.NextString();
                    string paramValue = tokens.NextString();
                    tokens.SkipToken();
                    content.OpaqueData.Add(stringParamName, paramValue);
                }
                if (token == "{")
                    tokens.SkipNode();
            }
            return content;
        }
private MaterialContent ImportCustomMaterial ( ) { EffectMaterialContent content = new EffectMaterialContent ( ) ; tokens . SkipName ( ) ; string effectName = GetAbsolutePath ( tokens . NextString ( ) ) ; content . Effect = new ExternalReference < EffectContent > ( effectName ) ; for ( string token = tokens . NextToken ( ) ; token != " " ; token = tokens . NextToken ( ) ) { if ( token == " " ) { tokens . SkipName ( ) ; string floatsParamName = tokens . NextString ( ) ; int numFloats = tokens . NextInt ( ) ; float [ ] floats = new float [ numFloats ] ; for ( int i = 0 ; i < numFloats ; i ++ ) floats [ i ] = tokens . NextFloat ( ) ; tokens . SkipToken ( ) ; content . OpaqueData . Add ( floatsParamName , floats ) ; } else if ( token == " " ) { tokens . SkipName ( ) ; string dwordParamName = tokens . NextString ( ) ; float dword = tokens . NextFloat ( ) ; tokens . SkipToken ( ) ; content . OpaqueData . Add ( dwordParamName , dword ) ; } else if ( token == " " ) { tokens . SkipName ( ) ; string stringParamName = tokens . NextString ( ) ; string paramValue = tokens . NextString ( ) ; tokens . SkipToken ( ) ; content . OpaqueData . Add ( stringParamName , paramValue ) ; } if ( token == " " ) tokens . SkipNode ( ) ; } return content ; }
Loads a custom material.
Loads a custom material .
// Find value initializers for the effect parameters and set the values // as indicated
The custom material
The custom material