source: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollps.hlsl @ 2467

Revision 2467, 1.5 KB checked in by szirmay, 17 years ago (diff)
Line 
1#define MAX_LIGHT 2
2#define MAX_CAU_CASTER 2
3#define SPOT_ANGLE 2.093
4#define SPOT_FALLOFF 1
5#define SHADOW_COLOR float4(0.3,0.3,0.3,1.0)
6#define SHADOW_BIAS_POINT 0.0001
7#define SHADOW_EPSILON_POINT 0.0001
8
9uniform sampler2D colorTexture : register(s0);
10uniform sampler2D bumpMap : register(s1);
11
12uniform float4 lightRange1;
13uniform float lightPower1;
14uniform float4 lightColor1;
15
16uniform float4 lightRange2;
17uniform float lightPower2;
18uniform float4 lightColor2;
19
20uniform float specularity;
21uniform float albedo;
22uniform float4 specularColor;
23
24#include "illum.hlsl"
25
26struct Troll_PS_IN
27{
28        float2 texCoord:TEXCOORD0;
29        float3 tangent:TEXCOORD1;
30        float3 binormal:TEXCOORD2;
31        float3 normal:TEXCOORD3;
32        float3 V: TEXCOORD4;
33        float3 L1: TEXCOORD5;
34        float3 L2: TEXCOORD6;
35};
36
37float4 Troll_PS(Troll_PS_IN IN):COLOR
38{
39        float4 Color = 0;
40        float3 N = normalize(IN.normal);//NormalMap(IN.tangent, IN.binormal, IN.normal, IN.texCoord, bumpMap);
41        float dist = length(IN.V);
42        float3 V = IN.V /dist;
43        float3 L1 = IN.L1;
44        float3 L2 = IN.L2;
45       
46        float4 diffuseColor = albedo * tex2D(colorTexture, IN.texCoord);
47        if( dot(lightRange1, lightRange1) != 0)
48        Color += Illumination(N, L1, V, lightColor1 * lightPower1, lightRange1, diffuseColor, specularity, specularColor);
49        if(dot(lightRange2, lightRange2) != 0)
50        Color += Illumination(N, L2, V, lightColor2 * lightPower2, lightRange2, diffuseColor, specularity, specularColor);
51       
52        float4 ret =  Color;
53        return float4(ret.xyz, dist);
54}
Note: See TracBrowser for help on using the repository browser.