source: trunk/tests/render_test/box.vert

Last change on this file 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
RevLine 
[46]1#version 120
[238]2attribute vec3 nv_position;
3attribute vec3 nv_color;
4uniform mat4 nv_m_mvp;
5
[46]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);
[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.