public override bool RestoreConfiguration( Root engine )
{
// Load Plugins
// RenderSystem Selection
if ( engine.RenderSystems.Count == 0 )
{
throw new AxiomException( "At least one RenderSystem must be loaded." );
}
if ( this.ConfigurationSection == null )
{
return false;
}
if ( engine.RenderSystems.ContainsKey( this.ConfigurationSection.RenderSystems.DefaultRenderSystem ) )
{
engine.RenderSystem = engine.RenderSystems[ this.ConfigurationSection.RenderSystems.DefaultRenderSystem ];
}
foreach ( RenderSystem renderSystemConfig in this.ConfigurationSection.RenderSystems )
{
if ( engine.RenderSystems.ContainsKey( renderSystemConfig.Name ) )
{
var renderSystem = engine.RenderSystems[ renderSystemConfig.Name ];
foreach ( RenderSystemOption optionConfig in renderSystemConfig.Options )
{
if ( renderSystem.ConfigOptions.ContainsKey( optionConfig.Name ) )
{
renderSystem.ConfigOptions[ optionConfig.Name ].Value = optionConfig.Value;
}
}
}
}
// Setup Resource Locations
foreach ( ResourceLocationElement locationElement in this.ConfigurationSection.ResourceLocations )
{
ResourceGroupManager.Instance.AddResourceLocation( locationElement.Path, locationElement.Type, locationElement.Group, bool.Parse( locationElement.Recurse ), false );
}
return ( engine.RenderSystem != null );
}