Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/fem/test/mandel.diderot
 [diderot] / branches / fem / test / mandel.diderot

# Diff of /branches/fem/test/mandel.diderot

revision 1894, Mon May 28 05:46:56 2012 UTC revision 1904, Sun Jun 3 02:40:45 2012 UTC
# Line 1  Line 1
1
2
3  // ../bin/diderotc --exec mandel.diderot && ./mandel && unu quantize -b 8 -i rgb.nrrd -o mandel.png  // ../bin/diderotc --exec mandel.diderot && ./mandel && unu quantize -b 8 -i rgb.nrrd -o mandel.png
4
5  // Global definitions  // Global definitions
6  input int reso = 800;  input int reso = 2000;
7  input int maxiter = 1000;  input int maxiter = 2000;
8    input vec2 center = [-1.2, -0.3]; // [0.0,0.0] for whole thing
9    input real fov = 0.15; // 2.0 for whole thing
10
11  // Strand definition  // Strand definition
12  strand mandel(int crIdx, int ciIdx) {  strand mandel(vec2 c) {
vec2 c = [lerp(-2.0, 2.0, 1.0, real(crIdx), real(reso)),
lerp(-2.0, 2.0, 1.0, real(ciIdx), real(reso))];
13     vec2 z = [0.0, 0.0];     vec2 z = [0.0, 0.0];
14     int iter = 0;     int iter = 0;
15     output vec3 rgb = [0.0, 0.0, 0.0];     output vec3 rgb = [0.0, 0.0, 0.0];
# Line 18  Line 20
20           // point has escaped; set color based on iteration           // point has escaped; set color based on iteration
21           real t = 11.0*real(iter)^0.2;           real t = 11.0*real(iter)^0.2;
22           rgb = [sin(t), sin(t + 2.0*π/3.0), sin(t - 2.0*π/3.0)];           rgb = [sin(t), sin(t + 2.0*π/3.0), sin(t - 2.0*π/3.0)];
23           rgb = ([1.2, 1.2, 1.2] + rgb)/2.0;           rgb = ([1.7, 1.7, 1.7] + rgb)/2.7;
24           stabilize;           stabilize;
25        }        }
26        if (iter > maxiter) {        if (iter > maxiter) {
# Line 29  Line 31
31  }  }
32
33  // Strand initialization  // Strand initialization
34  initially [ mandel(crIdx, ciIdx) | ciIdx in 1..reso, crIdx in 1..reso ];  initially [ mandel([lerp(center[0]-fov, center[0]+fov,
35                             1.0, real(crIdx), real(reso)),
36                        lerp(center[1]-fov, center[1]+fov,
37                             1.0, real(ciIdx), real(reso))])
38                | ciIdx in 1..reso, crIdx in 1..reso ];

Legend:
 Removed from v.1894 changed lines Added in v.1904