demo/kitchen-sink/docs/glsl.glsl
raw| 1 | uniform float amplitude; |
| 2 | attribute float displacement; |
| 3 | varying vec3 vNormal; |
| 4 | |
| 5 | void main() { |
| 6 | |
| 7 | vNormal = normal; |
| 8 | |
| 9 | // multiply our displacement by the |
| 10 | // amplitude. The amp will get animated |
| 11 | // so we'll have animated displacement |
| 12 | vec3 newPosition = position + |
| 13 | normal * |
| 14 | vec3(displacement * |
| 15 | amplitude); |
| 16 | |
| 17 | gl_Position = projectionMatrix * |
| 18 | modelViewMatrix * |
| 19 | vec4(newPosition,1.0); |
| 20 | } |