diff Data/Shaders/Environment.fx @ 60:b0f642ee22d3

Additional maps
author koryspansel <koryspansel@bendbroadband.com>
date Mon, 03 Oct 2011 08:58:08 -0700
parents fd55825393df
children
line wrap: on
line diff
--- a/Data/Shaders/Environment.fx	Fri Sep 30 22:48:03 2011 -0700
+++ b/Data/Shaders/Environment.fx	Mon Oct 03 08:58:08 2011 -0700
@@ -7,8 +7,8 @@
 sampler TextureSampler = sampler_state
 {
 	Texture		= <kTexture>;
-	MinFilter	= ANISOTROPIC;
-	MagFilter	= ANISOTROPIC;
+	MinFilter	= LINEAR;
+	MagFilter	= LINEAR;
 	AddressU	= CLAMP;
 	AddressV	= CLAMP;
 };
@@ -24,23 +24,36 @@
 	 * kTextureCoords
 	 */
 	float2 kTextureCoords : TEXCOORD0;
+	
+	/*
+	 * kNormal
+	 */
+	float3 kColor : COLOR0;
 };
 
 VertexOutput EnvironmentVS(float3 kVertexPosition : POSITION0, float3 kVertexNormal : NORMAL, float2 kTextureCoords : TEXCOORD0)
 {
 	float4x4 kWorldViewProjection = mul(mul(kWorld, kView), kProjection);
+
+	float4 kDiffuse			= float4(0.8f, 0.8f, 0.8f, 1.0f);
+	float4 kAmbient			= float4(0.4f, 0.4f, 0.4f, 1.0f);
+	float3 kDirection		= normalize(float3(-1.0f, -0.60f, -0.3f));	
+
+	float3 kNormal			= normalize(mul(kVertexNormal, (float3x3)kWorld));
 	
 	VertexOutput kOutput;
 	kOutput.kPosition		= mul(float4(kVertexPosition, 1.0f), kWorldViewProjection);
 	kOutput.kTextureCoords	= kTextureCoords;
+	kOutput.kColor			= kAmbient + kDiffuse * saturate(dot(-kDirection, kNormal));
 
 	return kOutput;
 }
 
-float4 EnvironmentPS(float2 kTextureCoords : TEXCOORD0) : COLOR0
+float4 EnvironmentPS(float4 kDiffuseColor : COLOR0, float2 kTextureCoords : TEXCOORD0) : COLOR0
 {
 	float4 kTexture = tex2D(TextureSampler, kTextureCoords);
-	return  float4(kTexture.rgb * kColor.rgb, kTexture.a);
+
+	return float4(kTexture.rgb * kDiffuseColor.rgb * kColor.rgb, kTexture.a);
 }
 
 technique Default