source: GTP/branches/IllumWPdeliver2008dec/IlluminationWP/demos/Standalone/Hierarchical Systems Demo [OpenGL]/src/Psystem_Default.cg @ 3255

Revision 3255, 1.1 KB checked in by szirmay, 15 years ago (diff)
Line 
1struct VertexOut
2{
3        float4 VertexPosition           :POSITION;
4        float2 TexCoord                         :TEXCOORD;
5        float4 Position                         :TEXCOORD1;
6        float4 EyePosition                      :TEXCOORD2;
7        float2 BbSizeAngleCos           :TEXCOORD3;
8        float4 LightSpacePos            :TEXCOORD4;     
9        float4 Color                            :COLOR0;
10};
11
12
13//
14//  Vertex program for displaying particle system with rectangle rendertexture
15//
16VertexOut VertexProgram( float4 Position :POSITION,
17                                                float4 Texcoord: TEXCOORD,
18                                                float4 Color:COLOR0,
19                                                uniform float4x4 ModelViewProj  :state.matrix.mvp
20                                                )                                                                       
21{
22        VertexOut Out; 
23                       
24        Out.Color=Color;
25       
26        Out.VertexPosition=mul(ModelViewProj, Position);
27        Out.TexCoord=Texcoord.xy;
28               
29        return Out;     
30}
31
32//
33//  Fragment program for displaying particle system with rectangle rendertexture
34//
35void FragmentProgram(   VertexOut       In,
36                                                uniform samplerRECT FrontTexture,
37                                                uniform float Transparency,
38                                                uniform float3 LightColor,
39                                                float4 out Color:COLOR                                         
40                                        )
41{                                       
42        float density=texRECT(FrontTexture,In.TexCoord*256).a*Transparency;
43                               
44        Color=float4(LightColor*density*In.Color.rgb,1-density);       
45                       
46}
47
Note: See TracBrowser for help on using the repository browser.