|
Revision 6871
(checked in by robert, 2 years ago)
|
Checked in first cut of new SVN for OpenSceneGraph-Data
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
// |
|---|
| 3 |
// eroded.vert: Vertex shader for erosion effect |
|---|
| 4 |
// |
|---|
| 5 |
// author: Randi Rost |
|---|
| 6 |
// |
|---|
| 7 |
// Copyright (c) 2002: 3Dlabs, Inc. |
|---|
| 8 |
// |
|---|
| 9 |
|
|---|
| 10 |
varying float lightIntensity; |
|---|
| 11 |
varying vec3 Position; |
|---|
| 12 |
uniform vec3 LightPosition; |
|---|
| 13 |
uniform float Scale; |
|---|
| 14 |
|
|---|
| 15 |
void main(void) { |
|---|
| 16 |
vec4 pos = gl_ModelViewMatrix * gl_Vertex; |
|---|
| 17 |
Position = vec3(gl_Vertex) * Scale; |
|---|
| 18 |
vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal); |
|---|
| 19 |
float dotval = max(dot(normalize(LightPosition - vec3(pos)), tnorm), 0.0); |
|---|
| 20 |
lightIntensity = dotval * 1.5; |
|---|
| 21 |
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; |
|---|
| 22 |
} |
|---|