[845] | 1 | struct VertexOut
|
---|
| 2 | {
|
---|
| 3 | float4 Position :POSITION;
|
---|
| 4 | float4 Color :COLOR0;
|
---|
| 5 | float2 TexCoord :TEXCOORD;
|
---|
| 6 | float error :TEXCOORD1;
|
---|
| 7 | float ID :TEXCOORD2;
|
---|
| 8 | float PSize :PSIZE;
|
---|
| 9 | };
|
---|
| 10 |
|
---|
| 11 |
|
---|
| 12 | VertexOut VertexProgram(
|
---|
| 13 | float4 Position : POSITION,
|
---|
| 14 | float ID : TEXCOORD0,
|
---|
| 15 | float4 Color : COLOR0,
|
---|
| 16 | uniform float4 PSize : state.point.size,
|
---|
| 17 | uniform float4x4 modelView : state.matrix.modelview,
|
---|
| 18 | uniform float4x4 modelViewProj:state.matrix.mvp
|
---|
| 19 | )
|
---|
| 20 | {
|
---|
| 21 | VertexOut Out;
|
---|
| 22 | Out.ID=ID;
|
---|
| 23 | Out.Color=Color;
|
---|
| 24 |
|
---|
| 25 | float4 pos_eye = mul(modelView, Position);
|
---|
| 26 | float dist = length(pos_eye.xyz);
|
---|
| 27 | Out.PSize =PSize.x*sqrt(1.0 / (1 + dist*dist));
|
---|
| 28 |
|
---|
| 29 | Out.Position = mul(modelViewProj, Position);
|
---|
| 30 |
|
---|
| 31 | return Out;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | float4 FragmentProgram(VertexOut In,
|
---|
| 35 | uniform sampler2D BbTexture,
|
---|
| 36 | uniform samplerRECT IllumTex,
|
---|
| 37 | uniform samplerRECT DirectIllum,
|
---|
| 38 | uniform float4 EyeDirsWeights ) : COLOR
|
---|
| 39 | {
|
---|
| 40 |
|
---|
| 41 | float4 Color=float4(0,0,0,0);
|
---|
| 42 |
|
---|
| 43 | int newID=round(In.ID);
|
---|
| 44 | int newDir=round(EyeDirsWeights.x);
|
---|
| 45 | int newDir2=round(EyeDirsWeights.y);
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | Color+=texRECT(IllumTex,float2(newID,newDir)).r;
|
---|
| 49 | //Color+=texRECT(IllumTex,float2(newID,newDir2)).r*EyeDirsWeights.w;
|
---|
| 50 |
|
---|
| 51 | Color+=texRECT(DirectIllum,float2(newID,newDir)).r;
|
---|
| 52 | //Color+=texRECT(DirectIllum,float2(newID,newDir2)).r*EyeDirsWeights.w;
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | //Color=texRECT(DirectIllum,float2(newID,0));
|
---|
| 56 |
|
---|
| 57 | Color.a=tex2D(BbTexture, In.TexCoord.xy).r;
|
---|
| 58 |
|
---|
| 59 | return Color;
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | } |
---|