/// <summary>
        /// Called when the atmosphere lookup texture has been built by the background worker
        /// </summary>
        private void WorkItemComplete( object sender, RunWorkerCompletedEventArgs args )
        {
            buildButton.Text = "Build";
            buildProgressBar.Value = 0;

            if ( args.Result == null )
            {
                return;
            }

            AtmosphereBuildOutputs buildOutputs = ( AtmosphereBuildOutputs )args.Result;

            //	Create the atmosphere lookup textures
            ITexture3d scatteringTexture = Graphics.Factory.CreateTexture3d( );
            scatteringTexture.Create( buildOutputs.ScatteringTexture );

            ITexture2d opticalDepthTexture = Graphics.Factory.CreateTexture2d( );
            opticalDepthTexture.Create( buildOutputs.OpticalDepthTexture, false );
            //	opticalDepthTexture.ToBitmap( false )[ 0 ].Save( "OpticalDepthTexture.png" );

            if ( m_Model != null )
            {
                m_Model.OpticalDepthTexture = opticalDepthTexture;
                m_Model.ScatteringTexture = scatteringTexture;
            }
            m_LastBuildOutput = buildOutputs;
            //	ISpherePlanetAtmosphereRenderer atmoRenderer = BuilderState.Instance.SpherePlanet.PlanetRenderer.SphereAtmosphereRenderer;
            //	atmoRenderer.SetLookupTextures( scatteringTexture, opticalDepthTexture );
        }
 /// <summary>
 /// Builds the atmosphere outputs
 /// </summary>
 public void Build( AtmosphereBuildProgress progress )
 {
     m_AtmosphereOutputs = new AtmosphereBuilder( ).Build( AtmosphereModel, AtmosphereParameters, progress );
     OnTemplateChanged( );
 }