/// <summary>
 /// Default constructor
 /// </summary>
 public SpherePlanetAtmosphereRenderer( )
 {
     //	Load in atmosphere effect
     m_Effect = new EffectAssetHandle( "Effects/Planets/atmosphereShell.cgfx", true );
     m_Effect.OnReload += Effect_OnReload;
     m_Techniques = new TechniqueSelector( m_Effect, "DefaultTechnique" );
 }
コード例 #2
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public SpherePlanetCloudRenderer( )
        {
            EffectAssetHandle effect = new EffectAssetHandle( "Effects/Planets/cloudLayer.cgfx", true );
            effect.OnReload += Effect_OnReload;

            m_Technique = new TechniqueSelector( effect, "DefaultTechnique" );
        }
        /// <summary>
        /// Setup constructor
        /// </summary>
        public SpherePlanetSimpleCloudShellRenderer( string effectPath )
        {
            EffectAssetHandle effect = new EffectAssetHandle( effectPath, true );
            //	effect.OnReload += Effect_OnReload;
            m_Technique = new TechniqueSelector( effect, "DefaultTechnique" );

            m_TextureBuilder = new CloudCubeMapTextureBuilder( );
        }
コード例 #4
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="planet">Planet to render</param>
 /// <param name="effectPath">Path to the terrain effect</param>
 public PlanetPackTextureTechnique( IPlanet planet, string effectPath )
 {
     Arguments.CheckNotNull( planet, "planet" );
     Arguments.CheckNotNullOrEmpty( effectPath, "effectPath" );
     m_Planet = planet;
     m_NoiseTexture = ( ITexture2d )AssetManager.Instance.Load( "Terrain/TiledNoise.noise.jpg" );
     m_Effect = new EffectAssetHandle( effectPath, true );
     m_Effect.OnReload += Effect_OnReload;
     m_Technique = new TechniqueSelector( m_Effect, "DefaultTechnique" );
 }
        /// <summary>
        /// Default constructor
        /// </summary>
        public SpherePlanetReflectiveOceanRenderer( string effectPath, string waterAnimationPath )
        {
            Arguments.CheckNotNullOrEmpty( effectPath, "effectPath" );
            Arguments.CheckNotNull( waterAnimationPath, "waterAnimationPath" );

            m_Effect = new EffectAssetHandle( effectPath, true );
            m_Technique = new TechniqueSelector( m_Effect, "DefaultTechnique" );

            using ( WaveAnimation animation = ( WaveAnimation )AssetManager.Instance.Load( waterAnimationPath ) )
            {
                m_WaveAnimation = new AnimatedTexture2d( animation.ToTextures( true ), 5.0f );
            }
        }
コード例 #6
0
        /// <summary>
        /// Setup constructor
        /// </summary>
        /// <param name="effectPath">Effect path</param>
        /// <param name="techniqueNames">Technique names</param>
        /// <param name="trackChangesInEffect">If true, then the effect path is checked for updates</param>
        public TechniqueSelector( string effectPath, bool trackChangesInEffect, params string[] techniqueNames )
        {
            Arguments.CheckNotNullOrEmpty( effectPath, "effectPath " );
            Arguments.CheckNotNullAndContainsNoNulls( techniqueNames, "techniqueNames" );

            EffectAssetHandle handle = new EffectAssetHandle( effectPath, trackChangesInEffect );
            handle.OnReload +=
                delegate
                {
                    Graphics.Renderer.MainRenderingThreadMarshaller.PostAction( RefreshEffectFromAsset, handle, techniqueNames );
                };
            RefreshEffectFromAsset( handle, techniqueNames );
        }
コード例 #7
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public SpherePlanetOceanRenderer( )
        {
            m_Effect = new EffectAssetHandle( "Effects/Planets/sphereOcean.cgfx", true );
            m_Effect.OnReload += Effect_OnReload;

            m_Technique = new TechniqueSelector( m_Effect, "DefaultTechnique" );

            using ( WaveAnimation animation = ( WaveAnimation )AssetManager.Instance.Load( "Ocean/SimpleWater.waves.bin" ) )
            {
                m_WaveAnimation = new AnimatedTexture2d( animation.ToTextures( true ), 5.0f );
            }

            //	Generate cached sphere for rendering the planet
            Graphics.Draw.StartCache( );
            Graphics.Draw.Sphere( null, Point3.Origin, 10.0f, 80, 80 );
            m_OceanGeometry = Graphics.Draw.StopCache( );
        }
コード例 #8
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public SpherePlanetOceanRenderer( string effectPath, string waterAnimationPath )
        {
            Arguments.CheckNotNull( effectPath, "effectPath" );
            Arguments.CheckNotNull( waterAnimationPath, "waterAnimationPath" );

            m_Effect = new EffectAssetHandle( effectPath, true );
            //	m_Effect.OnReload += Effect_OnReload;

            m_Technique = new TechniqueSelector( m_Effect, "DefaultTechnique" );

            using ( WaveAnimation animation = ( WaveAnimation )AssetManager.Instance.Load( waterAnimationPath ) )
            {
                m_WaveAnimation = new AnimatedTexture2d( animation.ToTextures( true ), 5.0f );
            }

            //	Generate cached sphere for rendering the planet
            Graphics.Draw.StartCache( );
            Graphics.Draw.Sphere( null, Point3.Origin, 10.0f, 80, 80 );
            m_OceanGeometry = Graphics.Draw.StopCache( );
        }
コード例 #9
0
        /// <summary>
        /// Builds the star box (dome, sphere, thing)
        /// </summary>
        public StarBox( )
        {
            EffectAssetHandle effect = new EffectAssetHandle( "Effects/Planets/stars.cgfx", false );
            m_Technique = new TechniqueSelector( effect, "DefaultTechnique" );

            Draw.ISurface surface = Graphics.Draw.NewSurface( Graphics.Draw.NewBrush( Color.Black ), null );
            surface.FaceBrush.State.CullFaces = false;
            surface.FaceBrush.State.DepthWrite = false;
            surface.FaceBrush.State.DepthTest = false;

            Graphics.Draw.StartCache( );
            Graphics.Draw.Sphere( surface, Point3.Origin, 100, 10, 10 );
            m_Box = Graphics.Draw.StopCache( );

            m_Texture = Graphics.Factory.CreateCubeMapTexture( );
            LoadStarBoxTextures( m_Texture, "Star Fields/Default/" );

            //int imageIndex = 0;
            //foreach ( Bitmap bmp in m_Texture.ToBitmaps( ) )
            //{
            //    bmp.Save( "StarBoxCubeMapFace" + imageIndex++ + ".bmp", ImageFormat.Bmp );
            //}
        }
コード例 #10
0
 public static object Test( )
 {
     object effect = new EffectAssetHandle( "Effects/Planets/cloudLayer.cgfx", false ).Asset;
     return effect;
 }
コード例 #11
0
 /// <summary>
 /// Loads the effect from an effect file and selects the named technique
 /// </summary>
 public TechniqueSelector( ISource effectSource, string name, bool reloadOnChangeToSource )
 {
     EffectAssetHandle effect = new EffectAssetHandle( effectSource, reloadOnChangeToSource );
     effect.OnReload += delegate { Select( m_Technique.Name ); };
     Effect = effect;
     Select( name );
 }
コード例 #12
0
 /// <summary>
 /// Refreshes the current effect and selected technique
 /// </summary>
 private void RefreshEffectFromAsset( EffectAssetHandle handle, string[] techniqueNames )
 {
     try
     {
         Effect = handle.Asset;
         foreach ( string techniqueName in techniqueNames )
         {
             if ( Effect.Techniques.ContainsKey( techniqueName ) )
             {
                 GraphicsLog.Info( "Selected technique \"{0}\" from effect \"{1}\"", techniqueName, handle.Source );
                 Select( techniqueName );
             }
         }
     }
     catch ( Exception ex )
     {
         GraphicsLog.Exception( ex, "Error occurred refreshing effect asset \"{0}\"", handle.Source );
     }
 }
コード例 #13
0
 /// <summary>
 /// Creates an effect asset handle from the default effect source
 /// </summary>
 private static ITechnique CreateDefaultTechnique( string location )
 {
     EffectAssetHandle handle = new EffectAssetHandle( Locations.NewLocation( location ), true );
     return new TechniqueSelector( handle );
 }