Mercurial > LightClone
comparison 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 |
comparison
equal
deleted
inserted
replaced
59:63806b850aa5 | 60:b0f642ee22d3 |
---|---|
5 extern uniform texture kTexture; | 5 extern uniform texture kTexture; |
6 | 6 |
7 sampler TextureSampler = sampler_state | 7 sampler TextureSampler = sampler_state |
8 { | 8 { |
9 Texture = <kTexture>; | 9 Texture = <kTexture>; |
10 MinFilter = ANISOTROPIC; | 10 MinFilter = LINEAR; |
11 MagFilter = ANISOTROPIC; | 11 MagFilter = LINEAR; |
12 AddressU = CLAMP; | 12 AddressU = CLAMP; |
13 AddressV = CLAMP; | 13 AddressV = CLAMP; |
14 }; | 14 }; |
15 | 15 |
16 struct VertexOutput | 16 struct VertexOutput |
22 | 22 |
23 /* | 23 /* |
24 * kTextureCoords | 24 * kTextureCoords |
25 */ | 25 */ |
26 float2 kTextureCoords : TEXCOORD0; | 26 float2 kTextureCoords : TEXCOORD0; |
27 | |
28 /* | |
29 * kNormal | |
30 */ | |
31 float3 kColor : COLOR0; | |
27 }; | 32 }; |
28 | 33 |
29 VertexOutput EnvironmentVS(float3 kVertexPosition : POSITION0, float3 kVertexNormal : NORMAL, float2 kTextureCoords : TEXCOORD0) | 34 VertexOutput EnvironmentVS(float3 kVertexPosition : POSITION0, float3 kVertexNormal : NORMAL, float2 kTextureCoords : TEXCOORD0) |
30 { | 35 { |
31 float4x4 kWorldViewProjection = mul(mul(kWorld, kView), kProjection); | 36 float4x4 kWorldViewProjection = mul(mul(kWorld, kView), kProjection); |
37 | |
38 float4 kDiffuse = float4(0.8f, 0.8f, 0.8f, 1.0f); | |
39 float4 kAmbient = float4(0.4f, 0.4f, 0.4f, 1.0f); | |
40 float3 kDirection = normalize(float3(-1.0f, -0.60f, -0.3f)); | |
41 | |
42 float3 kNormal = normalize(mul(kVertexNormal, (float3x3)kWorld)); | |
32 | 43 |
33 VertexOutput kOutput; | 44 VertexOutput kOutput; |
34 kOutput.kPosition = mul(float4(kVertexPosition, 1.0f), kWorldViewProjection); | 45 kOutput.kPosition = mul(float4(kVertexPosition, 1.0f), kWorldViewProjection); |
35 kOutput.kTextureCoords = kTextureCoords; | 46 kOutput.kTextureCoords = kTextureCoords; |
47 kOutput.kColor = kAmbient + kDiffuse * saturate(dot(-kDirection, kNormal)); | |
36 | 48 |
37 return kOutput; | 49 return kOutput; |
38 } | 50 } |
39 | 51 |
40 float4 EnvironmentPS(float2 kTextureCoords : TEXCOORD0) : COLOR0 | 52 float4 EnvironmentPS(float4 kDiffuseColor : COLOR0, float2 kTextureCoords : TEXCOORD0) : COLOR0 |
41 { | 53 { |
42 float4 kTexture = tex2D(TextureSampler, kTextureCoords); | 54 float4 kTexture = tex2D(TextureSampler, kTextureCoords); |
43 return float4(kTexture.rgb * kColor.rgb, kTexture.a); | 55 |
56 return float4(kTexture.rgb * kDiffuseColor.rgb * kColor.rgb, kTexture.a); | |
44 } | 57 } |
45 | 58 |
46 technique Default | 59 technique Default |
47 { | 60 { |
48 pass Pass0 | 61 pass Pass0 |