Last change
on this file since 139 was
139,
checked in by epyon, 12 years ago
|
- program - set_opt_uniform added
- example extended to feature per-pixel lighting, self-illumination mapping, specular mapping and dual custom colors mapping
|
File size:
715 bytes
|
Line | |
---|
1 | #version 120
|
---|
2 |
|
---|
3 | attribute vec3 position;
|
---|
4 | attribute vec2 texcoord;
|
---|
5 | attribute vec3 normal;
|
---|
6 |
|
---|
7 | varying vec3 v_normal;
|
---|
8 | varying vec3 v_light_vector;
|
---|
9 | varying vec3 v_view_vector;
|
---|
10 | varying vec2 v_texcoord;
|
---|
11 |
|
---|
12 | uniform mat4 matrix_mvp;
|
---|
13 | uniform mat4 nv_m_modelview;
|
---|
14 | uniform mat4 nv_m_projection;
|
---|
15 | uniform mat3 nv_m_normal;
|
---|
16 | uniform vec3 light_position;
|
---|
17 |
|
---|
18 | void main(void) {
|
---|
19 | vec4 vertex = vec4( position, 1.0 );
|
---|
20 | vec3 eye_pos = vec3( nv_m_modelview * vertex );
|
---|
21 | v_normal = normalize( nv_m_normal * normal );
|
---|
22 | v_light_vector = vec3( normalize( light_position - eye_pos ) );
|
---|
23 | v_view_vector = vec3( normalize( -eye_pos ) );
|
---|
24 |
|
---|
25 | v_texcoord = texcoord;
|
---|
26 | gl_Position = matrix_mvp * vertex;
|
---|
27 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.