/usr/share/psychtoolbox-3/PsychDemos/MandelbrotShader.frag.txt is in psychtoolbox-3-common 3.0.14.20170103+git6-g605ff5c.dfsg1-1build1.
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 | /*
File: MandelbrotShader.frag.txt
Abstract: Mandelbrot Shader (from the "orange book")
Copyright (C) 2002-2006 3Dlabs Inc. Ltd.
All rights reserved.
See 3Dlabs-License.txt for license information
*/
uniform vec2 center;
uniform float zoom;
void main() {
const float maxiter = 150.0;
float real = ((gl_TexCoord[0].x - 0.5) * 5.0 * zoom + center.x);
float imag = ((gl_TexCoord[0].y - 0.5) * 5.0 * zoom + center.y);
float Creal = real;
float Cimag = imag;
float r2 = 0.0;
float iter;
float tempreal;
vec3 InnerColor = vec3(0.0, 0.0, 0.0);
vec3 OuterColor1 = vec3(0.0, 0.0, 0.4);
vec3 OuterColor2 = vec3(1.0, 1.0, 1.0);
vec3 color;
for (iter = 0.0; (iter < maxiter) && (r2 < 4.0) ; iter += 1.0) {
tempreal = real;
real = (tempreal * tempreal) - (imag * imag) + Creal;
imag = (2.0 * tempreal * imag + Cimag);
r2 = (real * real) + (imag * imag);
}
tempreal = fract(iter * 0.01);
if (r2 < 4.0)
color = InnerColor;
else
color = mix(OuterColor1, OuterColor2, tempreal);
gl_FragColor = vec4(color, 1.0);
}
|