gallery top loads texts from each chapter

This commit is contained in:
kynd 2016-04-22 23:03:47 -07:00
parent da1e141582
commit 857340cc63
35 changed files with 189 additions and 199 deletions

View File

@ -0,0 +1,5 @@
## "Hello World!"
Usually the "Hello world!" example is the first step to learning a new language. In GPU-land rendering text is an overcomplicated task for a first step, instead we'll choose a bright welcoming color to shout our enthusiasm!
Read ["Hello World!"](../02) to learn more.

View File

@ -0,0 +1,32 @@
<?php
$path = "../..";
$subtitle = ": Gallery - Shaping functions";
$README = "README";
$language = "";
if ( !empty($_GET['lan']) ) {
if (file_exists($README.'-'.$_GET['lan'].'.md')) {
$language = '-'.$_GET['lan'];
$README .= $language;
}
}
include("../header.php");
include("../../chap-header.php");
echo '<div id="content">';
include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo '
</div>
<hr>
<ul class="navigationBar" >
<li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>';
include("../../footer.php");
?>

View File

@ -0,0 +1,11 @@
## Uniforms
Learn how to use Uniform variables. Uniform variables, or simply *uniforms* are the variables that carry information equally accessible from all of the threads of your shader. The [GSLS editor](http://editor.thebookofshaders.com/) has three uniforms set up for you.
Read [Uniforms](../03) to learn more.
```glsl
uniform vec2 u_resolution; // Canvas size (width,height)
uniform vec2 u_mouse; // mouse position in screen pixels
uniform float u_time; // Time in seconds since load
```

View File

@ -0,0 +1,32 @@
<?php
$path = "../..";
$subtitle = ": Gallery - Shaping functions";
$README = "README";
$language = "";
if ( !empty($_GET['lan']) ) {
if (file_exists($README.'-'.$_GET['lan'].'.md')) {
$language = '-'.$_GET['lan'];
$README .= $language;
}
}
include("../header.php");
include("../../chap-header.php");
echo '<div id="content">';
include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo '
</div>
<hr>
<ul class="navigationBar" >
<li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>';
include("../../footer.php");
?>

4
examples_proto/05/README.md Normal file → Executable file
View File

@ -1,9 +1,5 @@
# Shader Gallery
## Shaping functions ## Shaping functions
Shaping functions is fundamental technique that is recursively used throughout this book that let you control the variation of the value at will. Study how different functions of x are used to create different shapes and try making your own function. Shaping functions is fundamental technique that is recursively used throughout this book that let you control the variation of the value at will. Study how different functions of x are used to create different shapes and try making your own function.
Read [Shaping functions](../05) to learn more. Read [Shaping functions](../05) to learn more.
<div class="glslChapterGallery" data="05"></div>

6
examples_proto/05/index.php Normal file → Executable file
View File

@ -18,7 +18,8 @@
include("../../src/parsedown/Parsedown.php"); include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md')); echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo ' echo '
</div> </div>
<hr> <hr>
@ -26,5 +27,6 @@
<li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li> <li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>'; </ul>';
include("../footer.php"); include("../../footer.php");
?> ?>

4
examples_proto/06/README.md Normal file → Executable file
View File

@ -1,10 +1,6 @@
# Shader Gallery
## Colors ## Colors
Familiarize yourself with how to express colors in shaders. The examples cover how to mix colors and beautifully animate them over time as well as conversion between two different models(RGB and HSB). Familiarize yourself with how to express colors in shaders. The examples cover how to mix colors and beautifully animate them over time as well as conversion between two different models(RGB and HSB).
In GLSL, colors are simply just vectors, which means you can easily apply the concepts and techniques you learn here to other In GLSL, colors are simply just vectors, which means you can easily apply the concepts and techniques you learn here to other
Read [Colors](../06) to learn more. Read [Colors](../06) to learn more.
<div class="glslChapterGallery" data="06"></div>

8
examples_proto/06/index.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
<?php <?php
$path = "../.."; $path = "../..";
$subtitle = ": Gallery - Colors"; $subtitle = ": Gallery - Shaping functions";
$README = "README"; $README = "README";
$language = ""; $language = "";
@ -18,7 +18,8 @@
include("../../src/parsedown/Parsedown.php"); include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md')); echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo ' echo '
</div> </div>
<hr> <hr>
@ -26,5 +27,6 @@
<li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li> <li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>'; </ul>';
include("../footer.php"); include("../../footer.php");
?> ?>

4
examples_proto/07/README.md Normal file → Executable file
View File

@ -1,9 +1,5 @@
# Shader Gallery
## Shapes ## Shapes
Let's look at how to draw simple shapes in a parallel procedural way. In a nutshell, all you need to do is to determine if each pixel belongs to the shape you want to draw or not, and apply different colors accordingly. You can use coordinate system like a grid paper to draw rectangles and squares. We'll look at more advanced concept called distance field to draw more complex shapes. Let's look at how to draw simple shapes in a parallel procedural way. In a nutshell, all you need to do is to determine if each pixel belongs to the shape you want to draw or not, and apply different colors accordingly. You can use coordinate system like a grid paper to draw rectangles and squares. We'll look at more advanced concept called distance field to draw more complex shapes.
Read [Shapes](../07) to learn more. Read [Shapes](../07) to learn more.
<div class="glslChapterGallery" data="07"></div>

9
examples_proto/07/index.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
<?php <?php
$path = "../.."; $path = "../..";
$subtitle = ": Gallery - Shapes"; $subtitle = ": Gallery - Shaping functions";
$README = "README"; $README = "README";
$language = ""; $language = "";
@ -18,7 +18,8 @@
include("../../src/parsedown/Parsedown.php"); include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md')); echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo ' echo '
</div> </div>
<hr> <hr>
@ -26,6 +27,6 @@
<li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li> <li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>'; </ul>';
include("../../footer.php");
include("../footer.php");
?> ?>

4
examples_proto/08/README.md Normal file → Executable file
View File

@ -1,10 +1,6 @@
# Shader Gallery
## Matrix ## Matrix
Matrix is a very powerful tool for manipulating vectors. By mastering how to use matrices, you can freely translate, scale and rotate shapes. Since the technique can be equally applied to anything expressed by vectors, we will look at many more advanced use of matrices later in this book. Matrix is a very powerful tool for manipulating vectors. By mastering how to use matrices, you can freely translate, scale and rotate shapes. Since the technique can be equally applied to anything expressed by vectors, we will look at many more advanced use of matrices later in this book.
Matrices may look complex at a first glance, but you'll find it very handy and useful as you get used to the concept. Let's practice here and learn basics with simple examples. Matrices may look complex at a first glance, but you'll find it very handy and useful as you get used to the concept. Let's practice here and learn basics with simple examples.
Read [Matrix](../08) to learn more. Read [Matrix](../08) to learn more.
<div class="glslChapterGallery" data="08"></div>

8
examples_proto/08/index.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
<?php <?php
$path = "../.."; $path = "../..";
$subtitle = ": Gallery - Matrix"; $subtitle = ": Gallery - Shaping functions";
$README = "README"; $README = "README";
$language = ""; $language = "";
@ -18,7 +18,8 @@
include("../../src/parsedown/Parsedown.php"); include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md')); echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo ' echo '
</div> </div>
<hr> <hr>
@ -26,5 +27,6 @@
<li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li> <li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>'; </ul>';
include("../footer.php"); include("../../footer.php");
?> ?>

4
examples_proto/09/README.md Normal file → Executable file
View File

@ -1,9 +1,5 @@
# Shader Gallery
## Patterns ## Patterns
Repetitive patterns are perfect theme for computational sketching. Different from conventional way of drawing, shaders lets you draw everything parallelly at once. Instead of repeating the same procedure many times, you will wrap and repeat the "space". Sounds like Sci-Fi? Let's find out what it really means. Repetitive patterns are perfect theme for computational sketching. Different from conventional way of drawing, shaders lets you draw everything parallelly at once. Instead of repeating the same procedure many times, you will wrap and repeat the "space". Sounds like Sci-Fi? Let's find out what it really means.
Read [Patterns](../09) to learn more. Read [Patterns](../09) to learn more.
<div class="glslChapterGallery" data="09"></div>

8
examples_proto/09/index.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
<?php <?php
$path = "../.."; $path = "../..";
$subtitle = ": Gallery - Patterns"; $subtitle = ": Gallery - Shaping functions";
$README = "README"; $README = "README";
$language = ""; $language = "";
@ -18,7 +18,8 @@
include("../../src/parsedown/Parsedown.php"); include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md')); echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo ' echo '
</div> </div>
<hr> <hr>
@ -26,5 +27,6 @@
<li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li> <li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>'; </ul>';
include("../footer.php"); include("../../footer.php");
?> ?>

4
examples_proto/10/README.md Normal file → Executable file
View File

@ -1,9 +1,5 @@
# Shader Gallery
## Random ## Random
Life is boring if everything was predictable. Though nothing is truly random in computers, we can create pseudo-randomness that looks totally unpredictable using simple tricks to create more interesting patterns and behaviors. Life is boring if everything was predictable. Though nothing is truly random in computers, we can create pseudo-randomness that looks totally unpredictable using simple tricks to create more interesting patterns and behaviors.
Read [Random](../10) to learn more. Read [Random](../10) to learn more.
<div class="glslChapterGallery" data="10"></div>

8
examples_proto/10/index.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
<?php <?php
$path = "../.."; $path = "../..";
$subtitle = ": Gallery - Random"; $subtitle = ": Gallery - Shaping functions";
$README = "README"; $README = "README";
$language = ""; $language = "";
@ -18,7 +18,8 @@
include("../../src/parsedown/Parsedown.php"); include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md')); echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo ' echo '
</div> </div>
<hr> <hr>
@ -26,5 +27,6 @@
<li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li> <li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>'; </ul>';
include("../footer.php"); include("../../footer.php");
?> ?>

4
examples_proto/11/README.md Normal file → Executable file
View File

@ -1,10 +1,6 @@
# Shader Gallery
## Noise ## Noise
How can we create more natural looking textures like surface of the roads, rocks, trees and clouds? Noise function is the answer. How can we create more natural looking textures like surface of the roads, rocks, trees and clouds? Noise function is the answer.
Since Ken Perlin invented his first noise algorithm in 80s, the technique has been extensively used throughout computer graphics and simulations. Even if you have never heard of the name, it's not possible you have never seen it. Let's look step by step at how the function is built and works. We also cover more efficient version of the algorithm called simplex noise. Since Ken Perlin invented his first noise algorithm in 80s, the technique has been extensively used throughout computer graphics and simulations. Even if you have never heard of the name, it's not possible you have never seen it. Let's look step by step at how the function is built and works. We also cover more efficient version of the algorithm called simplex noise.
Read [Noise](../11) to learn more. Read [Noise](../11) to learn more.
<div class="glslChapterGallery" data="11"></div>

8
examples_proto/11/index.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
<?php <?php
$path = "../.."; $path = "../..";
$subtitle = ": Gallery - Noise"; $subtitle = ": Gallery - Shaping functions";
$README = "README"; $README = "README";
$language = ""; $language = "";
@ -18,7 +18,8 @@
include("../../src/parsedown/Parsedown.php"); include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md')); echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo ' echo '
</div> </div>
<hr> <hr>
@ -26,5 +27,6 @@
<li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li> <li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>'; </ul>';
include("../footer.php"); include("../../footer.php");
?> ?>

120
examples_proto/README.md Normal file → Executable file
View File

@ -1,123 +1,3 @@
# Shader Gallery # Shader Gallery
The following is the list of examples present in this book and more from our excellent contributors and readers. Find your favorite example and play around with it. It's good idea to change the values or commenting out a part of the code to understand what each part of the code is doing. Once you feel comfortable with the example, try if you can create something unique and new by tweaking it bit by bit, then share your experiment with "share" button at the top of the editor so that someone can find it and study. The following is the list of examples present in this book and more from our excellent contributors and readers. Find your favorite example and play around with it. It's good idea to change the values or commenting out a part of the code to understand what each part of the code is doing. Once you feel comfortable with the example, try if you can create something unique and new by tweaking it bit by bit, then share your experiment with "share" button at the top of the editor so that someone can find it and study.
## Featured shaders
Featured examples shared by our readers and students. We are looking forward to see a lot more shaders created with the [GLSL editor](http://editor.thebookofshaders.com/). Please share your masterpiecess to [@bookofshaders](https://twitter.com/bookofshaders).
<div class="glslChapterGallery" log="shared"></div>
<a id="shared"></a>
## Getting started
### "Hello World!"
Usually the "Hello world!" example is the first step to learning a new language. In GPU-land rendering text is an overcomplicated task for a first step, instead we'll choose a bright welcoming color to shout our enthusiasm!
Read ["Hello World!"](../02) to learn more.
<a id="02"></a>
### Uniforms
Learn how to use Uniform variables. Uniform variables, or simply *uniforms* are the variables that carry information equally accessible from all of the threads of your shader. The [GSLS editor](http://editor.thebookofshaders.com/) has three uniforms set up for you.
Read [Uniforms](../03) to learn more.
```glsl
uniform vec2 u_resolution; // Canvas size (width,height)
uniform vec2 u_mouse; // mouse position in screen pixels
uniform float u_time; // Time in seconds since load
```
<div class="glslChapterGallery" log="02"></div>
<a id="05"></a>
## Algorithmic drawing
### Shaping functions
Shaping functions is fundamental technique that is recursively used throughout this book that let you control the variation of value at will. Study how different functions of x are used to create different shapes and try making your own function.
Read [Shaping functions](../05) to learn more.
<div class="glslChapterGallery" log="05,3"></div>
<div class="extra-container"><a href="./05">See All Examples</a></div>
<a id="06"></a>
### Color
Familiarize yourself with how to express colors in shaders. The examples cover how to mix colors and beautifully animate them over time as well as conversion between two different models(RGB and HSB).
In GLSL, colors are simply just vectors, which means you can easily apply the concepts and techniques you learn here to other
Read [Colors](../06) to learn more.
<div class="glslChapterGallery" log="06,3"></div>
<div class="extra-container"><a href="./06">See All Examples</a></div>
<a id="07"></a>
### Shapes
Let's look at how to draw simple shapes in a parallel procedural way. In a nutshell, all you need to do is to determine if each pixel belongs to the shape you want to draw or not, and apply different colors accordingly. You can use coordinate system like a grid paper to draw rectangles and squares. We'll look at more advanced concept called distance field to draw more complex shapes.
Read [Shapes](../07) to learn more.
<div class="glslChapterGallery" log="07,3"></div>
<div class="extra-container"><a href="./07">See All Examples</a></div>
<a id="08"></a>
### Matrix
Matrix is a very powerful tool for manipulating vectors. By mastering how to use matrices, you can freely translate, scale and rotate shapes. Since the technique can be equally applied to anything expressed by vectors, we will look at many more advanced use of matrices later in this book.
Matrices may look complex at a first glance, but you'll find it very handy and useful as you get used to the concept. Let's practice here and learn basics with simple examples.
Read [Matrix](../08) to learn more.
<div class="glslChapterGallery" log="08,3"></div>
<div class="extra-container"><a href="./08">See All Examples</a></div>
<a id="09"></a>
### Patterns
Repetitive patterns are perfect theme for computational sketching. Different from conventional way of drawing, shaders lets you draw everything parallely at once. Instead of repeating the same procedure many times, you will wrap and repeat the "space". Sounds like Sci-Fi? Let's find out what it really means.
Read [Patterns](../09) to learn more.
<div class="glslChapterGallery" log="09,3"></div>
<div class="extra-container"><a href="./09">See All Examples</a></div>
<a id="10"></a>
## Generative designs
### Random
Life is boring if everything was predictable. Though nothing is truly random in computers, we can create pseudo-randomness that looks totally unpredictable using simple tricks to create more interesting patterns and behaviors.
Read [Random](../10) to learn more.
<div class="glslChapterGallery" log="10,3"></div>
<div class="extra-container"><a href="./10">See All Examples</a></div>
<a id="11"></a>
### Noise
How can we create more natural looking textures like surface of the roads, rocks, trees and clouds? Noise function is the answer.
Since Ken Perlin invented his first noise algorithm in 80s, the technique has been extensively used throughout computer graphics and simulations. Even if you have never heard of the name, it's not possible you have never seen it. Let's look step by step at how the function is built and works. We also cover more efficient version of the algorithm called simplex noise.
Read [Noise](../11) to learn more.
<div class="glslChapterGallery" log="11,3"></div>
<div class="extra-container"><a href="./11">See All Examples</a></div>
<a id="advanced"></a>
## Advanced examples
This section features relatively advanced examples from different chapters. Try if you can read and understand all the examples here to test yourself.
<div class="glslChapterGallery" log="advanced, 3"></div>
<div class="extra-container"><a href="./advanced">See All Examples</a></div>

4
examples_proto/advanced/README.md Normal file → Executable file
View File

@ -1,7 +1,3 @@
# Shader Gallery
## Advanced examples ## Advanced examples
In this section, we gathered relatively advanced examples from different chapters. Try if you can read and understand all the examples here to test yourself. In this section, we gathered relatively advanced examples from different chapters. Try if you can read and understand all the examples here to test yourself.
<div class="glslChapterGallery" data="advanced"></div>

10
examples_proto/advanced/index.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
<?php <?php
$path = "../.."; $path = "../..";
$subtitle = ": Gallery - Advanced"; $subtitle = ": Gallery - Shaping functions";
$README = "README"; $README = "README";
$language = ""; $language = "";
@ -18,13 +18,15 @@
include("../../src/parsedown/Parsedown.php"); include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md')); echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo ' echo '
</div> </div>
<hr> <hr>
<ul class="navigationBar" > <ul class="navigationBar" >
<li class="navigationBar" onclick="window.location.href=\'../index.php#advanced\'">Gallery Home </li> <li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>'; </ul>';
include("../footer.php"); include("../../footer.php");
?> ?>

6
examples_proto/css/gallery.css Normal file → Executable file
View File

@ -1,5 +1,11 @@
@charset 'utf-8'; @charset 'utf-8';
.gallery-top h2 {
padding-top: 48px;
margin-top: 48px;
border-top: 1px solid #CCCCCC;
}
.glslChapterGallery { .glslChapterGallery {
margin-top: 48px; margin-top: 48px;
margin-bottom: 12px; margin-bottom: 12px;

View File

@ -1,19 +0,0 @@
<?php
echo '
<footer>
<p> Copyright 2015 <a href="http://www.patriciogonzalezvivo.com" target="_blank">Patricio Gonzalez Vivo</a> </p>
</footer>
<script type="text/javascript" src="'.$path.'/src/main.js" defer></script>
<script> (function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,"script","//www.google-analytics.com/analytics.js","ga");
ga("create", "UA-18824436-2", "auto");
ga("send", "pageview");
</script>
</body>
</html>
';
?>

0
examples_proto/header.php Normal file → Executable file
View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

29
examples_proto/index.php Normal file → Executable file
View File

@ -15,11 +15,35 @@
include("./header.php"); include("./header.php");
include("../chap-header.php"); include("../chap-header.php");
echo '<div id="content">'; echo '<div id="content" class="gallery-top">';
include($path."/src/parsedown/Parsedown.php"); include($path."/src/parsedown/Parsedown.php");
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
$chapters = array(
array("shared", FALSE),
array("02", FALSE),
array("03", FALSE),
array("05", TRUE),
array("07", TRUE),
array("09", TRUE),
array("10", TRUE),
array("11", TRUE),
array("advanced", TRUE)
);
echo $Parsedown->text(file_get_contents($README.'.md')); echo $Parsedown->text(file_get_contents($README.'.md'));
foreach ($chapters as $chapter) {
echo $Parsedown->text(file_get_contents($chapter[0].'/'.README.'.md'));
$log = $chapter[0];
if ($chapter[1]) {$log .= ',3';}
echo "<div class=\"glslChapterGallery\" log=\"{$log}\"></div>";
if ($chapter[1]) {
echo "<div class=\"extra-container\"><a href=\"./{$chapter[0]}\">See All Examples</a></div>";
}
}
echo ' echo '
</div> </div>
<script>console.log();</script> <script>console.log();</script>
@ -28,5 +52,6 @@
<li class="navigationBar" onclick="window.location.href=\'../\'"> Home </li> <li class="navigationBar" onclick="window.location.href=\'../\'"> Home </li>
</ul>'; </ul>';
include("footer.php"); include("../footer.php");
?> ?>

0
examples_proto/moon.frag Normal file → Executable file
View File

View File

@ -0,0 +1,3 @@
## Featured shaders
Featured examples shared by our readers and students. We are looking forward to see a lot more shaders created with the [GLSL editor](http://editor.thebookofshaders.com/). Please share your masterpiecess to [@bookofshaders](https://twitter.com/bookofshaders).

View File

@ -0,0 +1,32 @@
<?php
$path = "../..";
$subtitle = ": Gallery - Shaping functions";
$README = "README";
$language = "";
if ( !empty($_GET['lan']) ) {
if (file_exists($README.'-'.$_GET['lan'].'.md')) {
$language = '-'.$_GET['lan'];
$README .= $language;
}
}
include("../header.php");
include("../../chap-header.php");
echo '<div id="content">';
include("../../src/parsedown/Parsedown.php");
$Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($README.'.md'));
$dir = basename(__DIR__);
echo "<div class=\"glslChapterGallery\" log=\"{$dir}\"></div>";
echo '
</div>
<hr>
<ul class="navigationBar" >
<li class="navigationBar" onclick="window.location.href=\'../index.php\'">Gallery Home </li>
</ul>';
include("../../footer.php");
?>

2
examples_proto/src/examples.js Normal file → Executable file
View File

@ -125,7 +125,7 @@ var shaderList = {
window.addEventListener("load", function () { window.addEventListener("load", function () {
var elms = document.getElementsByClassName('glslChapterGallery'); var elms = document.getElementsByClassName('glslChapterGallery');
console.log(elms);
for (var i = 0; i < elms.length; i++) { for (var i = 0; i < elms.length; i++) {
var elm = elms[i]; var elm = elms[i];
if (elm.hasAttribute('log')) { if (elm.hasAttribute('log')) {

0
examples_proto/test.html Normal file → Executable file
View File