Last change
on this file since 238 was
238,
checked in by epyon, 11 years ago
|
- mesh data interface and usage
- new wavefront importer (old pending removal)
- updates to test projects
|
File size:
597 bytes
|
Rev | Line | |
---|
[46] | 1 | #version 120
|
---|
[238] | 2 | attribute vec3 nv_position;
|
---|
| 3 | attribute vec3 nv_color;
|
---|
| 4 | uniform mat4 nv_m_mvp;
|
---|
| 5 |
|
---|
[46] | 6 | varying vec3 f_coord;
|
---|
| 7 | varying vec3 f_normal;
|
---|
| 8 | varying vec3 f_material;
|
---|
| 9 | varying float f_diffuse_value;
|
---|
| 10 | uniform vec3 light;
|
---|
| 11 |
|
---|
| 12 | void main(void) {
|
---|
| 13 | f_normal = vec3(0,0,0);
|
---|
[238] | 14 | f_normal[int(abs(nv_color.y)-1)] = sign( nv_color.y );
|
---|
[46] | 15 | vec3 vnormal = normalize(f_normal);
|
---|
[238] | 16 | vec3 vlight = normalize(light - nv_position);
|
---|
[46] | 17 | float diffuse = max(dot(vlight, vnormal), 0.0);
|
---|
| 18 | f_diffuse_value = diffuse;
|
---|
[238] | 19 | f_coord = nv_position;
|
---|
| 20 | f_material = nv_color;
|
---|
| 21 | gl_Position = nv_m_mvp * vec4(nv_position, 1.0);
|
---|
[46] | 22 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.