Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/SuperOrxoBros_HS18/data_extern/programs/Grass.cg @ 12175

Last change on this file since 12175 was 12175, checked in by siramesh, 5 years ago

Super Orxo Bros (Sidharth Ramesh, Nisa Balta, Jeff Ren)

File size: 912 bytes
Line 
1// Vertex program to wave some grass about
2// Simplistic, assumes base of the grass at 0
3void grass_vp(float4 position : POSITION,
4                          float3 normal   : NORMAL,
5                          float2 uv               : TEXCOORD0,
6                          out float4 oPosition : POSITION,
7                          out float2 oUv           : TEXCOORD0,
8                          out float4 colour    : COLOR,
9
10                          uniform float4x4 worldViewProj,
11                          uniform float4 ambient,
12                          uniform float4 objSpaceLight,
13                          uniform float4 lightColour,
14                          uniform float4 offset)
15{
16        float4 mypos = position;
17        //offset = float4(0.5, 0, 0, 0);
18        float4 factor = float4(1,1,1,1) - uv.yyyy;
19        mypos = mypos + offset * factor;
20        oPosition = mul(worldViewProj, mypos);
21
22        oUv = uv;
23        // get vertex light direction (support directional and point)
24        float3 light = normalize(
25                objSpaceLight.xyz -  (position.xyz * objSpaceLight.w));
26        float diffuseFactor = max(dot(normal, light), 0);
27       
28       
29        colour = ambient + diffuseFactor * lightColour;
30}
31
Note: See TracBrowser for help on using the repository browser.