Revision 657,
872 bytes
checked in by mattausch, 19 years ago
(diff) |
added ogre dependencies and patched ogre sources
|
Line | |
---|
1 | // Vertex program to wave some grass about |
---|
2 | // Simplistic, assumes base of the grass at 0 |
---|
3 | void 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 | mypos = mypos + offset * mypos.yyyy; |
---|
19 | oPosition = mul(worldViewProj, mypos); |
---|
20 | |
---|
21 | oUv = uv; |
---|
22 | // get vertex light direction (support directional and point) |
---|
23 | float3 light = normalize( |
---|
24 | objSpaceLight.xyz - (position.xyz * objSpaceLight.w)); |
---|
25 | float diffuseFactor = max(dot(normal, light), 0); |
---|
26 | |
---|
27 | |
---|
28 | colour = ambient + diffuseFactor * lightColour; |
---|
29 | } |
---|
30 | |
---|
Note: See
TracBrowser
for help on using the repository browser.