Solar Wind 3D Sample

This sample for Silverilght 5 uses the new 3D features to draw the Earth with day and night transitions, atmosphere layers, and population density overlays. It demonstrates advanced concepts like mipmaps, texture blending, multiple drawing passes, sampler states...

C# (10.4 MB)
 
 
 
 
 
4.4 Star
(8)
9,133 times
Add to favorites
9/12/2011
E-mail Twitter del.icio.us Digg Facebook
<UserControl x:Class="SolarWind.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:SolarWind"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" 
    KeyDown="OnKeyDown" KeyUp="OnKeyUp" MouseMove="OnMouseMove" MouseLeftButtonDown="OnMouseDown" MouseLeftButtonUp="OnMouseUp">

    <Grid x:Name="LayoutRoot" Background="Black">
        <Image Source="Textures/Stars.jpg" Opacity="1.0" Stretch="UniformToFill" />
        <DrawingSurface x:Name="ds" Loaded="DrawingSurface_Loaded" Draw="DrawingSurface_Draw" SizeChanged="DrawingSurface_SizeChanged">
            <DrawingSurface.CompositionMode>
                <OffscreenCompositionMode PreferredMultiSampleCount="2" />
            </DrawingSurface.CompositionMode>
        </DrawingSurface>
        <Canvas VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
            <Border Background="Gray" BorderBrush="DarkGray" BorderThickness="2" Canvas.Left="30" Canvas.Top="30" Padding="5">
                <StackPanel>
                    <TextBlock Text="Use arrow keys to zoom"/>
                    <TextBlock Text=" "/>
                    <CheckBox x:Name="AtmosphereCheck" Content="Atmosphere" IsChecked="True" Checked="OnAtmosphereChecked" Unchecked="OnAtmosphereUnchecked"/>
                    <CheckBox x:Name="PopulationDensityCheck" Content="Population Density" IsChecked="False" Checked="OnPopulationDensityChecked" Unchecked="OnPopulationDensityUnchecked"/>
                    <CheckBox x:Name="WireFrameCheck" Content="Show Wireframe" IsChecked="false" Checked="OnWireframeChecked" Unchecked="OnWireframeUnchecked"/>
                    <CheckBox x:Name="MagneticFieldCheck" Content="Magnetic Field" IsChecked="False" Checked="OnMagneticFieldChecked" Unchecked="OnMagneticFieldUnchecked"/>
                    <TextBlock Text=" "/>
                    <TextBlock Text="Rotation Speed"/>                    
                    <Slider x:Name="RotationSpeedSlider" IsTabStop="False" Minimum="-10.0" Maximum="10.0" Value="1.0" ValueChanged="OnRotationSpeedChanged"/>
                </StackPanel>
            </Border>
        </Canvas>
        <Button Content="Credits" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" Click="ShowCredits"/>
        <Popup x:Name="aboutPopup" IsOpen="false" Width="{Binding ElementName=aboutDialog, Path=Width}" Height="{Binding ElementName=aboutDialog, Path=Height}" HorizontalAlignment="Center" VerticalAlignment="Center">
            <local:AboutDialog x:Name="aboutDialog"/>
        </Popup>
    </Grid>
</UserControl>