Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Samples/Media/materials/programs/oceanGLSL.vert @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 831 bytes
Line 
1// oceanGLSL.vert
2// vertex program for Ocean water simulation
3// 05 Aug 2005
4// adapted for Ogre by nfz
5// converted from HLSL to GLSL
6// original shader source from Render Monkey 1.6 Reflections Refractions.rfx
7
8// 06 Aug 2005: moved uvw calculation from fragment program into vertex program
9
10uniform vec3 scale;
11uniform vec3 eyePosition;
12uniform vec2 waveSpeed;
13uniform float noiseSpeed;
14uniform float time_0_X;
15
16varying vec3 uvw;
17varying vec3 normal;
18varying vec3 vVec;
19
20void main(void)
21{
22   gl_Position = ftransform();
23   
24   //  the view vector needs to be in vertex space
25   vVec = gl_Vertex.xyz - eyePosition;
26   normal = gl_Normal;
27   // uvw is the calculated uvw coordinates based on vertex position
28   uvw = gl_Vertex.xyz * scale.xyz;
29   uvw.xz += waveSpeed * time_0_X;
30   uvw.y += uvw.z + noiseSpeed * time_0_X;
31   
32}
Note: See TracBrowser for help on using the repository browser.