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
9,128 times
Add to favorites
E-mail Twitter Digg Facebook
// This file defines the contract for the vertex shaders used to
// render the Earth. The globals are passed in as shader parameters
// from the application.

// Constants from app code

// transform object vertices to world-space
float4x4 WorldMatrix : register(c0);

// transform object normals, tangents, & binormals to world-space
float4x4 WorldInverseTransposeMatrix : register(c4);

// transform object vertices to view space and project them in perspective
float4x4 WorldViewProjectionMatrix : register(c8);

// provide tranform from "view" or "eye" coords back to world-space
float4x4 ViewInverseMatrix : register(c12);

// total seconds counter for animations
float TotalSeconds : register(c16);

// Static constants

// Earth rotation speed
static const float RotationSpeed = -0.2;

// Lamp light direction
static const float3 LightDir = float3(0.0f, 0.0f, -0.2f); 

// Vertex data from application
struct VertexData 
    float3 Position	: POSITION;
    float3 Normal	: NORMAL;
    float2 UV		: TEXCOORD0;

// Rotates around the Y-axis by angle
float4x4 RotateY(float A) 
	float s = sin(A);
	float c = cos(A);
	return float4x4(c,0,s,0,