From 9b83d28c465cde88806fd6278f25ce9a722181ee Mon Sep 17 00:00:00 2001 From: Patricio Gonzalez Vivo Date: Wed, 5 Aug 2015 08:39:27 -0300 Subject: [PATCH] adding files and main README-JP.md --- 00/index.php | 26 ++++++------- 01/index.php | 26 ++++++------- 02/index.php | 26 ++++++------- 03/index.php | 26 ++++++------- 04/index.php | 26 ++++++------- 05/index.php | 26 ++++++++----- 06/index.php | 22 +++++++---- 07/index.php | 22 +++++++---- 08/index.php | 22 +++++++---- 09/index.php | 22 +++++++---- 10/index.php | 22 +++++++---- 11/index.php | 22 +++++++---- 12/index.php | 23 ++++++++---- 13/index.php | 23 ++++++++---- 14/index.php | 22 +++++++---- 15/index.php | 22 +++++++---- 16/index.php | 22 +++++++---- 17/index.php | 22 +++++++---- README-jp.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 +- chap-header.php | 11 ++++++ header.php | 15 +++++++- index.php | 17 ++++++++- 23 files changed, 390 insertions(+), 177 deletions(-) create mode 100644 README-jp.md create mode 100644 chap-header.php diff --git a/00/index.php b/00/index.php index c8ecf14f..a6df8881 100644 --- a/00/index.php +++ b/00/index.php @@ -2,21 +2,21 @@ $path = ".."; $subtitle = ": about this book"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' -
-

The Book of Shaders by Patricio Gonzalez Vivo

-

Translations: English - Japanese

-
-
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - $README = "README"; - if(!empty($_GET['lan'])) - $README .= '-'.$_GET['lan']; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); echo $Parsedown->text(file_get_contents($README.'.md')); diff --git a/01/index.php b/01/index.php index 9e98606e..1022e00b 100644 --- a/01/index.php +++ b/01/index.php @@ -2,21 +2,21 @@ $path = ".."; $subtitle = ": What is a shader?"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' - -
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - $README = "README"; - if(!empty($_GET['lan'])) - $README .= '-'.$_GET['lan']; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); echo $Parsedown->text(file_get_contents($README.'.md')); diff --git a/02/index.php b/02/index.php index 8e4def15..785d07f6 100644 --- a/02/index.php +++ b/02/index.php @@ -2,21 +2,21 @@ $path = ".."; $subtitle = ": Hello world!"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' - -
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - $README = "README"; - if(!empty($_GET['lan'])) - $README .= '-'.$_GET['lan']; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); echo $Parsedown->text(file_get_contents($README.'.md')); diff --git a/03/index.php b/03/index.php index 19de56e9..7b41dc5f 100644 --- a/03/index.php +++ b/03/index.php @@ -2,21 +2,21 @@ $path = ".."; $subtitle = ": uniforms"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' - -
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - $README = "README"; - if(!empty($_GET['lan'])) - $README .= '-'.$_GET['lan']; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); echo $Parsedown->text(file_get_contents($README.'.md')); diff --git a/04/index.php b/04/index.php index 0adc855e..4eb3d3ea 100644 --- a/04/index.php +++ b/04/index.php @@ -2,21 +2,21 @@ $path = ".."; $subtitle = ": Running your shader"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' - -
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - $README = "README"; - if(!empty($_GET['lan'])) - $README .= '-'.$_GET['lan']; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); echo $Parsedown->text(file_get_contents($README.'.md')); diff --git a/05/index.php b/05/index.php index 3864389d..baf8a5f7 100644 --- a/05/index.php +++ b/05/index.php @@ -1,19 +1,25 @@

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + include($path."/src/parsedown/Parsedown.php"); + $Parsedown = new Parsedown(); + echo $Parsedown->text(file_get_contents($README.'.md')); + echo '

diff --git a/06/index.php b/06/index.php index b22d8106..d2bca385 100644 --- a/06/index.php +++ b/06/index.php @@ -2,17 +2,23 @@ $path = ".."; $subtitle = ": color"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' - -
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/07/index.php b/07/index.php index 7dc8f604..491c3604 100644 --- a/07/index.php +++ b/07/index.php @@ -2,17 +2,23 @@ $path = ".."; $subtitle = ": Shapes"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' - -
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/08/index.php b/08/index.php index 77fbc2e7..9ae20b0f 100644 --- a/08/index.php +++ b/08/index.php @@ -2,17 +2,23 @@ $path = ".."; $subtitle = ": 2D Matrices"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' - -
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/09/index.php b/09/index.php index 0a0c6d85..f8612e52 100644 --- a/09/index.php +++ b/09/index.php @@ -2,17 +2,23 @@ $path = ".."; $subtitle = ": Patterns"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' - -
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/10/index.php b/10/index.php index 5790cc5a..30a61320 100644 --- a/10/index.php +++ b/10/index.php @@ -2,17 +2,23 @@ $path = ".."; $subtitle = ": Random"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' - -
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/11/index.php b/11/index.php index 25436c75..42451020 100644 --- a/11/index.php +++ b/11/index.php @@ -2,17 +2,23 @@ $path = ".."; $subtitle = ": Noise"; - include($path."/header.php"); - include($path."/src/parsedown/Parsedown.php"); + $README = "README"; + $language = ""; - echo ' - -
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/12/index.php b/12/index.php index 8c9355a6..e4b04242 100644 --- a/12/index.php +++ b/12/index.php @@ -1,17 +1,24 @@

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/13/index.php b/13/index.php index 8c9355a6..09345b57 100644 --- a/13/index.php +++ b/13/index.php @@ -1,17 +1,24 @@

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/14/index.php b/14/index.php index 8c9355a6..5a557ab7 100644 --- a/14/index.php +++ b/14/index.php @@ -1,17 +1,23 @@

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/15/index.php b/15/index.php index 8c9355a6..5a557ab7 100644 --- a/15/index.php +++ b/15/index.php @@ -1,17 +1,23 @@

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/16/index.php b/16/index.php index 8c9355a6..5a557ab7 100644 --- a/16/index.php +++ b/16/index.php @@ -1,17 +1,23 @@

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/17/index.php b/17/index.php index 8c9355a6..5a557ab7 100644 --- a/17/index.php +++ b/17/index.php @@ -1,17 +1,23 @@

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
diff --git a/README-jp.md b/README-jp.md new file mode 100644 index 00000000..b56cf5ea --- /dev/null +++ b/README-jp.md @@ -0,0 +1,98 @@ + + +# The Book of Shaders +*by [Patricio Gonzalez Vivo](http://patriciogonzalezvivo.com/)* + +This is a gentle step-by-step guide through the abstract and complex universe of Fragment Shaders. + +## Translation notes + + +
+ +
+ +## Contents + +* [About this book](00/?lan=jp) + +* Getting started + * [What is a shader?](01/?lan=jp) + * [“Hello world!”](02/?lan=jp) + * [Uniforms](03/?lan=jp) + * [Running your shader](04/?lan=jp) + +* Algorithmic drawing + * [Shaping functions](05/) + * [Colors](06/) + * [Shapes](07/) + * [Matrices](08/) + * [Patterns](09/) + +* Generative designs + * [Random](10/) + * Noise + * Fractional brownian motion + * Fractals + +* Image processing: + * Textures + * Image operations + * Kernel convolutions + * Filters + * Others effects + +* Simulation + * Pingpong + * Conway + * Ripples + * Water color + * Reaction diffusion + * Voronoi + +* 3D graphics + * Lights + * Normal-maps + * Bump-maps + * Ray marching + * Environmental-maps (spherical and cube) + * Reflect and refract + +* [Appendix:](appendix/) Other ways to use this book + * [How can I navigate this book offline?](appendix/) + * [How to run the examples on a RaspberryPi?](appendix/) + * [How to print this book?](appendix/) + +* [Examples Gallery](examples/) + +* [Glossary](glossary/) + +## About the Author + +[Patricio Gonzalez Vivo](http://patriciogonzalezvivo.com/) (1982, Buenos Aires, Argentina) is a New York based artist and developer. He explores interstitial spaces between organic and synthetic, analog and digital, individual and collective. In his work he uses code as an expressive language with the intention of developing a better together. + +Patricio studied and practiced psychotherapy and expressive art therapy. He holds an MFA in Design & Technology from Parsons The New School, where he now teaches. Currently he works as a Graphic Engineer at Mapzen making openSource mapping tools. + + + +## About the Translator + +[Kenichi Yoneda (Kynd)](https://twitter.com/kyndinfo) ... + +## Acknowledgements + +Thanks to my wife [Jen Lowe](http://www.datatelling.com/), for her unconditional support, help and time editing this book. + +Thanks [Scott Murray](http://alignedleft.com/) for the inspiration and advice. + +Thanks [Kenichi Yoneda (Kynd)](https://twitter.com/kyndinfo) for the [Japanese translation](?lan=jp) + +Thanks [Karim Naaji](http://karim.naaji.fr/) for contributing with support, good ideas and code. + +Thanks to everyone who has believed in this project and [contributed with fixes](https://github.com/patriciogonzalezvivo/thebookofshaders/graphs/contributors) or donations. + +## Get new chapters + +Sign up for the news letter or [follow it on Twitter](https://twitter.com/bookofshaders) + +

\ No newline at end of file diff --git a/README.md b/README.md index 89c6ad9a..e398eff3 100644 --- a/README.md +++ b/README.md @@ -78,11 +78,11 @@ Thanks to my wife [Jen Lowe](http://www.datatelling.com/), for her unconditional Thanks [Scott Murray](http://alignedleft.com/) for the inspiration and advice. -Thanks [Kynd.info](https://twitter.com/kyndinfo) for the [Japanese translation](00/?lan=jp) +Thanks [Kenichi Yoneda (Kynd)](https://twitter.com/kyndinfo) for the [Japanese translation](?lan=jp) Thanks [Karim Naaji](http://karim.naaji.fr/) for contributing with support, good ideas and code. -Thanks to everyone who has believed in this project and contributed with fixes or donations. +Thanks to everyone who has believed in this project and [contributed with fixes](https://github.com/patriciogonzalezvivo/thebookofshaders/graphs/contributors) or donations. ## Get new chapters diff --git a/chap-header.php b/chap-header.php new file mode 100644 index 00000000..0a439805 --- /dev/null +++ b/chap-header.php @@ -0,0 +1,11 @@ + +

The Book of Shaders by Patricio Gonzalez Vivo

+

Translations: English - Japanese

+
+
+ '; + +?> \ No newline at end of file diff --git a/header.php b/header.php index dc686051..a1e96527 100644 --- a/header.php +++ b/header.php @@ -42,10 +42,21 @@ - - + + + '; + +if ( $language !== '' && file_exists($path.'/css/style'.$language.'.css') ) { + echo ''; +} + +echo ' '; ?> + + + + diff --git a/index.php b/index.php index 642fdb0f..c9c18093 100644 --- a/index.php +++ b/index.php @@ -1,10 +1,23 @@ '; - include("src/parsedown/Parsedown.php"); + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); + echo '
'; include("footer.php"); ?> \ No newline at end of file