gruff 0.1 → 0.1.1
raw patch · 3 files changed
+19/−50 lines, 3 files
Files
- cache.frag +8/−24
- colourize.frag +10/−25
- gruff.cabal +1/−1
cache.frag view
@@ -31,7 +31,6 @@ vec3 hsv2rgb(float h, float s, float v) { float i, f, p, q, t, r, g, b;- int ii; if (s == 0.0) { // Ignore hue r = v;@@ -43,32 +42,17 @@ h = pvp_adjust_3(h); h = h - floor(h); h = h * 6.0;- i = floor(h); ii = int(i);+ i = floor(h); f = h - i; p = v*(1.0 - s); // The "low-flat" curve q = v*(1.0 - (s*f)); // The "falling" curve t = v*(1.0 - (s*(1.0 - f))); // The "rising" curve- switch(ii) {- case 0: // red point- r = v; g = t; b = p; // RED max, GRN rising, BLU min- break;- case 1: // yellow point- r = q; g = v; b = p; // RED falling, GRN max, BLU min- break;- case 2: // green point- r = p; g = v; b = t; // RED min, GRN max, BLU rising- break;- case 3: // cyan point- r = p; g = q; b = v; // RED min, GRN falling, BLU max- break;- case 4: // blue point- r = t; g = p; b = v; // RED rising, GRN min, BLU max- break;- case 5: // magenta point- default:- r = v; g = p; b = q; // RED max, GRN min, BLU falling- break;- }+ if (i < 1.0) { r = v; g = t; b = p; } else+ if (i < 2.0) { r = q; g = v; b = p; } else+ if (i < 3.0) { r = p; g = v; b = t; } else+ if (i < 4.0) { r = p; g = q; b = v; } else+ if (i < 5.0) { r = t; g = p; b = v; } else+ { r = v; g = p; b = q; } } return vec3(r, g, b); }@@ -78,5 +62,5 @@ float h = n; float s = 1.0; float v = clamp(0.0, 1.0, 0.25 + log(h + 1.0));- gl_FragColor = vec4(hsv2rgb(frac(h), s, v), 1.0);+ gl_FragColor = vec4(hsv2rgb(h, s, v), 1.0); }
colourize.frag view
@@ -36,7 +36,6 @@ vec3 hsv2rgb(float h, float s, float v) { float i, f, p, q, t, r, g, b;- int ii; if (s == 0.0) { // Ignore hue r = v;@@ -48,32 +47,17 @@ h = pvp_adjust_3(h); h = h - floor(h); h = h * 6.0;- i = floor(h); ii = int(i);+ i = floor(h); f = h - i; p = v*(1.0 - s); // The "low-flat" curve q = v*(1.0 - (s*f)); // The "falling" curve t = v*(1.0 - (s*(1.0 - f))); // The "rising" curve- switch(ii) {- case 0: // red point- r = v; g = t; b = p; // RED max, GRN rising, BLU min- break;- case 1: // yellow point- r = q; g = v; b = p; // RED falling, GRN max, BLU min- break;- case 2: // green point- r = p; g = v; b = t; // RED min, GRN max, BLU rising- break;- case 3: // cyan point- r = p; g = q; b = v; // RED min, GRN falling, BLU max- break;- case 4: // blue point- r = t; g = p; b = v; // RED rising, GRN min, BLU max- break;- case 5: // magenta point- default:- r = v; g = p; b = q; // RED max, GRN min, BLU falling- break;- }+ if (i < 1.0) { r = v; g = t; b = p; } else+ if (i < 2.0) { r = q; g = v; b = p; } else+ if (i < 3.0) { r = p; g = v; b = t; } else+ if (i < 4.0) { r = p; g = q; b = v; } else+ if (i < 5.0) { r = t; g = p; b = v; } else+ { r = v; g = p; b = q; } } return vec3(r, g, b); }@@ -87,8 +71,9 @@ float h = hscale * log(i) + hshift; float s; float v;- if (t > 0.0) { s = 0.55; } else { s = 0.45; }- if (frac(i / 2) < 0.5) { v = 0.95; } else { v = 1.00; }+ if (t > 0.0) { s = 0.55; } else { s = 0.45; }+ i /= 2.0;+ if (i - floor(i) < 0.5) { v = 0.95; } else { v = 1.00; } c.rgb = hsv2rgb(h, s, v); c.rgb *= clamp(0.5 + 0.25 * log(d), 0.0, 1.0); }
gruff.cabal view
@@ -1,5 +1,5 @@ Name: gruff-Version: 0.1+Version: 0.1.1 Synopsis: fractal explorer GUI using the ruff library Description: Currently allows exploration only of the Mandelbrot Set fractal.