Last change
on this file since 12292 was
12115,
checked in by wiesep, 6 years ago
|
Changed folder structure, deletet some unused files and cleaned up code
|
File size:
905 bytes
|
Rev | Line | |
---|
[12115] | 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 | uniform mat4 worldViewProj; |
---|
| 16 | |
---|
| 17 | attribute vec4 vertex; |
---|
| 18 | attribute vec3 normal; |
---|
| 19 | |
---|
| 20 | varying vec3 uvw; |
---|
| 21 | varying vec3 oNormal; |
---|
| 22 | varying vec3 vVec; |
---|
| 23 | |
---|
| 24 | void main(void) |
---|
| 25 | { |
---|
| 26 | gl_Position = worldViewProj * vertex; |
---|
| 27 | |
---|
| 28 | // the view vector needs to be in vertex space |
---|
| 29 | vVec = vertex.xyz - eyePosition; |
---|
| 30 | oNormal = normal; |
---|
| 31 | // uvw is the calculated uvw coordinates based on vertex position |
---|
| 32 | uvw = vertex.xyz * scale.xyz; |
---|
| 33 | uvw.xz += waveSpeed * time_0_X; |
---|
| 34 | uvw.y += uvw.z + noiseSpeed * time_0_X; |
---|
| 35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.