source: OGRE/trunk/ogrenew/Samples/Media/materials/programs/oceanGLSL.vert @ 692

Revision 692, 1001 bytes checked in by mattausch, 18 years ago (diff)

adding ogre 1.2 and dependencies

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   // uvw is the calculated uvw coordinates based on vertex position
25   // GLSL uses xy instead of xz for uv and z is depth so do some swizzling
26   vec3 lookupPos = gl_Vertex.xzy * scale.xzy;
27   lookupPos .x += waveSpeed.x * time_0_X;
28   lookupPos .y += waveSpeed.y * time_0_X;
29   lookupPos .z += lookupPos.y + noiseSpeed * time_0_X;
30   uvw = lookupPos;
31   
32   //  the view vector needs to be in vertex space
33   vVec = gl_Vertex.xyz - eyePosition;
34   normal = gl_Normal;
35}
Note: See TracBrowser for help on using the repository browser.