From abfa452c0d22181ee6aadf6a7932552593178e08 Mon Sep 17 00:00:00 2001 From: Patricio Gonzalez Vivo Date: Wed, 4 May 2016 06:28:52 -0400 Subject: [PATCH] adding gallery --- 12/2d-cnoise-2x2.frag | 11 +++--- 12/2d-cnoise-2x2x2.frag | 15 +++++--- 12/2d-cnoise.frag | 11 +++--- 12/3d-cnoise.frag | 19 +++++---- css/style.css | 85 +++++++++++++++++++++++++++++++++++++++++ examples/gallery.css | 81 --------------------------------------- examples/index.php | 1 - 7 files changed, 117 insertions(+), 106 deletions(-) delete mode 100644 examples/gallery.css diff --git a/12/2d-cnoise-2x2.frag b/12/2d-cnoise-2x2.frag index 2f7eaf4..081587b 100755 --- a/12/2d-cnoise-2x2.frag +++ b/12/2d-cnoise-2x2.frag @@ -1,4 +1,5 @@ -// Author @patriciogv - 2015 +// Author: Stefan Gustavson +// Title: Cellular noise ("Worley noise") #ifdef GL_ES precision mediump float; @@ -24,9 +25,9 @@ vec4 permute(vec4 x) { // If you need a smooth F2, use the slower 3x3 version. // F1 is sometimes wrong, too, but OK for most purposes. vec2 cellular2x2(vec2 P) { -#define K 0.142857142857 // 1/7 -#define K2 0.0714285714285 // K/2 -#define jitter 0.8 // jitter 1.0 makes F1 wrong more often + #define K 0.142857142857 // 1/7 + #define K2 0.0714285714285 // K/2 + #define jitter 0.8 // jitter 1.0 makes F1 wrong more often vec2 Pi = mod(floor(P), 289.0); vec2 Pf = fract(P); vec4 Pfx = Pf.x + vec4(-0.5, -1.5, -0.5, -1.5); @@ -58,7 +59,7 @@ vec2 cellular2x2(vec2 P) { void main(void) { vec2 st = gl_FragCoord.xy/u_resolution.xy; - vec2 F = cellular2x2(st*20.); + vec2 F = cellular2x2(st*20.+vec2(u_time,0.)); float n = 1.0-1.5*F.x; gl_FragColor = vec4(n, n, n, 1.0); diff --git a/12/2d-cnoise-2x2x2.frag b/12/2d-cnoise-2x2x2.frag index 8a10e3d..a9136fa 100755 --- a/12/2d-cnoise-2x2x2.frag +++ b/12/2d-cnoise-2x2x2.frag @@ -1,3 +1,6 @@ +// Author: Stefan Gustavson +// Title: Cellular noise ("Worley noise") + #ifdef GL_ES precision mediump float; #endif @@ -24,12 +27,12 @@ vec3 permute(vec3 x) { // F2 is often wrong and has sharp discontinuities. // If you need a good F2, use the slower 3x3x3 version. vec2 cellular2x2x2(vec3 P) { -#define K 0.142857142857 // 1/7 -#define Ko 0.428571428571 // 1/2-K/2 -#define K2 0.020408163265306 // 1/(7*7) -#define Kz 0.166666666667 // 1/6 -#define Kzo 0.416666666667 // 1/2-1/6*2 -#define jitter 0.8 // smaller jitter gives less errors in F2 + #define K 0.142857142857 // 1/7 + #define Ko 0.428571428571 // 1/2-K/2 + #define K2 0.020408163265306 // 1/(7*7) + #define Kz 0.166666666667 // 1/6 + #define Kzo 0.416666666667 // 1/2-1/6*2 + #define jitter 0.8 // smaller jitter gives less errors in F2 vec3 Pi = mod(floor(P), 289.0); vec3 Pf = fract(P); vec4 Pfx = Pf.x + vec4(0.0, -1.0, 0.0, -1.0); diff --git a/12/2d-cnoise.frag b/12/2d-cnoise.frag index dcb201f..5bdfe65 100755 --- a/12/2d-cnoise.frag +++ b/12/2d-cnoise.frag @@ -1,4 +1,5 @@ -// Author @patriciogv - 2015 +// Author: Stefan Gustavson +// Title: Classic 2D cellular noise #ifdef GL_ES precision mediump float; @@ -15,9 +16,9 @@ vec3 permute(vec3 x) { // Cellular noise, returning F1 and F2 in a vec2. // Standard 3x3 search window for good F1 and F2 values vec2 cellular(vec2 P) { -#define K 0.142857142857 // 1/7 -#define Ko 0.428571428571 // 3/7 -#define jitter 1.0 // Less gives more regular pattern + #define K 0.142857142857 // 1/7 + #define Ko 0.428571428571 // 3/7 + #define jitter 1.0 // Less gives more regular pattern vec2 Pi = mod(floor(P), 289.0); vec2 Pf = fract(P); vec3 oi = vec3(-1.0, 0.0, 1.0); @@ -58,7 +59,7 @@ vec2 cellular(vec2 P) { void main(void) { vec2 st = gl_FragCoord.xy/u_resolution.xy; st *= 10.; - vec2 F = cellular(st); + vec2 F = cellular(st+vec2(u_time,0.)); float facets = 0.1+(F.y-F.x); float dots = smoothstep(0.05, 0.1, F.x); float n = facets * dots; diff --git a/12/3d-cnoise.frag b/12/3d-cnoise.frag index 748a884..6fee03a 100755 --- a/12/3d-cnoise.frag +++ b/12/3d-cnoise.frag @@ -1,5 +1,5 @@ -// Author @patriciogv - 2015 -// http://patriciogonzalezvivo.com +// Author: Stefan Gustavson +// Title: Classic 3D cellular noise #ifdef GL_ES precision mediump float; @@ -27,12 +27,12 @@ vec3 permute(vec3 x) { // implementation of Worley noise hands down. vec2 cellular(vec3 P) { -#define K 0.142857142857 // 1/7 -#define Ko 0.428571428571 // 1/2-K/2 -#define K2 0.020408163265306 // 1/(7*7) -#define Kz 0.166666666667 // 1/6 -#define Kzo 0.416666666667 // 1/2-1/6*2 -#define jitter 1.0 // smaller jitter gives more regular pattern + #define K 0.142857142857 // 1/7 + #define Ko 0.428571428571 // 1/2-K/2 + #define K2 0.020408163265306 // 1/(7*7) + #define Kz 0.166666666667 // 1/6 + #define Kzo 0.416666666667 // 1/2-1/6*2 + #define jitter 1.0 // smaller jitter gives more regular pattern vec3 Pi = mod(floor(P), 289.0); vec3 Pf = fract(P) - 0.5; @@ -188,6 +188,9 @@ void main(void) { st *= 10.; vec2 F = cellular(vec3(st,u_time)); + float dots = smoothstep(0.05, 0.1, F.x); float n = F.y-F.x; + + n *= dots; gl_FragColor = vec4(n, n, n, 1.0); } diff --git a/css/style.css b/css/style.css index e06c0e5..47b24b1 100644 --- a/css/style.css +++ b/css/style.css @@ -273,3 +273,88 @@ code { .ge_colorpicker_link-button { color: #333; } + +/* GALLERY */ + +@charset 'utf-8'; + +.glslGallery{ + -moz-column-width: initial; + -webkit-column-width: initial; +} + +.glslGallery_item{ + width: 242px; + margin: 8px; +} + +.glslGallery_thumb{ + max-width: 240px; + border: solid 1px #EEEEEE; +} + +.glslGallery_item canvas.glslGallery_canvas{ + max-width: 242px; +} + +.glslGallery_credits{ + position: relative; + left: 0; + bottom: 0; + background: none; + margin: 0; + padding: 0; +} + +.glslGallery_label{ + color: #333333; + font-family:Helvetica,Arial,sans-serif; + text-decoration:none; + width: 200px; +} +.glslGallery_title{ + margin: 0px; + padding-top: 14px; + font-size:12px; + width: 200px; +} +.glslGallery_author{ + margin: 0px; + padding-top: 14px; + padding-bottom: 4px; + font-size:12px; +} + +.glslGallery_openFrameIcon{ + bottom: 0px; + right: 0px; + font-size:14px; +} + +.more { + text-align: center; + margin-top: 32px; + margin-bottom: 32px; +} + +.more a { + font-size: 14px; + letter-spacing: 0.1em; + font-family:Helvetica,Arial,sans-serif; + font-weight: 600; + border-radius: 2px; + padding: 8px; + border: solid 1px #AAAAAA; + text-transform: uppercase; +} + +.more a:hover { + background: #EEEEEE; +} + +.gallery_author { + font-size: 16px; + font-style: italic; + text-align: right; +} + diff --git a/examples/gallery.css b/examples/gallery.css deleted file mode 100644 index ac757ff..0000000 --- a/examples/gallery.css +++ /dev/null @@ -1,81 +0,0 @@ -@charset 'utf-8'; - -.glslGallery{ - -moz-column-width: initial; - -webkit-column-width: initial; -} - -.glslGallery_item{ - width: 242px; - margin: 8px; -} - -.glslGallery_thumb{ - max-width: 240px; - border: solid 1px #EEEEEE; -} - -.glslGallery_item canvas.glslGallery_canvas{ - max-width: 242px; -} - -.glslGallery_credits{ - position: relative; - left: 0; - bottom: 0; - background: none; - margin: 0; - padding: 0; -} - -.glslGallery_label{ - color: #333333; - font-family:Helvetica,Arial,sans-serif; - text-decoration:none; - width: 200px; -} -.glslGallery_title{ - margin: 0px; - padding-top: 14px; - font-size:12px; - width: 200px; -} -.glslGallery_author{ - margin: 0px; - padding-top: 14px; - padding-bottom: 4px; - font-size:12px; -} - -.glslGallery_openFrameIcon{ - bottom: 0px; - right: 0px; - font-size:14px; -} - -.more { - text-align: center; - margin-top: 32px; - margin-bottom: 32px; -} - -.more a { - font-size: 14px; - letter-spacing: 0.1em; - font-family:Helvetica,Arial,sans-serif; - font-weight: 600; - border-radius: 2px; - padding: 8px; - border: solid 1px #AAAAAA; - text-transform: uppercase; -} - -.more a:hover { - background: #EEEEEE; -} - -.gallery_author { - font-size: 16px; - font-style: italic; - text-align: right; -} diff --git a/examples/index.php b/examples/index.php index d84af5e..24f96ee 100755 --- a/examples/index.php +++ b/examples/index.php @@ -13,7 +13,6 @@ include('../header.php'); include('../chap-header.php'); - echo ''; echo '
'; include($path.'/src/parsedown/Parsedown.php');