/// <summary>
 /// Sets up a model instance from this template
 /// </summary>
 public override void SetupInstance( IPlanetEnvironmentModel model, ModelTemplateInstanceContext context )
 {
     base.SetupInstance( model, context );
     IPlanetHomogenousProceduralTerrainModel terrainModel = ( IPlanetHomogenousProceduralTerrainModel )model;
     terrainModel.HeightFunction = HeightFunction;
     terrainModel.GroundOffsetFunction = GroundOffsetFunction;
 }
        /// <summary>
        /// Sets up a ring model instance
        /// </summary>
        public override void SetupInstance( IPlanetEnvironmentModel model, ModelTemplateInstanceContext context )
        {
            base.SetupInstance( model, context );

            ISpherePlanetRingModel ringModel = ( ISpherePlanetRingModel )model;
            double radius = Range.Mid( InnerRadiusMultiple, ( float )context.Random.NextDouble( ) );
            ringModel.InnerRadius = new Units.Metres( radius );
        }
 /// <summary>
 /// Called when a model is removed from a model composite
 /// </summary>
 private void OnModelRemoved( IComposite<IPlanetEnvironmentModel> composite, IPlanetEnvironmentModel component )
 {
     IPlanetEnvironmentRenderer[] renderers;
     if ( !m_RendererMap.TryGetValue( component, out renderers ) )
     {
         return;
     }
     foreach ( IPlanetEnvironmentRenderer renderer in renderers )
     {
         renderer.PlanetRenderer = null;
     }
     m_RendererMap.Remove( component );
 }
 /// <summary>
 /// Called when a model is added to a model composite
 /// </summary>
 private void OnModelAdded( IComposite<IPlanetEnvironmentModel> composite, IPlanetEnvironmentModel component )
 {
     IPlanetEnvironmentRenderer[] renderers = m_RendererFactory.CreateModelRenderer( component );
     if ( renderers == null )
     {
         return;
     }
     foreach ( IPlanetEnvironmentRenderer renderer in renderers )
     {
         renderer.PlanetRenderer = m_Planet.Renderer;
     }
     m_RendererMap.Add( component, renderers );
 }
 /// <summary>
 /// Sets up a ring model instance
 /// </summary>
 public override void SetupInstance( IPlanetEnvironmentModel model, ModelTemplateInstanceContext context )
 {
     IPlanetRingModel ringModel = ( IPlanetRingModel )model;
     double width = RingWidth.Minimum + ( RingWidth.Maximum - RingWidth.Minimum ) * context.Random.NextDouble( );
     ringModel.Width = new Units.Metres( width );
 }
        /// <summary>
        /// Creates an instance of this template
        /// </summary>
        /// <param name="model">Planet model to create</param>
        /// <param name="context">Instancing context</param>
        public override void SetupInstance( IPlanetEnvironmentModel model, ModelTemplateInstanceContext context )
        {
            Arguments.CheckNotNull( model, "planetModel" );
            Arguments.CheckNotNull( context, "context" );

            SetupCloudModel( ( IPlanetSimpleCloudModel )model, context );
        }
 /// <summary>
 /// Atmosphere model creation
 /// </summary>
 public override void SetupInstance( IPlanetEnvironmentModel model, ModelTemplateInstanceContext context )
 {
     IPlanetAtmosphereModel atmosphereModel = ( IPlanetAtmosphereModel )model;
 }
 /// <summary>
 /// Atmosphere model creation
 /// </summary>
 public override void SetupInstance( IPlanetEnvironmentModel model, ModelTemplateInstanceContext context )
 {
     IPlanetAtmosphereScatteringModel atmosphereModel = ( IPlanetAtmosphereScatteringModel )model;
     double thicknessRatio = AtmosphereModel.AtmosphereThicknessMetres / AtmosphereModel.InnerRadiusMetres;
     atmosphereModel.Thickness = ( ( SpherePlanetModel )model.PlanetModel ).Radius * thicknessRatio;
 }
 /// <summary>
 /// Atmosphere model creation
 /// </summary>
 public override void SetupInstance( IPlanetEnvironmentModel model, ModelTemplateInstanceContext context )
 {
     IPlanetAtmosphereScatteringModel atmosphereModel = ( IPlanetAtmosphereScatteringModel )model;
     atmosphereModel.Thickness = Range.Mid( m_Thickness, ( float )context.Random.NextDouble( ) );
     //	IPlanetAtmosphereModel atmosphereModel = ( IPlanetAtmosphereModel )model;
 }
 /// <summary>
 /// Sets up an ocean model instance
 /// </summary>
 public override void SetupInstance( IPlanetEnvironmentModel model, ModelTemplateInstanceContext context )
 {
     IPlanetOceanModel oceanModel = ( IPlanetOceanModel )model;
     oceanModel.SeaLevel = Range.Mid( SeaLevel, ( float )context.Random.NextDouble( ) );
 }
 /// <summary>
 /// Creates an instance of this template
 /// </summary>
 public override void SetupInstance( IPlanetEnvironmentModel model, ModelTemplateInstanceContext context )
 {
     ( ( IPlanetTerrainModel )model ).MaximumHeight = Range.Mid( MaximumHeightRange, context.Random.NextDouble( ) );
 }