Mercurial > LightClone
diff Data/Shaders/Environment.fx @ 0:7e3a0ae9c016
Initial commit
author | koryspansel <koryspansel@bendbroadband.com> |
---|---|
date | Wed, 07 Sep 2011 12:36:37 -0700 |
parents | |
children | fd55825393df |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Data/Shaders/Environment.fx Wed Sep 07 12:36:37 2011 -0700 @@ -0,0 +1,71 @@ +extern uniform float4x4 kWorld; +extern uniform float4x4 kView; +extern uniform float4x4 kProjection; +extern uniform float4 kColor; +extern uniform texture kTexture; + +sampler TextureSampler = sampler_state +{ + Texture = <kTexture>; + MinFilter = LINEAR; + MagFilter = LINEAR; + AddressU = WRAP; + AddressV = WRAP; +}; + +struct VertexOutput +{ + /* + * kPosition + */ + float4 kPosition : POSITION0; + + /* + * kTextureCoords + */ + float2 kTextureCoords : TEXCOORD0; +}; + +VertexOutput EnvironmentVS(float3 kVertexPosition : POSITION0, float3 kVertexNormal : NORMAL, float2 kTextureCoords : TEXCOORD0) +{ + float4x4 kWorldViewProjection = mul(mul(kWorld, kView), kProjection); + + VertexOutput kOutput; + kOutput.kPosition = mul(float4(kVertexPosition, 1.0f), kWorldViewProjection); + kOutput.kTextureCoords = kTextureCoords; + + return kOutput; +} + +float4 EnvironmentPS(float2 kTextureCoords : TEXCOORD0) : COLOR0 +{ + float4 kTexture = tex2D(TextureSampler, kTextureCoords); + return float4(kTexture.rgb * kColor.rgb, kTexture.a); +} + +technique Default +{ + pass Pass0 + { + vertexShader = compile vs_2_0 EnvironmentVS(); + pixelShader = compile ps_2_0 EnvironmentPS(); + + ZEnable = true; + ZWriteEnable = true; + ZFunc = LessEqual; + } +} + +technique Wire +{ + pass Pass0 + { + vertexShader = compile vs_2_0 EnvironmentVS(); + pixelShader = compile ps_2_0 EnvironmentPS(); + + ZEnable = true; + ZWriteEnable = false; + ZFunc = LessEqual; + FillMode = Wireframe; + } +}