Exemple #1
0
        /// <summary>
        /// Function to return the 3D layer that contains our planet.
        /// </summary>
        /// <param name="graphics">The graphics interface for the application.</param>
        /// <param name="resources">The resources for the application.</param>
        /// <returns>The 3D planet layer.</returns>
        public static PlanetLayer GetPlanetLayer(GorgonGraphics graphics, ResourceManagement resources)
        {
            // Create our planet.
            var planetLayer = new PlanetLayer(graphics, resources)
            {
                ParallaxLevel = 50,             // Kinda far away.
                Planets       =
                {
                    new Planet(new PlanetaryLayer[]
                    {
                        new PlanetaryLayer(resources.Meshes["earthSphere"])
                        {
                            Animation = resources.Animations["PlanetRotation"]
                        },
                        new PlanetaryLayer(resources.Meshes["earthCloudSphere"])
                        {
                            Animation = resources.Animations["CloudRotation"]
                        },
                    })
                    {
                        Position = new DX.Vector3(-30, -15, 4.0f)
                    }
                }
            };

            // Add an ambient light to the planet so we can see some details without a major light source.
            planetLayer.Lights.Add(new Light
            {
                Attenuation        = float.MaxValue.Sqrt(),
                Color              = GorgonColor.White,
                SpecularPower      = 0.0f,
                Intensity          = 0.3f,
                LocalLightPosition = new DX.Vector3(0, 0, -10000.0f),
                Layers             =
                {
                    planetLayer
                }
            });

            planetLayer.LoadResources();
            planetLayer.PostProcessGroup = "Final Pass";

            return(planetLayer);
        }