/usr/share/libavogadro/shaders/phong.frag is in avogadro-data 1.0.3-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | // wwlk
//
// Do one per fragment diffuse light
// + four specular lights
// + four more specular lights
// 8 specular lights per fragment!
const float Shininess = 40.0;
void main (void)
{
//
// vec3 EyeNormal = vec3(gl_TexCoord0);
//
// vec3 ULLight = vec3(gl_TexCoord1);
// vec3 LRLight = vec3(gl_TexCoord2);
// vec3 RimLight = vec3(gl_TexCoord3);
//
// vec4 DifColor = vec4(gl_TexCoord4);
// vec4 SpecColor = vec4(gl_TexCoord5);
// vec4 ULColor = vec4(gl_TexCoord6);
// vec4 LRColor = vec4(gl_TexCoord7);
//
vec3 NNormal;
vec3 LNormal;
vec4 MyColor;
vec4 SpecularColor;
float Intensity;
//
// Since the normal is getting interpolated, we
// have to first restore it by normalizing it.
//
// NNormal = normalize( EyeNormal );
NNormal = normalize( vec3(gl_TexCoord[0]) );
//
// Per fragment diffuse lighting
// We are going to put the diffuse light about
// the right spot....
////// Intensity = dot ( ULLight, NNormal );
Intensity = dot (vec3(gl_TexCoord[1]), NNormal );
Intensity = max ( Intensity, 0.0 );
////// MyColor = vec4(Intensity) * DifColor;
MyColor = vec4(Intensity) * gl_TexCoord[4];
//
// We are going to point the normal to the
// upper right front all of the time by taking
// the abs. No need to normalize again.
//
NNormal = abs(NNormal);
//
// Now, start the specular calculations.
//
////// Intensity = dot( NNormal, LRLight );
Intensity = dot( NNormal, vec3( gl_TexCoord[1] ) );
Intensity = max( Intensity, 0.0 );
Intensity = pow( Intensity, Shininess );
////// MyColor += vec4(Intensity) * ULColor;
MyColor += vec4(Intensity) * gl_TexCoord[6];
////// Intensity = dot( NNormal, LRLight );
Intensity = dot( NNormal, vec3( gl_TexCoord[2] ) );
Intensity = max( Intensity, 0.0 );
Intensity = pow( Intensity, Shininess );
////// MyColor += vec4(Intensity) * ULColor;
MyColor += vec4(Intensity) * gl_TexCoord[7];
//
// Squash the Y of the normal vector
//
NNormal.y = 0.0;
NNormal = normalize( NNormal );
////// Intensity = dot( NNormal, RimLight );
Intensity = dot( NNormal, vec3( gl_TexCoord[3] ) );
////// Intensity = max( Intensity, 0.0 );
Intensity = pow( Intensity, Shininess );
////// MyColor += vec4(Intensity) * SpecColor;
MyColor += vec4(Intensity) * gl_TexCoord[5];
////// MyColor.a = Difcolor.a;
MyColor.a = gl_TexCoord[4].a;
gl_FragColor = MyColor;
}
|