home *** CD-ROM | disk | FTP | other *** search
- //rain cylendar vertex shader:
- //moves texture coordinates with time and angle
- //scales cylendar by specified amounts
- //Luke Lenhart
- //(C)2004-2005 Digipen Institute of Technology
-
- //u tex coord modifier (should be varied from 0 to 1 with angle of camera)
- float uMod;
-
- //scale of cylendar
- float4 scaleXYZ;
-
- //alpha value of it all
- float alpha;
-
- //world,view,projection transform
- float4x4 matWorldViewProj;
-
- //current time (in seconds) since whenever
- float curTime;
-
- //shader input
- struct VS_INPUT
- {
- float4 Pos : POSITION;
- float2 Tex0 : TEXCOORD0;
- };
-
- //shader output
- struct VS_OUTPUT
- {
- float4 Pos : POSITION;
- float4 Color : COLOR;
- float2 Tex0 : TEXCOORD0;
- };
-
- //shader code
- VS_OUTPUT VShader(VS_INPUT In)
- {
- VS_OUTPUT Out;
-
- //calc transformed position
- float4 scaledPos=scaleXYZ*In.Pos;
- Out.Pos=mul(matWorldViewProj, scaledPos);
-
- Out.Tex0=In.Tex0*float2(0.05f*pow(scaleXYZ.x,0.8),75.0f/pow(scaleXYZ.x,0.5f))+float2(uMod*In.Pos.z*40.0f,-2.0f*curTime*(45.0f/pow(scaleXYZ.x,0.7f)))+float2(scaleXYZ.x*0.001,0);
-
- //make vert color
- Out.Color=float4(1,1,1,1);
-
- //if z is near 1, fade it out
- if (In.Pos.z>=0.95f)
- {
- Out.Color.a=0.0f;
- }
-
- //apply alpha
- Out.Color.a*=alpha;
-
- //spit out the results
- return Out;
- }
-