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:
791 bytes
|
Rev | Line | |
---|
[46] | 1 | #version 120
|
---|
| 2 | varying vec3 f_coord;
|
---|
| 3 | varying vec3 f_normal;
|
---|
| 4 | varying vec3 f_material;
|
---|
| 5 | varying float f_diffuse_value;
|
---|
[238] | 6 | uniform sampler2D nv_t_diffuse;
|
---|
[46] | 7 | uniform vec3 light;
|
---|
| 8 |
|
---|
| 9 | void main(void) {
|
---|
| 10 | float w = f_material.x;
|
---|
| 11 | bool secondary = f_normal.y < 0.1;
|
---|
| 12 | float remmod = floor( w / 16 + 0.5 );
|
---|
| 13 | float modulus = w - remmod * 16;
|
---|
| 14 | float dist = distance( light, f_coord );
|
---|
| 15 | float dmod = clamp(5.0 - dist, 0.0, 1.0) * f_diffuse_value;
|
---|
| 16 |
|
---|
| 17 | if (secondary)
|
---|
[238] | 18 | gl_FragColor = texture2D(nv_t_diffuse, vec2((fract(f_coord.z - f_coord.x) + modulus ), ( fract(-f_coord.y) + remmod) ) / 16.0);
|
---|
[46] | 19 | else
|
---|
[238] | 20 | gl_FragColor = texture2D(nv_t_diffuse, vec2((fract(f_coord.z) + modulus ), ( fract(f_coord.x) + remmod) ) / 16.0);
|
---|
[46] | 21 | gl_FragColor = vec4( gl_FragColor.xyz * (f_diffuse_value + 0.4), 1.0 );
|
---|
| 22 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.