Mercurial > LightClone
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7e3a0ae9c016 |
---|---|
1 extern uniform float4x4 kWorld; | |
2 extern uniform float4x4 kView; | |
3 extern uniform float4x4 kProjection; | |
4 extern uniform float4 kColor; | |
5 extern uniform texture kTexture; | |
6 | |
7 sampler TextureSampler = sampler_state | |
8 { | |
9 Texture = <kTexture>; | |
10 MinFilter = LINEAR; | |
11 MagFilter = LINEAR; | |
12 AddressU = WRAP; | |
13 AddressV = WRAP; | |
14 }; | |
15 | |
16 struct VertexOutput | |
17 { | |
18 /* | |
19 * kPosition | |
20 */ | |
21 float4 kPosition : POSITION0; | |
22 | |
23 /* | |
24 * kTextureCoords | |
25 */ | |
26 float2 kTextureCoords : TEXCOORD0; | |
27 }; | |
28 | |
29 VertexOutput EnvironmentVS(float3 kVertexPosition : POSITION0, float3 kVertexNormal : NORMAL, float2 kTextureCoords : TEXCOORD0) | |
30 { | |
31 float4x4 kWorldViewProjection = mul(mul(kWorld, kView), kProjection); | |
32 | |
33 VertexOutput kOutput; | |
34 kOutput.kPosition = mul(float4(kVertexPosition, 1.0f), kWorldViewProjection); | |
35 kOutput.kTextureCoords = kTextureCoords; | |
36 | |
37 return kOutput; | |
38 } | |
39 | |
40 float4 EnvironmentPS(float2 kTextureCoords : TEXCOORD0) : COLOR0 | |
41 { | |
42 float4 kTexture = tex2D(TextureSampler, kTextureCoords); | |
43 return float4(kTexture.rgb * kColor.rgb, kTexture.a); | |
44 } | |
45 | |
46 technique Default | |
47 { | |
48 pass Pass0 | |
49 { | |
50 vertexShader = compile vs_2_0 EnvironmentVS(); | |
51 pixelShader = compile ps_2_0 EnvironmentPS(); | |
52 | |
53 ZEnable = true; | |
54 ZWriteEnable = true; | |
55 ZFunc = LessEqual; | |
56 } | |
57 } | |
58 | |
59 technique Wire | |
60 { | |
61 pass Pass0 | |
62 { | |
63 vertexShader = compile vs_2_0 EnvironmentVS(); | |
64 pixelShader = compile ps_2_0 EnvironmentPS(); | |
65 | |
66 ZEnable = true; | |
67 ZWriteEnable = false; | |
68 ZFunc = LessEqual; | |
69 FillMode = Wireframe; | |
70 } | |
71 } |