Changeset 238 for trunk/tests/render_test/box.vert
- Timestamp:
- 05/16/14 05:48:01 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/render_test/box.vert
r46 r238 1 1 #version 120 2 attribute vec3 coords; 3 attribute vec3 material; 2 attribute vec3 nv_position; 3 attribute vec3 nv_color; 4 uniform mat4 nv_m_mvp; 5 4 6 varying vec3 f_coord; 5 7 varying vec3 f_normal; 6 8 varying vec3 f_material; 7 9 varying float f_diffuse_value; 8 uniform mat4 matrix_mvp;9 10 uniform vec3 light; 10 11 11 12 void main(void) { 12 13 f_normal = vec3(0,0,0); 13 f_normal[int(abs( material.y)-1)] = sign( material.y );14 f_normal[int(abs(nv_color.y)-1)] = sign( nv_color.y ); 14 15 vec3 vnormal = normalize(f_normal); 15 vec3 vlight = normalize(light - coords);16 vec3 vlight = normalize(light - nv_position); 16 17 float diffuse = max(dot(vlight, vnormal), 0.0); 17 18 f_diffuse_value = diffuse; 18 f_coord = coords;19 f_material = material;20 gl_Position = matrix_mvp * vec4(coords, 1.0);19 f_coord = nv_position; 20 f_material = nv_color; 21 gl_Position = nv_m_mvp * vec4(nv_position, 1.0); 21 22 }
Note: See TracChangeset
for help on using the changeset viewer.