source: GTP/trunk/App/Demos/Illum/Illumination Networks Demo [OpenGL]/src/FinalDisplay.cg @ 845

Revision 845, 1.7 KB checked in by szirmay, 18 years ago (diff)
Line 
1struct 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
12VertexOut VertexProgram(
13                  float4 Position   : POSITION,
14          float2 TexCoord                       : TEXCOORD0,
15          float4 Color          : COLOR0, 
16          uniform float Opacity,                       
17          uniform float4 PSize : state.point.size,
18          uniform float4x4 modelView : state.matrix.modelview,
19          uniform float4x4 modelViewProj:state.matrix.mvp                       
20          )
21{
22        VertexOut Out;
23        Out.ID=TexCoord.x;
24        Out.Color=Color;
25        Out.Color.a=Opacity;
26         
27   float4 pos_eye = mul(modelView, Position);
28    float dist = length(pos_eye.xyz);
29    Out.PSize =PSize.x*TexCoord.y*sqrt(1.0 / (1 + dist*dist));
30               
31        Out.Position = mul(modelViewProj, Position);   
32       
33    return Out;
34}
35
36float4 FragmentProgram(VertexOut In,
37                                        uniform sampler2D BbTexture,                                   
38                                        uniform samplerRECT IllumTex
39                                        ) : COLOR
40{
41/*
42                float ds=texRECT(VisMap,float2(particle,direction)).g;
43                float tau=1.0;
44                //float alpha=1-exp(-ds*tau);
45                float alpha=Alb_Op.y;*/
46                                               
47                int particle=round(In.ID);
48                       
49                float4 Color=texRECT(IllumTex,float2(particle,0))*In.Color;
50                               
51                Color.a*=tex2D(BbTexture, In.TexCoord.xy).r;
52                //Color.a=1;
53               
54                return  Color;       
55}
56
57/*
58float4 FragmentProgram(VertexOut In,
59                                        uniform samplerRECT LVisMap,
60                                        uniform sampler2D BbTexture,
61                                        uniform float Ldir
62                                        ) : COLOR
63{
64                                       
65                int particle=round(In.ID);
66                       
67                float4 Color=texRECT(LVisMap,float2(particle,Ldir));
68                               
69                Color.a*=tex2D(BbTexture, In.TexCoord.xy).r;
70               
71                return  Color;
72   
73   
74       
75}*/
Note: See TracBrowser for help on using the repository browser.