public Technique GetBestTechnique( int lodIndex, IRenderable renderable )
{
Technique technique = null;
Dictionary<int, Technique> lodTechniques;
if ( this.SupportedTechniques.Count > 0 )
{
if ( !this.bestTechniquesByScheme.ContainsKey( MaterialManager.Instance.ActiveSchemeIndex ) )
{
technique = MaterialManager.Instance.ArbitrateMissingTechniqueForActiveScheme( this,
lodIndex,
renderable );
if ( technique != null )
{
return technique;
}
// Nope, use default
// get the first item, will be 0 (the default) if default
// scheme techniques exist, otherwise the earliest defined
Dictionary<ushort, Dictionary<int, Technique>>.Enumerator iter = this.bestTechniquesByScheme.GetEnumerator();
if ( iter.Current.Value == null )
iter.MoveNext();
lodTechniques = iter.Current.Value;
}
else
{
lodTechniques = this.bestTechniquesByScheme[ MaterialManager.Instance.ActiveSchemeIndex ];
}
if ( !lodTechniques.ContainsKey( lodIndex ) )
{
while ( lodIndex >= 0 || !lodTechniques.ContainsKey( lodIndex ) )
{
lodIndex--;
}
if ( lodIndex >= 0 )
{
technique = lodTechniques[ lodIndex ];
}
}
else
{
technique = lodTechniques[ lodIndex ];
}
}
return technique;
}