Last change
on this file since 72 was
44,
checked in by bknecht, 17 years ago
|
merge from tutorial branche to trunk
|
File size:
831 bytes
|
Rev | Line | |
---|
[25] | 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 | |
---|
| 10 | uniform vec3 scale; |
---|
| 11 | uniform vec3 eyePosition; |
---|
| 12 | uniform vec2 waveSpeed; |
---|
| 13 | uniform float noiseSpeed; |
---|
| 14 | uniform float time_0_X; |
---|
| 15 | |
---|
| 16 | varying vec3 uvw; |
---|
| 17 | varying vec3 normal; |
---|
| 18 | varying vec3 vVec; |
---|
| 19 | |
---|
| 20 | void 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.