source: trunk/tests/render_test/box.vert @ 462

Last change on this file since 462 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
Line 
1#version 120
2attribute vec3 nv_position;
3attribute vec3 nv_color;
4uniform mat4 nv_m_mvp;
5
6varying vec3 f_coord;
7varying vec3 f_normal;
8varying vec3 f_material;
9varying float f_diffuse_value;
10uniform vec3 light;
11
12void main(void) {
13        f_normal = vec3(0,0,0);
14        f_normal[int(abs(nv_color.y)-1)] = sign( nv_color.y );
15        vec3 vnormal  = normalize(f_normal);
16        vec3 vlight   = normalize(light - nv_position);
17        float diffuse = max(dot(vlight, vnormal), 0.0);
18        f_diffuse_value = diffuse;
19        f_coord = nv_position;
20        f_material = nv_color;
21        gl_Position = nv_m_mvp * vec4(nv_position, 1.0);
22}
Note: See TracBrowser for help on using the repository browser.