[2386] | 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 |
|
---|
| 9 | uniform sampler2D colorTexture : register(s0);
|
---|
| 10 | uniform sampler2D bumpMap : register(s1);
|
---|
| 11 |
|
---|
[2458] | 12 | uniform float4 lightRange1;
|
---|
| 13 | uniform float lightPower1;
|
---|
| 14 | uniform float4 lightColor1;
|
---|
[2386] | 15 |
|
---|
[2458] | 16 | uniform float4 lightRange2;
|
---|
| 17 | uniform float lightPower2;
|
---|
| 18 | uniform float4 lightColor2;
|
---|
| 19 |
|
---|
[2386] | 20 | uniform float specularity;
|
---|
[2417] | 21 | uniform float albedo;
|
---|
[2386] | 22 | uniform float4 specularColor;
|
---|
| 23 |
|
---|
| 24 | #include "illum.hlsl"
|
---|
| 25 |
|
---|
| 26 | struct Troll_PS_IN
|
---|
| 27 | {
|
---|
| 28 | float2 texCoord:TEXCOORD0;
|
---|
| 29 | float3 tangent:TEXCOORD1;
|
---|
| 30 | float3 binormal:TEXCOORD2;
|
---|
| 31 | float3 normal:TEXCOORD3;
|
---|
| 32 | float3 V: TEXCOORD4;
|
---|
[2458] | 33 | float3 L1: TEXCOORD5;
|
---|
| 34 | float3 L2: TEXCOORD6;
|
---|
[2386] | 35 | };
|
---|
| 36 |
|
---|
| 37 | float4 Troll_PS(Troll_PS_IN IN):COLOR
|
---|
| 38 | {
|
---|
| 39 | float4 Color = 0;
|
---|
[2389] | 40 | float3 N = normalize(IN.normal);//NormalMap(IN.tangent, IN.binormal, IN.normal, IN.texCoord, bumpMap);
|
---|
[2398] | 41 | float dist = length(IN.V);
|
---|
| 42 | float3 V = IN.V /dist;
|
---|
[2458] | 43 | float3 L1 = IN.L1;
|
---|
| 44 | float3 L2 = IN.L2;
|
---|
[2386] | 45 |
|
---|
[2417] | 46 | float4 diffuseColor = albedo * tex2D(colorTexture, IN.texCoord);
|
---|
[2467] | 47 | if( dot(lightRange1, lightRange1) != 0)
|
---|
[2458] | 48 | Color += Illumination(N, L1, V, lightColor1 * lightPower1, lightRange1, diffuseColor, specularity, specularColor);
|
---|
[2467] | 49 | if(dot(lightRange2, lightRange2) != 0)
|
---|
[2458] | 50 | Color += Illumination(N, L2, V, lightColor2 * lightPower2, lightRange2, diffuseColor, specularity, specularColor);
|
---|
[2386] | 51 |
|
---|
[2417] | 52 | float4 ret = Color;
|
---|
[2398] | 53 | return float4(ret.xyz, dist);
|
---|
[2386] | 54 | } |
---|