/usr/share/libavogadro/shaders/marble.frag is in avogadro-data 1.1.1-0ubuntu7.
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 | // wwlk
//
// Show me the normal
uniform vec4 my01H2; // please load with (0.0,1.0,0.5,2.0)
varying vec3 v_EyeNormal;
varying vec4 v_EyePosition;
uniform float time;
uniform vec3 lightDirection;
uniform vec3 blue;
uniform vec3 white;
uniform sampler3D tex1;
uniform sampler2D tex2;
void main (void)
{
vec3 NNormal;
vec4 MyColor;
vec4 tex, tx2;
vec3 color;
float turb;
float illum;
vec4 Intensity;
float myHalf = 0.5;
//
// Since the EyeNormal is getting interpolated, we
// have to first restore it by normalizing it.
//
NNormal = normalize( v_EyeNormal );
illum = clamp( dot(NNormal, lightDirection), 0.0, 1.0) + 0.2;
// Fetch two samples from a texture with 4 noise octaves
tex = texture3D( tex1, gl_TexCoord[0].stp);
tx2 = texture3D( tex1, gl_TexCoord[0].stp*16.0+0.5);
// Remamp noise from [0,1] to [-1,1]
tex = tex *2.0 -1.0;
tx2 = tx2 *2.0 -1.0;
//accumulate turbulence
turb = tex.r + myHalf*(tex.g + myHalf*(tex.b + myHalf*tex.a));
turb += 0.0625*(tx2.r + myHalf*(tx2.g+ myHalf*tx2.b));
//remap the turbulence value and use it to index a color spline stored as a texture
turb = clamp( turb*2.0 , 0.0, 1.0);
vec2 coord = vec2(turb);
vec4 c = texture2D( tex2, coord);
color = vec3(c) * illum;
gl_FragColor = vec4( color, 1.0);
}
|