Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/png/materials/programs/Grass.cg @ 7016

Last change on this file since 7016 was 5313, checked in by landauf, 16 years ago

no codechanges, changed eol-style of materials and programs to native

  • Property svn:eol-style set to native
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.