2013-12-18 19:13:17 -05:00
|
|
|
#version 130
|
2013-11-30 16:33:06 -05:00
|
|
|
uniform sampler2D tex;
|
|
|
|
uniform int hastex;
|
|
|
|
uniform float objectid;
|
|
|
|
|
2013-12-18 19:13:17 -05:00
|
|
|
noperspective in vec3 nor;
|
|
|
|
noperspective in vec3 eyenor;
|
|
|
|
noperspective in vec3 viewpos;
|
2013-11-30 16:33:06 -05:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
float rim = 1.0 - dot(eyenor, viewpos);
|
|
|
|
rim = smoothstep(0.5, 1.5, rim) * 0.35;
|
2013-12-25 15:19:18 -05:00
|
|
|
vec4 color;
|
2013-11-30 16:33:06 -05:00
|
|
|
|
|
|
|
if (hastex != 0) {
|
|
|
|
vec4 col = texture2D(tex, gl_TexCoord[0].xy);
|
|
|
|
|
2013-12-26 21:06:08 -05:00
|
|
|
if (col.a < 0.1)
|
2013-11-30 16:33:06 -05:00
|
|
|
discard;
|
|
|
|
|
|
|
|
col.xyz += rim;
|
|
|
|
|
2013-12-25 15:19:18 -05:00
|
|
|
color = col;
|
2013-11-30 16:33:06 -05:00
|
|
|
} else {
|
2013-12-25 15:19:18 -05:00
|
|
|
color = gl_Color + vec4(vec3(rim), 0.0);
|
2013-11-30 16:33:06 -05:00
|
|
|
}
|
|
|
|
|
2013-12-25 15:19:18 -05:00
|
|
|
gl_FragData[0] = vec4(color.xyz, 1.);
|
2013-12-23 11:59:55 -05:00
|
|
|
gl_FragData[1] = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
|
2013-12-25 15:19:18 -05:00
|
|
|
gl_FragData[2] = vec4(1. - color.a);
|
2013-11-30 16:33:06 -05:00
|
|
|
}
|
|
|
|
|