Rev | Line | |
---|
[12083] | 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 | #version 150 |
---|
| 11 | |
---|
| 12 | uniform vec3 scale; |
---|
| 13 | uniform vec3 eyePosition; |
---|
| 14 | uniform vec2 waveSpeed; |
---|
| 15 | uniform float noiseSpeed; |
---|
| 16 | uniform float time_0_X; |
---|
| 17 | uniform mat4 worldViewProj; |
---|
| 18 | |
---|
| 19 | in vec4 vertex; |
---|
| 20 | in vec4 normal; |
---|
| 21 | |
---|
| 22 | out vec3 uvw; |
---|
| 23 | out vec4 oNormal; |
---|
| 24 | out vec3 vVec; |
---|
| 25 | |
---|
| 26 | void main(void) |
---|
| 27 | { |
---|
| 28 | gl_Position = worldViewProj * vertex; |
---|
| 29 | |
---|
| 30 | // the view vector needs to be in vertex space |
---|
| 31 | vVec = vertex.xyz - eyePosition; |
---|
| 32 | oNormal = normal; |
---|
| 33 | // uvw is the calculated uvw coordinates based on vertex position |
---|
| 34 | uvw = vertex.xyz * scale.xyz; |
---|
| 35 | uvw.xz += waveSpeed * time_0_X; |
---|
| 36 | uvw.y += uvw.z + noiseSpeed * time_0_X; |
---|
| 37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.