| Line | |
|---|
| 1 | #version 150 |
|---|
| 2 | |
|---|
| 3 | in vec4 uv0; |
|---|
| 4 | in vec4 position; |
|---|
| 5 | in vec3 normal; |
|---|
| 6 | |
|---|
| 7 | uniform mat4 worldViewProjMatrix; |
|---|
| 8 | uniform vec3 eyePosition; // object space |
|---|
| 9 | uniform float timeVal; |
|---|
| 10 | uniform float scale; // the amount to scale the noise texture by |
|---|
| 11 | uniform float scroll; // the amount by which to scroll the noise |
|---|
| 12 | uniform float noise; // the noise perturb as a factor of the time |
|---|
| 13 | |
|---|
| 14 | out vec3 noiseCoord; |
|---|
| 15 | out vec4 projectionCoord; |
|---|
| 16 | out vec3 eyeDir; |
|---|
| 17 | out vec3 oNormal; |
|---|
| 18 | |
|---|
| 19 | // Vertex program for fresnel reflections / refractions |
|---|
| 20 | void main() |
|---|
| 21 | { |
|---|
| 22 | gl_Position = worldViewProjMatrix * position; |
|---|
| 23 | // Projective texture coordinates, adjust for mapping |
|---|
| 24 | mat4 scalemat = mat4(0.5, 0.0, 0.0, 0.0, |
|---|
| 25 | 0.0, -0.5, 0.0, 0.0, |
|---|
| 26 | 0.0, 0.0, 0.5, 0.0, |
|---|
| 27 | 0.5, 0.5, 0.5, 1.0); |
|---|
| 28 | projectionCoord = scalemat * gl_Position; |
|---|
| 29 | |
|---|
| 30 | // Noise map coords |
|---|
| 31 | noiseCoord.xy = (uv0.xy + (timeVal * scroll)) * scale; |
|---|
| 32 | noiseCoord.z = noise * timeVal; |
|---|
| 33 | |
|---|
| 34 | eyeDir = normalize(position.xyz - eyePosition); |
|---|
| 35 | oNormal = normal.rgb; |
|---|
| 36 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.